From 81c93ee7a4bc6735ad8f69ea0ee7244eaa58d73f Mon Sep 17 00:00:00 2001
From: YL <YL@LAPTOP-SE03PLUR>
Date: 星期二, 15 二月 2022 08:32:07 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MESWMS-LayUI

---
 WebTM/views/设备管理/Sb_Add_EqpMaintenanceBillList.html |  172 ++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 156 insertions(+), 16 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 9d9f414..c46dcb6 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"
@@ -17,7 +17,7 @@
 <body>
 
     <div id="layout1" class="layui-fluid">
-        <div class="layui-row layui-col-space15">
+        <div class="layui-row layui-col-space15">                                                                
             <div class="layui-col-md12">
                 <div class="layui-card">
                     <form id="form0" class="layui-form" lay-filter="component-form-group" action="">
@@ -152,6 +152,28 @@
                                                 </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>
+                                                    </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">
                                                     <textarea placeholder="璇疯緭鍏ョ淮淇唴瀹�" class="layui-textarea" name="HRepairContent" id="HRepairContent"></textarea>
@@ -226,7 +248,7 @@
 
             var option;
             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 杩涘叆椤甸潰鍗冲姞杞�
@@ -246,13 +268,34 @@
             }
             //#endregion
 
+
+            //鑾峰彇涓嬫媺閫変腑鍊�
+            form.on('select(HMainSourceBillType)', function (data) {
+                Sctag = data.value;
+                form.render('select');
+                switch (Sctag) {
+                    //鏃犳簮鍗曟柊澧�
+                    case '1':
+                        $('#HMainSourceBillNo').attr("disabled", false);
+                        $('#XDHList').addClass("layui-btn-disabled").attr("disabled", true);
+                        break;
+                    //鏈夋簮鍗曟柊澧灺� 聽
+                    case '2':
+                        $('#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": 0, "HManagerCode": "", "HManagerName": "", "HRepairExplanation": "", "HRemark": ""/*, "HSourceInterID": 0, "HSourceEntryID": 0, "HSourceBillNo": " ", "HSourceBillType": " " */};
                 switch (obj.event) {
                     //澧炲姞涓�琛�
                     case 'btn-AddLine': set_AddLine(NewRow);
@@ -331,7 +374,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) {
@@ -461,13 +504,93 @@
                 });
             });
 
+            //琛ㄥご淇℃伅閫夋嫨鍗曟嵁寮圭獥
+            form.on('submit(XDHList)', function () {
+                //椤甸潰灞�-鑷畾涔�
+                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);
+                        ////鎸夐�夊崟鍙峰姞杞借〃浣撴暟鎹�
+                        //$.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);
+                    }
+                });
+            });
+
             //淇濆瓨
             form.on('submit(Saver)', function (data) {
                 //debugger;
                 data.field.HMaker = sessionStorage["HUserName"];//鍒跺崟浜�
                 var sMainStr = JSON.stringify(data.field);
                 var sSubStr = JSON.stringify(table.cache['mainTable']);
-                var sMainSub = sMainStr + ';' + sSubStr;
+                var sMainSub = sMainStr + ';' + sSubStr + ";" + sessionStorage["HUserName"];
                 //瀵规暟鎹繘琛岄獙璇�
                 if (AllowLoadData(sSubStr)) {
                     $.ajax(
@@ -486,7 +609,7 @@
                                     });
                                 }
                                 else {
-                                    f_alert(data.Message);
+                                    layui.alert("淇濆瓨澶辫触")
                                     console.log("Reason" + sMainStr + "sub:" + JSON.stringify(layui.table.cache.mainTable));
                                 }
                                 layer.closeAll("loading");
@@ -537,14 +660,18 @@
                 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 = {
@@ -565,7 +692,7 @@
             function set_AddFNew() {
                 //鑾峰彇鏈�澶у崟鎹彿
                 get_MAXNum();
-                option.data = [TabRow];
+                option.data = [{ "HRepairID": 0, "HRepairCode": "", "HRepairName": "", "HManagerID": 0, "HManagerCode": "", "HManagerName": "", "HRepairExplanation": "", "HRemark": ""/*, "HSourceInterID": 0, "HSourceEntryID": 0, "HSourceBillNo": " ", "HSourceBillType": " "*/ }];
                 table.render(option);
             }
 
@@ -593,7 +720,7 @@
             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);
             }
 
@@ -631,6 +758,10 @@
                                 , "HRepairContent": data.缁翠慨鍐呭         //缁翠慨鍐呭
                                 , "HExplanation": data.缁翠慨瑕佹眰           //缁翠慨瑕佹眰
                                 , "HRemark": data.琛ㄥご澶囨敞                //澶囨敞
+                                , "HMainSourceBillType": data.HMainSourceBillType
+                                , "HMainSourceBillNo": data.HMainSourceBillNo
+                                , "HMainSourceInterID": data.HMainSourceInterID
+                                , "HMainSourceEntryID": data.HMainSourceEntryID
                             });
 
                         } else {
@@ -724,7 +855,7 @@
                                     }
                                     //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
                                     obj.update({
-                                        HRepairID1: checkStatus.data[0].HItemID,
+                                        HRepairID: checkStatus.data[0].HItemID,
                                         HRepairCode: checkStatus.data[0].HNumber,
                                         HRepairName: checkStatus.data[0].HName,
                                     });
@@ -765,7 +896,7 @@
 
                                     //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
                                     obj.update({
-                                        HManagerID1: checkStatus.data[0].HItemID,
+                                        HManagerID: checkStatus.data[0].HItemID,
                                         HManagerCode: checkStatus.data[0].HNumber,
                                         HManagerName: checkStatus.data[0].HName
                                     });
@@ -820,6 +951,17 @@
                 }
             }
 
+            //鍒ゆ柇婧愬崟甯﹀洖鏁版嵁鏁扮粍涓殑鍊兼槸鍚︾浉鍚�
+            function isAllEqual(array) {
+                if (array.length > 0) {
+                    return !array.some(function (value, index) {
+                        return value !== array[0];
+                    });
+                } else {
+                    return true;
+                }
+            }
+
             //鏁版嵁楠岃瘉
             function AllowLoadData(sSubStr) {  //sSubStr
 
@@ -842,7 +984,7 @@
                 if ($("#HRepairName").val() == '') {
                     layer.msg("缁翠慨椤圭洰娌℃湁閫夋嫨", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
                     return false;
-                }
+                } 
                 //鏁板瓧姝e垯(鍖呭惈灏忔暟)
                 var reg = /^\d+(\.\d+)?$/;
                 if (reg.test($("#HPlanTimes").val()) == false || $("#HPlanTimes").val() == '') {
@@ -882,9 +1024,7 @@
                         }
                     }
                 }
-                else {
-                    return true;
-                }
+                return true;
             }
 
             //#endregion

--
Gitblit v1.9.1