Ver código fonte

调用变更令,允许跨部位调用

MaiXinRong 6 anos atrás
pai
commit
af0ac4cdfd

+ 2 - 2
app/controller/stage_controller.js

@@ -605,7 +605,7 @@ 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(ctx.tender.id, bills, pos);
+                const changes = await ctx.service.change.getValidChanges(ctx.tender.id, bills);
                 const useChanges = await ctx.service.stageChange.getLastestStageData(ctx.tender.id, ctx.stage.id, bills.id, pos ? pos.id : -1);
                 ctx.body = {err: 0, msg: '', data: {changes, useChanges}};
             } catch(err) {
@@ -867,7 +867,7 @@ module.exports = app => {
 
                 const pos = JSON.parse(JSON.stringify(spreadConst.stageCompare.pos));
                 return [ledger, pos];
-            };
+            }
             try {
                 const renderData = await this._getDefaultRenderData(ctx);
                 [renderData.ledgerSpread, renderData.posSpread] = getCompareSpreadSetting();

+ 20 - 9
app/public/js/stage.js

@@ -221,8 +221,12 @@ $(document).ready(() => {
                 }
             });
             // 过滤可变更数量为0
-            $('#customCheckDisabled').click(function () {
-                self._filterEmptyChange(!this.checked);
+            $('#filterEmpty').click(function () {
+                self._filterChange(!this.checked, $('#matchPos')[0].checked);
+            });
+            // 匹配编号
+            $('#matchPos').click(function () {
+                self._filterChange(!$('#filterEmpty')[0].checked, this.checked);
             });
             // 展开收起 变更令详细信息
             $('#show-bgl-detail').bind('click', function () {
@@ -341,21 +345,28 @@ $(document).ready(() => {
                 SpreadJsObj.loadSheetData(sheet, SpreadJsObj.DataType.Data, this.changes);
                 sheet.setSelection(0, 0, 1, 1);
                 this._loadChangeDetail(this.changes[0]);
-                this._filterEmptyChange(!$('#customCheckDisabled')[0].checked);
+                this._filterChange(!$('#filterEmpty')[0].checked, $('#matchPos')[0].checked);
             } else {
                 toast('查询变更令有误,请刷新页面后重试', 'warning');
             }
         }
-        _filterEmptyChange(isFilter) {
+        _filterChange(filterEmpty, matchPosName) {
             for (const c of this.changes) {
-                c.visible = isFilter ? (c.vamount && !checkZero(c.vamount)) : true;
+                const filterVisible = filterEmpty ? (c.vamount && !checkZero(c.vamount)) : true;
+                const matchVisible = matchPosName && this.callData.pos ? c.b_detail === this.callData.pos.name : true;
+                c.visible = filterVisible && matchVisible;
             }
             SpreadJsObj.refreshTreeRowVisible(this.spread.getActiveSheet());
         }
-        loadChanges(data, code) {
+        loadChanges(data) {
             this.callData = data;
+            if (this.callData.pos) {
+                $('#matchPos').parent().show();
+            } else {
+                $('#matchPos').parent().hide();
+            }
             const self = this;
-            $('#b-code-hint').text('当前变更清单:' + code);
+            $('#b-code-hint').text('当前变更清单:' + data.bills.b_code);
             postData(window.location.pathname + '/valid-change', data, function (result) {
                 self.changes = result.changes;
                 self.useChanges = result.useChanges;
@@ -385,7 +396,7 @@ $(document).ready(() => {
         }
     };
     ledgerSpreadSetting.imageClick = function (data) {
-        changesObj.loadChanges({bills: data}, data.b_code);
+        changesObj.loadChanges({bills: data});
     };
     //
     SpreadJsObj.initSheet(slSpread.getActiveSheet(), ledgerSpreadSetting);
@@ -409,7 +420,7 @@ $(document).ready(() => {
     };
     posSpreadSetting.imageClick = function (data) {
         const node = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
-        changesObj.loadChanges({pos: data}, node.b_code);
+        changesObj.loadChanges({bills: node, pos: data});
     };
     SpreadJsObj.initSheet(spSpread.getActiveSheet(), posSpreadSetting);
 

+ 8 - 2
app/view/stage/modal.ejs

@@ -48,8 +48,14 @@
                             </li>
                             <li class="nav-item">
                                 <div class="custom-control custom-checkbox my-2">
-                                    <input class="custom-control-input" id="customCheckDisabled" checked="" type="checkbox">
-                                    <label class="custom-control-label" for="customCheckDisabled">显示可变更数量为0项 </label>
+                                    <input class="custom-control-input" id="filterEmpty" checked="" type="checkbox">
+                                    <label class="custom-control-label" for="filterEmpty">显示可变更数量为0项 </label>
+                                </div>
+                            </li>
+                            <li class="nav-item">
+                                <div class="custom-control custom-checkbox my-2">
+                                    <input class="custom-control-input" id="matchPos" checked="" type="checkbox">
+                                    <label class="custom-control-label" for="matchPos">匹配变更部位 </label>
                                 </div>
                             </li>
                         </ul>