Browse Source

Merge branch 'dev' of http://192.168.1.41:3000/maixinrong/Calculation into dev

laiguoran 4 years ago
parent
commit
34e91e8c83

+ 1 - 5
app/controller/advance_controller.js

@@ -145,10 +145,7 @@ module.exports = app => {
                 const max_pr = ctx.helper.mul(ctx.helper.div(ctx.helper.sub(advancePayTotal, (prevAdvance && prevAdvance.prev_total_amount || 0)), advancePayTotal, 10), 100);
                 // 特殊处理金额的显示(formatMoney)
                 const s1 = parseFloat(ctx.advance.prev_amount).toString().split('.')[1];
-                let s2 = parseFloat(ctx.advance.prev_total_amount).toString().split('.')[1];
-                if (isEdited) {
-                    s2 = parseFloat(ctx.advance.prev_total_amount.toFixed(this.decimal)).toString().split('.')[1];
-                }
+                const s2 = parseFloat(ctx.advance.prev_total_amount).toString().split('.')[1];
                 const prev_amount = ctx.helper.formatMoney(ctx.advance.prev_amount, ',', s1 && s1.length || 0);
                 const prev_total_amount = ctx.helper.formatMoney(ctx.advance.prev_total_amount, ',', s2 && s2.length || 0);
                 renderData.isEdited = isEdited;
@@ -173,7 +170,6 @@ module.exports = app => {
         async update(ctx) {
             const { id } = ctx.advance;
             const data = JSON.parse(ctx.request.body.data);
-            console.log('data', data);
             try {
                 const result = await ctx.service.advance.updateAdvance(data, id);
                 if (result) {

+ 4 - 4
app/public/js/advance_audit.js

@@ -160,7 +160,7 @@ $(document).ready(function () {
             return toastr.error('请填写本期金额!')
         }
         const prev_amount = prevAdvance && prevAdvance.prev_total_amount || 0
-        const prev_total_amount = parseFloat(ZhCalc.add(cur_amount, prev_amount).toFixed(decimal))
+        const prev_total_amount = ZhCalc.add(cur_amount, prev_amount)
         const remark = filterText($('#ad-remark').val())
         const data = {pay_ratio, cur_amount, prev_amount, prev_total_amount, remark, status: auditConst.status.checking}
         postData(preUrl + '/audit/start', data, (data) => {
@@ -204,10 +204,10 @@ $(document).ready(function () {
                 // 限制不能超过最大值
                 val = re_amount
             }
-            // $(this).val(fixedToSub(val, decimal)) // 重新赋值限制只有两位小数
+            $(this).val(fixedToSub(val, decimal)) // 重新赋值限制只有两位小数
             const pay_a_input = $(`.pay-input[data-type=${reverse(type)}]`)
             pay_ratio = parseFloat(ZhCalc.mul(ZhCalc.div(val, advancePayTotal), 100).toFixed(2))
-            cur_amount = val
+            cur_amount = ZhCalc.round(val, decimal)
             pay_a_input.val(pay_ratio)
             const total = parseFloat(ZhCalc.add(val, p_amount).toFixed(decimal)).toString().split('.')[1]
             // 截止本期金额文案更新
@@ -219,7 +219,7 @@ $(document).ready(function () {
             // 支付比例转化
             $(this).val(fixedToSub(val)) // 重新赋值限制只有两位小数
             const cur_m_input = $(`.pay-input[data-type=${reverse(type)}]`)
-            cur_amount = ZhCalc.mul(advancePayTotal, ZhCalc.div(val, 100))
+            cur_amount = ZhCalc.round(ZhCalc.mul(advancePayTotal, ZhCalc.div(val, 100)), decimal)
             pay_ratio = val
             cur_m_input.val(parseFloat(cur_amount.toFixed(decimal)))
             const total = parseFloat(ZhCalc.add(cur_amount, p_amount).toFixed(decimal)).toString().split('.')[1]

+ 82 - 38
app/public/js/ledger.js

@@ -48,6 +48,9 @@ $(document).ready(function() {
         rootId: -1,
         keys: ['id', 'tender_id', 'ledger_id'],
         preUrl: '/tender/' + getTenderId() + '/ledger',
+        //treeCacheKey: 'ledger_bills_fold' + '_' + getTenderId(),
+        markFoldKey: 'bills-fold',
+        markFoldSubKey: window.location.pathname.split('/')[2],
     };
     if (checkTzMeasureType()) {
         treeSetting.calcFields = ['sgfh_tp', 'sjcl_tp', 'qtcl_tp', 'total_price'];
@@ -2190,14 +2193,14 @@ $(document).ready(function() {
                 if (!dealBills) {
                     dealBills = new DealBills('#deal-bills-spread', {
                         cols: [
-                            {title: '清单编号', field: 'code', hAlign: 0, width: 85, formatter: '@', readOnly: true},
-                            {title: '名称', field: 'name', hAlign: 0, width: 150, formatter: '@', readOnly: true},
-                            {title: '单位', field: 'unit', hAlign: 1, width: 50, formatter: '@', readOnly: true},
-                            {title: '单价', field: 'unit_price', hAlign: 2, width: 50, readOnly: true},
-                            {title: '数量', field: 'quantity', hAlign: 2, width: 50, readOnly: true},
-                            {title: '金额', field: 'total_price', hAlign: 2, width: 50, readOnly: true},
+                            {title: '清单编号', field: 'code', hAlign: 0, width: 85, formatter: '@'},
+                            {title: '名称', field: 'name', hAlign: 0, width: 150, formatter: '@'},
+                            {title: '单位', field: 'unit', hAlign: 1, width: 50, formatter: '@'},
+                            {title: '单价', field: 'unit_price', hAlign: 2, width: 50},
+                            {title: '数量', field: 'quantity', hAlign: 2, width: 50},
+                            {title: '金额', field: 'total_price', hAlign: 2, width: 50},
                         ],
-                        emptyRows: 0,
+                        emptyRows: 3,
                         headRows: 1,
                         headRowHeight: [32],
                         defaultRowHeight: 21,
@@ -2205,6 +2208,7 @@ $(document).ready(function() {
                         font: '12px 微软雅黑',
                         headColWidth: [0],
                         selectedBackColor: '#fffacd',
+                        readOnly: true,
                     });
                     dealBills.loadData();
                 }
@@ -2260,44 +2264,47 @@ $(document).ready(function() {
             this.url = '/tender/' + getTenderId() + '/deal';
             this.spreadSetting = spreadSetting;
             this.spread = SpreadJsObj.createNewSpread(this.obj);
+            this.sheet = this.spread.getActiveSheet();
             SpreadJsObj.initSheet(this.spread.getActiveSheet(), this.spreadSetting);
             if (!readOnly) {
                 this.spread.bind(spreadNS.Events.CellDoubleClick, function (e, info) {
-                const dealSheet = info.sheet;
-                const mainSheet = ledgerSpread.getActiveSheet();
+                    const dealSheet = info.sheet;
+                    if (!dealSheet.zh_setting.readOnly) return;
 
-                const dealBills = SpreadJsObj.getSelectObject(dealSheet);
-                if (!dealBills) { return; }
-                const mainTree = mainSheet.zh_tree;
-                const mainNode = SpreadJsObj.getSelectObject(mainSheet);
-                if (!mainNode || !mainTree) { return; }
+                    const mainSheet = ledgerSpread.getActiveSheet();
 
-                if (mainNode.code && mainNode.code !== '' && !mainTree.isLeafXmj(mainNode)) {
-                    toastr.error('非最底层项目下,不应添加清单');
-                    return;
-                }
+                    const dealBills = SpreadJsObj.getSelectObject(dealSheet);
+                    if (!dealBills) { return; }
+                    const mainTree = mainSheet.zh_tree;
+                    const mainNode = SpreadJsObj.getSelectObject(mainSheet);
+                    if (!mainNode || !mainTree) { return; }
 
-                postData(window.location.pathname + '/update', {
-                    postType: 'add-deal',
-                    postData: {
-                        id: mainNode.ledger_id,
-                        type: mainNode.code ? 'child' : 'next',
-                        dealBills: {
-                            b_code: dealBills.code, name: dealBills.name, unit: dealBills.unit,
-                            unit_price: dealBills.unit_price,
-                        }
-                    },
-                }, function (result) {
-                    const refreshData = mainTree.loadPostData(result);
-                    treeOperationObj.refreshTree(mainSheet, refreshData);
-                    const sel = mainSheet.getSelections()[0];
-                    mainSheet.setSelection(refreshData.create[0].index, sel.col, sel.rowCount, sel.colCount);
-                    SpreadJsObj.reloadRowsBackColor(mainSheet, [sel.row, refreshData.create[0].index]);
-                    treeOperationObj.refreshOperationValid(mainSheet);
-                    ledgerSpread.focus();
-                    posOperationObj.loadCurPosData();
+                    if (mainNode.code && mainNode.code !== '' && !mainTree.isLeafXmj(mainNode)) {
+                        toastr.error('非最底层项目下,不应添加清单');
+                        return;
+                    }
+
+                    postData(window.location.pathname + '/update', {
+                        postType: 'add-deal',
+                        postData: {
+                            id: mainNode.ledger_id,
+                            type: mainNode.code ? 'child' : 'next',
+                            dealBills: {
+                                b_code: dealBills.code, name: dealBills.name, unit: dealBills.unit,
+                                unit_price: dealBills.unit_price,
+                            }
+                        },
+                    }, function (result) {
+                        const refreshData = mainTree.loadPostData(result);
+                        treeOperationObj.refreshTree(mainSheet, refreshData);
+                        const sel = mainSheet.getSelections()[0];
+                        mainSheet.setSelection(refreshData.create[0].index, sel.col, sel.rowCount, sel.colCount);
+                        SpreadJsObj.reloadRowsBackColor(mainSheet, [sel.row, refreshData.create[0].index]);
+                        treeOperationObj.refreshOperationValid(mainSheet);
+                        ledgerSpread.focus();
+                        posOperationObj.loadCurPosData();
+                    });
                 });
-            });
             }
             $('#upload-deal-bills').click(function () {
                     const file = $('#deal-bills-file')[0];
@@ -2319,6 +2326,43 @@ $(document).ready(function() {
                         return target.hitTestType === spreadNS.SheetArea.viewport || target.hitTestType === spreadNS.SheetArea.rowHeader;
                     },
                     items: {
+                        edit: {
+                            name: '进入编辑模式',
+                            icon: 'fa-edit',
+                            visible: function (key, opt) {
+                                return self.sheet.zh_setting.readOnly;
+                            },
+                            callback: function (key, opt) {
+                                self.sheet.zh_setting.readOnly = false;
+                                SpreadJsObj.refreshSheetReadOnly(self.sheet);
+                            },
+                        },
+                        read: {
+                            name: '退出编辑模式',
+                            icon: 'fa-sign-out',
+                            visible: function (key, opt) {
+                                return !self.sheet.zh_setting.readOnly;
+                            },
+                            callback: function (key, opt) {
+                                self.sheet.zh_setting.readOnly = true;
+                                SpreadJsObj.refreshSheetReadOnly(self.sheet);
+                            },
+                        },
+                        del: {
+                            name: '删除',
+                            icon: 'fa-times',
+                            visible: function (key, opt) {
+                                return !self.sheet.zh_setting.readOnly;
+                            },
+                            disabled: function (key, opt) {
+                                const select = SpreadJsObj.getSelectObject(self.sheet);
+                                return !select;
+                            },
+                            callback: function (key, opt) {
+
+                            },
+                        },
+                        sprEdit: '---------',
                         apply: {
                             name: '应用全部清单单价至台账',
                             icon: 'fa-magic',

+ 2 - 0
app/public/js/ledger_audit.js

@@ -28,6 +28,8 @@ $(document).ready(() => {
         rootId: -1,
         keys: ['id', 'tender_id', 'ledger_id'],
         preUrl: '/ledger',
+        markFoldKey: 'bills-fold',
+        markFoldSubKey: window.location.pathname.split('/')[2],
     };
     if (checkTzMeasureType()) {
         treeSetting.calcFields = ['sgfh_tp', 'sjcl_tp', 'qtcl_tp', 'total_price'];

File diff suppressed because it is too large
+ 7 - 0
app/public/js/local-forage/localforage.min.js


+ 2 - 0
app/public/js/measure_compare.js

@@ -144,6 +144,8 @@ $(document).ready(() => {
         masterId: 'id',
         minorId: 'lid',
         calcFields: [],
+        markFoldKey: 'bills-fold',
+        markFoldSubKey: window.location.pathname.split('/')[2],
     });
     const cPos = new MasterPosData({
         id: 'id', ledgerId: 'lid', masterId: 'id', minorId: 'pid',

+ 73 - 23
app/public/js/path_tree.js

@@ -263,6 +263,7 @@ const createNewPathTree = function (type, setting) {
          * 构造函数
          */
         constructor(setting) {
+            const self = this;
             // 无索引
             this.datas = [];
             // 以key为索引
@@ -273,6 +274,23 @@ const createNewPathTree = function (type, setting) {
             this.children = [];
             // 树设置
             this.setting = setting;
+
+            if (this.setting.markFoldKey) {
+                const markStr = getLocalCache(this.setting.markFoldKey);
+                const markData = markStr ? markStr.split('|') : ['', ''];
+                try {
+                    this.markFold = markData[0] === this.setting.markFoldSubKey
+                        ? (markData[1] ? markData[1].split(',').map(x => { return parseInt(x) }) : [])
+                        : [];
+                } catch {
+                    this.markFold = [];
+                }
+            }
+            // if (this.setting.treeCacheKey) {
+            //     localforage.getItem(this.setting.treeCacheKey).then(function (v) {
+            //         self.markFold = v && v.markFold ? v.markFold : [];
+            //     });
+            // }
         }
         /**
          * 树结构根据显示排序
@@ -309,6 +327,7 @@ const createNewPathTree = function (type, setting) {
          * @param datas
          */
         loadDatas(datas) {
+            self = this;
             // 清空旧数据
             this.items = {};
             this.nodes = [];
@@ -342,6 +361,9 @@ const createNewPathTree = function (type, setting) {
             });
             this.sortTreeNode(true);
             if (this.setting.autoExpand >= 0) this.expandByLevel(this.setting.autoExpand);
+            if (this.setting.markFoldKey) this.expandByCustom(function (node) {
+                return self.markFold.indexOf(node[self.setting.id]) === -1;
+            });
         }
 
         getItemsByIndex(index) {
@@ -487,6 +509,49 @@ const createNewPathTree = function (type, setting) {
             const siblings = this.getChildren(this.getParent(node));
             return (siblings && siblings.length > 0) ? node.order === siblings[siblings.length - 1].order : false;
         };
+
+        /**
+         * 提取节点key和索引数据
+         * @param {Object} node - 节点
+         * @returns {key}
+         */
+        getNodeKeyData(node) {
+            const data = {};
+            for (const key of this.setting.keys) {
+                data[key] = node[key];
+            }
+            return data;
+        };
+        /**
+         * 得到树结构构成id
+         * @param node
+         * @returns {*}
+         */
+        getNodeKey(node) {
+            return node[this.setting.id];
+        };
+
+        _markFold(node) {
+            if (!this.setting.markFoldKey || !this.setting.markFoldSubKey) return;
+            // if (!this.setting.treeCacheKey) return;
+
+            if (!node.expanded) {
+                if (this.markFold.indexOf(node[this.setting.id]) === -1) this.markFold.push(node[this.setting.id]);
+            } else {
+                if (this.markFold.indexOf(node[this.setting.id]) >= 0) this.markFold.splice(this.markFold.indexOf(node[this.setting.id]), 1);
+            }
+        }
+        _saveMarkFold() {
+            if (this.setting.markFoldKey && this.setting.markFoldSubKey) {
+                setLocalCache(this.setting.markFoldKey, this.setting.markFoldSubKey + '|' + this.markFold.join(','));
+            }
+            // if (this.setting.treeCacheKey) {
+            //     localforage.setItem(this.setting.treeCacheKey, {
+            //         markFold: this.markFold,
+            //         time: new Date(),
+            //     });
+            // }
+        }
         /**
          * 刷新子节点是否可见
          * @param {Object} node
@@ -510,30 +575,10 @@ const createNewPathTree = function (type, setting) {
          */
         setExpanded(node, expanded) {
             node.expanded = expanded;
+            this._markFold(node);
             this._refreshChildrenVisible(node);
+            this._saveMarkFold();
         };
-
-        /**
-         * 提取节点key和索引数据
-         * @param {Object} node - 节点
-         * @returns {key}
-         */
-        getNodeKeyData(node) {
-            const data = {};
-            for (const key of this.setting.keys) {
-                data[key] = node[key];
-            }
-            return data;
-        };
-        /**
-         * 得到树结构构成id
-         * @param node
-         * @returns {*}
-         */
-        getNodeKey(node) {
-            return node[this.setting.id];
-        };
-
         /**
          * 递归 设置节点展开状态
          * @param {Array} nodes - 需要设置状态的节点
@@ -543,7 +588,11 @@ const createNewPathTree = function (type, setting) {
          */
         _recursiveExpand(nodes, parent, checkFun) {
             for (const node of nodes) {
-                node.expanded = checkFun(node);
+                const expanded = checkFun(node);
+                if (node.expanded !== expanded) {
+                    node.expanded = expanded;
+                    this._markFold(node);
+                }
                 node.visible = parent ? (parent.expanded && parent.visible) : true;
                 this._recursiveExpand(node.children, node, checkFun);
             }
@@ -554,6 +603,7 @@ const createNewPathTree = function (type, setting) {
          */
         expandByCustom(checkFun) {
             this._recursiveExpand(this.children, null, checkFun);
+            this._saveMarkFold();
         }
         /**
          * 展开到第几层

+ 12 - 0
app/public/js/spreadjs_rela/spreadjs_zh.js

@@ -981,6 +981,18 @@ const SpreadJsObj = {
             }
         }
     },
+    refreshSheetReadOnly: function (sheet) {
+        this.beginMassOperation(sheet);
+        if (sheet.zh_setting) {
+            sheet.zh_setting.cols.forEach(function (col, i) {
+                for (let iRow = 0; iRow < sheet.getRowCount(); iRow++) {
+                    sheet.getCell(iRow, i).locked(col.readOnly || sheet.zh_setting.readOnly || false);
+                }
+                //sheet.getRange(-1, i, -1, 1, GC.Spread.Sheets.SheetArea.viewport).locked(col.readOnly || sheet.zh_setting.readOnly || false);
+            });
+        }
+        this.endMassOperation(sheet);
+    },
     /**
      * 刷新列是否只读
      * @param sheet

+ 2 - 0
app/public/js/stage.js

@@ -163,6 +163,8 @@ $(document).ready(() => {
         rootId: -1,
         keys: ['id', 'tender_id', 'ledger_id'],
         stageId: 'id',
+        markFoldKey: 'bills-fold',
+        markFoldSubKey: window.location.pathname.split('/')[2],
     };
     // 台账树结构计算相关设置
     stageTreeSetting.updateFields = ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'postil', 'used', 'contract_expr'];

+ 6 - 16
app/service/advance.js

@@ -36,21 +36,12 @@ module.exports = app => {
             const advance = await this.db.query(sql, sqlParam);
             for (const item of advance) {
                 item.pay_ratio = this.ctx.helper.mul(this.ctx.helper.div(item.cur_amount, advancePayTotal), 100, 2) || 0;
-                if (item.status === auditConst.status.uncheck || item.status === auditConst.status.checkNo) {
-                    const s1 = item.cur_amount && parseFloat(item.cur_amount.toFixed(decimal)).toString().split('.')[1];
-                    const s2 = parseFloat(item.prev_amount).toString().split('.')[1];
-                    const s3 = parseFloat(item.prev_total_amount.toFixed(decimal)).toString().split('.')[1];
-                    item.cur_amount = this.ctx.helper.formatMoney(item.cur_amount, ',', s1 && s1.length || 0);
-                    item.prev_amount = this.ctx.helper.formatMoney(item.prev_amount, ',', s2 && s2.length || 0);
-                    item.prev_total_amount = this.ctx.helper.formatMoney(item.prev_total_amount, ',', s3 && s3.length || 0);
-                } else {
-                    const s1 = item.cur_amount.toString().split('.')[1] && item.cur_amount.toString().split('.')[1].length;
-                    const s2 = item.prev_amount.toString().split('.')[1] && item.prev_amount.toString().split('.')[1].length;
-                    const s3 = item.prev_total_amount.toString().split('.')[1] && item.prev_total_amount.toString().split('.')[1].length;
-                    item.cur_amount = this.ctx.helper.formatMoney(item.cur_amount, ',', s1 || 0);
-                    item.prev_amount = this.ctx.helper.formatMoney(item.prev_amount, ',', s2 || 0);
-                    item.prev_total_amount = this.ctx.helper.formatMoney(item.prev_total_amount, ',', s3 || 0);
-                }
+                const s1 = item.cur_amount && item.cur_amount.toString().split('.')[1];
+                const s2 = item.prev_amount.toString().split('.')[1];
+                const s3 = item.prev_total_amount.toString().split('.')[1];
+                item.cur_amount = this.ctx.helper.formatMoney(item.cur_amount, ',', s1 && s1.length || 0);
+                item.prev_amount = this.ctx.helper.formatMoney(item.prev_amount, ',', s2 && s2.length || 0);
+                item.prev_total_amount = this.ctx.helper.formatMoney(item.prev_total_amount, ',', s3 && s3.length || 0);
                 item.curAuditor = await this.ctx.service.advanceAudit.getAuditorByStatus(item.id, item.status, item.times);
                 if (item.status === auditConst.status.checkNoPre) {
                     item.curAuditor2 = await this.ctx.service.advanceAudit.getAuditorByStatus(item.id, auditConst.status.checking);
@@ -184,7 +175,6 @@ module.exports = app => {
             const prevRecord = await this.getPreviousRecord(ctx.tender.id, ctx.advance.type) || { prev_total_amount: 0 };
             const { cur_amount } = payload;
             payload.prev_total_amount = ctx.helper.add(cur_amount, prevRecord.prev_total_amount);
-            console.log(payload);
             return await this.update(payload, {
                 id,
             });

+ 26 - 2
app/service/tender_info.js

@@ -12,7 +12,7 @@ const infoConst = require('../const/tender_info');
 const parseInfo = infoConst.parseInfo;
 const arrayInfo = infoConst.arrayInfo;
 const defaultInfo = infoConst.defaultInfo;
-
+const advanceConst = require('../const/audit').advance;
 module.exports = app => {
 
     class TenderInfo extends app.BaseService {
@@ -202,8 +202,10 @@ module.exports = app => {
 
         async saveDecimal(tenderId, newDecimal, oldDecimal) {
             const changeBills = [],
+                changeAdvanceBills = [],
                 calcUp = newDecimal.up < oldDecimal.up,
-                calcTp = newDecimal.tp !== oldDecimal.tp;
+                calcTp = newDecimal.tp !== oldDecimal.tp,
+                caclPayTp = (newDecimal.pay ? newDecimal.payTp : newDecimal.tp) < (oldDecimal.pay ? oldDecimal.payTp : oldDecimal.tp);
             if (calcUp || calcTp) {
                 const bills = await this.ctx.service.ledger.getAllDataByCondition({
                     columns: ['id', 'unit_price', 'sgfh_qty', 'sjcl_qty', 'qtcl_qty', 'deal_qty', 'quantity'],
@@ -220,12 +222,30 @@ module.exports = app => {
                     changeBills.push(cb);
                 }
             }
+            if (caclPayTp) {
+                // 获取预付款需要修改的相关记录
+                const ad_bills = await this.ctx.service.advance.getAllDataByCondition({
+                    columns: ['id', 'cur_amount', 'prev_amount', 'prev_total_amount'],
+                    where: { status: [advanceConst.status.uncheck, advanceConst.status.checkNo], tid: tenderId },
+                });
+                const decimal = newDecimal.pay ? newDecimal.payTp : newDecimal.tp;
+                // 根据精度重新计算相关金额
+                for (const ad of ad_bills) {
+                    const cb = { id: ad.id };
+                    const cur_amount = this.ctx.helper.round(ad.cur_amount, decimal);
+                    cb.cur_amount = cur_amount;
+                    cb.prev_total_amount = this.ctx.helper.add(cur_amount, ad.prev_amount);
+                    changeAdvanceBills.push(cb);
+                }
+            }
             if (changeBills.length > 0) {
                 const transaction = await this.db.beginTransaction();
                 try {
                     await transaction.update(this.tableName,
                         { decimal: JSON.stringify(newDecimal) }, { where: { tid: tenderId } });
                     await transaction.updateRows(this.ctx.service.ledger.tableName, changeBills);
+
+                    // await transaction.updateRows(this.ctx.service.advance.tableName, changeAdvanceBills);
                     await transaction.commit();
                 } catch (error) {
                     await transaction.rollback();
@@ -235,6 +255,10 @@ module.exports = app => {
                 await this.db.update(this.tableName,
                     { decimal: JSON.stringify(newDecimal) }, { where: { tid: tenderId } });
             }
+            // 更新预付款记录
+            if (changeAdvanceBills.length) {
+                await this.db.updateRows(this.ctx.service.advance.tableName, changeAdvanceBills);
+            }
         }
     }
 

+ 1 - 1
app/view/revise/info.ejs

@@ -225,7 +225,7 @@
     const billsSpreadSetting = JSON.parse('<%- JSON.stringify(ledgerSpread) %>');
     const posSpreadSetting = JSON.parse('<%- JSON.stringify(posSpread) %>');
     const thousandth = <%- ctx.tender.info.display.thousandth %>;
-    const decimal = <%- ctx.tender.info.decimal %>;
+    const decimal = JSON.parse('<%- JSON.stringify(ctx.tender.info.decimal) %>');
     $('.sp-list-btn').click(function () {
         const type = $(this).data('type')
         if (type === 'hide') {

+ 1 - 1
app/view/tender/detail_modal.ejs

@@ -353,7 +353,7 @@
                                     <span class="input-group-text">金额</span>
                                 </div>
                                 <input type="number" class="form-control" value="2" id="decimal-extra-tp"
-                                       oninput="limitDecimal(this)" min="0" max="4">
+                                       oninput="limitDecimal(this)" min="0" max="4" maxlength="1">
                             </div>
                         </div>
                     </div>