From f63064b50164522377c5881f97b0e630217e030c Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期三, 30 三月 2022 10:39:26 +0800
Subject: [PATCH] #

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

diff --git a/src/main/webapp/static/js/pakStore/pakStore.js b/src/main/webapp/static/js/pakStore/pakStore.js
index 344d0e8..3b3e666 100644
--- a/src/main/webapp/static/js/pakStore/pakStore.js
+++ b/src/main/webapp/static/js/pakStore/pakStore.js
@@ -3,7 +3,7 @@
 var matCodeData = [];
 function getCol() {
     var cols = [
-        {fixed: 'left', field: 'count', title: '鏁伴噺锛堝繀濉級', align: 'center', edit:'text', width: 120,  style:'color: blue;font-weight: bold'},
+        {fixed: 'left', field: 'anfme', title: '鏁伴噺锛堝繀濉級', align: 'center', edit:'text', width: 120,  style:'color: blue;font-weight: bold'},
         {field: 'batch', title: '鎵瑰彿锛堥�夊~锛�', align: 'center', edit:'text', width: 200,  style:'color: blue;font-weight: bold'}
     ];
     cols.push.apply(cols, matCols);
@@ -17,7 +17,6 @@
     var table = layui.table;
     var $ = layui.jquery;
     var layer = layui.layer;
-    var layDate = layui.laydate;
     var form = layui.form;
     admin = layui.admin;
 
@@ -30,7 +29,7 @@
         toolbar: '#toolbar',
         cols: [getCol()],
         done: function (res, curr, count) {
-            $('td[data-field=count] div').html(initCountVal);
+            $('td[data-field=anfme] div').html(initCountVal);
             setMatCodeData(res.data);
             limit();
             getInBound();
@@ -41,22 +40,23 @@
     table.on('edit(chooseData)', function (obj) {
         let index = obj.tr.attr("data-index");
         let data = matCodeData[index];
+        let modify = true;
         if (obj.field === 'anfme'){
             let vle = Number(obj.value);
             if (isNaN(vle)) {
                 layer.msg("璇疯緭鍏ユ暟瀛�", {icon: 2});
-                return false;
+                modify = false;
             } else {
                 if (vle <= 0) {
                     layer.msg("鏁伴噺蹇呴』澶т簬闆�", {icon: 2});
-                    return false;
+                    modify = false;
                 }
             }
         }
-        data[obj.field] = obj.value;
+        if (modify) {
+            data[obj.field] = obj.value;
+        }
         tableIns.reload({data: matCodeData});
-
-        updateMatCodeData(obj.data.matNo, Number(obj.value));
     });
 
     // 鐩戝惉澶村伐鍏锋爮浜嬩欢
@@ -72,11 +72,11 @@
                 }
                 // 鍒ゆ柇鐗╂枡鏁伴噺鏄惁瀛樺湪寮傚父
                 for (var i=0;i<matCodeData.length;i++){
-                    if (isNaN(matCodeData[i].count)) {
+                    if (isNaN(matCodeData[i].anfme)) {
                         layer.msg("璇疯緭鍏ユ暟瀛�");
                         return;
                     }
-                    if (matCodeData[i].count === 0){
+                    if (matCodeData[i].anfme === 0){
                         layer.msg("鏁伴噺涓嶈兘涓洪浂");
                         return;
                     }
@@ -115,14 +115,11 @@
         switch (obj.event) {
             case 'remove':
                 for (let i = matCodeData.length - 1; i >= 0; i--) {
-                    if (matCodeData[i].matNo === data.matNo) {
+                    if (matCodeData[i].matNo === data.matNo && matCodeData[i].batch === data.batch) {
                         matCodeData.splice(i, 1);
                     }
                 }
-                tableIns.reload({data: matCodeData,done:function (res) {
-                        limit();
-                        getInBound();
-                    }});
+                tableIns.reload({data: matCodeData});
                 break;
         }
     });
@@ -130,29 +127,8 @@
     function setMatCodeData(data) {
         matCodeData = data;
         for (var i=0;i<matCodeData.length;i++){
-            matCodeData[i]["count"] = initCountVal;
+            matCodeData[i]["anfme"] = initCountVal;
         }
-    }
-
-    function updateMatCodeData(matNo, count) {
-        if (isNaN(count)) {
-            layer.msg("璇疯緭鍏ユ暟瀛�");
-        } else {
-            if (count > 0) {
-                for (var i=0;i<matCodeData.length;i++){
-                    if (matCodeData[i]["matNo"] === matNo){
-                        matCodeData[i]["count"] = count;
-                    }
-                }
-            } else {
-                layer.msg("鏁伴噺蹇呴』澶т簬闆�");
-            }
-        }
-
-        tableIns.reload({data: matCodeData,done:function (res) {
-                limit();
-                getInBound();
-            }});
     }
 
     // 鑾峰彇鍙敤鍏ュ簱绔欑偣
@@ -185,9 +161,10 @@
 function getMat() {
     matCodeLayerIdx = admin.open({
         type: 2,
-        title: '鎻愬彇鐗╂枡',
-        maxmin: true,
-        area: [top.detailWidth, top.detailHeight],
+        title: false,
+        closeBtn: false,
+        maxmin: false,
+        area: ['90%', '85%'],
         shadeClose: true,
         content: 'matQuery.html',
         success: function(layero, index){

--
Gitblit v1.9.1