From 39f9a5e6c709adc2aa3b2c6b5d54bc1d8dc43c1c Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期六, 18 七月 2020 09:19:29 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/js/pakStore/stockAdjust.js |   69 ++++++++++++++++++++--------------
 1 files changed, 40 insertions(+), 29 deletions(-)

diff --git a/src/main/webapp/static/js/pakStore/stockAdjust.js b/src/main/webapp/static/js/pakStore/stockAdjust.js
index b4df94a..0438e7a 100644
--- a/src/main/webapp/static/js/pakStore/stockAdjust.js
+++ b/src/main/webapp/static/js/pakStore/stockAdjust.js
@@ -2,6 +2,17 @@
 var initAnfmeVal = "-";
 var matCodeData = [];
 var currLocNo;
+function getCol() {
+    var cols = [
+        {fixed: 'left', field: 'count', title: '瀹為檯鏁伴噺', align: 'center', edit:'text', width: 120,  style:'color: blue;font-weight: bold'}
+        ,{field: 'anfme', align: 'center',title: '鏁伴噺'}
+    ];
+    arrRemove(detlCols, "field", "anfme")
+    cols.push.apply(cols, detlCols);
+    cols.push({fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:80})
+    return cols;
+}
+
 layui.use(['table','laydate', 'form'], function() {
     var table = layui.table;
     var $ = layui.jquery;
@@ -16,22 +27,7 @@
         limit: 500,
         cellMinWidth: 50,
         toolbar: '#toolbar',
-        cols: [[
-            {fixed: 'left', field: 'count', title: '瀹為檯鏁伴噺', align: 'center', edit:'text', width: 120,  style:'color: blue;font-weight: bold'}
-            ,{field: 'anfme', align: 'center',title: '鏁伴噺'}
-            ,{field: 'locNo$', align: 'center',title: '搴撲綅鍙�'}
-            ,{field: 'matnr', align: 'center',title: '鐗╂枡'}
-            ,{field: 'lgnum', align: 'center',title: '浠撳簱鍙�'}
-            ,{field: 'tbnum', align: 'center',title: '杞偍璇锋眰缂栧彿'}
-            // ,{field: 'tbpos', align: 'center',title: '琛岄」鐩�'}
-            ,{field: 'zmatid', align: 'center',title: '鐗╂枡鏍囩ID'}
-            ,{field: 'maktx', align: 'center',title: '鐗╂枡鎻忚堪'}
-            ,{field: 'werks', align: 'center',title: '宸ュ巶'}
-            ,{field: 'altme', align: 'center',title: '鍗曚綅'}
-            ,{field: 'zpallet', align: 'center',title: '鎵樼洏鏉$爜'}
-            ,{field: 'bname', align: 'center',title: '鐢ㄦ埛ID'}
-            ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:80}
-        ]],
+        cols: [getCol()],
         done: function (res, curr, count) {
             limit();
         }
@@ -79,7 +75,7 @@
                         success: function (res) {
                             if (res.code === 200){
                                 layer.msg(currLocNo + res.msg);
-                                reset();
+                                init(currLocNo)
                             } else if (res.code === 403){
                                 top.location.href = baseUrl+"/";
                             }else {
@@ -115,6 +111,15 @@
             layer.msg("璇疯緭鍏ュ簱浣嶅彿");
             return;
         }
+        init(locNo);
+    });
+
+    // 閲嶇疆浜嬩欢
+    form.on('submit(reset)', function (data) {
+        reset();
+    });
+
+    function init(locNo) {
         http.post(baseUrl + "/locDetl/list/auth", {locNo: locNo,limit: 1000}, function (res) {
             matCodeData = [];
             let data = res.data.records;
@@ -126,12 +131,7 @@
             locTips(true, locNo);
             tableReload();
         })
-    });
-
-    // 閲嶇疆浜嬩欢
-    form.on('submit(reset)', function (data) {
-        reset();
-    });
+    }
 
     function reset() {
         clearFormVal($('#search-box'));
@@ -226,12 +226,23 @@
 function addTableData(data) {
     let applyData = [];
     for (var i=0;i<data.length;i++){
-        applyData.push({
-            count: initCountVal,
-            anfme: initAnfmeVal,
-            removeBtn: true,
-            matnr: data[i].matNo
-        })
+        let pass = false;
+        for (var j=0;j<matCodeData.length;j++){
+            if (data[i].matNo === matCodeData[j].matnr) {
+                pass = true;
+                break;
+            }
+        }
+        if (!pass) {
+            applyData.push({
+                count: initCountVal,
+                anfme: initAnfmeVal,
+                removeBtn: true,
+                matnr: data[i].matNo,
+                maktx: data[i].matName,
+                altme: data[i].str1,
+            })
+        }
     }
     matCodeData.push.apply(matCodeData,applyData);
     tableIns.reload({data: matCodeData});

--
Gitblit v1.9.1