瀏覽代碼

1. 本期计量列显示调整
2. 调用变更令,删除、复制粘贴本期计量,更新已用提示

MaiXinRong 6 年之前
父節點
當前提交
159b191361
共有 4 個文件被更改,包括 45 次插入23 次删除
  1. 7 10
      app/const/spread.js
  2. 1 2
      app/controller/stage_controller.js
  3. 27 0
      app/public/js/stage.js
  4. 10 11
      app/public/js/stage_detail.js

+ 7 - 10
app/const/spread.js

@@ -64,9 +64,8 @@ const stage = {
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'total_price', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '本期合同计量|数量', colSpan: '2|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 60, type: 'Number'},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'contract_tp', hAlign: 2, width: 60, type: 'Number'},
-            {title: '本期数量变更|数量', colSpan: '3|1', rowSpan: '1|1', field: 'qc_qty', hAlign: 2, width: 60, type: 'Number',},
+            {title: '本期数量变更|数量', colSpan: '2|1', rowSpan: '1|1', field: 'qc_qty', hAlign: 2, width: 60, type: 'Number',},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'qc_tp', hAlign: 2, width: 60, type: 'Number'},
-            {title: '|变更令', colSpan: '|1', rowSpan: '|1', field: 'qc_tp_bgl', hAlign: 2, width: 60, readOnly: true, formatter: '@'},
             {title: '本期完成计量|数量', colSpan: '2|1', rowSpan: '1|1', field: 'gather_qty', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'gather_tp', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '截止本期合同计量|数量', colSpan: '2|1', rowSpan: '1|1', field: 'end_contract_qty', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
@@ -88,14 +87,12 @@ const stage = {
         cols: [
             {title: '部位名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 180, formatter: '@', readOnly: true},
             {title: '复核数量', colSpan: '1', rowSpan: '2', field: 'quantity', hAlign: 2, width: 60, formatter: '@'},
-            {title: '本期|合同计量', colSpan: '4|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 60, type: 'Number'},
-            {title: '|数量变更计量', colSpan: '|1', rowSpan: '|1', field: 'qc_qty', hAlign: 2, width: 80, type: 'Number'},
-            {title: '|变更令', colSpan: '|1', rowSpan: '|1', field: 'qc_bgl', hAlign: 0, width: 60, formatter: '@', readOnly: true},
-            {title: '|完成计量', colSpan: '|1', rowSpan: '|1', field: 'gather_qty', hAlign: 2, width: 60, type: 'Number', readOnly: true},
-            {title: '截止|合同计量', colSpan: '4|1', rowSpan: '1|1', field: 'end_contract_qty', hAlign: 2, width: 60, type: 'Number', readOnly: true},
-            {title: '|数量变更计量', colSpan: '|1', rowSpan: '|1', field: 'end_qc_qty', hAlign: 2, width: 80, type: 'Number', readOnly: true},
-            {title: '|变更令', colSpan: '|1', rowSpan: '|1', field: 'end_qc_bgl', hAlign: 0, width: 60, formatter: '@', readOnly: true},
-            {title: '|完成计量', colSpan: '|1', rowSpan: '|1', field: 'end_gather_qty', hAlign: 2, width: 60, type: 'Number', readOnly: true},
+            {title: '本期计量|合同', colSpan: '3|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 60, type: 'Number'},
+            {title: '|数量变更', colSpan: '|1', rowSpan: '|1', field: 'qc_qty', hAlign: 2, width: 80, type: 'Number'},
+            {title: '|完成', colSpan: '|1', rowSpan: '|1', field: 'gather_qty', hAlign: 2, width: 60, type: 'Number', readOnly: true},
+            {title: '截止本期计量|合同', colSpan: '3|1', rowSpan: '1|1', field: 'end_contract_qty', hAlign: 2, width: 60, type: 'Number', readOnly: true},
+            {title: '|数量变更', colSpan: '|1', rowSpan: '|1', field: 'end_qc_qty', hAlign: 2, width: 80, type: 'Number', readOnly: true},
+            {title: '|完成', colSpan: '|1', rowSpan: '|1', field: 'end_gather_qty', hAlign: 2, width: 60, type: 'Number', readOnly: true},
             {title: '本期批注', colSpan: '1', rowSpan: '2', field: 'postil', hAlign: 0, width: 80, formatter: '@'},
             {title: '图册号', colSpan: '1', rowSpan: '2', field: 'drawing_code', hAlign: 0, width: 80, formatter: '@', readOnly: true},
             {title: '添加期数', colSpan: '1', rowSpan: '2', field: 'add_stage', hAlign:1, width: 80, readOnly: true},

+ 1 - 2
app/controller/stage_controller.js

@@ -606,14 +606,13 @@ module.exports = app => {
                 }
                 const bills = data.bills ? data.bills : await ctx.service.ledger.getDataById(data.pos.lid);
                 const pos = data.pos;
-                const changes = await ctx.service.change.getValidChanges(bills, pos);
+                const changes = await ctx.service.change.getValidChanges(ctx.tender.id, bills, pos);
                 ctx.body = {err: 0, msg: '', data: changes};
             } catch(err) {
                 this.log(err);
                 ctx.body = {err: 1, msg: err.toString(), data: null};
             }
         }
-
         // 审批相关
         /**
          * 添加审批人

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

@@ -187,6 +187,33 @@ $(document).ready(() => {
                     info.sheet.repaint(info.sheet.getCellRect(info.row, 0));
                 }
             });
+            this.spread.bind(spreadNS.Events.ClipboardPasted, function (e, info) {
+                if (info.sheet.zh_setting) {
+                    const sortData = SpreadJsObj.getSortData(info.sheet);
+                    for (let iRow = 0; iRow < info.cellRange.rowCount; iRow++) {
+                        const curRow = iRow + info.cellRange.row;
+                        const curCol = info.cellRange.col;
+                        const col = info.sheet.zh_setting.cols[info.cellRange.col];
+                        sortData[curRow][col.field] = col.type === 'Number' ? _.toNumber(info.sheet.getText(curRow, curCol)) : info.sheet.getText(curRow, curCol);
+                    }
+                    SpreadJsObj.reLoadRowData(sheet, info.cellRange.row, sel.cellRange.rowCount);
+                }
+            });
+            SpreadJsObj.addDeleteBind(this.spread, function (sheet) {
+                if (sheet.zh_setting) {
+                    const sel = sheet.getSelections()[0];
+                    const sortData = SpreadJsObj.getSortData(sheet);
+                    // 仅本期计量可删除
+                    if (sel.col === 5 || sel.colCount === 1) {
+                        const col = sheet.zh_setting.cols[sel.col];
+                        for (let iRow = sel.row; iRow < sel.row + sel.rowCount; iRow++) {
+                            const data = sortData[iRow];
+                            data[col.field] = null;
+                        }
+                        SpreadJsObj.reLoadRowData(sheet, sel.row, sel.rowCount);
+                    }
+                }
+            });
             // 过滤可变更数量为0
             $('#customCheckDisabled').click(function () {
                 self._filterEmptyChange(!this.checked);

+ 10 - 11
app/public/js/stage_detail.js

@@ -9,8 +9,9 @@
  */
 
 $(document).ready(() => {
-    let gsSpread, gsTree;
+    let gsSpread;
     stageIm.init(stage, imType);
+    const gsTree = stageIm.getGsTree();
 
     function getSelectDetailData() {
         const rowIndex = parseInt($('#im-list').attr('rowIndex'));
@@ -23,14 +24,14 @@ $(document).ready(() => {
         $('#edit-detail').show();
         $('#save-detail').hide();
         $('#cancel-detail').hide();
-        $('#bgl-code').val(data.bgl_code ? data.bgl_code : '');
-        $('#bw-name').val(data.bw ? data.bw : '');
-        $('#start-peg').val(data.start_peg ? data.start_peg : '');
-        $('#end-peg').val(data.end_peg ? data.end_peg : '');
-        $('#unit-name').val(data.jldy ? data.jldy : '');
-        $('#drawing-code').val(data.drawing_code ? data.drawing_code : '');
-        $('#calc-memo').val(data.calc_memo ? data.calc_memo : '');
-        if (data.calc_img) {
+        $('#bgl-code').val(data && data.bgl_code ? data.bgl_code : '');
+        $('#bw-name').val(data && data.bw ? data.bw : '');
+        $('#start-peg').val(data && data.start_peg ? data.start_peg : '');
+        $('#end-peg').val(data && data.end_peg ? data.end_peg : '');
+        $('#unit-name').val(data && data.jldy ? data.jldy : '');
+        $('#drawing-code').val(data && data.drawing_code ? data.drawing_code : '');
+        $('#calc-memo').val(data && data.calc_memo ? data.calc_memo : '');
+        if (data && data.calc_img) {
             $('#calc-img').html('<img src="/' + data.calc_img + '" class="d-100" width="100%">');
         } else {
             $('#calc-img').html('');
@@ -235,7 +236,6 @@ $(document).ready(() => {
                     }
                 }
             });
-            const gsTree = stageIm.getGsTree();
             SpreadJsObj.loadSheetData(gsSpread.getActiveSheet(), SpreadJsObj.DataType.Tree, gsTree);
             const gatherNodes = stage.im_gather_node ? _.map(stage.im_gather_node.split(','), _.toNumber) : [];
             for (const node of gsTree.datas) {
@@ -245,7 +245,6 @@ $(document).ready(() => {
             SpreadJsObj.refreshTreeRowVisible(gsSpread.getActiveSheet());
             SpreadJsObj.resetFieldReadOnly(gsSpread.getActiveSheet, 'check', !$('#im-gather-check')[0].checked);
         } else {
-            const gsTree = stageIm.getGsTree();
             const gatherNodes = stage.im_gather_node ? _.map(stage.im_gather_node.split(','), _.toNumber) : [];
             for (const node of gsTree.datas) {
                 node.check = gatherNodes.indexOf(node.id) !== -1;