From 07cf94734c36d4eae6ddbc4dd338bf5af81a2193 Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期一, 28 十月 2024 16:11:39 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-LayUI

---
 WebTM/views/生产管理/生产开工单/Sc_MESBeginWorkBillList.html |  655 ++++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 486 insertions(+), 169 deletions(-)

diff --git "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\345\274\200\345\267\245\345\215\225/Sc_MESBeginWorkBillList.html" "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\345\274\200\345\267\245\345\215\225/Sc_MESBeginWorkBillList.html"
index 5293144..418bbab 100644
--- "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\345\274\200\345\267\245\345\215\225/Sc_MESBeginWorkBillList.html"
+++ "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\345\274\200\345\267\245\345\215\225/Sc_MESBeginWorkBillList.html"
@@ -40,6 +40,18 @@
                                         <input type="date" class="layui-input" id="HDate1">
                                     </div>
                                 </div>
+                                <div class="layui-inline">
+                                    <label class="layui-form-label">鍗曟嵁鍙�</label>
+                                    <div class="layui-input-block">
+                                        <input type="text" class="layui-input" name="HBillNo" id="HBillNo">
+                                    </div>
+                                </div>
+                                <div class="layui-inline">
+                                    <label class="layui-form-label">鐢熶骇璧勬簮</label>
+                                    <div class="layui-input-block">
+                                        <input type="text" class="layui-input" name="HSource" id="HSource">
+                                    </div>
+                                </div>
                                 <!--<div class="layui-inline">
                                     <label class="layui-form-label">鍗曟嵁绫诲瀷</label>
                                     <div class="layui-input-block">
@@ -72,23 +84,20 @@
                                             <span>鍏朵粬鏉′欢></span>
                                         </div>
                                     </div>
-                                    <div class="layui-inline">
-                                        <label class="layui-form-label">鍗曟嵁鍙�</label>
-                                        <div class="layui-input-block">
-                                            <input type="text" class="layui-input" name="HBillNo" id="HBillNo">
-                                        </div>
-                                    </div>
+
                                 </div>
                             </div>
                         </div>
                         <table class="" id="mainTable" lay-filter="mainTable"></table>
                         <script type="text/html" id="toolbarDemo">
                             <div class="layui-btn-container">
-                                <!--<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-getCheckData"><i class="layui-icon layui-icon-tips"></i>棰勮</button>-->
-                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Add"><i class="layui-icon layui-icon-add-1"></i>鏂板</button>
+                                <button type="button" class="layui-btn layui-btn-sm layui-btn-disabled" lay-event="btn-Print"><i class="layui-icon layui-icon-print"></i>棰勮</button>
+                                <button type="button" class="layui-btn layui-btn-sm layui-btn-disabled" lay-event="btn-Add" id="btn-Add"><i class="layui-icon layui-icon-add-1"></i>鏂板</button>
                                 <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Edit"><i class="layui-icon layui-icon-edit"></i>缂栬緫</button>
                                 <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Delete"><i class="layui-icon layui-icon-delete"></i>鍒犻櫎</button>
-
+                                <button type="button" class="layui-btn layui-btn-sm" lay-event="get_Refresh"><i class="layui-icon layui-icon-refresh-3"></i>鍒锋柊</button>
+                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Audit"><i class="layui-icon layui-icon-radio"></i>瀹℃牳</button>
+                                <button type="button" class="layui-btn layui-btn-sm" lay-event="get_Exit"><i class="layui-icon layui-icon-logout"></i>閫�鍑�</button>
 
                             </div>
                         </script>
@@ -101,12 +110,20 @@
     <script src="../../../layuiadmin/Scripts/json2.js"></script>
     <script src="../../../layuiadmin/Scripts/jquery-1.4.1.js"></script>
     <script src="../../../layuiadmin/Scripts/webConfig.js"></script>
+    <script src="../../../layuiadmin/PubCustom.js"></script>
+    <script src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
     <script>
