沈泽
2021-10-15 241218f741eb8951ca5f3b141547c34565c8cd69
WebTM/views/É豸¹ÜÀí/Sb_EquipMaintainBillEdit.html
@@ -23,10 +23,11 @@
                    <form id="form0" class="layui-form" lay-filter="component-form-group" action="">
                        <div class="layui-card-header">
                            <div class="layui-btn-group">
                                <button type="button" id="add-btn" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Saver">保存</button>
                                <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="set_AddNew" id="set_AddNew">新增</button>
                                <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Saver" id="add-btn">保存</button>
                                <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="view">预览</button>
                                <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="print">打印</button>
                                <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Exit">退出</button>
                            </div>
@@ -240,10 +241,10 @@
                var NewRow = TabRow1;
                switch (obj.event) {
                    //新增一行
                    case 'btn-AddLine': btnAddLine1(NewRow);
                    case 'btn-AddLine1': btnAddLine1(NewRow);
                        break;
                    //复制一行
                    case 'btn-CopyLine': btnCopyLine1(data);
                    case 'btn-CopyLine1': btnCopyLine1(data);
                        break;
                }
            });
@@ -291,6 +292,13 @@
                    }
                });
            });
            //新增
            form.on('submit(set_AddNew)', function (data) {
                $("#component-form-group")[0].reset();
                layui.form.render();
                set_AddFNew();
            });
            //保存
            form.on('submit(Saver)', function (data) {
                //debugger;
@@ -299,7 +307,10 @@
                var sSubStr = JSON.stringify(table.cache['mainTable']);
                var sSubStr1 = JSON.stringify(table.cache['mainTable1']);
                var sMainSub = sMainStr + ';' + sSubStr + ';' + sSubStr1;
                //if (AllowLoadData(sSubStr, sSubStr1)) {
                if (!AllowLoadData(sSubStr))//数据验证
                {
                    return false;
                }
                $.ajax(
                    {
                        type: "POST",
@@ -328,7 +339,16 @@
                            console.log("Reason" + sMainStr);
                        }
                    });
                //}
            });
            //预览Printing
            form.on("submit(view)", function (data) {
                window.open("../../基础资料/公用基础资料/HBarPlanPrint.html?linterid=" + linterid + "&Type=HEquipMaintainBill&OpenTmp=设备保养记录条码");
            });
            //打印Printing
            form.on("submit(print)", function (data) {
                window.open("../../基础资料/公用基础资料/HBarPlanPrint.html?linterid=" + linterid + "&Type=HEquipMaintainBill&OpenTmp=设备保养记录条码");
            });
            //退出
            form.on('submit(Exit)', function (data) {//
@@ -347,6 +367,7 @@
                parent.location.href = "../../../views/index.html"
                //window.close();//关闭当前页
            })
            //监听提交
            form.verify({
                numberOrEmpty: function (value, item) {
@@ -495,7 +516,7 @@
                                "HBillNo": data.单据号
                                , "HDate": formatDate(data.日期)
                                , "HInnerBillNo": data.内部单据号
                                , "HEquipName": data.设备名称
                                , "HEquipName": data.设备名称
                                , "HEquipID": data.设备ID              //设备
                                , "HExplanation": data.摘要               //摘要
                                , "HBeginDate": data.开始日期                //
@@ -520,7 +541,7 @@
                $.ajax({
                    url: GetWEBURL() + 'Sb_EquipMaintainBill/Sb_EquipMaintainBillListProjectDetaiNew',
                    type: "GET",
                    data: { "HInterID": linterid},
                    data: { "HInterID": linterid },
                    success: function (result) {
                        console.log(result);
                        //console.log('gouba' + result);
@@ -553,7 +574,7 @@
            //增加一行
            function btnAddLine(NewRow) {
                table.cache["mainTable"].push(NewRow);
                option1.data = table.cache["mainTable"];
                option.data = table.cache["mainTable"];
                table.render(option);
            }
            //增加一行1
@@ -800,8 +821,7 @@
                            });
                        }
                        //负责人信息
                        if (obj.event === 'HManagerNumber')
                        {
                        if (obj.event === 'HManagerNumber') {
                            //页面层-自定义
                            layer.open({
                                type: 2,
@@ -848,48 +868,54 @@
            }
            //非空验证
            function AllowLoadData(sSubStr) {
                var Result = true;
                if ($("#HEquipID").val() == '' || $("#HEquipName").val() == '') {
                    layer.msg("请选择设备", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    return Result = false;
                }
                if (typeof (sSubStr) != "undefined" && typeof (sSubStr) != "") {
                    sSubStr = JSON.parse(sSubStr);
                    for (var i = 0; i < sSubStr.length; i++) {
                        if (sSubStr[i].HMaintainItemID == "") {
                            layer.msg("保养项明细记录第" + (i + 1) + "行,保养项目信息为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            return false;
                            return Result = false;
                        }
                        if (sSubStr[i].HMaintainItem == "") {
                            layer.msg("保养项明细记录第" + (i + 1) + "行,保养部位信息为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            return false;
                            return Result = false;
                        }
                        if (sSubStr[i].HManagerNumber == "") {
                            layer.msg("保养项明细记录第" + (i + 1) + "行,责任人信息为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            return false;
                            return Result = false;
                        }
                    }
                }
                if (typeof (sSubStr1) == "undefined" || sSubStr1 == "" || sSubStr1 == "[]") {
                    layer.msg("配件项明细记录不能为空", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    return false;
                }
                if (typeof (sSubStr1) != "undefined" && typeof (sSubStr1) != "") {
                    sSubStr1 = JSON.parse(sSubStr1);
                    for (var i = 0; i < sSubStr1.length; i++) {
                        if (sSubStr1[i].HMaterNumber == "") {
                            layer.msg("配件项明细记录第" + (i + 1) + "行,配件代码为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            return false;
                        }
                        if (sSubStr1[i].HUnitNumber == "") {
                            layer.msg("配件项明细记录第" + (i + 1) + "行,单位代码信息为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            return false;
                        }
                        if (sSubStr[i].HManagerNumber == "") {
                            layer.msg("保养项明细记录第" + (i + 1) + "行,负责人信息为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            return false;
                        }
                    }
                }
                //if (typeof (sSubStr1) == "undefined" || sSubStr1 == "" || sSubStr1 == "[]") {
                //    layer.msg("配件项明细记录不能为空", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                //    return false;
                //}
                //if (typeof (sSubStr1) != "undefined" && typeof (sSubStr1) != "") {
                //    sSubStr1 = JSON.parse(sSubStr1);
                //    for (var i = 0; i < sSubStr1.length; i++) {
                //        if (sSubStr1[i].HMaterNumber == "") {
                //            layer.msg("配件项明细记录第" + (i + 1) + "行,配件代码为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                //            return false;
                //        }
                //        if (sSubStr1[i].HUnitNumber == "") {
                //            layer.msg("配件项明细记录第" + (i + 1) + "行,单位代码信息为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                //            return false;
                //        }
                //        if (sSubStr[i].HManagerNumber == "") {
                //            layer.msg("保养项明细记录第" + (i + 1) + "行,负责人信息为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                //            return false;
                //        }
                //    }
                //}
                else {
                    return true;
                    return Result = true;
                }
                return Result;
            }
            function f_alert(sMsg) {