From 0c639381be63fa0df712015d141f12e4473b23f9 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 27 五月 2021 14:58:00 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/js/order/order.js |  800 +++++++++++++++++++-------------------------------------
 1 files changed, 277 insertions(+), 523 deletions(-)

diff --git a/src/main/webapp/static/js/order/order.js b/src/main/webapp/static/js/order/order.js
index f8836e8..7375a83 100644
--- a/src/main/webapp/static/js/order/order.js
+++ b/src/main/webapp/static/js/order/order.js
@@ -1,13 +1,14 @@
 var pageCurr;
 layui.config({
     base: baseUrl + "/static/layui/lay/modules/"
-}).use(['table','laydate', 'form', 'admin'], function(){
+}).use(['table','laydate', 'form', 'admin', 'tableMerge'], 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 tableMerge = layui.tableMerge;
 
     /****************************************** 宸﹁竟琛� *************************************************/
 
@@ -48,8 +49,8 @@
     });
 
     /* 琛ㄦ牸鎼滅储 */
-    form.on('submit(docTypeTable)', function (data) {
-        insTb.reload({where: data.field});
+    form.on('submit(docTypeTableSearch)', function (data) {
+        insTb.reload({where: {doc_name: data.field.docName}});
         return false;
     });
 
@@ -58,13 +59,20 @@
         if (obj.event === 'add') { // 娣诲姞
             showEditModel();
         } else if (obj.event === 'edit') { // 淇敼
-            showEditModel(selObj.data, selObj);
+            if (selObj == null) {
+                return;
+            }
+            showEditModel(selObj.data);
         } else if (obj.event === 'del') { // 鍒犻櫎
+            if (selObj == null) {
+                return;
+            }
             doDel(selObj);
         }
     });
 
     /* 鐩戝惉琛屽崟鍑讳簨浠� */
+    var selObj;
     table.on('row(docTypeTable)', function (obj) {
         selObj = obj;
         obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click');
@@ -72,31 +80,36 @@
     });
 
     /* 鏄剧ず琛ㄥ崟寮圭獥 */
