From cb2ef0d32782054eaf0a5c00290e049aaca84fd5 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期五, 27 八月 2021 10:22:17 +0800
Subject: [PATCH] #

---
 src/main/webapp/views/waitMatin/waitMatin.html |   98 ++++++++++++++++++++++++++++++++----------------
 1 files changed, 65 insertions(+), 33 deletions(-)

diff --git a/src/main/webapp/views/waitMatin/waitMatin.html b/src/main/webapp/views/waitMatin/waitMatin.html
index 1c4b9c7..502cf94 100644
--- a/src/main/webapp/views/waitMatin/waitMatin.html
+++ b/src/main/webapp/views/waitMatin/waitMatin.html
@@ -196,7 +196,7 @@
             if (layEvent === 'edit') {
                 showEditModel(data);
             } else if (layEvent === 'del') {
-                doDel(data.experimentTypeId);
+                doDel(data.billNo);
             } else if (layEvent === 'look') {
                 var $a = $(obj.tr).find('a[lay-event="look"]');
                 var offset = $a.offset();
@@ -273,28 +273,50 @@
                     form.val('editForm', expTpe);
                     // 琛ㄥ崟鎻愪氦浜嬩欢
                     form.on('submit(waitMatinEditSubmit)', function (data) {
-                        if (isExpAdd) {
-                            if (xxDataList.length <= 0) {
-                                layer.tips('璇锋坊鍔犲崟鎹槑缁�', '#matAddBtnComment', {tips: [1, '#ff4c4c']});
-                                return false;
-                            }
-                            var nList = admin.util.deepClone(xxDataList);
-                            for (var xi = 0; xi < nList.length; xi++) {
-                                nList[xi].experimentId = undefined;
-                            }
-                            data.field.expListJson = JSON.stringify(nList);
+                        // 缁勮鏁版嵁
+                        if (xxDataList.length <= 0) {
+                            layer.tips('璇锋坊鍔犲崟鎹槑缁�', '#matAddBtnComment', {tips: [1, '#ff4c4c']});
+                            return false;
                         }
-                        layer.load(2);
-                        $.get(url, data.field, function (res) {
-                            layer.closeAll('loading');
-                            if (res.code === 200) {
-                                layer.close(dIndex);
-                                insTb.reload({page: {curr: 1}});
-                                layer.msg(res.msg, {icon: 1});
-                            } else {
-                                layer.msg(res.msg, {icon: 2});
+                        var param = [];
+                        var nList = admin.util.deepClone(xxDataList);
+                        for (var xi = 0; xi < nList.length; xi++) {
+                            if (nList[xi].qty > 0) {
+                                param.push({
+                                    billNo: data.field.billNo,
+                                    billType: data.field.billType,
+                                    matNo: nList[xi].matNo,
+                                    matName: nList[xi].matName,
+                                    qty: nList[xi].qty,
+                                })
                             }
-                        }, 'json');
+                        }
+                        if (param.length === 0) {
+                            layer.msg('鍗曟嵁鏄庣粏鏁伴噺涓嶅悎娉�', {icon: 2});
+                            return false;
+                        }
+                        if (isExpAdd) {
+                            layer.load(2);
+                            $.ajax({
+                                url: baseUrl+"/waitMatin/add/auth",
+                                headers: {'token': localStorage.getItem('token')},
+                                data: JSON.stringify(param),
+                                contentType:'application/json;charset=UTF-8',
+                                method: 'POST',
+                                success: function (res) {
+                                    layer.closeAll('loading');
+                                    if (res.code === 200){
+                                        layer.close(dIndex);
+                                        insTb.reload({page: {curr: 1}});
+                                        layer.msg(res.msg, {icon: 1});
+                                    } else if (res.code === 403){
+                                        top.location.href = baseUrl+"/";
+                                    }else {
+                                        layer.msg(res.msg, {icon: 2});
+                                    }
+                                }
+                            })
+                        }
                         return false;
                     });
                     // 鏄庣粏琛ㄦ牸
@@ -457,25 +479,35 @@
             });
         }
 
-        // 鍒犻櫎
-        function doDel(experimentTypeId) {
+        // 鍒犻櫎鍗曟嵁
+        function doDel(billNo) {
             layer.confirm('纭畾瑕佸垹闄ゅ悧锛�', {
                 shade: .1,
                 skin: 'layui-layer-admin'
             }, function (i) {
                 layer.close(i);
                 layer.load(2);
-                $.post('../../json/ok.json', {
-                    experimentTypeId: experimentTypeId
-                }, function (res) {
-                    layer.closeAll('loading');
-                    if (res.code === 200) {
-                        layer.msg(res.msg, {icon: 1});
-                        insTb.reload({page: {curr: 1}});
-                    } else {
-                        layer.msg(res.msg, {icon: 2});
+
+                $.ajax({
+                    url: baseUrl+"/waitMatin/delete/auth",
+                    headers: {'token': localStorage.getItem('token')},
+                    data: {
+                        billNo: billNo
+                    },
+                    // contentType:'application/json;charset=UTF-8',
+                    method: 'POST',
+                    success: function (res) {
+                        layer.closeAll('loading');
+                        if (res.code === 200){
+                            insTb.reload({page: {curr: 1}});
+                            layer.msg(res.msg, {icon: 1});
+                        } else if (res.code === 403){
+                            top.location.href = baseUrl+"/";
+                        }else {
+                            layer.msg(res.msg, {icon: 2});
+                        }
                     }
-                }, 'json');
+                })
             });
         }
 

--
Gitblit v1.9.1