From 918cf69e763d30a1315fa1c83a964dae4dd88f12 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <xltys1995>
Date: 星期六, 03 四月 2021 15:11:08 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/js/custOrder/custOrder.js |  119 ++++++++++++++++++++++++++++++++---------------------------
 1 files changed, 65 insertions(+), 54 deletions(-)

diff --git a/src/main/webapp/static/js/custOrder/custOrder.js b/src/main/webapp/static/js/custOrder/custOrder.js
index eae59fb..4227d59 100644
--- a/src/main/webapp/static/js/custOrder/custOrder.js
+++ b/src/main/webapp/static/js/custOrder/custOrder.js
@@ -16,13 +16,14 @@
 }
 layui.config({
     base: baseUrl + "/static/layui/lay/modules/"  // 閰嶇疆妯″潡鎵�鍦ㄧ殑鐩綍
-}).use(['table', 'laydate', 'form', 'tableX'], function(){
+}).use(['table', 'laydate', 'form', 'tableX', 'tableMerge'], function(){
     var table = layui.table;
     var $ = layui.jquery;
     var layer = layui.layer;
     var layDate = layui.laydate;
     var form = layui.form;
     var tableX = layui.tableX;
+    var tableMerge = layui.tableMerge;
 
     // 鏁版嵁娓叉煋
     tableIns = table.render({
@@ -38,21 +39,22 @@
         cols: [[
             {type: 'checkbox'}
 //            ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80}
-            ,{field: 'number', align: 'center',title: '閿�鍞崟鍙�'}
+            ,{field: 'number', align: 'center', merge: true, title: '鍗曞彿'}
 
-            ,{field: 'btypeId', align: 'center',title: '瀹㈡埛缂栧彿'}
+            ,{field: 'btypeId', align: 'center', merge: ['number'], title: '瀹㈡埛缂栧彿'}
             ,{field: 'etypeId', align: 'center',title: '缁忔墜浜虹紪鍙�', hide: true}
+            ,{field: 'billDate', align: 'center',merge: ['number'],title: '鍗曟嵁鏃ユ湡'}
             ,{field: 'userCode', align: 'center',title: '鍟嗗搧缂栧彿'}
             ,{field: 'qty', align: 'center',title: '鍟嗗搧鏁伴噺'}
             ,{field: 'price', align: 'center',title: '鍟嗗搧鍗曚环', hide: true}
             ,{field: 'comment', align: 'center',title: '鍟嗗搧澶囨敞', hide: true}
             ,{field: 'status$', align: 'center',title: '鐘舵��', templet: '#statusTpl', width: 100}
-            ,{field: 'billDate', align: 'center',title: '鍗曟嵁鏃ユ湡'}
+
             // ,{field: 'createTime$', align: 'center',title: '娣诲姞鏃堕棿'}
             ,{field: 'updateTime$', align: 'center',title: '淇敼鏃堕棿', hide: true}
             // ,{field: 'memo', align: 'center',title: '澶囨敞'}
 
-            ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width: 120}
+            ,{fixed: 'right', title:'鎿嶄綔', align: 'center', merge: ['number'], toolbar: '#operate', width: 120}
         ]],
         request: {
             pageName: 'curr',
@@ -74,15 +76,9 @@
                 top.location.href = baseUrl+"/";
             }
             pageCurr=curr;
+            // tableX.merges('custOrder', [1, 11]);
+            tableMerge.render(this);
             limit();
-            form.on('checkbox(tableCheckbox)', function (data) {
-                var _index = $(data.elem).attr('table-index')||0;
-                if(data.elem.checked){
-                    res.data[_index][data.value] = 'Y';
-                }else{
-                    res.data[_index][data.value] = 'N';
-                }
-            });
         }
     });
 