-    function showEditModel(mData, obj) {
+    function showEditModel(mData) {
         admin.open({
             type: 1,
-            title: (mData ? '淇敼' : '娣诲姞') + '瀛楀吀',
-            content: $('#dictEditDialog').html(),
+            title: (mData ? '淇敼' : '娣诲姞') + '鍗曟嵁绫诲瀷',
+            content: $('#docTypeEditDialog').html(),
             success: function (layero, dIndex) {
                 // 鍥炴樉琛ㄥ崟鏁版嵁
-                form.val('dictEditForm', mData);
+                form.val('docTypeEditForm', mData);
                 // 琛ㄥ崟鎻愪氦浜嬩欢
-                form.on('submit(dictEditSubmit)', function (data) {
+                form.on('submit(docTypeEditSubmit)', function (data) {
                     var loadIndex = layer.load(2);
-                    $.get(mData ? '../../json/ok.json' : '../../json/ok.json', data.field, function (res) {
-                        layer.close(loadIndex);
-                        if (200 === res.code) {
-                            layer.close(dIndex);
-                            layer.msg(res.msg, {icon: 1});
-                            if (obj) {
-                                obj.update(data.field);
-                            } else {
+                    $.ajax({
+                        url: baseUrl+"/docType/"+(mData?'update':'add')+"/auth",
+                        headers: {'token': localStorage.getItem('token')},
+                        data: data.field,
+                        method: 'POST',
+                        success: function (res) {
+                            layer.close(loadIndex);
+                            selObj = null;
+                            if (res.code === 200){
+                                layer.close(dIndex);
+                                layer.msg(res.msg, {icon: 1});
                                 insTb.reload();
+                            } else if (res.code === 403){
+                                top.location.href = baseUrl+"/";
+                            } else {
+                                layer.msg(res.msg, {icon: 2});
                             }
-                        } else {
-                            layer.msg(res.msg, {icon: 2});
                         }
-                    }, 'json');
+                    })
                     return false;
                 });
             }
@@ -105,24 +118,31 @@
 
     /* 鍒犻櫎 */
     function doDel(obj) {
-        layer.confirm('纭畾瑕佸垹闄ゆ瀛楀吀鍚楋紵', {
+        layer.confirm('纭畾瑕佸垹闄ゆ鍗曟嵁绫诲瀷鍚楋紵', {
             skin: 'layui-layer-admin',
             shade: .1
         }, function (i) {
             layer.close(i);
             var loadIndex = layer.load(2);
-            $.get('../../json/ok.json', {
-                id: obj.data.dictId,
-            }, function (res) {
-                layer.close(loadIndex);
-                if (200 === res.code) {
-                    layer.msg(res.msg, {icon: 1});
-                    obj.del();
-                    $('#dictTable+.layui-table-view .layui-table-body tbody>tr:first').trigger('click');
-                } else {
-                    layer.msg(res.msg, {icon: 2});
+            $.ajax({
+                url: baseUrl+"/docType/delete/one/auth",
+                headers: {'token': localStorage.getItem('token')},
+                data: {param: JSON.stringify(obj.data)},
+                method: 'POST',
+                success: function (res) {
+                    selObj = null;
+                    layer.close(loadIndex);
+                    if (res.code === 200){
+                        layer.closeAll();
+                        insTb.reload();
+                        $('#dictTable+.layui-table-view .layui-table-body tbody>tr:first').trigger('click');
+                    } else if (res.code === 403){
+                        top.location.href = baseUrl+"/";
+                    } else {
+                        layer.msg(res.msg, {icon: 2});
+                    }
                 }
-            }, 'json');
+            })
         });
     }
 
@@ -137,24 +157,22 @@
         page: true,
         limit: 16,
         limits: [16, 30, 50, 100, 200, 500],
-        toolbar: '#toolbar',
+        toolbar: '#orderToolbar',
         height: 'full-100',
         cols: [[
             {type: 'checkbox'}
-            // ,{field: 'id', align: 'center',title: 'ID'}
             // ,{field: 'uuid', align: 'center',title: '缂栧彿'}
-            ,{field: 'orderNo', align: 'center',title: '璁㈠崟缂栧彿'}
-            ,{field: 'orderTime', align: 'center',title: '鍗曟嵁鏃ユ湡'}
-            ,{field: 'docType$', align: 'center',title: '鍗曟嵁绫诲瀷'}
-            ,{field: 'itemId$', align: 'center',title: '椤圭洰缂栧彿'}
+            ,{field: 'docType$', align: 'center',title: '绫诲埆', templet: '#docTypeTpl', width: 100}
+            ,{field: 'orderNo', align: 'center',title: '鍗曟嵁缂栧彿', minWidth: 250}
+            ,{field: 'orderTime', align: 'center',title: '鍗曟嵁鏃ユ湡', width: 120}
+            ,{field: 'itemName', align: 'center',title: '椤圭洰', hide: true}
             ,{field: 'allotItemId$', align: 'center',title: '璋冩嫧椤圭洰缂栧彿', hide: true}
             ,{field: 'defNumber', align: 'center',title: '鍒濆绁ㄦ嵁鍙�', hide: true}
-            ,{field: 'number', align: 'center',title: '绁ㄦ嵁鍙�'}
-            // ,{field: 'cstmr$', align: 'center',title: '瀹㈡埛缂栧彿'}
-            ,{field: 'cstmrName', align: 'center',title: '瀹㈡埛', hide: true}
+            ,{field: 'number', align: 'center',title: '绁ㄦ嵁鍙�', hide: true}
+            ,{field: 'cstmrName', align: 'center',title: '瀹㈡埛'}
             ,{field: 'tel', align: 'center',title: '鑱旂郴鏂瑰紡', hide: true}
-            ,{field: 'operMemb', align: 'center',title: '鎿嶄綔浜哄憳'}
-            ,{field: 'totalFee', align: 'center',title: '鍚堣閲戦'}
+            ,{field: 'operMemb', align: 'center',title: '鎿嶄綔浜哄憳', hide: true}
+            ,{field: 'totalFee', align: 'center',title: '鍚堣閲戦', hide: true}
             ,{field: 'discount', align: 'center',title: '浼樻儬鐜�', hide: true}
             ,{field: 'discountFee', align: 'center',title: '浼樻儬閲戦', hide: true}
             ,{field: 'otherFee', align: 'center',title: '閿�鍞垨閲囪喘璐圭敤鍚堣', hide: true}
@@ -168,14 +186,7 @@
             ,{field: 'sendTime$', align: 'center',title: '鍙戣揣鏃堕棿', hide: true}
             ,{field: 'shipName', align: 'center',title: '鐗╂祦鍚嶇О', hide: true}
             ,{field: 'shipCode', align: 'center',title: '鐗╂祦鍗曞彿', hide: true}
-            ,{field: 'settle$', align: 'center',title: '璁㈠崟鐘舵��'}
-            // ,{field: 'status$', align: 'center',title: '鐘舵��'}
-            // ,{field: 'createBy$', align: 'center',title: '娣诲姞浜哄憳',event: 'createBy', style: 'cursor:pointer'}
-            // ,{field: 'createTime$', align: 'center',title: '娣诲姞鏃堕棿'}
-            // ,{field: 'updateBy$', align: 'center',title: '淇敼浜哄憳',event: 'updateBy', style: 'cursor:pointer'}
-            // ,{field: 'updateTime$', align: 'center',title: '淇敼鏃堕棿'}
-            // ,{field: 'memo', align: 'center',title: '澶囨敞'}
-
+            ,{field: 'settle$', align: 'center',title: '璁㈠崟鐘舵��', templet: '#settleTpl', width: 100}
             ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:150}
         ]],
         request: {
@@ -193,446 +204,246 @@
         response: {
             statusCode: 200
         },
+        size: 'lg',
         done: function(res, curr, count) {
             if (res.code === 403) {
                 top.location.href = baseUrl+"/";
             }
             pageCurr=curr;
             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';
-                }
-            });
         }
     });
     /* 琛ㄦ牸2鎼滅储 */
-    form.on('submit(orderTable)', function (data) {
+    form.on('submit(orderTbSearch)', function (data) {
         insTb2.reload({where: data.field, page: {curr: 1}});
         return false;
     });
-
-    /* 琛ㄦ牸2宸ュ叿鏉$偣鍑讳簨浠� */
-    table.on('tool(orderTable)', function (obj) {
-        if (obj.event === 'edit') { // 淇敼
-            showEditModel2(obj.data);
-        } else if (obj.event === 'del') { // 鍒犻櫎
-            doDel2(obj);
-        }
+    /* 琛ㄦ牸2閲嶇疆 */
+    form.on('submit(orderTbReset)', function (data) {
+        insTb2.reload({where: null,page: {curr: 1}});
+        return false;
     });
 
     /* 琛ㄦ牸2澶村伐鍏锋爮鐐瑰嚮浜嬩欢 */
     table.on('toolbar(orderTable)', function (obj) {
         if (obj.event === 'add') { // 娣诲姞
-            showEditModel2();
+            right();
         } else if (obj.event === 'del') { // 鍒犻櫎
-            var checkRows = table.checkStatus('dictDataTable');
+            var checkRows = table.checkStatus('orderTable');
             if (checkRows.data.length === 0) {
                 layer.msg('璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁', {icon: 2});
                 return;
             }
             var ids = checkRows.data.map(function (d) {
-                return d.dictDataId;
+                return d.id;
             });
-            doDel2({ids: ids});
+            doDelOrder({ids: ids});
         }
     });
 
-    /* 鏄剧ず琛ㄥ崟寮圭獥2 */
-    function showEditModel2(mData) {
-        admin.open({
-            type: 1,
-            title: (mData ? '淇敼' : '娣诲姞') + '鏁版嵁瀛楀吀椤�',
-            content: $('#dictDataEditDialog').html(),
-            success: function (layero, dIndex) {
-                // 鍥炴樉琛ㄥ崟鏁版嵁
-                form.val('dictDataEditForm', mData);
-                // 琛ㄥ崟鎻愪氦浜嬩欢
-                form.on('submit(dictDataEditSubmit)', function (data) {
-                    data.field.dictId = selObj.data.dictId;
-                    var loadIndex = layer.load(2);
-                    $.get(mData ? '../../json/ok.json' : '../../json/ok.json', data.field, function (res) {
+    /* 琛ㄦ牸2宸ュ叿鏉$偣鍑讳簨浠� */
+    table.on('tool(orderTable)', function (obj) {
+        var data = obj.data;
+        switch (obj.event) {
+            // 鎷h揣
+            case 'stockOut':
+                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({
+                        orderNo: data.orderNo
+                    }),
+                    method: 'POST',
+                    success: function (res) {
                         layer.close(loadIndex);
-                        if (200 === res.code) {
-                            layer.close(dIndex);
-                            layer.msg(res.msg, {icon: 1});
-                            insTb2.reload({page: {curr: 1}});
-                        } else {
-                            layer.msg(res.msg, {icon: 2});
-                        }
-                    }, 'json');
-                    return false;
-                });
-            }
-        });
-    }
+                        if (res.code === 200){
+                            layer.open({
+                                type: 1
+                                ,title: false
+                                ,closeBtn: false
+                                ,offset: '100px'
+                                ,area: '1000px'
+                                ,shade: 0.5
+                                ,shadeClose: true
+                                ,btn: ['绔嬪嵆鐢熸垚', '绋嶅悗澶勭悊']
+                                ,btnAlign: 'c'
+                                ,moveType: 1 //鎷栨嫿妯″紡锛�0鎴栬��1
+                                ,content: $('#stoukOutPreview')
+                                ,success: function(layero, index){
+                                    table.render({
+                                        elem: '#stoPreTab',
+                                        data: res.data,
+                                        page: true,
+                                        cellMinWidth: 100,
+                                        height: 432,
+                                        cols: [[
+                                            {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: 90, style: 'font-weight: bold'},
+                                            // {field: 'remQty', title: '浣欓噺', align: 'center', width: 80},
+                                            {field: 'total', title: '鎬婚噺', align: 'center', width: 90},
+                                        ]],
+                                        done: function () {
+                                            tableMerge.render(this);
+                                            $('.layui-table-body.layui-table-main').css("overflow", "auto")
+                                        }
+                                    });
 
-    /* 鍒犻櫎2 */
-    function doDel2(obj) {
+                                }
+                                ,yes: function(index, layero){
+                                    //鎸夐挳銆愰┈涓婃嫞璐с�戠殑鍥炶皟
+                                    stockOut(data.orderNo);
+                                }
+                                ,btn2: function(index, layero){
+                                    //鎸夐挳銆愮◢鍚庡鐞嗐�戠殑鍥炶皟
+                                    //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
+                                }
+                            });
+                        } else if (res.code === 403){
+                            top.location.href = baseUrl+"/";
+                        } else {
+                            layer.msg(res.msg, {icon: 2})
+                        }
+                    }
+                })
+                break;
+            // 鎵撳嵃
+            case 'print':
+                layer.confirm('寮�濮嬫墦鍗�' +data.orderNo + ' 鎷h揣鍗曪紵', {shadeClose: true}, function(){
+                    layer.closeAll();
+                    printPakouts(data.orderNo);
+                })
+                break;
+            // 鍒犻櫎
+            case 'del':
+                var ids = [obj.id];
+                doDelOrder({ids: ids});
+                break;
+
+        }
+    });
+
+    /* 鍒犻櫎璁㈠崟 */
+    function doDelOrder(obj) {
         layer.confirm('纭畾瑕佸垹闄ら�変腑鏁版嵁鍚楋紵', {
             skin: 'layui-layer-admin',
             shade: .1
         }, function (i) {
             layer.close(i);
             var loadIndex = layer.load(2);
-            $.get('../../json/ok.json', {
-                id: obj.data ? obj.data.dictDataId : '',
-                ids: obj.ids ? obj.ids.join(',') : ''
-            }, function (res) {
-                layer.close(loadIndex);
-                if (200 === res.code) {
-                    layer.msg(res.msg, {icon: 1});
-                    insTb2.reload({page: {curr: 1}});
-                } else {
-                    layer.msg(res.msg, {icon: 2});
+            $.ajax({
+                url: baseUrl+"/orders/delete/auth",
+                headers: {'token': localStorage.getItem('token')},
+                data: {ids: obj.ids},
+                method: 'POST',
+                success: function (res) {
+                    layer.close(loadIndex);
+                    if (res.code === 200){
+                        layer.msg(res.msg, {icon: 1});
+                        $(".layui-laypage-btn")[0].click();
+                    } else if (res.code === 403){
+                        top.location.href = baseUrl+"/";
+                    }else {
+                        layer.msg(res.msg, {icon: 2});
+                    }
                 }
-            }, 'json');
+            })
+
         });
     }
 
+    // 鐢熸垚鎷h揣鍗�
+    function stockOut(orderNo) {
+        layer.closeAll();
+        $.ajax({
+            url: baseUrl+"/work/stock/out/create",
+            headers: {'token': localStorage.getItem('token')},
+            contentType:'application/json;charset=UTF-8',
+            data: JSON.stringify({
+                orderNo: orderNo
+            }),
+            method: 'POST',
+            success: function (res) {
+                // 鎴愬姛
+                if (res.code === 200){
+                    layer.confirm(res.msg, {
+                            shadeClose: true
+                            , btn: ['鎵撳嵃鎷h揣鍗�']
+                        }, function() {
+                            layer.closeAll();
+                            printPakouts(orderNo);
+                        }
+                    )
+                } else if (res.code === 403){
+                    top.location.href = baseUrl+"/";
+                } else {
+                    layer.msg(res.msg, {icon: 2})
+                }
+                $(".layui-laypage-btn")[0].click();
+            }
+        })
+        // });
+    }
 
+    // 鎵撳嵃鎷h揣鍗�
+    function printPakouts(orderNo) {
+        $.ajax({
+            url: baseUrl+"/work/stock/out/print",
+            headers: {'token': localStorage.getItem('token')},
+            data: JSON.stringify({
+                orderNo: orderNo
+            }),
+            contentType:'application/json;charset=UTF-8',
+            method: 'POST',
+            success: function (res) {
+                if (res.code === 200){
+                    res.data["barcodeUrl"]=baseUrl+"/order/code/auth?type=1&param="+res.data.docNum;
+                    var tpl = $('#pakoutPrintTpl').html();
+                    var template = Handlebars.compile(tpl);
+                    var html = template(res);
+                    var box = $("#pakoutPrintBox");
+                    box.html(html);box.show();
+                    box.print({
+                        mediaPrint:true,
+                        deferred: $.Deferred().done(function () {
+                            layer.confirm('[閲嶈] 鎵撳嵃鏄惁鎴愬姛锛�',  {btn: ['Yes', 'No']}, function(){
+                                $.ajax({
+                                    url: baseUrl+"/pakout/print/auth",
+                                    headers: {'token': localStorage.getItem('token')},
+                                    data: {
+                                        docNumber: orderNo
+                                    },
+                                    method: 'POST',
+                                    success: function (res) {
+                                        if (res.code === 200){
+                                            layer.closeAll();
+                                            $(".layui-laypage-btn")[0].click();
+                                            layer.msg(res.msg, {icon: 1})
+                                        } else if (res.code === 403){
+                                            top.location.href = baseUrl+"/";
+                                        } else {
+                                            layer.msg(res.msg, {icon: 2})
+                                        }
+                                    }
+                                })
+                            });
+                        })
+                    });
+                    box.hide();
+                } else if (res.code === 403){
+                    top.location.href = baseUrl+"/";
+                } else {
+                    layer.msg(res.msg, {icon: 2})
+                }
+            }
+        })
+    }
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-//     // 鏁版嵁娓叉煋
-//     tableIns = table.render({
-//         elem: '#order',
-//         headers: {token: localStorage.getItem('token')},
-//         url: baseUrl+'/order/list/auth',
-//         page: true,
-//         limit: 16,
-//         limits: [16, 30, 50, 100, 200, 500],
-//         even: true,
-//         toolbar: '#toolbar',
-//         cellMinWidth: 50,
-//         cols: [[
-//             {type: 'checkbox'}
-//             // ,{field: 'id', align: 'center',title: 'ID'}
-//             // ,{field: 'uuid', align: 'center',title: '缂栧彿'}
-//             ,{field: 'orderNo', align: 'center',title: '璁㈠崟缂栧彿'}
-//             ,{field: 'orderTime', align: 'center',title: '鍗曟嵁鏃ユ湡'}
-//             ,{field: 'docType$', align: 'center',title: '鍗曟嵁绫诲瀷'}
-//             ,{field: 'itemId$', align: 'center',title: '椤圭洰缂栧彿'}
-//             ,{field: 'allotItemId$', align: 'center',title: '璋冩嫧椤圭洰缂栧彿', hide: true}
-//             ,{field: 'defNumber', align: 'center',title: '鍒濆绁ㄦ嵁鍙�', hide: true}
-//             ,{field: 'number', align: 'center',title: '绁ㄦ嵁鍙�'}
-//             // ,{field: 'cstmr$', align: 'center',title: '瀹㈡埛缂栧彿'}
-//             ,{field: 'cstmrName', align: 'center',title: '瀹㈡埛', hide: true}
-//             ,{field: 'tel', align: 'center',title: '鑱旂郴鏂瑰紡', hide: true}
-//             ,{field: 'operMemb', align: 'center',title: '鎿嶄綔浜哄憳'}
-//             ,{field: 'totalFee', align: 'center',title: '鍚堣閲戦'}
-//             ,{field: 'discount', align: 'center',title: '浼樻儬鐜�', hide: true}
-//             ,{field: 'discountFee', align: 'center',title: '浼樻儬閲戦', hide: true}
-//             ,{field: 'otherFee', align: 'center',title: '閿�鍞垨閲囪喘璐圭敤鍚堣', hide: true}
-//             ,{field: 'actFee', align: 'center',title: '瀹炰粯閲戦', hide: true}
-//             ,{field: 'payType$', align: 'center',title: '浠樻绫诲瀷'}
-//             ,{field: 'salesman', align: 'center',title: '涓氬姟鍛�', hide: true}
-//             ,{field: 'accountDay', align: 'center',title: '缁撶畻澶╂暟', hide: true}
-//             ,{field: 'postFeeType$', align: 'center',title: '閭垂鏀粯绫诲瀷', hide: true}
-//             ,{field: 'postFee', align: 'center',title: '閭垂', hide: true}
-//             ,{field: 'payTime$', align: 'center',title: '浠樻鏃堕棿', hide: true}
-//             ,{field: 'sendTime$', align: 'center',title: '鍙戣揣鏃堕棿', hide: true}
-//             ,{field: 'shipName', align: 'center',title: '鐗╂祦鍚嶇О', hide: true}
-//             ,{field: 'shipCode', align: 'center',title: '鐗╂祦鍗曞彿', hide: true}
-//             ,{field: 'settle$', align: 'center',title: '璁㈠崟鐘舵��'}
-//             // ,{field: 'status$', align: 'center',title: '鐘舵��'}
-//             // ,{field: 'createBy$', align: 'center',title: '娣诲姞浜哄憳',event: 'createBy', style: 'cursor:pointer'}
-//             // ,{field: 'createTime$', align: 'center',title: '娣诲姞鏃堕棿'}
-//             // ,{field: 'updateBy$', align: 'center',title: '淇敼浜哄憳',event: 'updateBy', style: 'cursor:pointer'}
-//             // ,{field: 'updateTime$', align: 'center',title: '淇敼鏃堕棿'}
-//             // ,{field: 'memo', align: 'center',title: '澶囨敞'}
-//
-//             ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:150}
-//         ]],
-//         request: {
-//             pageName: 'curr',
-//             pageSize: 'limit'
-//         },
-//         parseData: function (res) {
-//             return {
-//                 'code': res.code,
-//                 'msg': res.msg,
-//                 'count': res.data.total,
-//                 'data': res.data.records
-//             }
-//         },
-//         response: {
-//             statusCode: 200
-//         },
-//         done: function(res, curr, count) {
-//             if (res.code === 403) {
-//                 top.location.href = baseUrl+"/";
-//             }
-//             pageCurr=curr;
-//             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';
-//                 }
-//             });
-//         }
-//     });
-//
-//     // 鐩戝惉鎺掑簭浜嬩欢
-//     table.on('sort(locMast)', function (obj) {
-//         var searchData = {};
-//         $.each($('#search-box [name]').serializeArray(), function() {
-//             searchData[this.name] = this.value;
-//         });
-//         searchData['orderByField'] = obj.field;
-//         searchData['orderByType'] = obj.type;
-//         tableIns.reload({
-//             where: searchData,
-//             page: {
-//                 curr: 1
-//             },
-//             done: function (res, curr, count) {
-//                 if (res.code === 403) {
-//                     top.location.href = baseUrl+"/";
-//                 }
-//                 pageCurr=curr;
-//                 limit();
-//             }
-//         });
-//     });
-//
-//     // 鐩戝惉澶村伐鍏锋爮浜嬩欢
-//     table.on('toolbar(order)', 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: 'order_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){
-//                     layer.msg('璇烽�夋嫨鏁版嵁');
-//                 } else {
-//                     layer.confirm('纭畾鍒犻櫎'+(data.length===1?'姝�':data.length)+'鏉℃暟鎹悧', function(){
-//                         $.ajax({
-//                             url: baseUrl+"/order/delete/auth",
-//                             headers: {'token': localStorage.getItem('token')},
-//                             data: {param: JSON.stringify(data)},
-//                             method: 'POST',
-//                             traditional:true,
-//                             success: function (res) {
-//                                 if (res.code === 200){
-//                                     layer.closeAll();
-//                                     tableReload(false);
-//                                 } else if (res.code === 403){
-//                                     top.location.href = baseUrl+"/";
-//                                 } else {
-//                                     layer.msg(res.msg)
-//                                 }
-//                             }
-//                         })
-//                     });
-//                 }
-//                 break;
-//             case 'exportData':
-//                 layer.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
-//                     var titles=[];
-//                     var fields=[];
-//                     obj.config.cols[0].map(function (col) {
-//                         if (col.type === 'normal' && col.hide === false && col.toolbar == null) {
-//                             titles.push(col.title);
-//                             fields.push(col.field);
-//                         }
-//                     });
-//                     var exportData = {};
-//                     $.each($('#search-box [name]').serializeArray(), function() {
-//                         exportData[this.name] = this.value;
-//                     });
-//                     var param = {
-//                         'order': exportData,
-//                         'fields': fields
-//                     };
-//                     $.ajax({
-//                         url: baseUrl+"/order/export/auth",
-//                         headers: {'token': localStorage.getItem('token')},
-//                         data: JSON.stringify(param),
-//                         dataType:'json',
-//                         contentType:'application/json;charset=UTF-8',
-//                         method: 'POST',
-//                         success: function (res) {
-//                             layer.closeAll();
-//                             if (res.code === 200) {
-//                                 table.exportFile(titles,res.data,'xls');
-//                             } else if (res.code === 403) {
-//                                 top.location.href = baseUrl+"/";
-//                             } else {
-//                                 layer.msg(res.msg)
-//                             }
-//                         }
-//                     });
-//                 });
-//                 break;
-//         }
-//     });
-//
-//     // 鐩戝惉琛屽伐鍏蜂簨浠�
-//     table.on('tool(order)', function(obj){
-//         var data = obj.data;
-//         switch (obj.event) {
-//             // 璇︽儏
-//             case 'detail':
-//                 layer.open({
-//                     type: 2,
-//                     title: '璇︽儏',
-//                     maxmin: true,
-//                     area: [top.detailWidth, top.detailHeight],
-//                     shadeClose: true,
-//                     content: 'order_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');
-//                     }
-//                 });
-//                 break;
-//             // 缂栬緫
-//             case 'edit':
-//                 layer.open({
-//                     type: 2,
-//                     title: '淇敼',
-//                     maxmin: true,
-//                     area: [top.detailWidth, top.detailHeight],
-//                     content: 'order_detail.html',
-//                     success: function(layero, index){
-//                         layer.getChildFrame('#data-detail-submit-save', index).hide();
-//                         setFormVal(layer.getChildFrame('#detail', index), data, false);
-//                         top.convertDisabled(layer.getChildFrame('#data-detail :input', index), false);
-//                         top.convertDisabled(layer.getChildFrame('#id', index), true);
-//                         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');
-//                     }
-//                 });
-//                 break;
-//
-//
-//         }
-//     });
-//
-//     // 鏁版嵁淇濆瓨鍔ㄤ綔
-//     form.on('submit(save)', function () {
-//         if (banMsg != null){
-//             layer.msg(banMsg);
-//             return;
-//         }
-//         method("add");
-//     });
-//
-//     // 鏁版嵁淇敼鍔ㄤ綔
-//     form.on('submit(edit)', function () {
-//         method("update")
-//     });
-//
-//     function method(name){
-//         var index = layer.load(1, {
-//             shade: [0.5,'#000'] //0.1閫忔槑搴︾殑鑳屾櫙
-//         });
-//         var data = {
-// //            id: $('#id').val(),
-//             id: $('#id').val(),
-//             uuid: $('#uuid').val(),
-//             orderNo: $('#orderNo').val(),
-//             orderTime: $('#orderTime').val(),
-//             docType: $('#docType').val(),
-//             itemId: $('#itemId').val(),
-//             allotItemId: $('#allotItemId').val(),
-//             defNumber: $('#defNumber').val(),
-//             number: $('#number').val(),
-//             cstmr: $('#cstmr').val(),
-//             cstmrName: $('#cstmrName').val(),
-//             tel: $('#tel').val(),
-//             operMemb: $('#operMemb').val(),
-//             totalFee: $('#totalFee').val(),
-//             discount: $('#discount').val(),
-//             discountFee: $('#discountFee').val(),
-//             otherFee: $('#otherFee').val(),
-//             actFee: $('#actFee').val(),
-//             payType: $('#payType').val(),
-//             salesman: $('#salesman').val(),
-//             accountDay: $('#accountDay').val(),
-//             postFeeType: $('#postFeeType').val(),
-//             postFee: $('#postFee').val(),
-//             payTime: top.strToDate($('#payTime\\$').val()),
-//             sendTime: top.strToDate($('#sendTime\\$').val()),
-//             shipName: $('#shipName').val(),
-//             shipCode: $('#shipCode').val(),
-//             settle: $('#settle').val(),
-//             status: $('#status').val(),
-//             createBy: $('#createBy').val(),
-//             createTime: top.strToDate($('#createTime\\$').val()),
-//             updateBy: $('#updateBy').val(),
-//             updateTime: top.strToDate($('#updateTime\\$').val()),
-//             memo: $('#memo').val(),
-//
-//         };
-//         $.ajax({
-//             url: baseUrl+"/order/"+name+"/auth",
-//             headers: {'token': localStorage.getItem('token')},
-//             data: top.reObject(data),
-//             method: 'POST',
-//             success: function (res) {
-//                 if (res.code === 200){
-//                     parent.layer.closeAll();
-//                     parent.$(".layui-laypage-btn")[0].click();
-//                     $("#data-detail :input").each(function () {
-//                         $(this).val("");
-//                     });
-//                 } else if (res.code === 403){
-//                     top.location.href = baseUrl+"/";
-//                 }else {
-//                     layer.msg(res.msg)
-//                 }
-//                 layer.close(index);
-//             }
-//         })
-//     }
-//
-//     // 澶嶉�夋浜嬩欢
-//     form.on('checkbox(detailCheckbox)', function (data) {
-//         var el = data.elem;
-//         if (el.checked) {
-//             $(el).val('Y');
-//         } else {
-//             $(el).val('N');
-//         }
-//     });
-//
 //     // 鎼滅储鏍忔悳绱簨浠�
 //     form.on('submit(search)', function (data) {
 //         pageCurr = 1;
@@ -667,10 +478,22 @@
 
 });
 
-// 鍏抽棴鍔ㄤ綔
-$(document).on('click','#data-detail-close', function () {
-    parent.layer.closeAll();
-});
+function right(){
+    top.popupRight = top.layui.admin.popupRight({
+        id: 'LAY_adminPopupLayerTest'
+        , area: '750px'
+        , type: 2
+        , shade: [0.5,'#000']
+        , content:'order/matQuery.html'
+        , success: function(){
+            // $('#'+ this.id).html('<div style="padding: 20px;">鏀惧叆鍐呭</div>');
+            //admin.view(this.id).render('system/xxx')
+        }
+        , end: function () {
+            $(".layui-laypage-btn")[0].click();
+        }
+    });
+}
 
 function tableReload(child) {
     var searchData = {};
@@ -681,76 +504,7 @@
         where: searchData,
         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);
         }
     });
 }
 
-function setFormVal(el, data, showImg) {
-    for (var val in data) {
-        var find = el.find(":input[id='" + val + "']");
-        if (find[0]!=null){
-            if (find[0].type === 'checkbox'){
-                if (data[val]==='Y'){
-                    find.attr("checked","checked");
-                    find.val('Y');
-                } else {
-                    find.remove("checked");
-                    find.val('N');
-                }
-                continue;
-            }
-        }
-        find.val(data[val]);
-        if (showImg){
-            var next = find.next();
-            if (next.get(0)){
-                if (next.get(0).localName === "img") {
-                    find.hide();
-                    next.attr("src", data[val]);
-                    next.show();
-                }
-            }
-        }
-    }
-}
-
-function clearFormVal(el) {
-    $(':input', el)
-        .val('')
-        .removeAttr('checked')
-        .removeAttr('selected');
-}
-
-function detailScreen(index) {
-    var detail = layer.getChildFrame('#data-detail', index);
-    var height = detail.height()+60;
-    if (height > ($(window).height()*0.9)) {
-        height = ($(window).height()*0.8);
-    }
-    layer.style(index, {
-//        top: (($(window).height()-height)/3)+"px",
-        height: height+'px'
-    });
-}
-
-$('body').keydown(function () {
-    if (event.keyCode === 13) {
-        $("#search").click();
-    }
-});

--
Gitblit v1.9.1