ソースを参照

1. 台账分解,工程量清单不允许编辑设计数量
2. 台账分解,修改单价,应重算金额
3. 批量插入清单部位,每次打开,所有表格都应选中第一个单元格

MaiXinRong 6 年 前
コミット
fccc66aef7

+ 1 - 1
app/const/spread.js

@@ -21,7 +21,7 @@ const ledgerSpread = {
         {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 60, type: 'Number', readOnly: 'readOnly.unit_price'},
         {title: '设计数量|数量1',  colSpan: '2|1', rowSpan: '1|1', field: 'dgn_qty1', hAlign: 2, width: 60, type: 'Number', readOnly: 'readOnly.dgnQty'},
         {title: '|数量2',  colSpan: '|1', rowSpan: '|1', field: 'dgn_qty2', hAlign: 2, width: 60, type: 'Number', readOnly: 'readOnly.dgnQty'},
-        {title: '经济指标',  colSpan: '1', rowSpan: '2', field: 'dgn_price', hAlign: 2, width: 60, type: 'Number', realyOnly: true},
+        {title: '经济指标',  colSpan: '1', rowSpan: '2', field: 'dgn_price', hAlign: 2, width: 60, type: 'Number', readOnly: true},
         {title: '签约|数量', colSpan: '2|1', rowSpan: '1|1', field: 'deal_qty', hAlign: 2, width: 60, type: 'Number', readOnly: 'readOnly.quantity'},
         {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'deal_tp', hAlign: 2, width: 60, type: 'Number', readOnly: true},
         {title: '施工图复核|数量', colSpan: '2|1', rowSpan: '1|1', field: 'quantity', hAlign: 2, width: 60, type: 'Number', readOnly: 'readOnly.quantity'},

+ 39 - 0
app/controller/stage_controller.js

@@ -12,6 +12,7 @@ const moment = require('moment');
 const auditConst = require('../const/audit');
 const spreadConst = require('../const/spread');
 const tenderConst = require('../const/tender');
+const payConst = require('../const/deal_pay.js');
 const measureType = tenderConst.measureType;
 const path = require('path');
 
@@ -382,6 +383,43 @@ module.exports = app => {
             }
         }
 
