소스 검색

修复汇总展示bug

ellisran 1 년 전
부모
커밋
b63f375513
2개의 변경된 파일17개의 추가작업 그리고 13개의 파일을 삭제
  1. 16 13
      app/public/js/change_information.js
  2. 1 0
      app/service/change.js

+ 16 - 13
app/public/js/change_information.js

@@ -429,10 +429,12 @@ $(document).ready(() => {
             {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 60, type: 'Number', getValue: 'getValue.unit_price'},
             {title: '申报变更|数量', colSpan: '2|1', rowSpan: '1|1', field: 'camount', hAlign: 2, width: 60, type: 'Number', getValue: 'getValue.camount'},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'ca_tp', hAlign: 2, width: 80, type: 'Number', getValue: 'getValue.ca_tp'},
-            {title: '审批变更|数量', colSpan: '2|1', rowSpan: '1|1', field: 'samount', hAlign: 2, width: 60, type: 'Number', getValue: 'getValue.samount', visible: auditStatus !== 6},
-            {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'sa_tp', hAlign: 2, width: 80, type: 'Number', getValue: 'getValue.sa_tp', visible: auditStatus !== 6},
-            {title: '审批变更|数量', colSpan: '2|1', rowSpan: '1|1', field: 'spamount', hAlign: 2, width: 60, type: 'Number', getValue: 'getValue.spamount', visible: auditStatus === 6},
-            {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'spa_tp', hAlign: 2, width: 80, type: 'Number', getValue: 'getValue.spa_tp', visible: auditStatus === 6},
+            {title: '审批变更|数量', colSpan: '2|1', rowSpan: '1|1', field: 'amount', hAlign: 2, width: 60, type: 'Number', getValue: 'getValue.amount', visible: auditStatus === 7},
+            {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'a_tp', hAlign: 2, width: 80, type: 'Number', getValue: 'getValue.a_tp', visible: auditStatus === 7},
+            {title: '审批变更|数量', colSpan: '2|1', rowSpan: '1|1', field: 'spamount', hAlign: 2, width: 60, type: 'Number', getValue: 'getValue.spamount', visible: [3,4,5,6,8].indexOf(auditStatus) !== -1},
+            {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'spa_tp', hAlign: 2, width: 80, type: 'Number', getValue: 'getValue.spa_tp', visible: [3,4,5,6,8].indexOf(auditStatus) !== -1},
+            {title: '审批变更|数量', colSpan: '2|1', rowSpan: '1|1', hAlign: 2, width: 60, type: 'Number', getValue: '', visible: [1,2,9].indexOf(auditStatus) !== -1},
+            {title: '|金额', colSpan: '|1', rowSpan: '|1', hAlign: 2, width: 80, type: 'Number', getValue: '', visible: [1,2,9].indexOf(auditStatus) !== -1},
         ],
         emptyRows: 0,
         headRows: 2,
@@ -457,11 +459,11 @@ $(document).ready(() => {
             ca_tp: function (data) {
                 return ZhCalc.round(ZhCalc.mul(ZhCalc.round(data.unit_price, unitPriceUnit), ZhCalc.round(data.camount, findDecimal(data.unit))), totalPriceUnit);
             },
-            samount: function (data) {
-                return ZhCalc.round(data.samount, findDecimal(data.unit));
+            amount: function (data) {
+                return ZhCalc.round(data.amount, findDecimal(data.unit));
             },
-            sa_tp: function (data) {
-                return ZhCalc.round(ZhCalc.mul(ZhCalc.round(data.unit_price, unitPriceUnit), ZhCalc.round(data.samount, findDecimal(data.unit))), totalPriceUnit);
+            a_tp: function (data) {
+                return ZhCalc.round(ZhCalc.mul(ZhCalc.round(data.unit_price, unitPriceUnit), ZhCalc.round(data.amount, findDecimal(data.unit))), totalPriceUnit);
             },
             spamount: function (data) {
                 return ZhCalc.round(data.spamount, findDecimal(data.unit));
@@ -475,9 +477,9 @@ $(document).ready(() => {
         makeBackColor: function () {
             const rowCount = hzSpread.getActiveSheet().getRowCount();
             for (let i = 0; i < rowCount; i++) {
-                if (auditStatus === 6 && hzSpread.getActiveSheet().zh_data[i].camount != hzSpread.getActiveSheet().zh_data[i].spamount) {
+                if ([3,4,5,6,7,8].indexOf(auditStatus) !== -1 && hzSpread.getActiveSheet().zh_data[i].camount != hzSpread.getActiveSheet().zh_data[i].spamount) {
                     hzSpread.getActiveSheet().getRange(i, -1, 1, -1).backColor('#ffeeba');
-                } else if (auditStatus !== 6 && hzSpread.getActiveSheet().zh_data[i].camount != hzSpread.getActiveSheet().zh_data[i].samount) {
+                } else if ([1,2,9].indexOf(auditStatus) !== -1 && hzSpread.getActiveSheet().zh_data[i].camount != hzSpread.getActiveSheet().zh_data[i].samount) {
                     hzSpread.getActiveSheet().getRange(i, -1, 1, -1).backColor('#ffeeba');
                 }
             }
@@ -515,12 +517,13 @@ $(document).ready(() => {
         const newChangeList = _.cloneDeep(changeList);
         for (const cl of newChangeList) {
             const hzIndex = _.findIndex(hzList, { code: cl.code, name: cl.name, unit: cl.unit, unit_price: cl.unit_price});
+            const audit_amount = cl.audit_amount ? cl.audit_amount.split(',') : '';
+            const amount = audit_amount ? parseFloat(audit_amount[audit_amount.length - 1]) : 0;
+            cl.amount = amount;
             if (hzIndex !== -1) {
                 hzList[hzIndex].camount = ZhCalc.add(hzList[hzIndex].camount, cl.camount);
                 hzList[hzIndex].spamount = ZhCalc.add(hzList[hzIndex].spamount, cl.spamount);
-                const samount = cl.samount ? parseFloat(cl.samount) : 0;
-                hzList[hzIndex].samount = hzList[hzIndex].samount ? parseFloat(hzList[hzIndex].samount) : 0;
-                hzList[hzIndex].samount = ZhCalc.add(hzList[hzIndex].samount, samount);
+                hzList[hzIndex].amount = ZhCalc.add(hzList[hzIndex].amount, amount);
             } else {
                 hzList.push(cl);
             }

+ 1 - 0
app/service/change.js

@@ -1388,6 +1388,7 @@ module.exports = app => {
                 const attList = await this.ctx.service.changeAtt.getAllDataByCondition({ where: { cid } });
                 await this.ctx.helper.delFiles(attList);
                 await this.transaction.delete(this.ctx.service.changeAtt.tableName, { cid });
+                await this.transaction.delete(this.ctx.service.changeHistory.tableName, { cid });
                 // if (attList.length !== 0) {
                 //     for (const att of attList) {
                 //         await fs.unlinkSync(path.join(this.app.baseDir, att.filepath));