From 2f053f201b7a0e8cc07cf932940bfbf5d0fedaa3 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期二, 09 一月 2024 17:04:39 +0800
Subject: [PATCH] 1

---
 WebTM/views/设备管理/Sb_Add_EqpMaintenanceBillList.html |  563 +++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 517 insertions(+), 46 deletions(-)

diff --git "a/WebTM/views/\350\256\276\345\244\207\347\256\241\347\220\206/Sb_Add_EqpMaintenanceBillList.html" "b/WebTM/views/\350\256\276\345\244\207\347\256\241\347\220\206/Sb_Add_EqpMaintenanceBillList.html"
index 4ad9059..b96d197 100644
--- "a/WebTM/views/\350\256\276\345\244\207\347\256\241\347\220\206/Sb_Add_EqpMaintenanceBillList.html"
+++ "b/WebTM/views/\350\256\276\345\244\207\347\256\241\347\220\206/Sb_Add_EqpMaintenanceBillList.html"
@@ -10,7 +10,7 @@
     <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
     <style type="text/css">
         .layui-form-label {
-            width: 85px;
+            width: 95px;
         }
     </style>
 </head>
@@ -37,7 +37,7 @@
                                 <li class="layui-this">鍩烘湰淇℃伅</li>-->
                                 <!--<li>鍏朵粬淇℃伅</li>-->
                                 <!--</ul>-->
-                                <h1 style="text-align:center;"><b>璁惧缁翠慨鍗�</b></h1>
+                                <h1 style="text-align:center;"><b>璁惧缁翠慨璁板綍鍗�</b></h1>
                                 <div class="layui-tab-content">
                                     <div class="layui-tab-item layui-show">
                                         <div class="layui-form-item">
@@ -62,7 +62,7 @@
                                                 </div>
                                             </div>
                                             <div class="layui-inline">
-                                                <label class="layui-form-label">缁翠慨浜�</label>
+                                                <label class="layui-form-label">缁翠慨浜�<label style="color:red"> * </label></label>
                                                 <div class="layui-input-inline">
                                                     <input type="text" name="HEmpName" id="HEmpName" class="layui-input" value="" style="float:left;width:150px;">
                                                     <input type="hidden" name="HEmpID" id="HEmpID" class="layui-input" value="" style="float:left;width:150px;">
@@ -75,13 +75,13 @@
                                         </div>
                                         <div class="layui-form-item">
                                             <div class="layui-inline">
-                                                <label class="layui-form-label">缁翠慨寮�濮�</label>
+                                                <label class="layui-form-label">缁翠慨寮�濮�<label style="color:red"> * </label></label>
                                                 <div class="layui-input-inline">
                                                     <input class="layui-input" name="HRepairBeginDate" id="HRepairBeginDate" autocomplete="off" timeFormat="yyyy-MM-dd">
                                                 </div>
                                             </div>
                                             <div class="layui-inline">
-                                                <label class="layui-form-label">璁惧</label>
+                                                <label class="layui-form-label">璁惧<label style="color:red"> * </label></label>
                                                 <div class="layui-input-inline">
                                                     <input type="text" name="HEquipName" id="HEquipName" class="layui-input" value="" style="float:left;width:150px;">
                                                     <input type="hidden" name="HEquipID" id="HEquipID" class="layui-input" value="" style="float:left;width:150px;">
@@ -91,7 +91,7 @@
                                                 </div>
                                             </div>
                                             <div class="layui-inline">
-                                                <label class="layui-form-label">璐熻矗浜�</label>
+                                                <label class="layui-form-label">璐熻矗浜�<label style="color:red"> * </label></label>
                                                 <div class="layui-input-inline">
                                                     <input type="text" name="HManagerName" id="HManagerName" class="layui-input" value="" style="float:left;width:150px;">
                                                     <input type="hidden" name="HManagerID" id="HManagerID" class="layui-input" value="" style="float:left;width:150px;">
@@ -101,7 +101,7 @@
                                                 </div>
                                             </div>
                                             <div class="layui-inline">
-                                                <label class="layui-form-label">缁翠慨缁撴潫</label>
+                                                <label class="layui-form-label">缁翠慨缁撴潫<label style="color:red"> * </label></label>
                                                 <div class="layui-input-inline">
                                                     <input class="layui-input" name="HRepairEndDate" id="HRepairEndDate" autocomplete="off" timeFormat="yyyy-MM-dd">
                                                 </div>
@@ -109,7 +109,7 @@
                                         </div>
                                         <div class="layui-form-item">
                                             <div class="layui-inline">
-                                                <label class="layui-form-label">缁翠慨椤圭洰</label>
+                                                <label class="layui-form-label">缁翠慨椤圭洰<label style="color:red"> * </label></label>
                                                 <div class="layui-input-inline">
                                                     <input type="text" name="HRepairName" id="HRepairName" class="layui-input" value="" style="float:left;width:150px;">
                                                     <input type="hidden" name="HRepairID" id="HRepairID" class="layui-input" value="" style="float:left;width:150px;">
@@ -119,7 +119,7 @@
                                                 </div>
                                             </div>
                                             <div class="layui-inline">
-                                                <label class="layui-form-label">缁翠慨閮ㄩ棬</label>
+                                                <label class="layui-form-label">缁翠慨閮ㄩ棬<label style="color:red"> * </label></label>
                                                 <div class="layui-input-inline">
                                                     <input type="text" name="HDeptName" id="HDeptName" class="layui-input" value="" style="float:left;width:150px;">
                                                     <input type="hidden" name="HDeptID" id="HDeptID" class="layui-input" value="" style="float:left;width:150px;">