+        async _getPayCalcBase(ctx) {
+            //const calcBase = JSON.parse(JSON.stringify(payConst.calcBase));
+            const calcBase = [
+                {name: '签约合同价', code: 'htj'},
+                {name: '签约合同价(不含暂列金)', code: 'htjszl'},
+                {name: '签约开工预付款', code: 'kgyfk'},
+                {name: '签约材料预付款', code: 'clyfk'},
+                {name: '本期完成计量', code: 'bqwc'},
+                {name: '100章本期完成计量', code: 'ybbqwc'},
+            ];
+            const param = ctx.tender.info.deal_param;
+            for (const cb of calcBase) {
+                switch (cb.code) {
+                    case 'htj':
+                        cb.value = param.contractPrice;
+                        break;
+                    case 'htjszl':
+                        cb.value = this._.subtract(param.contractPrice, param.zanLiePrice);
+                        break;
+                    case 'kgyfk':
+                        cb.value = param.startAdvance;
+                        break;
+                    case 'clyfk':
+                        cb.value = param.materialAdvance;
+                        break;
+                    case 'bqwc':
+                        cb.value = await ctx.stage.stageBills.getSumTotalPrice(ctx.stage);
+                        break;
+                    case 'ybbqwc':
+                        cb.value = await ctx.sevice.stageBills.getSumTotalPrice(ctx.stage, '^1\d{2}-');
+                        break;
+                    default:
+                        cb.value = 0;
+                }
+            }
+        }
+
         /**
          * 合同支付
          * @param ctx
@@ -391,6 +429,7 @@ module.exports = app => {
             try {
                 await this._getStage(ctx);
                 const renderData = this._getDefaultRenderData(ctx);
+                renderData.pay = await ctx.service.stagePos.get
                 await this.layout('stage/pay.ejs', renderData, 'stage/pay_modal.ejs');
             } catch (err) {
                 this.log(err);

+ 4 - 1
app/public/js/ledger.js

@@ -1189,9 +1189,10 @@ $(document).ready(function() {
             // 清理原有数据
             SpreadJsObj.beginMassOperation(qdSheet);
             qdSheet.clear(0, 0, qdSheet.getRowCount(), qdSheet.getColumnCount(), GC.Spread.Sheets.SheetArea.viewport, GC.Spread.Sheets.StorageType.data);
-            for (let iRow = 1; iRow <= this.billsCount; iRow ++) {
+            for (let iRow = 1; iRow <= this.billsCount; iRow++) {
                 qdSheet.getCell(iRow - 1, 0, GC.Spread.Sheets.SheetArea.rowHeader).text('清单' + iRow);
             }
+            qdSheet.setSelection(0, 0, 1 ,1);
             SpreadJsObj.endMassOperation(qdSheet);
             // 初始化 部位数量复核表
             const posSheet = this.posSpread.getActiveSheet();
@@ -1200,11 +1201,13 @@ $(document).ready(function() {
             SpreadJsObj.beginMassOperation(posSheet);
             posSheet.setColumnWidth(0, 45, GC.Spread.Sheets.SheetArea.rowHeader);
             posSheet.clear(0, 0, posSheet.getRowCount(), posSheet.getColumnCount(), GC.Spread.Sheets.SheetArea.viewport, GC.Spread.Sheets.StorageType.data);
+            posSheet.setSelection(0, 0, 1 ,1);
             SpreadJsObj.endMassOperation(posSheet);
             // 检查签约清单数据,以工具栏数据为准
             if (dealBills) {
                 SpreadJsObj.loadSheetData(this.dealSpread.getActiveSheet(), 'data', dealBills.data);
             }
+            this.dealSpread.getActiveSheet().setSelection(0, 0, 1, 1);
         }
         // 获取界面数据
         getBatchData () {

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

@@ -20,7 +20,9 @@ const ledgerTreeCol = {
             return node.children && node.children.length > 0;
         },
         dgnQty: function (node) {
-            return !_.isEmpty(node.b_code);
+            console.log(node.b_code);
+            console.log(!_.isEmpty(node.b_code));
+            return _.isEmpty(node.b_code);
         },
     },
     getEvent: function (eventName) {

+ 23 - 12
app/service/ledger.js

@@ -1322,7 +1322,7 @@ module.exports = app => {
             const result = {};
             let bChanged = false;
             for (const prop in orgData) {
-                if (newData[prop] && newData[prop] !== orgData[prop]) {
+                if (this._.isEmpty(newData[prop]) && newData[prop] !== orgData[prop]) {
                     result[prop] = newData[prop];
                     bChanged = true;
                 }
@@ -1591,23 +1591,34 @@ module.exports = app => {
                     }
                     let updateData;
                     if (this._checkCalcField(row)) {
-                        if (!row.unit_price) {
-                            row.unit_price = updateNode.unit_price;
-                        }
+                        let calcData = JSON.parse(JSON.stringify(row));
                         const precision = this.ctx.helper.findPrecision(this.ctx.tender.info.precision, updateNode.unit);
                         this.ctx.helper.checkFieldPrecision(row, qtyFields, precision.value);
                         if (row.quantity) {
-                            row.total_price = this._.multiply(row.quantity, row.unit_price);
-                        } else if (row.total_price) {
-                            row.quantity = null;
+                            if (row.unit_price) {
+                                calcData.total_price = this._.multiply(row.quantity, row.unit_price);
+                            } else {
+                                calcData.total_price = this._.multiply(row.quantity, updateNode.unit_price);
+                            }
+                        } else if (row.unit_price) {
+                            calcData.total_price = this._.multiply(updateNode.quantity, row.unit_price);
+                        }
+                        if (row.total_price) {
+                            calcData.quantity = null;
                         }
                         if (row.deal_qty) {
-                            row.deal_tp = this._.multiply(row.deal_qty, row.unit_price);
-                        } else if (row.deal_tp) {
-                            row.deal_qty = null;
+                            if (row.unit_price) {
+                                calcData.deal_tp = this._.multiply(row.deal_qty, row.unit_price);
+                            } else {
+                                calcData.deal_tp = this._.multiply(row.deal_qty, updateNode.unit_price);
+                            }
+                        } else if (row.unit_price) {
+                            calcData.deal_tp = this._.multiply(updateNode.deal_qty, row.unit_price);
+                        }
+                        if (row.deal_tp) {
+                            calcData.deal_qty = null;
                         }
-                        const data1 = this._filterChangedField(updateNode, row);
-                        updateData = this._filterUpdateInvalidField(updateNode.id, data1);
+                        updateData = this._filterUpdateInvalidField(updateNode.id, calcData);
                     } else {
                         updateData = this._filterUpdateInvalidField(updateNode.id, row);
                     }

+ 1 - 1
app/view/ledger/explode_modal.ejs

@@ -57,7 +57,7 @@
             <div class="modal-body">
                 <div class="row">
                     <div class="col-6">
-                        <h6>清单编号</h6>
+                        <h6>清单信息</h6>
                         <div class="batch-l-t">
                         </div>
                         <h6>部位数量复核表</h6>