Browse Source

变更令,添加清单,选择所有新增部位/清单

MaiXinRong 2 years ago
parent
commit
4fa9965aa5
2 changed files with 38 additions and 0 deletions
  1. 37 0
      app/public/js/change_information_set.js
  2. 1 0
      app/view/change/information_modal.ejs

+ 37 - 0
app/public/js/change_information_set.js

@@ -1435,6 +1435,43 @@ $(document).ready(() => {
             }
         }
     });
+    // 选中所有新增部位/清单
+    $('#select-all-revise').click(function() {
+        const qtySpr = '*;*', infoSpr = '!_!', recSpr = '$#$';
+        const gclTr = $('#table-list-select tr');
+        for (const tr of gclTr) {
+            const lid = $(tr).data('lid');
+            let gcl = _.find(gclGatherData, function (item) {
+                return item.leafXmjs && item.leafXmjs[0].gcl_id === lid;
+            });
+            if (!gcl) gcl = gclGatherData[$(this).data('gcl')];
+            if (!gcl || !gcl.cid) continue;
+
+            let data_bwmx = $(tr).attr('data-bwmx').split(recSpr);
+            data_bwmx = data_bwmx.filter(x => {
+                const rec = x.split(qtySpr);
+                const info = rec[0].split(infoSpr);
+                if (info.length < 8) return true;
+
+                const leaf = gcl.leafXmjs.find(lx => { return lx.mx_id === info[6]});
+                return !leaf || !leaf.cid;
+            });
+            for (const [index, leaf] of gcl.leafXmjs.entries()) {
+                if (!leaf.cid) continue;
+
+                const bwmx = [leaf.code, leaf.jldy || '', leaf.dwgc || '', leaf.fbgc || '', leaf.fxgc || '', leaf.gcl_id, leaf.mx_id, leaf.bwmx || ''];
+                const de_qu = bwmx.join(infoSpr) + qtySpr + (leaf.quantity || 0);
+                data_bwmx.push(de_qu);
+            }
+            $(tr).attr('data-bwmx', data_bwmx.join(recSpr)).addClass('table-success');
+        }
+
+        // 触发点击当前清单,重载当前全部部位
+        const dataIndex = $('#code-list').attr('data-index');
+        if (dataIndex) {
+            $(`tr[data-index=${dataIndex}]`).trigger('click');
+        }
+    });
 
     // 记录变更信息操作
     $('body').on('valuechange', '#change_form input[type="text"]', function (e, previous) {

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

@@ -207,6 +207,7 @@
                     </div>
                 </div>
                 <div class="modal-footer">
+                    <button type="button" class="btn btn-sm btn-primary" id="select-all-revise">选择所有新增部位/清单</button>
                     <!--<button type="button" class="add-list-btn btn btn-sm btn-outline-primary">添加空白清单</button>-->
                     <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal" id="cancel-list-btn">取消</button>
                     <button type="button" class="add-list-btn btn btn-primary btn-sm">添加</button>