Преглед изворни кода

添加台账清单页增加填写申请数量和计价按钮功能

ellisran пре 10 месеци
родитељ
комит
3f5db8ec7d

+ 1 - 0
app/controller/change_controller.js

@@ -1799,6 +1799,7 @@ module.exports = app => {
                 stdChapters,
                 nodeType: stdConst.nodeType,
                 settleStatus: ctx.service.settle.settleStatus,
+                precision: ctx.tender.info.precision,
             };
         }
 

Разлика између датотеке није приказан због своје велике величине
+ 915 - 62
app/public/js/change_revise.js


+ 2 - 2
app/public/js/spreadjs_rela/spreadjs_zh.js

@@ -738,14 +738,14 @@ const SpreadJsObj = {
                 sheet.extendCellType.checkbox = new spreadNS.CellTypes.CheckBox();
             }
             sheet.getRange(-1, col, -1, 1).cellType(sheet.extendCellType.checkbox);
-            sheet.getRange(-1, col, -1, 1).hAlign(col ? col.hAlign : spreadNS.HorizontalAlign.center);// 空白行不居中问题,checkbox要默认居中
+            sheet.getRange(-1, col, -1, 1).hAlign(colSetting ? colSetting.hAlign : spreadNS.HorizontalAlign.center);// 空白行不居中问题,checkbox要默认居中
         }
         if (colSetting.cellType === 'signalCheckbox') {
             if (!sheet.extendCellType.signalCheckbox) {
                 sheet.extendCellType.signalCheckbox = this.CellType.getSignalCheckboxCellType();
             }
             sheet.getRange(-1, col, -1, 1).cellType(sheet.extendCellType.signalCheckbox);
-            sheet.getRange(-1, col, -1, 1).hAlign(col ? col.hAlign : spreadNS.HorizontalAlign.center);// 空白行不居中问题,checkbox要默认居中
+            sheet.getRange(-1, col, -1, 1).hAlign(colSetting ? colSetting.hAlign : spreadNS.HorizontalAlign.center);// 空白行不居中问题,checkbox要默认居中
         }
         if (colSetting.cellType === 'unit') {
             if (!sheet.extendCellType.unit) {

+ 9 - 9
app/service/change_audit_list.js

@@ -484,21 +484,21 @@ module.exports = app => {
             }
         }
 
-        async calcCamountSum(transaction, updateTpDecimal = false) {
+        async calcCamountSum(transaction, updateTpDecimal = false, change = this.ctx.change) {
             // const sql = 'SELECT SUM(ROUND(`camount`*`unit_price`, )) as total_price FROM ?? WHERE cid = ?';
             // const sqlParam = [this.tableName, this.change.cid];
             // const tp = await transaction.queryOne(sql, sqlParam);
             // 防止小数位不精确,采用取值计算
             const sql = 'SELECT unit_price, spamount, is_valuation, gcl_id, unit FROM ?? WHERE cid = ?';
-            const sqlParam = [this.tableName, this.ctx.change.cid];
+            const sqlParam = [this.tableName, change.cid];
             const changeList = await transaction.query(sql, sqlParam);
             let total_price = 0;
             let positive_tp = 0;
             let negative_tp = 0;
             let valuation_tp = 0;
             let unvaluation_tp = 0;
-            const tp_decimal = this.ctx.change.tp_decimal ? this.ctx.change.tp_decimal : this.ctx.tender.info.decimal.tp;
-            const up_decimal = this.ctx.change.up_decimal ? this.ctx.change.up_decimal : this.ctx.tender.info.decimal.up;
+            const tp_decimal = change.tp_decimal ? change.tp_decimal : this.ctx.tender.info.decimal.tp;
+            const up_decimal = change.up_decimal ? change.up_decimal : this.ctx.tender.info.decimal.up;
             const gclChangeList = this._.uniq(this._.map(changeList, 'gcl_id'));
             for (const g of gclChangeList) {
                 if (g) {
@@ -560,7 +560,7 @@ module.exports = app => {
             }
             const options = {
                 where: {
-                    cid: this.ctx.change.cid,
+                    cid: change.cid,
                 },
             };
             await transaction.update(this.ctx.service.change.tableName, updateData, options);
@@ -645,7 +645,7 @@ module.exports = app => {
                     await transaction.delete(this.tableName, delData);
                     for (const c of changes) {
                         // 重算选了此清单的变更令已变更金额
-                        await this.reCalcTp(transaction, c.cid);
+                        await this.calcCamountSum(transaction, false, c);
                     }
                 }
             }
@@ -718,7 +718,7 @@ module.exports = app => {
                     if (updateArr.length > 0) await transaction.updateRows(this.tableName, updateArr);
                     if (cidList.length > 0) {
                         for (const c of cidList) {
-                            await this.reCalcTp(transaction, c);
+                            await this.calcCamountSum(transaction, false, c);
                         }
                     }
                 }
@@ -941,9 +941,9 @@ module.exports = app => {
         async reCalcTp(transaction, cid) {
             const change = await transaction.get(this.ctx.service.change.tableName, { cid });
             let count = '';
-            if (change.status === audit.flow.status.uncheck || change.status === audit.flow.status.back || change.status === audit.flow.status.revise) {
+            if (change.status === audit.change.status.uncheck || change.status === audit.change.status.checkNo || change.status === audit.change.status.revise) {
                 count = '`camount`';
-            } else if (change.status === audit.flow.status.checking || change.status === audit.flow.status.backnew) {
+            } else if (change.status === audit.change.status.checking || change.status === audit.change.status.checkNoPre) {
                 count = '`spamount`';
             }
             if (count) {

+ 3 - 0
app/service/change_pos.js

@@ -380,6 +380,9 @@ module.exports = app => {
                     }
                     updateBills.ledger_id = bills.ledger_id;
                 }
+                if (newBills && updateBills.cid && updateBills.cid === 1) {
+                    await this.ctx.service.changeAuditList.deleteDataByRevise(transaction, tid, [bills.id], 'gcl_id', '');
+                }
                 await this.ctx.service.changeAuditList.updateDataByRevisePos(transaction, tid, data);
                 await transaction.commit();
             } catch (err) {

+ 1 - 0
app/view/change/revise.ejs

@@ -199,4 +199,5 @@
     const settleBills = JSON.parse(unescape('<%- escape(JSON.stringify(settleBills)) %>'));
     const settlePos = JSON.parse(unescape('<%- escape(JSON.stringify(settlePos)) %>'));
     const openRevise = <%- ctx.session.sessionProject.page_show.openChangeRevise %>;
+    const precision = JSON.parse('<%- JSON.stringify(precision) %>');
 </script>