@@ -135,9 +135,9 @@
                                                 </div>
                                             </div>
                                             <div class="layui-inline">
-                                                <label class="layui-form-label">瀹為檯缁翠慨宸ユ椂</label>
+                                                <label class="layui-form-label">瀹為檯缁翠慨宸ユ椂<label style="color:red"> * </label></label>
                                                 <div class="layui-input-inline">
-                                                    <input type="text" name="HTimes" id="HTimes" class="layui-input" value="">
+                                                    <input type="text" name="HTimes" id="HTimes" class="layui-input" value="" style="margin-left:5px">
                                                 </div>
                                             </div>
                                         </div>
@@ -151,6 +151,29 @@
                                                     </select>
                                                 </div>
                                             </div>
+                                            <div class="layui-inline">
+                                                <label class="layui-form-label">婧愬崟绫诲瀷</label>
+                                                <div class="layui-input-inline">
+                                                    <select name="HMainSourceBillType" lay-filter="HMainSourceBillType" id="HMainSourceBillType">
+                                                        <option value="璁惧缁翠慨鐧昏鍗�" selected="selected">璁惧缁翠慨鐧昏鍗�</option>
+                                                        <option value="鎵嬪伐褰曞叆">鎵嬪伐褰曞叆</option>
+                                                        <option value="璁惧缁翠慨娲惧伐鍗�">璁惧缁翠慨娲惧伐鍗�</option>
+                                                    </select>
+                                                </div>
+                                            </div>
+                                            <div class="layui-inline">
+                                                <label class="layui-form-label">閫夊崟鍙�</label>
+                                                <div class="layui-input-inline">
+                                                    <input type="text" name="HMainSourceBillNo" id="HMainSourceBillNo" class="layui-input" value="" style="float:left;width:150px;">
+                                                    <input type="hidden" name="HMainSourceInterID" id="HMainSourceInterID" class="layui-input" value="" style="float:left;width:150px;">
+                                                    <input type="hidden" name="HMainSourceEntryID" id="HMainSourceEntryID" class="layui-input" value="" style="float:left;width:150px;">
+                                                    <button type="button" lay-submit="" class="layui-btn" lay-filter="XDHList" id="XDHList" style="width:40px;">
+                                                        <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
+                                                    </button>
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="layui-form-item">
                                             <div class="layui-inline">
                                                 <label class="layui-form-label">缁翠慨鍐呭</label>
                                                 <div class="layui-input-inline">
@@ -175,14 +198,38 @@
                             </div>
                         </div>
 
-                        <table class="layui-hide" id="mainTable" lay-filter="mainTable"></table>
+                        <div class="layui-tab layui-tab-card" lay-filter="TabTest">
+                            <ul class="layui-tab-title">
+                                <li class="layui-this">缁翠慨淇℃伅</li>
+                                <li>閰嶄欢淇℃伅</li>
+                            </ul>
+                            <div class="layui-tab-content">
+                                <div class="layui-tab-item layui-show">
+                                    <table class="layui-hide" id="mainTable" lay-filter="mainTable"></table>
+                                </div>
+                                <div class="layui-tab-item">
+                                    <table class="layui-hide" id="mainTable1" lay-filter="mainTable1"></table>
+                                </div>
+                            </div>
+                        </div>
                         <script type="text/html" id="toolbarDemo">
                             <div class="layui-btn-container">
                                 <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-AddLine"><i class="layui-icon layui-icon-form"></i>澧炲姞涓�琛�</button>
                                 <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-CopyLine"><i class="layui-icon layui-icon-form"></i>澶嶅埗涓�琛�</button>
                             </div>
                         </script>
+                        <script type="text/html" id="toolbarDemo1">
+                            <div class="layui-btn-container">
+
+                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-AddLine1"><i class="layui-icon layui-icon-form"></i>澧炲姞涓�琛�</button>
+                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-CopyLine1"><i class="layui-icon layui-icon-form"></i>澶嶅埗涓�琛�</button>
+
+                            </div>
+                        </script>
                         <script type="text/html" id="xuhao">
+                            {{d.LAY_TABLE_INDEX+1}}
+                        </script>
+                        <script type="text/html" id="xuhao1">
                             {{d.LAY_TABLE_INDEX+1}}
                         </script>
                     </form>
@@ -191,6 +238,10 @@
         </div>
     </div>
     <script type="text/html" id="barDemo">
+        <!--<a class="layui-btn layui-btn-xs" lay-event="edit">缂栬緫</a>-->
+        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">鍒犻櫎</a>
+    </script>
+    <script type="text/html" id="barDemo1">
         <!--<a class="layui-btn layui-btn-xs" lay-event="edit">缂栬緫</a>-->
         <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">鍒犻櫎</a>
     </script>
@@ -224,20 +275,27 @@
                 , laydate = layui.laydate
                 , element = layui.element;
 
-            var option;
+            var option;//缁翠慨淇℃伅
+            var option1 = [];//閰嶄欢
             var sBillType = "3910";
-            var TabRow = { "HRepairID1": 0, "HRepairCode": "", "HRepairName": "", "HManagerID1": 0, "HManagerCode": "", "HManagerName": "", "HRepairExplanation": "", "HRemark": "" };
+            //var TabRow = { "HRepairID1": 0, "HRepairCode": "", "HRepairName": "", "HManagerID1": 0, "HManagerCode": "", "HManagerName": "", "HRepairExplanation": "", "HRemark": "" };
             //#endregion
 
             //#region 杩涘叆椤甸潰鍗冲姞杞�
-
             //鍒濆鍖栬〃鍗曟彃浠�
             set_InitFrom();
-
             //鍒濆鍖栬〃鏍�
             set_InitGrid();
