From 40bfd7078ca4e46ae127dea1cf37870af2865c46 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期六, 13 三月 2021 15:21:50 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/js/custOrder/custOrder.js |  207 +++++++++++++++++++++++++++++++--------------------
 1 files changed, 124 insertions(+), 83 deletions(-)

diff --git a/src/main/webapp/static/js/custOrder/custOrder.js b/src/main/webapp/static/js/custOrder/custOrder.js
index 5ef4824..6358a08 100644
--- a/src/main/webapp/static/js/custOrder/custOrder.js
+++ b/src/main/webapp/static/js/custOrder/custOrder.js
@@ -14,18 +14,15 @@
         }
     });
 }
-
 layui.config({
-    base: '../../layuiadmin/' //闈欐�佽祫婧愭墍鍦ㄨ矾寰�
-}).extend({
-    index: 'lib/index' //涓诲叆鍙fā鍧�
-}).use(['table', 'laydate', 'form'], function(){
+    base: baseUrl + "/static/layui/lay/modules/"  // 閰嶇疆妯″潡鎵�鍦ㄧ殑鐩綍
+}).use(['table', 'laydate', 'form', 'tableX'], function(){
     var table = layui.table;
     var $ = layui.jquery;
     var layer = layui.layer;
     var layDate = layui.laydate;
     var form = layui.form;
-    var admin = layui.admin;
+    var tableX = layui.tableX;
 
     // 鏁版嵁娓叉煋
     tableIns = table.render({
@@ -42,16 +39,17 @@
             {type: 'checkbox'}
 //            ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80}
             ,{field: 'number', align: 'center',title: '閿�鍞崟鍙�'}
-            ,{field: 'billDate', align: 'center',title: '鍗曟嵁鏃ユ湡'}
+
             ,{field: 'btypeId', align: 'center',title: '瀹㈡埛缂栧彿'}
             ,{field: 'etypeId', align: 'center',title: '缁忔墜浜虹紪鍙�', hide: true}
             ,{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: '鐘舵��'}
+            ,{field: 'status$', align: 'center',title: '鐘舵��', templet: '#statusTpl', width: 100}
+            ,{field: 'billDate', align: 'center',title: '鍗曟嵁鏃ユ湡'}
             // ,{field: 'createTime$', align: 'center',title: '娣诲姞鏃堕棿'}
-            ,{field: 'updateTime$', align: 'center',title: '淇敼鏃堕棿'}
+            ,{field: 'updateTime$', align: 'center',title: '淇敼鏃堕棿', hide: true}
             // ,{field: 'memo', align: 'center',title: '澶囨敞'}
 
             ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width: 120}
@@ -115,20 +113,6 @@
     table.on('toolbar(custOrder)', function (obj) {
         var checkStatus = table.checkStatus(obj.config.id);
         switch(obj.event) {
-            case 'addData':
-                layer.open({
-                    type: 2,
-                    title: '鏂板',
-                    maxmin: true,
-                    area: [top.detailWidth, top.detailHeight],
-                    content: 'custOrder_detail.html',
-                    success: function(layero, index){
-                        layer.getChildFrame('#data-detail-submit-edit', index).hide();
-                    	clearFormVal(layer.getChildFrame('#detail', index));
-                        layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
-                    }
-                });
-                break;
             case 'deleteData':
                 var data = checkStatus.data;
                 if (data.length === 0){
@@ -202,68 +186,125 @@
         switch (obj.event) {
             // 鎷h揣
             case 'stockOut':
-                layer.confirm(data.number + ' 璁㈠崟寮�濮嬫嫞璐э紵', {shadeClose: true}, function(){
-                    layer.closeAll();
-                    $.ajax({
-                        url: baseUrl+"/work/stock/out",
-                        headers: {'token': localStorage.getItem('token')},
-                        contentType:'application/json;charset=UTF-8',
-                        data: JSON.stringify({
-                            number: data.number
-                        }),
-                        method: 'POST',
-                        success: function (res) {
-                            // 鎴愬姛
-                            if (res.code === 200){
-                                layer.confirm(res.msg, {
-                                        shadeClose: true
-                                        , btn: ['鎵撳嵃鎷h揣鍗�']
-                                    }, function() {
-                                        layer.closeAll();
-                                        printPakouts(data.number);
-                                    }
-                                )
-                            // 缂烘枡
-                            } else if (res.code === 20001) {
-                                layer.confirm(res.msg, {
-                                        shadeClose: true
-                                        , btn: ['搴撳瓨璋冩嫧', '鍙栨秷']
-                                    }, function() {
-                                        // todo 搴撳瓨璋冩嫧
-                                        layer.closeAll();
-                                    }, function() {
-                                        // printPakouts(data.number);
-                                        layer.closeAll();
-                                    }
-                                )
-                            } else if (res.code === 403){
-                                top.location.href = baseUrl+"/";
-                            } else {
-                                layer.msg(res.msg)
-                            }
-                            $(".layui-laypage-btn")[0].click();
+                var loadIndex = layer.load(2);
+                $.ajax({
+                    url: baseUrl + "/work/stock/out/preview",
+                    headers: {'token': localStorage.getItem('token')},
+                    contentType: 'application/json;charset=UTF-8',
+                    data: JSON.stringify({
+                        number: data.number
+                    }),
+                    method: 'POST',
+                    success: function (res) {
+                        console.log(res)
+                        layer.close(loadIndex);
+                        // 鎴愬姛
+                        if (res.code === 200){
+                            layer.open({
+                                type: 1
+                                ,title: false
+                                ,closeBtn: false
+                                ,offset: '100px'
+                                ,area: '1200px;'
+                                ,shade: 0.5
+                                ,id: 'LAY_layuipro'
+                                ,btn: ['椹笂鎷h揣', '绋嶅悗澶勭悊']
+                                ,btnAlign: 'c'
+                                ,moveType: 1 //鎷栨嫿妯″紡锛�0鎴栬��1
+                                // ,content: '<div style="padding: 50px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;">浣犵煡閬撳悧锛熶翰锛�<br>layer 鈮� layui<br><br>layer鍙槸浣滀负Layui鐨勪竴涓脊灞傛ā鍧楋紝鐢变簬鍏剁敤鎴峰熀鏁拌緝澶э紝鎵�浠ュ父甯镐細鏈変汉浠ヤ负layui鏄痩ayerui<br><br>layer铏界劧宸茶 Layui 鏀剁紪涓哄唴缃殑寮瑰眰妯″潡锛屼絾浠嶇劧浼氫綔涓轰竴涓嫭绔嬬粍浠跺叏鍔涚淮鎶ゃ�佸崌绾с��<br><br>鎴戜滑姝ゅ悗鐨勫緛閫旀槸鏄熻景澶ф捣 ^_^</div>'
+                                ,content: $('#stoukOutPreview')
+                                ,success: function(layero, index){
+                                    table.render({
+                                        elem: '#stoPreTab',
+                                        // url: 'tablex-tb2.json',
+                                        data: res.data,
+                                        page: true,
+                                        cellMinWidth: 100,
+                                        cols: [[
+                                            {field: 'title', title: '鍚嶇О', sort: true},
+                                            {field: 'maktx', title: '鑿滃崟鍚嶇О'},
+                                            {field: 'locNo', title: '璐т綅'},
+                                            {field: 'reduce', title: '鍑哄簱鏁伴噺'},
+                                            {field: 'prior', title: '鎺ㄨ崘璐т綅'},
+                                        ]],
+                                        done: function () {
+                                            tableX.merges('stoPreTab', [0]);
+                                        }
+                                    });
+
+                                    // var btn = layero.find('.layui-layer-btn');
+                                    // btn.find('.layui-layer-btn0').attr({
+                                    //     href: 'http://www.layui.com/'
+                                    //     ,target: '_blank'
+                                    // });
+                                }
+                            });
+                        // 缂烘枡
+                        } else if (res.code === 20001) {
+                            layer.confirm(res.msg, {
+                                    shadeClose: true
+                                    , area: ['400px']
+                                    , btn: ['搴撳瓨璋冩嫧', '鍙栨秷']
+                                }, function() {
+                                    // todo 搴撳瓨璋冩嫧
+                                    layer.closeAll();
+                                }, function() {
+                                    // printPakouts(data.number);
+                                    layer.closeAll();
+                                }
+                            )
+                        } else if (res.code === 403){
+                            top.location.href = baseUrl+"/";
+                        } else {
+                            layer.msg(res.msg, {icon: 1})
                         }
-                    })
-                });
-                break;
-            // 璇︽儏
-            case 'detail':
-                layer.open({
-                    type: 2,
-                    title: '璇︽儏',
-                    maxmin: true,
-                    area: [top.detailWidth, top.detailHeight],
-                    shadeClose: true,
-                    content: 'custOrder_detail.html',
-                    success: function(layero, index){
-                        setFormVal(layer.getChildFrame('#detail', index), data, true);
-                        top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true);
-                        layer.getChildFrame('#data-detail-submit-save,#data-detail-submit-edit,#prompt', index).hide();
-                        layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
-                        layero.find('iframe')[0].contentWindow.layui.form.render('select');
-                        layero.find('iframe')[0].contentWindow.layui.form.render('checkbox');
                     }
-                });
+                })
+
+
+                // layer.confirm(data.number + ' 璁㈠崟寮�濮嬫嫞璐э紵', {shadeClose: true}, function(){
+                //     layer.closeAll();
+                //     $.ajax({
+                //         url: baseUrl+"/work/stock/out",
+                //         headers: {'token': localStorage.getItem('token')},
+                //         contentType:'application/json;charset=UTF-8',
+                //         data: JSON.stringify({
+                //             number: data.number
+                //         }),
+                //         method: 'POST',
+                //         success: function (res) {
+                //             // 鎴愬姛
+                //             if (res.code === 200){
+                //                 layer.confirm(res.msg, {
+                //                         shadeClose: true
+                //                         , btn: ['鎵撳嵃鎷h揣鍗�']
+                //                     }, function() {
+                //                         layer.closeAll();
+                //                         printPakouts(data.number);
+                //                     }
+                //                 )
+                //             // 缂烘枡
+                //             } else if (res.code === 20001) {
+                //                 layer.confirm(res.msg, {
+                //                         shadeClose: true
+                //                         , btn: ['搴撳瓨璋冩嫧', '鍙栨秷']
+                //                     }, function() {
+                //                         // todo 搴撳瓨璋冩嫧
+                //                         layer.closeAll();
+                //                     }, function() {
+                //                         // printPakouts(data.number);
+                //                         layer.closeAll();
+                //                     }
+                //                 )
+                //             } else if (res.code === 403){
+                //                 top.location.href = baseUrl+"/";
+                //             } else {
+                //                 layer.msg(res.msg)
+                //             }
+                //             $(".layui-laypage-btn")[0].click();
+                //         }
+                //     })
+                // });
                 break;
             // 鎵撳嵃
             case 'print':

--
Gitblit v1.9.1