Просмотр исходного кода

成本报审,往期已计量的台账节点,明细表格不可编辑、不可导入合同数据

MaiXinRong 2 дней назад
Родитель
Сommit
dae4ca246a

+ 5 - 4
app/controller/tender_controller.js

@@ -1113,19 +1113,20 @@ module.exports = app => {
                 await ctx.service.tenderInfo.saveTenderInfo(ctx.tender.id, { shenpi: postData });
                 let auditList = [];
                 let groupList = [];
+                const spType =  shenpiConst.sp_type[data.code]|| shenpiConst.cost_sp_type[data.code];
                 if (data.status === shenpiConst.sp_status.gdspl) {
-                    groupList = await ctx.service.shenpiGroup.getGroupList(ctx.tender.id, shenpiConst.sp_type[data.code]) || [];
+                    groupList = await ctx.service.shenpiGroup.getGroupList(ctx.tender.id, spType) || [];
                     if (groupList && groupList.length > 0) {
                         for (const group of groupList) {
                             if (group.change_type) group.change_type = JSON.parse(group.change_type);
-                            group.auditGroupList = await ctx.service.shenpiAudit.getAuditGroupList(ctx.tender.id, shenpiConst.sp_type[data.code], data.status, group.id);
+                            group.auditGroupList = await ctx.service.shenpiAudit.getAuditGroupList(ctx.tender.id, spType, data.status, group.id);
                             if (group.is_select) auditList = group.auditGroupList;
                         }
                     } else {
-                        auditList = await ctx.service.shenpiAudit.getAuditGroupList(ctx.tender.id, shenpiConst.sp_type[data.code], data.status);
+                        auditList = await ctx.service.shenpiAudit.getAuditGroupList(ctx.tender.id, spType, data.status);
                     }
                 } else if (data.status === shenpiConst.sp_status.gdzs) {
-                    auditList = await ctx.service.shenpiAudit.getAudit(ctx.tender.id, shenpiConst.sp_type[data.code], data.status);
+                    auditList = await ctx.service.shenpiAudit.getAudit(ctx.tender.id, spType, data.status);
                 }
                 ctx.body = { err: 0, msg: '', data: { auditList, groupList } };
             } catch (err) {

+ 3 - 1
app/public/js/cost_stage_ledger.js

@@ -663,7 +663,7 @@ $(document).ready(function() {
         loadDetailData(bills) {
             detailObj.billsNode = bills;
             const spreadSetting = bills && bills.is_deal ? this.dealSpreadSetting : this.commonSpreadSetting;
-            if (!bills || (bills.children && bills.children.length > 0)) {
+            if (!bills || (bills.children && bills.children.length > 0) || (bills.is_used && !bills.had_detail)) {
                 spreadSetting.readOnly = true;
             } else {
                 spreadSetting.readOnly = readOnly;
@@ -1155,6 +1155,7 @@ $(document).ready(function() {
                 const node = SpreadJsObj.getSelectObject(billsObj.sheet);
                 if (!node) return true;
                 if (node.children && node.children.length > 0) return true;
+                if (node.is_used && !node.had_detail) return true;
                 if (node.had_detail && !node.is_deal) return true;
                 const detailRange = detailObj.data.getPartData(node.id);
                 if (!detailRange || detailRange.length === 0) return false;
@@ -1171,6 +1172,7 @@ $(document).ready(function() {
                 const node = SpreadJsObj.getSelectObject(billsObj.sheet);
                 if (!node) return true;
                 if (node.children && node.children.length > 0) return true;
+                if (node.is_used && !node.had_detail) return true;
                 if (node.had_detail && !node.is_deal) return true;
                 const detailRange = detailObj.data.getPartData(node.id);
                 if (!detailRange || detailRange.length === 0) return false;

+ 0 - 1
app/public/js/shenpi.js

@@ -1119,7 +1119,6 @@ $(document).ready(function () {
         auditUnion.loadUnionData(this.getAttribute('sp_type'), this.getAttribute('audit_order'));
     });
 
-
     class AuditMulti {
         constructor() {
             this.spread = SpreadJsObj.createNewSpread($('#multi-spread')[0]);

+ 3 - 0
app/service/cost_stage_ledger.js

@@ -139,6 +139,9 @@ module.exports = app => {
                 if (!bills.had_detail) {
                     bills.had_detail = preDetail.findIndex(x => { return x.cost_id === bills.cost_id; }) >= 0;
                 }
+                if (!bills.is_used) {
+                    bills.is_used = !!bills.tax || !!bills.pay_tp || !!bills.cut_tp || !!bills.yf_tp || !!bills.sf_tp;
+                }
                 delete bills.postil;
                 for(const prop of costFields.curFields) {
                     bills['pre_' + prop] = this.ctx.helper.add(bills['pre_' + prop], bills[prop]);

+ 3 - 2
app/service/shenpi_audit.js

@@ -328,6 +328,7 @@ module.exports = app => {
                 const needYB = ['ledger', 'revise', 'change'];
                 const shenpiInfo = await this.ctx.service.tenderInfo.getTenderShenpiInfo(this.ctx.tender.id);
                 for (const code of data.shenpiList.split(',')) {
+                    const new_sp_type = shenpiConst.sp_type[code] || shenpiConst.sp_other_type[code] || shenpiConst.cost_sp_type[code];
                     // 把当前审批状态复制到其他标段里
                     if (shenpiInfo[code] !== shenpi_status) {
                         shenpiInfo[code] = shenpi_status;
@@ -339,7 +340,7 @@ module.exports = app => {
                                 throw '选择同步的流程中存在审批组,无法设置同步';
                             }
                         }
-                        await transaction.delete(this.tableName, { tid: this.ctx.tender.id, sp_type, sp_status: shenpiInfo[code] });
+                        await transaction.delete(this.tableName, { tid: this.ctx.tender.id, sp_type: new_sp_type, sp_status: shenpiInfo[code] });
                         const flows = data.flowList.split(';');
                         let audit_order = 1;
                         for (const f of flows) {
@@ -351,7 +352,7 @@ module.exports = app => {
                                 if (aid !== this.ctx.tender.data.user_id || needYB.indexOf(code) >= 0) {
                                     insertList.push({
                                         tid: this.ctx.tender.id,
-                                        sp_type, sp_status: shenpi_status,
+                                        sp_type: new_sp_type, sp_status: shenpi_status,
                                         audit_id: aid,
                                         audit_type: auditTypeValid ? audit_type : auditType.key.common,
                                         audit_order: audit_order,