@@ -196,7 +192,6 @@
                     }),
                     method: 'POST',
                     success: function (res) {
-                        console.log(JSON.stringify(res.data))
                         layer.close(loadIndex);
                         // 鎴愬姛
                         if (res.code === 200){
@@ -205,10 +200,12 @@
                                 ,title: false
                                 ,closeBtn: false
                                 ,offset: '100px'
-                                ,area: '800px;'
+                                // ,area: ['800px','450px']
+                                ,area: '1000px'
                                 ,shade: 0.5
+                                ,shadeClose: true
                                 ,id: 'LAY_layuipro'
-                                ,btn: ['椹笂鎷h揣', '绋嶅悗澶勭悊']
+                                ,btn: ['绔嬪嵆鐢熸垚', '绋嶅悗澶勭悊']
                                 ,btnAlign: 'c'
                                 ,moveType: 1 //鎷栨嫿妯″紡锛�0鎴栬��1
                                 ,content: $('#stoukOutPreview')
@@ -218,16 +215,22 @@
                                         data: res.data,
                                         page: true,
                                         cellMinWidth: 100,
+                                        // ,width: admin.screen() > 1 ? 892 : ''
+                                        height: 432,
                                         cols: [[
-                                            {field: 'title', title: '鍟嗗搧', align: 'center'},
-                                            {field: 'anfme', title: '鎬绘暟閲�', align: 'center', style: 'font-weight: bold', width: 80},
+                                            {field: 'title', title: '鍟嗗搧', merge: true, align: 'center'},
+                                            {field: 'anfme', title: '鎬绘暟閲�', merge: ['title'], align: 'center', style: 'font-weight: bold', width: 90},
+                                            {field: 'type', title: '浠撳簱', merge: true, align: 'center', templet: '#typeTpl', width: 90},
                                             {field: 'locNo', title: '璐т綅', align: 'center'},
                                             {field: 'prior$', title: '鎺ㄨ崘璐т綅', align: 'center', width: 100},
-                                            {field: 'reduce', title: '鏁伴噺', align: 'center', width: 80, style: 'font-weight: bold'},
-                                            {field: 'remQty', title: '浣欓噺', align: 'center', width: 80},
+                                            {field: 'reduce', title: '鏁伴噺', align: 'center', width: 90, style: 'font-weight: bold'},
+                                            // {field: 'remQty', title: '浣欓噺', align: 'center', width: 80},
+                                            {field: 'total', title: '鎬婚噺', align: 'center', width: 90},
                                         ]],
                                         done: function () {
-                                            tableX.merges('stoPreTab', [0,1]);
+                                            tableMerge.render(this);
+                                            // tableX.merges('stoPreTab', [0,1,2]);
+                                            $('.layui-table-body.layui-table-main').css("overflow", "auto")
                                         }
                                     });
 
@@ -243,22 +246,24 @@
                             });
                         // 缂烘枡
                         } else if (res.code === 20001) {
-                            layer.confirm(res.msg, {
-                                    shadeClose: true
-                                    , area: ['400px']
-                                    , btn: ['搴撳瓨璋冩嫧', '鍙栨秷']
-                                }, function() {
-                                    // todo 搴撳瓨璋冩嫧
-                                    layer.closeAll();
-                                }, function() {
-                                    // printPakouts(data.number);
-                                    layer.closeAll();
-                                }
-                            )
+                            // layer.confirm(res.msg, {
+                            //         shadeClose: true
+                            //         , area: ['400px']
+                            //         , btn: ['搴撳瓨璋冩嫧', '鍙栨秷']
+                            //     }, function() {
+                            //         // 搴撳瓨璋冩嫧
+                            //         stockTransfer(data.number);
+                            //         layer.closeAll();
+                            //     }, function() {
+                            //         // printPakouts(data.number);
+                            //         layer.closeAll();
+                            //     }
+                            // )
+                            layer.msg(res.msg, {icon: 2})
                         } else if (res.code === 403){
                             top.location.href = baseUrl+"/";
                         } else {
-                            layer.msg(res.msg, {icon: 1})
+                            layer.msg(res.msg, {icon: 2})
                         }
                     }
                 })
@@ -276,7 +281,7 @@
 
     // 寮�濮嬫嫞璐�
     function stockOut(number) {
-        layer.confirm(number + ' 璁㈠崟寮�濮嬫嫞璐э紵', {shadeClose: true}, function(){
+        // layer.confirm(number + ' 璁㈠崟寮�濮嬫嫞璐э紵', {shadeClose: true}, function(){
             layer.closeAll();
             $.ajax({
                 url: baseUrl+"/work/stock/out",
@@ -303,21 +308,43 @@
                                 shadeClose: true
                                 , btn: ['搴撳瓨璋冩嫧', '鍙栨秷']
                             }, function() {
-                                // todo 搴撳瓨璋冩嫧
+                                // 搴撳瓨璋冩嫧
                                 layer.closeAll();
                             }, function() {
-                                // printPakouts(data.number);
+                            alert(number)
                                 layer.closeAll();
                             }
                         )
                     } else if (res.code === 403){
                         top.location.href = baseUrl+"/";
                     } else {
-                        layer.msg(res.msg)
+                        layer.msg(res.msg, {icon: 2})
                     }
                     $(".layui-laypage-btn")[0].click();
                 }
             })
+        // });
+    }
+
+    // 搴撳瓨璋冩嫧
+    function stockTransfer(number) {
+
+        $.ajax({
+            url: baseUrl + "/work/stock/transfer",
+            headers: {'token': localStorage.getItem('token')},
+            data: {
+                number: number
+            },
+            method: 'POST',
+            success: function (res) {
+                if (res.code === 200) {
+                    layer.msg(res.msg, {icon: 1})
+                } else if (res.code === 403) {
+                    top.location.href = baseUrl + "/";
+                } else {
+                    layer.msg(res.msg, {icon: 2})
+                }
+            }
         });
     }
 
@@ -482,22 +509,6 @@
         page: {
             curr: pageCurr
         },
-        done: function (res, curr, count) {
-            if (res.code === 403) {
-                top.location.href = baseUrl+"/";
-            }
-            pageCurr=curr;
-            if (res.data.length === 0 && count !== 0) {
-                tableIns.reload({
-                    where: searchData,
-                    page: {
-                        curr: pageCurr-1
-                    }
-                });
-                pageCurr -= 1;
-            }
-            limit(child);
-        }
     });
 }
 

--
Gitblit v1.9.1