+            set_InitGrid_pj();
             //鍒ゆ柇鎿嶄綔绫诲瀷
             if (OperationType == 1) {//鏃犳簮鍗�
+                $("#HEmpID").val(sessionStorage["HEmpID"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭缁翠慨浜篒D
+                $("#HEmpName").val(sessionStorage["HEmpName"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭缁翠慨浜�
+                $("#HDeptID").val(sessionStorage["HDeptID"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭閮ㄩ棬ID
+                $("#HDeptName").val(sessionStorage["HDept"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭閮ㄩ棬
+                $("#HManagerID").val(sessionStorage["HEmpID"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭璐熻矗浜篒D
+                $("#HManagerName").val(sessionStorage["HEmpName"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭璐熻矗浜�
+
                 set_AddFNew();
             }
             else if (OperationType == 3) {//缂栬緫
@@ -248,13 +306,34 @@
             }
             //#endregion
 
+
+            //鑾峰彇涓嬫媺閫変腑鍊�
+            form.on('select(HMainSourceBillType)', function (data) {
+                Sctag = data.value;
+                form.render('select');
+                switch (Sctag) {
+                    //鏃犳簮鍗曟柊澧�
+                    case '鎵嬪伐褰曞叆':
+                        $('#HMainSourceBillNo').attr("disabled", false);
+                        $('#XDHList').addClass("layui-btn-disabled").attr("disabled", true);
+                        break;
+                    //鏈夋簮鍗曟柊澧灺� 聽
+                    default:
+                        $('#HMainSourceBillNo').attr("disabled", true);
+                        $('#XDHList').removeClass("layui-btn-disabled").attr("disabled", false);
+                        break;
+                }
+            });
+
+
+
             //#region 瑙﹀彂浜嬩欢锛氬寘鎷琭orm.on(){}鏍煎紡鐨勬墍鏈夌偣鍑讳簨浠躲�侀�夋嫨浜嬩欢绛�
 
             //澶村伐鍏锋爮浜嬩欢
             table.on('toolbar(mainTable)', function (obj) {
                 var checkStatus = table.checkStatus('mainTable')
                     , data = checkStatus.data;;
-                var NewRow = TabRow;
+                var NewRow = { "HRepairID": 0, "HRepairCode": "", "HRepairName": "", "HManagerID": sessionStorage["HEmpID"], "HManagerCode": sessionStorage["HEmpNumber"], "HManagerName": sessionStorage["HEmpName"], "HRepairExplanation": "", "HRemark": ""/*, "HSourceInterID": 0, "HSourceEntryID": 0, "HSourceBillNo": " ", "HSourceBillType": " " */ };
                 switch (obj.event) {
                     //澧炲姞涓�琛�
                     case 'btn-AddLine': set_AddLine(NewRow);
@@ -264,11 +343,32 @@
                         break;
                 }
             });
+            //澶村伐鍏锋爮浜嬩欢
+            table.on('toolbar(mainTable1)', function (obj) {
+                var checkStatus = table.checkStatus('mainTable1')
+                    , data = checkStatus.data;
+                var NewRow = { "HMaterID": 0, "HMaterNumber": "", "HMaterName": "", "HUnitID": 0, "HUnitNumber": "", "HUnitName": "", "HManagerID": sessionStorage["HEmpID"], "HManagerNumber": sessionStorage["HEmpNumber"], "HManagerName": sessionStorage["HEmpName"], "HQty": "0", "HRemark": "" };
+                switch (obj.event) {
+                    //鏂板涓�琛�
+                    case 'btn-AddLine1': btnAddLine1(NewRow);
+                        break;
+                    //澶嶅埗涓�琛�
+                    case 'btn-CopyLine1': btnCopyLine1(data);
+                        break;
+                }
+            });
 
-            //琛屽唴浜嬩欢
+            //琛屽唴浜嬩欢 缁翠慨
             table.on('tool(mainTable)', function (obj) {
                 set_GridDelete(obj);   //琛屽唴鍒犻櫎
                 set_GridCellCheck(obj); //琛屽唴蹇嵎閿瓫閫�
+
+            });
+
+            //琛屽唴浜嬩欢 閰嶄欢
+            table.on('tool(mainTable1)', function (obj) {
+                set_GridDelete1(obj);   //琛屽唴鍒犻櫎
+                set_GridCellCheck1(obj); //琛屽唴蹇嵎閿瓫閫�
 
             });
 
@@ -333,7 +433,7 @@
                             return layer.msg('璇烽�夋嫨鏁版嵁');
                         }
                         $("#HEquipName").val(checkStatus.data[0].HName);
-                        $("#HEquipID").val(checkStatus.data[0].HItemID);
+                        $("#HEquipID").val(checkStatus.data[0].HInterID);
                         layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
                     }
                     , btn2: function (index, layero) {
@@ -463,14 +563,143 @@
                 });
             });
 
+            //琛ㄥご淇℃伅閫夋嫨鍗曟嵁寮圭獥
+            form.on('submit(XDHList)', function () {
+
+                if ($("#HMainSourceBillType").val() == "璁惧缁翠慨鐧昏鍗�") {
+                    //椤甸潰灞�-鑷畾涔�
+                    layer.open({
+                        type: 2,
+                        skin: 'layui-layer-rim', //鍔犱笂杈规
+                        title: '璁惧鏁呴殰鐧昏鍗�',
+                        shift: 2,
+                        area: ['90%', '90%'],
+                        content: ['../璁惧绠$悊/Sb_EqpConkBookBillList.html', 'yes'],
+                        btn: ['纭畾', '鍙栨秷']
+                        , btn1: function (index, layero) {
+                            //var NewRow = { "HRepairID": 0, "HRepairCode": "", "HRepairName": "", "HManagerID": 0, "HManagerCode": "", "HManagerName": "", "HRepairExplanation": "", "HRemark": "", "HSourceInterID": 0, "HSourceEntryID": 0, "HSourceBillNo": " ", "HSourceBillType": " " };
+                            ////鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
+                            var iframeWindow = window['layui-layer-iframe' + index]  //鑾峰彇寮规椤甸潰
+                            var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//鑾峰彇table鐨別lem:"#test"
+                            if (checkStatus.data.length === 0) {
+                                return layer.msg('璇烽�夋嫨鍗曟嵁鏁版嵁');
+                            }
+                            $("#HMainSourceBillNo").val(checkStatus.data[0].鍗曟嵁鍙�);
+                            $("#HMainSourceInterID").val(checkStatus.data[0].hmainid);
+                            $("#HMainSourceEntryID").val(checkStatus.data[0].hsubid);
+                            //鍥炲~璁惧淇℃伅
+                            $("#HEquipName").val(checkStatus.data[0].璁惧鍚嶇О);
+                            $("#HEquipID").val(checkStatus.data[0].HEquipID);
+                            ////鎸夐�夊崟鍙峰姞杞借〃浣撴暟鎹�
+                            //$.ajax({
+                            //    url: GetWEBURL() + 'Sb_EqpRepairWorkBill/Sb_EqpRepairWorkBillSubByHMainSourceBillNo',
+                            //    type: "GET",
+                            //    data: { "HMainSourceBillNo": checkStatus.data[0].鍗曟嵁鍙� },
+                            //    success: function (result) {
+                            //        if (result.count == 1) {
+                            //            var EndData = result.data;
+                            //            var rowdate = layui.table.cache["mainTable"];
+                            //            if (rowdate.length == 0)  //琛ㄤ綋鏁版嵁涓虹┖鏃�
+                            //            {
+                            //                buttonArr = [];//娓呯┖鏁扮粍
+                            //                for (var i = 0; i < checkStatus.data.length; i++) {
+                            //                    var checkrow = { "HRepairID": 0, "HRepairCode": "", "HRepairName": "", "HManagerID": 0, "HManagerCode": "", "HManagerName": "", "HRepairExplanation": "", "HRemark": "", "HSourceInterID": EndData[i].hmainid, "HSourceEntryID": EndData[i].hsubid, "HSourceBillNo": EndData[i].鍗曟嵁鍙�, "HSourceBillType": EndData[i].HBillType };
+                            //                    buttonArr.push(checkrow);  //灏嗕箣鍓嶇殑鏁版嵁瀛樺偍
+                            //                }
+                            //                table.reload("mainTable", {
+                            //                    data: buttonArr    //灏嗘暟鎹噸鏂拌浇鍏ヨ〃鏍�
+                            //                })
+                            //            }
+                            //            else {
+                            //                buttonArr = [];//娓呯┖鏁扮粍
+                            //                for (var i = 0; i < EndData.length; i++) {
+                            //                    var checkrow = {
+                            //                        "HRepairID": rowdate[i].HRepairID, "HRepairCode": rowdate[i].HRepairCode, "HRepairName": rowdate[i].HRepairName,
+                            //                        "HRepairExplanation": rowdate[i].HRepairExplanation, "HManagerID": rowdate[i].HManagerID, "HManagerCode": rowdate[i].HManagerCode,
+                            //                        "HManagerName": rowdate[i].HManagerName, "HMoney": rowdate[i].HMoney, "HRemark": rowdate[i].HRemark,
+                            //                        "HSourceInterID": EndData[i].hmainid, "HSourceEntryID": EndData[i].hsubid,
+                            //                        "HSourceBillNo": EndData[i].鍗曟嵁鍙�, "HSourceBillType": EndData[i].HBillType
+                            //                    };
+                            //                    buttonArr.push(checkrow);  //灏嗕箣鍓嶇殑鏁版嵁瀛樺偍
+                            //                }
+                            //                table.reload("mainTable", {
+                            //                    data: buttonArr    //灏嗘暟鎹噸鏂拌浇鍏ヨ〃鏍�
+                            //                })
+                            //            }
+                            //        } else {
+                            //            layer.alert(result.code + result.Message, { icon: 5 });
+                            //        }
+                            //    }, error: function () {
+                            //        layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                            //    }
+                            //});
+                            layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
+                        }
+                        , btn2: function (index, layero) {
+                            //鎸夐挳銆愭寜閽簩銆戠殑鍥炶皟
+                            //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
+                        },
+                        end: function () {
+
+                        },
+                        success: function (layero, index) {
+                            //layer.full(index);
+                        }
+                    });
+                } else if ($("#HMainSourceBillType").val() == "璁惧缁翠慨娲惧伐鍗�") {
+                    //椤甸潰灞�-鑷畾涔�
+                    layer.open({
+                        type: 2,
+                        skin: 'layui-layer-rim', //鍔犱笂杈规
+                        title: '璁惧缁翠慨娲惧伐鍗�',
+                        shift: 2,
+                        area: ['90%', '90%'],
+                        content: ['../璁惧绠$悊/璁惧缁翠慨娲惧伐鍗�/Sb_EquipRepairSendWorkBillList.html', 'yes'],
+                        btn: ['纭畾', '鍙栨秷']
+                        , btn1: function (index, layero) {
+                            //鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
+                            var iframeWindow = window['layui-layer-iframe' + index]  //鑾峰彇寮规椤甸潰
+                            var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//鑾峰彇table鐨別lem:"#test"
+                            if (checkStatus.data.length !=1 ) {
+                                return layer.msg('璇烽�夋嫨涓�鏉″崟鎹暟鎹�');
+                            }
+                            $("#HMainSourceBillNo").val(checkStatus.data[0].鍗曟嵁鍙�);
+                            $("#HMainSourceInterID").val(checkStatus.data[0].hmainid);
+                            $("#HMainSourceEntryID").val(checkStatus.data[0].hsubid);
+                            //鍥炲~璁惧淇℃伅
+                            $("#HEquipName").val(checkStatus.data[0].璁惧);
+                            $("#HEquipID").val(checkStatus.data[0].HEquipID);
+                         
+                            layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
+                        }
+                    });
+                }
+            });
+
             //淇濆瓨
             form.on('submit(Saver)', function (data) {
-                //debugger;
+                var num = [];
+                for (var i = 0; i < table.cache["mainTable"].length; i++) {
+                    if (table.cache["mainTable"][i] != "") {
+                        table.cache["mainTable"][i].LAY_TABLE_INDEX = i;
+                        num.push(table.cache["mainTable"][i])
+                    }
+                }
+                var num1 = [];
+                for (var i = 0; i < table.cache["mainTable1"].length; i++) {
+                    if (table.cache["mainTable1"][i] != "") {
+                        table.cache["mainTable1"][i].LAY_TABLE_INDEX = i;
+                        num1.push(table.cache["mainTable1"][i])
+                    }
+                }
+
                 data.field.HMaker = sessionStorage["HUserName"];//鍒跺崟浜�
                 var sMainStr = JSON.stringify(data.field);
-                var sSubStr = JSON.stringify(table.cache['mainTable']);
-                var sMainSub = sMainStr + ';' + sSubStr;
+                var sSubStr = JSON.stringify(num);
+                var sSubStr1 = JSON.stringify(num1);
+                var sMainSub = sMainStr + ';' + sSubStr + ";" + sessionStorage["HUserName"] + ";" + sSubStr1 ;
                 //瀵规暟鎹繘琛岄獙璇�
+              
                 if (AllowLoadData(sSubStr)) {
                     $.ajax(
                         {
@@ -481,14 +710,11 @@
                             dataType: "json",
                             success: function (data) {
                                 if (data.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
-                                    layer.msg(data.Message, { time: 1 * 1000, icon: 1 }, function () {
-                                        $('#add-btn').addClass("layui-btn-disabled").attr("disabled", true);
-                                        var index = parent.layer.getFrameIndex(window.name); //鍏堝緱鍒板綋鍓峣frame灞傜殑绱㈠紩
-                                        parent.layer.close(index); //鍐嶆墽琛屽叧闂� 聽 聽 聽 聽 聽聽 聽聽聽 聽
-                                    });
+                                    $('#add-btn').addClass("layui-btn-disabled").attr("disabled", true);
+                                    layer.msg(data.Message, { time: 1 * 1000, icon: 1 });
                                 }
                                 else {
-                                    f_alert(data.Message);
+                                    layer.alert("淇濆瓨澶辫触")
                                     console.log("Reason" + sMainStr + "sub:" + JSON.stringify(layui.table.cache.mainTable));
                                 }
                                 layer.closeAll("loading");
@@ -504,8 +730,14 @@
 
             //閫�鍑�
             form.on('submit(Exit)', function (data) {//
-                var index = parent.layer.getFrameIndex(window.name); //鍏堝緱鍒板綋鍓峣frame灞傜殑绱㈠紩
-                parent.layer.close(index); //鍐嶆墽琛屽叧闂�
+                if (linterid == undefined) {
+                    //鍏抽棴椤电
+                    Pub_Close(2);
+                }
+                else {
+                    //鍏抽棴椤电
+                    Pub_Close(1);
+                }
             });
 
             //#endregion
@@ -527,20 +759,24 @@
                 });
             }
 
-            //鍒濆鍖栬〃鏍�
+            //鍒濆鍖栬〃鏍� 缁翠慨
             function set_InitGrid() {
                 //琛ㄥご
                 columns = [
                     { type: 'checkbox', fixed: 'left' }
                     , { templet: '#xuhao', title: '搴忓彿', sort: true, fixed: 'left', event: "qwe" }
-                    , { field: 'HRepairID1', title: 'HRepairID1', edit: 'text', event: "", hide: true }
+                    , { field: 'HRepairID', title: 'HRepairID', edit: 'text', event: "", hide: true }
                     , { field: 'HRepairCode', title: '缁翠慨椤圭洰浠g爜', edit: 'text', event: "", event: "HRepairCode" }
                     , { field: 'HRepairName', title: '缁翠慨椤圭洰', edit: 'text', event: "" }
-                    , { field: 'HManagerID1', title: 'HManagerID1', edit: 'text', hide: true }
+                    , { field: 'HManagerID', title: 'HManagerID', edit: 'text', hide: true }
                     , { field: 'HManagerCode', title: '璐熻矗浜轰唬鐮�', edit: 'text', event: "HManagerCode" }
                     , { field: 'HManagerName', title: '璐熻矗浜�', edit: 'text' }
                     , { field: 'HRepairExplanation', title: '缁翠慨瑕佹眰', edit: 'text' }
                     , { field: 'HRemark', title: '澶囨敞', event: "", edit: 'text' }
+                    //, { field: 'HSourceInterID', title: '婧愬崟涓诲唴鐮�' }
+                    //, { field: 'HSourceEntryID', title: '婧愬崟瀛愬唴鐮�' }
+                    //, { field: 'HSourceBillNo', title: '婧愬崟鍗曞彿' }
+                    //, { field: 'HSourceBillType', title: '婧愬崟绫诲瀷' }
                     , { fixed: 'right', title: '鎿嶄綔', toolbar: '#barDemo', width: 150 }
                 ];
                 option = {
@@ -549,7 +785,40 @@
                     , toolbar: '#toolbarDemo'
                     , page: true
                     , cellMinWidth: 120
-                    , height: 500
+                    , height: 300
+                    , cols: [columns]
+                    , done: function (res, curr, count) {
+
+                    }
+                };
+            }
+
+            //鍒濆鍖栬〃鏍� 閰嶄欢
+            function set_InitGrid_pj() {
+                //琛ㄥご
+                columns = [
+                    { type: 'checkbox', fixed: 'left' }
+                    , { templet: '#xuhao1', title: '搴忓彿', sort: true, fixed: 'left', event: "qwe" }
+                    , { field: 'HMaterID', title: '閰嶄欢ID', edit: 'text', hide: true }
+                    , { field: 'HMaterNumber', title: '閰嶄欢浠g爜', edit: 'text', event: "HMaterCode" }
+                    , { field: 'HMaterName', title: '閰嶄欢鍚嶇О', edit: 'text', event: "" }
+                    , { field: 'HUnitID', title: '鍗曚綅ID', edit: 'text', hide: true }
+                    , { field: 'HUnitNumber', title: '鍗曚綅浠g爜', edit: 'text', event: "HUnitCode" }
+                    , { field: 'HUnitName', title: '鍗曚綅鍚嶇О', edit: 'text', event: "" }
+                    , { field: 'HManagerID', title: '璐熻矗浜篒D', edit: 'text', hide: true }
+                    , { field: 'HManagerNumber', title: '璐熻矗浜轰唬鐮�', edit: 'text', event: 'HManagerNumber' }
+                    , { field: 'HManagerName', title: '璐熻矗浜�', edit: 'text' }
+                    , { field: 'HQty', title: '鐢ㄩ噺', edit: 'text' }
+                    , { field: 'HRemark', title: '澶囨敞', edit: 'text' }
+                    , { fixed: 'right', title: '鎿嶄綔', toolbar: '#barDemo1', width: 150 }
+                ];
+                option1 = {
+                    id: 'mainTable1'
+                    , elem: '#mainTable1'
+                    , toolbar: '#toolbarDemo1'
+                    , page: true
+                    , cellMinWidth: 120
+                    , height: 300
                     , cols: [columns]
                     , done: function (res, curr, count) {
 
@@ -561,8 +830,10 @@
             function set_AddFNew() {
                 //鑾峰彇鏈�澶у崟鎹彿
                 get_MAXNum();
-                option.data = [TabRow];
+                option.data = [{ "HRepairID": 0, "HRepairCode": "", "HRepairName": "", "HManagerID": sessionStorage["HEmpID"], "HManagerCode": sessionStorage["HEmpNumber"], "HManagerName": sessionStorage["HEmpName"], "HRepairExplanation": "", "HRemark": ""/*, "HSourceInterID": 0, "HSourceEntryID": 0, "HSourceBillNo": " ", "HSourceBillType": " "*/ }];
+                option1.data = [{ "HMaterID": 0, "HMaterNumber": "", "HMaterName": "", "HUnitID": 0, "HUnitNumber": "", "HUnitName": "", "HManagerID": sessionStorage["HEmpID"], "HManagerNumber": sessionStorage["HEmpNumber"], "HManagerName": sessionStorage["HEmpName"], "HQty": "0", "HRemark": "" }];
                 table.render(option);
+                table.render(option1);
             }
 
             //鑾峰彇鏈�澶у崟鎹彿鍙婇粯璁ゅ�艰祴鍊�
@@ -589,8 +860,10 @@
             function set_EditFromGrid() {
                 set_EditForm(linterid);  //缂栬緫鑾峰彇琛ㄥご
                 set_EditGrid(linterid);  //缂栬緫鑾峰彇琛ㄤ綋
-                option.data = [TabRow];
+                option.data = [{ "HRepairID": 0, "HRepairCode": "", "HRepairName": "", "HManagerID": 0, "HManagerCode": "", "HManagerName": "", "HRepairExplanation": "", "HRemark": ""/*, "HSourceInterID": 0, "HSourceEntryID": 0, "HSourceBillNo": " ", "HSourceBillType": " " */ }];
                 table.render(option);
+                option1.data = [{ "HMaterID": 0, "HMaterNumber": "", "HMaterName": "", "HUnitID": 0, "HUnitNumber": "", "HUnitName": "", "HManagerID": "0 ", "HManagerNumber": " ", "HManagerName": " ", "HQty": "0", "HRemark": "" }];
+                table.render(option1);
             }
 
             //缂栬緫鍔犺浇琛ㄥご
@@ -627,6 +900,10 @@
                                 , "HRepairContent": data.缁翠慨鍐呭         //缁翠慨鍐呭
                                 , "HExplanation": data.缁翠慨瑕佹眰           //缁翠慨瑕佹眰
                                 , "HRemark": data.琛ㄥご澶囨敞                //澶囨敞
+                                , "HMainSourceBillType": data.HMainSourceBillType
+                                , "HMainSourceBillNo": data.HMainSourceBillNo
+                                , "HMainSourceInterID": data.HMainSourceInterID
+                                , "HMainSourceEntryID": data.HMainSourceEntryID
                             });
 
                         } else {
@@ -658,11 +935,13 @@
                 $.ajax({
                     url: GetWEBURL() + 'Sb_EqpRepairWorkBill/Sb_EqpRepairWorkBillListProjectDetai',
                     type: "GET",
-                    data: { "sqlWhere": "and hmainid=" + linterid },
+                    data: { "HInterID":linterid },
                     success: function (result) {
                         if (result.count == 1) {
-                            option.data = result.data;
+                            option.data = result.list[0];
                             table.render(option);
+                            option1.data = result.list[1];
+                            table.render(option1);
                         } else {
                             layer.alert(result.code + result.Message, { icon: 5 });
                         }
@@ -720,7 +999,7 @@
                                     }
                                     //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
                                     obj.update({
-                                        HRepairID1: checkStatus.data[0].HItemID,
+                                        HRepairID: checkStatus.data[0].HItemID,
                                         HRepairCode: checkStatus.data[0].HNumber,
                                         HRepairName: checkStatus.data[0].HName,
                                     });
@@ -761,7 +1040,7 @@
 
                                     //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
                                     obj.update({
-                                        HManagerID1: checkStatus.data[0].HItemID,
+                                        HManagerID: checkStatus.data[0].HItemID,
                                         HManagerCode: checkStatus.data[0].HNumber,
                                         HManagerName: checkStatus.data[0].HName
                                     });
@@ -785,13 +1064,162 @@
                 })
             }
 
-            //澧炲姞涓�琛�
-            function set_AddLine(NewRow) {
-                table.cache["mainTable"].push(NewRow);
-                option.data = table.cache["mainTable"];
-                table.render(option);
+            // 琛屽唴鍒犻櫎  閰嶄欢
+            function set_GridDelete1(obj) {
+                var data = obj.data;
+                var rowIndex = $(obj.tr).attr("data-index");
+                if (obj.event === 'del') {
+                    layer.confirm('鐪熺殑鍒犻櫎琛屼箞', function (index) {
+                        console.log("绱㈠紩涓�:" + rowIndex);
+                        if (rowIndex === '0') {
+                            layer.msg('棣栬鏃犳硶鍒犻櫎锛侊紒锛�');
+                        } else {
+                            //obj.del();
+                            //layer.close(index);
+                            var oldData = table.cache["mainTable1"];
+                            oldData.splice(obj.tr.data('index'), 1);
+                            table.reload('mainTable1', { data: oldData });
+                            layer.close(index);
+                        }
+                    });
+                }
             }
 
+            // 琛ㄦ牸琛屽唴浜嬩欢蹇嵎閿瓫閫�1 閰嶄欢
+            function set_GridCellCheck1(obj) {
+                $(document).off('keydown', ".layui-table-edit").on('keydown', '.layui-table-edit', function (e) {
+                    if (event.key == "F7") {
+                        //鍗曚綅浠g爜
+                        if (obj.event === 'HUnitCode') {
+                            //椤甸潰灞�-鑷畾涔�
+                            layer.open({
+                                type: 2,
+                                skin: 'layui-layer-rim', //鍔犱笂杈规
+                                title: '鍗曚綅鍒楄〃',
+                                closeBtn: 1,
+                                shift: 2,
+                                area: ['90%', '90%'],
+                                maxmin: true,
+                                content: ['../PublicPage/UnitInformation.html', 'yes'],
+                                btn: ['纭畾', '鍙栨秷']
+                                , btn1: function (index, layero) {
+                                    //鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
+                                    var iframeWindow = window['layui-layer-iframe' + index]  //鑾峰彇寮规椤甸潰
+                                    var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//鑾峰彇table鐨別lem:"#test"
+                                    if (checkStatus.data.length === 0) {
+                                        return layer.msg('璇烽�夋嫨鏁版嵁');
+                                    }
+                                    //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
+                                    obj.update({
+                                        HUnitID: checkStatus.data[0].HItemID,
+                                        HUnitNumber: checkStatus.data[0].HNumber,
+                                        HUnitName: checkStatus.data[0].HName
+                                    });
+                                    layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
+                                }
+                                , btn2: function (index, layero) {
+                                    //鎸夐挳銆愭寜閽簩銆戠殑鍥炶皟
+                                    //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
+                                },
+                                end: function () {
+                                }
+                            });
+                        }
+                        //閰嶄欢浠g爜
+                        if (obj.event === 'HMaterCode') {
+                            //椤甸潰灞�-鑷畾涔�
+                            layer.open({
+                                type: 2,
+                                skin: 'layui-layer-rim', //鍔犱笂杈规
+                                title: '閰嶄欢鍒楄〃',
+                                closeBtn: 1,
+                                shift: 2,
+                                area: ['90%', '90%'],
+                                maxmin: true,
+                                content: ['../PublicPage/PartInformation.html', 'yes'],
+                                btn: ['纭畾', '鍙栨秷']
+                                , btn1: function (index, layero) {
+                                    //鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
+                                    var iframeWindow = window['layui-layer-iframe' + index]  //鑾峰彇寮规椤甸潰
+                                    var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//鑾峰彇table鐨別lem:"#test"
+                                    if (checkStatus.data.length === 0) {
+                                        return layer.msg('璇烽�夋嫨鏁版嵁');
+                                    }
+                                    //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
+                                    obj.update({
+                                        HMaterID: checkStatus.data[0].HItemID,
+                                        HMaterNumber: checkStatus.data[0].HNumber,
+                                        HMaterName: checkStatus.data[0].HName
+                                    });
+                                    layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
+                                }
+                                , btn2: function (index, layero) {
+                                    //鎸夐挳銆愭寜閽簩銆戠殑鍥炶皟
+                                    //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
+                                },
+                                end: function () {
+                                }
+                            });
+                        }
+                        //璐熻矗浜轰俊鎭�
+                        if (obj.event === 'HManagerNumber') {
+                            //椤甸潰灞�-鑷畾涔�
+                            layer.open({
+                                type: 2,
+                                skin: 'layui-layer-rim', //鍔犱笂杈规
+                                title: '璐d换浜哄垪琛�',
+                                closeBtn: 1,
+                                shift: 2,
+                                area: ['90%', '90%'],
+                                maxmin: true,
+                                content: ['../PublicPage/UserInformation.html', 'yes'],
+                                btn: ['纭畾', '鍙栨秷']
+                                , btn1: function (index, layero) {
+
+                                    //鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
+                                    var iframeWindow = window['layui-layer-iframe' + index]  //鑾峰彇寮规椤甸潰
+                                    var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//鑾峰彇table鐨別lem:"#test"
+                                    if (checkStatus.data.length === 0) {
+                                        return layer.msg('璇烽�夋嫨鏁版嵁');
+                                    }
+
+                                    //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
+                                    obj.update({
+                                        HManagerID: checkStatus.data[0].HItemID,
+                                        HManagerNumber: checkStatus.data[0].HNumber,
+                                        HManagerName: checkStatus.data[0].HName
+                                    });
+
+                                    layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
+                                }
+                                , btn2: function (index, layero) {
+                                    //鎸夐挳銆愭寜閽簩銆戠殑鍥炶皟
+                                    //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
+                                },
+                                end: function () {
+
+                                }
+                            });
+                        }
+                        obj.event = "";
+                        return false;
+
+                    }
+                })
+            }
+
+            //澧炲姞涓�琛�
+            function set_AddLine(NewRow) {
+                var tableBak = table.cache["mainTable"]; //鑾峰彇涔嬪墠缂栬緫杩囩殑琛ㄦ牸鏁版嵁
+                buttonArr = [];//娓呯┖鏁扮粍
+                for (var i = 0; i < tableBak.length; i++) {
+                    buttonArr.push(tableBak[i]);  //灏嗕箣鍓嶇殑鏁版嵁瀛樺偍
+                }
+                buttonArr.push(NewRow);  //鍦ㄥ熬閮ㄥ姞涓�琛�
+                table.reload("mainTable", {
+                    data: buttonArr    //灏嗘暟鎹噸鏂拌浇鍏ヨ〃鏍�
+                })
+            }
             //澶嶅埗涓�琛�
             function set_CopyLine(data) {
                 var copydata = JSON.stringify(data);
@@ -808,6 +1236,48 @@
                     option.data = table.cache["mainTable"];//灏嗘暟鎹粦瀹氬埌data涓�
                     table.render(option);//灏嗘暟鎹覆鏌撳埌琛ㄦ牸涓�
                     //layer.alert(copyrow);
+                }
+            }
+
+            //澧炲姞涓�琛�1 閰嶄欢
+            function btnAddLine1(NewRow) {
+                var tableBak = table.cache["mainTable1"]; //鑾峰彇涔嬪墠缂栬緫杩囩殑琛ㄦ牸鏁版嵁
+                buttonArr = [];//娓呯┖鏁扮粍
+                for (var i = 0; i < tableBak.length; i++) {
+                    buttonArr.push(tableBak[i]);  //灏嗕箣鍓嶇殑鏁版嵁瀛樺偍
+                }
+                buttonArr.push(NewRow);  //鍦ㄥ熬閮ㄥ姞涓�琛�
+                table.reload("mainTable1", {
+                    data: buttonArr    //灏嗘暟鎹噸鏂拌浇鍏ヨ〃鏍�
+                })
+            }
+
+            //澶嶅埗涓�琛�1 閰嶄欢
+            function btnCopyLine1(data) {
+                var copydata = JSON.stringify(data);
+                if (data.length <= 0) {
+                    layer.msg("璇烽�夋嫨闇�瑕佸鍒剁殑涓�琛岋紒");
+                }
+                else if (data.length > 1) {
+                    layer.msg("鍙兘閫夋嫨澶嶅埗涓�琛岋紒");
+                }
+                else {
+                    var copydata2 = copydata.substring(1, copydata.length);//鍘婚櫎棣栬瀛楃'['
+                    var copyrow = copydata2.substring(0, copydata2.length - 1);//鍘婚櫎鏈熬瀛楃']'
+                    table.cache["mainTable1"].push(JSON.parse(copyrow));//灏嗗鍒剁殑琛屽己杞垚json杩藉姞鍒拌〃鏍间笂
+                    option1.data = table.cache["mainTable1"];//灏嗘暟鎹粦瀹氬埌data涓�
+                    table.render(option1);//灏嗘暟鎹覆鏌撳埌琛ㄦ牸涓�
+                }
+            }
+
+            //鍒ゆ柇婧愬崟甯﹀洖鏁版嵁鏁扮粍涓殑鍊兼槸鍚︾浉鍚�
+            function isAllEqual(array) {
+                if (array.length > 0) {
+                    return !array.some(function (value, index) {
+                        return value !== array[0];
+                    });
+                } else {
+                    return true;
                 }
             }
 
@@ -853,7 +1323,7 @@
                     return false;
                 }
                 //鍒ゆ柇鐗╂枡鏄庣粏椤�
-                if (typeof (sSubStr) == "undefined" || sSubStr == "") {
+                if (typeof (sSubStr) == "undefined" || sSubStr == "" || sSubStr == "[]") {
                     layer.msg("娌℃湁鐗╂枡鏄庣粏璁板綍", { icon: 5, btn: ['纭'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
                     return false;
                 }
@@ -873,6 +1343,7 @@
                         }
                     }
                 }
+                return true;
             }
 
             //#endregion

--
Gitblit v1.9.1