+        //鑾峰彇椤甸潰璺宠浆鍙傛暟  //鍗曟嵁缂栬緫鐘舵�侊細 1.鏃犳簮鍗曟柊澧灺� 聽2.鏈夋簮鍗曟柊澧灺� 聽3.缂栬緫聽 4.娴忚聽 5.鍙樻洿
+        var params = get_UrlVars();
+        if (typeof (params[params[0]]) == "undefined") {
+            var OperationType = 1;//鎿嶄綔绫诲瀷
+        }
         layui.config({
             base: '../../../layuiadmin/' //闈欐�佽祫婧愭墍鍦ㄨ矾寰�
         }).extend({
             index: 'lib/index', //涓诲叆鍙fā鍧�
         }).use(['index', 'form', 'table', 'element', 'laypage', 'laydate'], function () {
+            //#region 鍙傛暟
             var $ = layui.$
                 , admin = layui.admin
                 , layer = layui.layer
@@ -116,170 +133,56 @@
                 , laypage = layui.laypage
                 , laydate = layui.laydate
                 , util = layui.util
+
+
             //鏌ヨ鏉′欢
             var sWhere = "";
+            var option = [];
+            //#endregion
 
-            var option = {
-                elem: '#mainTable'
-                , toolbar: '#toolbarDemo'
-                , height: 'full-50'
-                , page: true
-                , cellMinWidth: 90
-                , cols: [[
-                    { type: 'checkbox', fixed: 'left' }
-                    , { field: 'hmainid', title: '鍗曟嵁ID', hide: true }
-                    , { field: '鏃ユ湡', title: '鏃ユ湡', width: 160, templet: "<div>{{d.鏃ユ湡 ==null ?'':layui.util.toDateString(d.鏃ユ湡, 'yyyy-MM-dd')}}</div>" }
-                    , { field: '鍗曟嵁鍙�', title: '鍗曟嵁鍙�', width: 160 }
-                    , { field: '鍗曟嵁绫诲瀷', title: '鍗曟嵁绫诲瀷', width: 160 }
-                    , { field: '閮ㄩ棬浠g爜', title: '閮ㄩ棬浠g爜', width: 115 }
-                    , { field: '閮ㄩ棬鍚嶇О', title: '閮ㄩ棬鍚嶇О', width: 200 }
-                    , { field: '鐝粍浠g爜', title: '鐝粍浠g爜', width: 115 }
-                    , { field: '鐝粍鍚嶇О', title: '鐝粍鍚嶇О', width: 200 }
-                    , { field: '璧勬簮浠g爜', title: '璧勬簮浠g爜', width: 115 }
-                    , { field: '璧勬簮鍚嶇О', title: '璧勬簮鍚嶇О', width: 200 }
-                    , { field: '寮�宸ユ椂闂�', title: '寮�宸ユ椂闂�', width: 200, templet: "<div>{{d.鍒跺崟鏃ユ湡 ==null ?'':layui.util.toDateString(d.鍒跺崟鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
-                    , { field: '澶囨敞', title: '澶囨敞', width: 200 }
-                    , { field: '鍒跺崟浜�', title: '鍒跺崟浜�', width: 200 }
-                    , { field: '鍒跺崟鏃ユ湡', title: '鍒跺崟鏃ユ湡', width: 200, templet: "<div>{{d.鍒跺崟鏃ユ湡 ==null ?'':layui.util.toDateString(d.鍒跺崟鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
-                    , { field: '瀹℃牳浜�', title: '瀹℃牳浜�', width: 200 }
-                    , { field: '瀹℃牳鏃ユ湡', title: '瀹℃牳鏃ユ湡', width: 200, templet: "<div>{{d.瀹℃牳鏃ユ湡 ==null ? '':layui.util.toDateString(d.瀹℃牳鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
-                    , { field: '淇敼浜�', title: '淇敼浜�', width: 200 }
-                    , { field: '淇敼鏃ユ湡', title: '淇敼鏃ユ湡', width: 200, templet: "<div>{{d.淇敼鏃ユ湡 ==null ?'':layui.util.toDateString(d.淇敼鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
-                    , { field: '鍏抽棴浜�', title: '鍏抽棴浜�', width: 200 }
-                    , { field: '鍏抽棴鏃ユ湡', title: '鍏抽棴鏃ユ湡', width: 200, templet: "<div>{{d.鍏抽棴鏃ユ湡 ==null ?'':layui.util.toDateString(d.鍏抽棴鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
-                    , { field: '浣滃簾浜�', title: '浣滃簾浜�', width: 200 }
-                    , { field: '浣滃簾鏃ユ湡', title: '浣滃簾鏃ユ湡', width: 200, templet: "<div>{{d.浣滃簾鏃ユ湡 ==null ?'':layui.util.toDateString(d.浣滃簾鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
-                ]]
-            };
+            //#region 杩涘叆椤甸潰鍗冲姞杞�
+            //鍒ゆ柇鎿嶄綔绫诲瀷
+            if (OperationType == 1) {//鏃犳簮鍗�
+                //鎶ュ伐骞冲彴鎶ユ鐢宠鏌ョ湅鍒楄〃
+                set_ClearBill();
+            }
 
-            var index = layer.load(0);
+            else {
+                layer.alert("鏈煡鎿嶄綔绫诲瀷锛�", { icon: 5 });
+            }
+            //#endregion
+
+            //#region 瑙﹀彂浜嬩欢锛氬寘鎷琭orm.on(){}鏍煎紡鐨勬墍鏈夌偣鍑讳簨浠躲�侀�夋嫨浜嬩欢绛�
 
             //澶村伐鍏锋爮浜嬩欢
             table.on('toolbar(mainTable)', function (obj) {
                 var checkStatus = table.checkStatus(obj.config.id);
                 switch (obj.event) {
-                    case 'btn-Add':
-                        //椤甸潰灞�-鑷畾涔�
-                        layer.open({
-                            type: 2,
-                            skin: 'layui-layer-rim', //鍔犱笂杈规
-                            title: '鏂板寮�宸ュ崟',
-                            closeBtn: 1,
-                            shift: 2,
-                            area: ['100%', '100%'],
-                            maxmin: true,
-                            content: '../鐢熶骇寮�宸ュ崟/Sc_Add_MESBeginWorkBillList.html?hID=&Type=1',
-                            end: function () {
-                                //鍒锋柊椤甸潰,
-                                location.reload();
-                            },
-                            success: function (layero, index) {
-
-                            }
-                        });
+                    case 'btn-Add': //set_AddNew();
                         break;
-                    case 'btn-Edit':
-                        var checkStatus = table.checkStatus('mainTable')
-                            , data = checkStatus.data;
-                        if (checkStatus.data.length === 1) {
-                            var hID = data[0].hmainid.toString();
-                            //if (AllowLoadData(sSubStr) != false) {//闈炵┖楠岃瘉
-                            layer.open({
-                                type: 2
-                                , area: ['100%', '100%']
-                                , title: '缂栬緫寮�宸ュ崟'
-                                , closeBtn: 1
-                                , shade: 0.6 //閬僵閫忔槑搴�
-                                , maxmin: true //鍏佽鍏ㄥ睆鏈�灏忓寲
-                                , anim: 0 //0-6鐨勫姩鐢诲舰寮忥紝-1涓嶅紑鍚�
-                                , content: '../鐢熶骇寮�宸ュ崟/Sc_Add_MESBeginWorkBillList.html?hID=' + hID +'&Type=3'
-                                , resize: false,
-                                end: function () {
-                                    //鍒锋柊椤甸潰,
-                                    location.reload();
-                                }
-                                , cancel: function () {
-                                    //$(".layui-btn").removeClass("layui-btn-disabled");
-                                }
-                            })
-
-                        } else {
-                            layer.msg('璇烽�夋嫨涓�琛屾暟鎹紪杈戯紒');
-                        }
-
+                    case 'btn-Edit': set_ShowBill();
                         break;
-                    case 'btn-Delete':
-                        var checkStatus = table.checkStatus('mainTable')
-                            , data = checkStatus.data;
-                        if (checkStatus.data.length === 1) {
-                            var InterID = data[0].hmainid.toString();
-                            //閫昏緫鍒犻櫎鏂规硶
-                            layer.confirm("纭瑕佸垹闄ゅ悧锛屽垹闄ゅ悗涓嶈兘鎭㈠", { title: "鍒犻櫎纭" }, function (index) {
-                                $.ajax({
-                                    type: "GET",
-                                    url: GetWEBURL() + "Sc_MESBeginWorkBill/DeltetMESBeginWorkBill", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
-                                    data: { "HInterID": InterID },
-                                    success: function (result) {
-                                        if (result.count == 1) {
-                                            layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
-                                                // 寰楀埌frame绱㈠紩
-                                                var index = layer.getFrameIndex(window.name);
-                                                //鍏抽棴褰撳墠frame
-                                                layer.close(index);
-                                                //淇敼涓哄姛鍚庡埛鏂扮晫闈�
-                                                window.location.reload();
-                                            });
-
-                                        } else {
-                                            layer.alert(result.code + result.Message, { icon: 5 });
-                                        }
-                                    }, error: function () {
-                                        layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
-                                    }
-                                });
-                            })
-                        }
-                        else {
-                            layer.msg('璇烽�夋嫨涓�琛屾暟鎹垹闄わ紒');
-                        }
+                    case 'btn-Delete': set_DeleteBill();
+                        break;
+                    //鍒锋柊
+                    case 'get_Refresh': set_Refresh();
+                        break;
+                    //瀹℃牳鎸夐挳
+                    case 'btn-Audit': set_CheckBill();
+                        break;
+                    //閫�鍑�
+                    case 'get_Exit': Pub_Close(2);
                         break;
                 };
             });
 
-            //杩涘叆椤甸潰鏄剧ず鐨勭紦瀛樺垪琛�
-            $.ajax({
-                //url: "http://61.130.49.162:9090/WMSAPI///Web/GetMAXNum",
-                url: GetWEBURL() + '/Sc_MESBeginWorkBill/GetMESBeginWorkBill',
-                type: "GET",
-                data: { "sWhere": sWhere},
-                success: function (data1) {
-                    if (data1.count == 1) {
-                        option.data = data1.data;
-                        table.render(option);
-                        layer.close(index);
-                    } else {
-                        layer.close(index);
-                        layer.alert(data1.code + data1.Message, { icon: 5 });
-                    }
-                }, error: function () {
-                    layer.close(index);
-                    layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
-                }
-            });
-
-            //閲嶇疆鎸夐挳
-            form.on('submit(btnReSearch)', function (data) {
-                $("#HDate").val("");//寮�濮嬫棩鏈�
-                $("#HDate1").val("");//缁撴潫鏃ユ湡
-                $("#HBillNo").val("");//鍗曟嵁鍙�
-                $("#btnSearch").click();
-            });
-
             //鏌ヨ鎸夐挳
             form.on('submit(btnSearch)', function (data) {//閫夋嫨浠撲綅
+                var ajaxLoad = layer.load();
                 var HDate = $("#HDate").val();//寮�濮嬫棩鏈�
                 var HDate1 = $("#HDate1").val();//缁撴潫鏃ユ湡
                 var HBillNo = $("#HBillNo").val();//鍗曟嵁鍙�
+                var HSource = $("#HSource").val();//鐢熶骇璧勬簮
                 if (HDate) {
                     sWhere += " and CONVERT(varchar(100),鏃ユ湡, 23) >= '" + HDate + "'";
                 }
@@ -289,24 +192,24 @@
                 if (HBillNo) {
                     sWhere += " and 鍗曟嵁鍙� like '%" + HBillNo + "%'";
                 }
-                var index = layer.load(0);
+                if (HSource) {
+                    sWhere += " and 璧勬簮浠g爜 like '%" + HSource + "%' or 璧勬簮鍚嶇О like '%" + HSource + "%'";
+                }
                 $.ajax({
-                    //url: "http://61.130.49.162:9090/WMSAPI///Web/GetMAXNum",
                     url: GetWEBURL() + '/Sc_MESBeginWorkBill/GetMESBeginWorkBill',
                     type: "GET",
-                    data: { "sWhere": sWhere},
+                    data: { "sWhere": sWhere },
                     success: function (data1) {
                         if (data1.count == 1) {
                             option.data = data1.data;
                             table.render(option);
-                            layer.close(index);
-                            layer.alert("鏌ヨ鎴愬姛", { icon: 1 });
+                            layer.close(ajaxLoad);
                         } else {
-                            layer.close(index);
+                            layer.close(ajaxLoad);
                             layer.alert(data1.code + data1.Message, { icon: 5 });
                         }
                     }, error: function () {
-                        layer.close(index);
+                        layer.close(ajaxLoad);
                         layer.alert("鎺ュ彛澶辨晥!", { icon: 5 });
                     }
                 });
@@ -320,23 +223,437 @@
                 //$("#BeginHCreateDate").val("");//缁撴潫鍒跺崟鏃堕棿
             });
 
-            //鐩戝惉琛屽弻鍑讳簨浠�
-            table.on('rowDouble(mainTable)', function (obj) {
-                layer.alert("鍙屽嚮浜嬩欢", { icon: 1 });
+            //閲嶇疆鎸夐挳
+            form.on('submit(btnReSearch)', function (data) {
+                $("#HDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * 30), "yyyy-MM-dd"));
+                $("#HDate1").val(Format(new Date(), "yyyy-MM-dd"));
+                $("#HBillNo").val("");//鍗曟嵁鍙�
+                $("#HSource").val("");//鐢熶骇璧勬簮
+                $("#btnSearch").click();
+            });
+            //#endregion
+
+
+            //#region 鏈〉闈㈡墍鏈夎璋冪敤鐨勬柟娉�
+
+            // 鍒濆鍖栫晫闈�
+            function set_ClearBill() {
+                //鍒濆鍖栬〃鏍�
+                set_InitGrid();
+                //鏌ヨ
+                get_Display();
+
+            }
+
+
+            //鍒濆鍖栬〃鏍�
+            function set_InitGrid() {
+                $("#HDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * 30), "yyyy-MM-dd"));
+                $("#HDate1").val(Format(new Date(), "yyyy-MM-dd"));
+                 option = {
+                    elem: '#mainTable'
+                    , toolbar: '#toolbarDemo'
+                    , height: 'full-50'
+                    , page: true
+                    , cellMinWidth: 90
+                    , cols: [[
+                        { type: 'checkbox', fixed: 'left' }
+                        , { field: 'hmainid', title: '鍗曟嵁ID', hide: true }
+                        , { field: '鏃ユ湡', title: '鏃ユ湡', width: 160, templet: "<div>{{d.鏃ユ湡 ==null ?'':layui.util.toDateString(d.鏃ユ湡, 'yyyy-MM-dd')}}</div>" }
+                        , { field: '鍗曟嵁鍙�', title: '鍗曟嵁鍙�', width: 160 }
+                        , { field: '鍗曟嵁绫诲瀷', title: '鍗曟嵁绫诲瀷', width: 160 }
+                        , { field: 'HBillStatus', title: '鍗曟嵁鐘舵��', width: 160 }
+                        , { field: '閮ㄩ棬浠g爜', title: '閮ㄩ棬浠g爜', width: 115 }
+                        , { field: '閮ㄩ棬鍚嶇О', title: '閮ㄩ棬鍚嶇О', width: 200 }
+                        , { field: '鐝粍浠g爜', title: '鐝粍浠g爜', width: 115 }
+                        , { field: '鐝粍鍚嶇О', title: '鐝粍鍚嶇О', width: 200 }
+                        , { field: '璧勬簮浠g爜', title: '璧勬簮浠g爜', width: 115 }
+                        , { field: '璧勬簮鍚嶇О', title: '璧勬簮鍚嶇О', width: 200 }
+                        , { field: '寮�宸ユ椂闂�', title: '寮�宸ユ椂闂�', width: 200, templet: "<div>{{d.鍒跺崟鏃ユ湡 ==null ?'':layui.util.toDateString(d.鍒跺崟鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
+                        , { field: '澶囨敞', title: '澶囨敞', width: 200 }
+                        , { field: '鍒跺崟浜�', title: '鍒跺崟浜�', width: 200 }
+                        , { field: '鍒跺崟鏃ユ湡', title: '鍒跺崟鏃ユ湡', width: 200, templet: "<div>{{d.鍒跺崟鏃ユ湡 ==null ?'':layui.util.toDateString(d.鍒跺崟鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
+                        , { field: '瀹℃牳浜�', title: '瀹℃牳浜�', width: 200 }
+                        , { field: '瀹℃牳鏃ユ湡', title: '瀹℃牳鏃ユ湡', width: 200, templet: "<div>{{d.瀹℃牳鏃ユ湡 ==null ? '':layui.util.toDateString(d.瀹℃牳鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
+                        , { field: '淇敼浜�', title: '淇敼浜�', width: 200 }
+                        , { field: '淇敼鏃ユ湡', title: '淇敼鏃ユ湡', width: 200, templet: "<div>{{d.淇敼鏃ユ湡 ==null ?'':layui.util.toDateString(d.淇敼鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
+                        , { field: '鍏抽棴浜�', title: '鍏抽棴浜�', width: 200 }
+                        , { field: '鍏抽棴鏃ユ湡', title: '鍏抽棴鏃ユ湡', width: 200, templet: "<div>{{d.鍏抽棴鏃ユ湡 ==null ?'':layui.util.toDateString(d.鍏抽棴鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
+                        , { field: '浣滃簾浜�', title: '浣滃簾浜�', width: 200 }
+                        , { field: '浣滃簾鏃ユ湡', title: '浣滃簾鏃ユ湡', width: 200, templet: "<div>{{d.浣滃簾鏃ユ湡 ==null ?'':layui.util.toDateString(d.浣滃簾鏃ユ湡, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
+                    ]]
+                };
+            }
+
+            //鏌ヨ
+            function get_Display()
+            {
+                var ajaxLoad = layer.load();
+                //杩涘叆椤甸潰鏄剧ず鐨勭紦瀛樺垪琛�
+                $.ajax({
+                    url: GetWEBURL() + '/Sc_MESBeginWorkBill/GetMESBeginWorkBill',
+                    type: "GET",
+                    data: { "sWhere": sWhere },
+                    success: function (data1) {
+                        if (data1.count == 1) {
+                            option.data = data1.data;
+                            table.render(option);
+                            layer.close(ajaxLoad);
+                        } else {
+                            layer.close(ajaxLoad);
+                            layer.alert(data1.code + data1.Message, { icon: 5 });
+                        }
+                    }, error: function () {
+                        layer.close(ajaxLoad);
+                        layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                    }
+                });
+            }
+
+            //鏂板
+            function set_AddNew()
+            {
+                //椤甸潰灞�-鑷畾涔�
+                layer.open({
+                    type: 2,
+                    skin: 'layui-layer-rim', //鍔犱笂杈规
+                    title: '鏂板寮�宸ュ崟',
+                    closeBtn: 1,
+                    shift: 2,
+                    area: ['100%', '100%'],
+                    maxmin: true,
+                    content: '../鐢熶骇寮�宸ュ崟/Sc_Add_MESBeginWorkBillList.html?OperationType=1&linterid=&HSouceBillType=',
+                    end: function () {
+                        //鍒锋柊椤甸潰,
+                        location.reload();
+                    },
+                    success: function (layero, index) {
+
+                    }
+                });
+            }
+
+            //缂栬緫
+            function set_ShowBill()
+            {
+                var checkStatus = table.checkStatus('mainTable')
+                    , data = checkStatus.data;
+                if (checkStatus.data.length === 1) {
+                    var linterid = data[0].hmainid.toString();
+                    var HBillStatus = data[0].HBillStatus.toString();
+                    if (HBillStatus != "1")
+                    {
+                        layer.msg('鍗曟嵁鐘舵�佷笉涓烘湭瀹℃牳鐘舵��,涓嶅厑璁哥紪杈戯紒');
+                        return false;
+                    }
+                    //if (AllowLoadData(sSubStr) != false) {//闈炵┖楠岃瘉
+                    layer.open({
+                        type: 2
+                        , area: ['100%', '100%']
+                        , title: '缂栬緫寮�宸ュ崟'
+                        , closeBtn: 1
+                        , shade: 0.6 //閬僵閫忔槑搴�
+                        , maxmin: true //鍏佽鍏ㄥ睆鏈�灏忓寲
+                        , anim: 0 //0-6鐨勫姩鐢诲舰寮忥紝-1涓嶅紑鍚�
+                        , content: '../鐢熶骇寮�宸ュ崟/Sc_Add_MESBeginWorkBillList.html?OperationType=3&linterid=' + linterid+'&HSouceBillType='
+                        ,resize: false,
+                        end: function () {
+                            //鍒锋柊椤甸潰,
+                            location.reload();
+                        }
+                        , cancel: function () {
+                            //$(".layui-btn").removeClass("layui-btn-disabled");
+                        }
+                    })
+
+                } else {
+                    layer.msg('璇烽�夋嫨涓�琛屾暟鎹紪杈戯紒');
+                }
+            }
+
+            //鍒犻櫎
+            function set_DeleteBill()
+            {
+                var checkStatus = table.checkStatus('mainTable')
+                    , data = checkStatus.data;
+                if (checkStatus.data.length === 1) {
+                    var InterID = data[0].hmainid.toString();
+                    var HBillStatus = data[0].HBillStatus.toString();
+                    if (HBillStatus != "1") {
+                        layer.msg('鍗曟嵁鐘舵�佷笉涓烘湭瀹℃牳鐘舵��,涓嶅厑璁稿垹闄わ紒');
+                        return false;
+                    }
+                    //閫昏緫鍒犻櫎鏂规硶
+                    layer.confirm("纭瑕佸垹闄ゅ悧锛屽垹闄ゅ悗涓嶈兘鎭㈠", { title: "鍒犻櫎纭" }, function (index) {
+                        $.ajax({
+                            type: "GET",
+                            url: GetWEBURL() + "Sc_MESBeginWorkBill/DeltetMESBeginWorkBill", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                            data: { "HInterID": InterID, "UserName": sessionStorage["HUserName"] },
+                            success: function (result) {
+                                if (result.count == 1) {
+                                    layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
+                                        // 寰楀埌frame绱㈠紩
+                                        var index = layer.getFrameIndex(window.name);
+                                        //鍏抽棴褰撳墠frame
+                                        layer.close(index);
+                                        //淇敼涓哄姛鍚庡埛鏂扮晫闈�
+                                        window.location.reload();
+                                    });
+
+                                } else {
+                                    layer.alert(result.code + result.Message, { icon: 5 });
+                                }
+                            }, error: function () {
+                                layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                            }
+                        });
+                    })
+                }
+                else {
+                    layer.msg('璇烽�夋嫨涓�琛屾暟鎹垹闄わ紒');
+                }
+            }
+
+            //鍒锋柊
+            function set_Refresh()
+            {
+                $("#btnSearch").click();
+            }
+
+            //瀹℃牳
+            function set_CheckBill() {
+                var checkStatus = table.checkStatus('mainTable')
+                    , data = checkStatus.data;
+                if (checkStatus.data.length === 1) {
+                    var InterID = data[0].hmainid.toString();
+                    //閫昏緫瀹℃牳鏂规硶
+                    $.ajax({
+                        type: "GET",
+                        url: GetWEBURL() + "/Sc_MESBeginWorkBill/AuditProcessReportList", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                        data: { "HInterID": InterID, "IsAudit": 0, "CurUserName": sessionStorage["HUserName"] },
+                        success: function (result) {
+                            if (result.count == 1) {
+                                layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
+                                    // 寰楀埌frame绱㈠紩
+                                    var index = layer.getFrameIndex(window.name);
+                                    //鍏抽棴褰撳墠frame
+                                    layer.close(index);
+                                    //淇敼涓哄姛鍚庡埛鏂扮晫闈�
+                                    $("#btnSearch").trigger('click');
+                                });
+
+                            } else {
+                                layer.alert(result.code + result.Message, { icon: 5 });
+                            }
+                        }, error: function () {
+                            layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                        }
+                    });
+                }
+                else {
+                    layer.msg('璇烽�夋嫨涓�琛屾暟鎹鏍革紒');
+                }
+            }
+
+            //鍙嶅鏍�
+            function set_AbandonCheck() {
+                var checkStatus = table.checkStatus('mainTable')
+                    , data = checkStatus.data;
+                if (checkStatus.data.length === 1) {
+                    var InterID = data[0].hmainid.toString();
+                    //閫昏緫瀹℃牳鏂规硶
+                    $.ajax({
+                        type: "GET",
+                        url: GetWEBURL() + "/Sc_MESBeginWorkBill/AuditProcessReportList", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                        data: { "HInterID": InterID, "IsAudit": 1, "CurUserName": sessionStorage["HUserName"] },
+                        success: function (result) {
+                            if (result.count == 1) {
+                                layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
+                                    // 寰楀埌frame绱㈠紩
+                                    var index = layer.getFrameIndex(window.name);
+                                    //鍏抽棴褰撳墠frame
+                                    layer.close(index);
+                                    //淇敼涓哄姛鍚庡埛鏂扮晫闈�
+                                    $("#btnSearch").trigger('click');
+                                });
+
+                            } else {
+                                layer.alert(result.code + result.Message, { icon: 5 });
+                            }
+                        }, error: function () {
+                            layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                        }
+                    });
+
+                }
+                else {
+                    layer.msg('璇烽�夋嫨涓�琛屾暟鎹弽瀹℃牳锛�');
+                }
+
+            }
+
+
+            //#endregion
+
+
+            table.on('toolbar(mainTable)', function (obj0) {
+                var othis = $(this)
+                    , events = othis.attr('lay-event')
+                    , openPanel = function (sets) {
+                        var list = $(sets.list)
+                            , panel = $('<ul class="layui-table-tool-panel"></ul>');
+                        panel.html(list);
+                    };
+                switch (events) {
+                    case 'LAYTABLE_COLS': //绛涢�夊垪
+                        openPanel({
+                            list: function () {
+                               
+                            }()
+                            , done: function () {
+                                form.on('checkbox(LAY_TABLE_TOOL_COLS)', function (obj) {
+                                    console.log("a");
+                                    var othis = $(obj.elem)
+                                        , checked = this.checked
+                                        , key = othis.data('key')
+                                        , parentKey = othis.data('parentkey');
+
+                                    layui.each(options.cols, function (i1, item1) {
+                                        layui.each(item1, function (i2, item2) {
+                                            if (i1 + '-' + i2 === key) {
+                                                var hide = item2.hide;
+
+                                                //鍚屾鍕鹃�夊垪鐨� hide 鍊煎拰闅愯棌鏍峰紡
+                                                item2.hide = !checked;
+                                                that.elem.find('*[data-key="' + options.index + '-' + key + '"]')
+                                                [checked ? 'removeClass' : 'addClass'](HIDE);
+
+                                                //鏍规嵁鍒楃殑鏄剧ず闅愯棌锛屽悓姝ュ绾ц〃澶寸殑鐖剁骇鐩稿叧灞炴�у��
+                                                if (hide != item2.hide) {
+                                                    that.setParentCol(!checked, parentKey);
+                                                }
+
+                                                //閲嶆柊閫傞厤灏哄
+                                                that.resize();
+                                            }
+                                        });
+                                    });
+                                });
+                            }
+                        });
+                        break;
+                };
             });
 
 
-            //laydate.render({
-            //    elem: '#HDate'
-            //    , type: 'datetime'
-            //    , trigger: 'click'
-            //    , format:'yyyy-MM-dd HH:mm'
+            form.on('checkbox(LAY_TABLE_TOOL_COLS)', function (obj) {
+                console.log("a");
+                var othis = $(obj.elem)
+                    , checked = this.checked
+                    , title = this.title
+                    , value = this.value
+                    , key = othis.data('key')
+                    , parentKey = othis.data('parentkey');
+                console.log(title, value, checked, key, parentKey);
+
+                layui.each(option.cols, function (i1, item1) {
+                    layui.each(item1, function (i2, item2) {
+                        //console.log(item1, item2);
+                        if (i1 + '-' + i2 === key) {
+                            var hide = item2.hide;
+                            //鍚屾鍕鹃�夊垪鐨� hide 鍊煎拰闅愯棌鏍峰紡
+                            item2.hide = !checked;
+                            //layui.elem.find('*[data-key="' + options.index + '-' + key + '"]')
+                            //[checked ? 'removeClass' : 'addClass'](HIDE);
+
+
+                        }
+
+                    });
+                });
+            });
+            //宸ュ叿鏍忔搷浣滀簨浠�
+            //table.on('click', '*[lay-event]', function (e) {
+            //    var othis = $(this)
+            //        , events = othis.attr('lay-event')
+            //        , openPanel = function (sets) {
+            //            var list = $(sets.list)
+            //                , panel = $('<ul class="layui-table-tool-panel"></ul>');
+
+            //            panel.html(list);
+            //        };
+
+            //      switch (events) {
+            //        case 'LAYTABLE_COLS': //绛涢�夊垪
+            //            openPanel({
+            //                list: function () {
+            //                    var lis = [];
+            //                    that.eachCols(function (i, item) {
+            //                        if (item.field && item.type == 'normal') {
+            //                            lis.push('<li><input type="checkbox" name="' + item.field + '" data-key="' + item.key + '" data-parentkey="' + (item.parentKey || '') + '" lay-skin="primary" ' + (item.hide ? '' : 'checked') + ' title="' + (item.title || item.field) + '" lay-filter="LAY_TABLE_TOOL_COLS"></li>');
+            //                        }
+            //                    });
+            //                    return lis.join('');
+            //                }()
+            //                , done: function () {
+            //                    form.on('checkbox(LAY_TABLE_TOOL_COLS)', function (obj) {
+            //                        var othis = $(obj.elem)
+            //                            , checked = this.checked
+            //                            , key = othis.data('key')
+            //                            , parentKey = othis.data('parentkey');
+
+            //                        layui.each(options.cols, function (i1, item1) {
+            //                            layui.each(item1, function (i2, item2) {
+            //                                if (i1 + '-' + i2 === key) {
+            //                                    var hide = item2.hide;
+
+            //                                    //鍚屾鍕鹃�夊垪鐨� hide 鍊煎拰闅愯棌鏍峰紡
+            //                                    item2.hide = !checked;
+            //                                    that.elem.find('*[data-key="' + options.index + '-' + key + '"]')
+            //                                    [checked ? 'removeClass' : 'addClass'](HIDE);
+
+            //                                    //鏍规嵁鍒楃殑鏄剧ず闅愯棌锛屽悓姝ュ绾ц〃澶寸殑鐖剁骇鐩稿叧灞炴�у��
+            //                                    if (hide != item2.hide) {
+            //                                        that.setParentCol(!checked, parentKey);
+            //                                    }
+
+            //                                    //閲嶆柊閫傞厤灏哄
+            //                                    that.resize();
+            //                                }
+            //                            });
+            //                        });
+            //                    });
+            //                }
+            //            });
+            //            break;
+            //    }
             //});
 
+            //鐩戝惉澶村伐鍏锋爮
+            //table.on('toolbar(mainTable)', function (obj) {
+            //    console.log(obj);
+            //    if (obj.event === 'LAYTABLE_COLS')
+            //    {
+
+            //    }
+            //    //if (obj.event === 'refresh') {
+            //    //    reloadTable();
+            //    //}
+            //    //else if (obj.event === 'LAYTABLE_EXCEL') {
+            //    //    var formSelect = form.val('searchForm');
+            //    //    $.ajax({
+            //    //        type: 'get'
+            //    //        , url: ctx + '/inventoryReport/getInventoryHistoryList'
+            //    //        , data: formSelect
+            //    //        , success: function (res) {
+            //    //            table.exportFile('tableList', res.data, 'xls');
+            //    //        }
+            //    //    });
+            //    //}
+            //});
 
             //浠ヤ笂鏄痩ayui妯″潡
         });
-
 
 
 

--
Gitblit v1.9.1