1
wtt
2025-12-29 3425237a2b54ca28fc3e3c5f7c35a7fbef4e15fa
WebTM/views/³µ¼ä¹ÜÀí/Æô¶¯µã¼ìµ¥/Gy_WorkBeginDotCheckListBill.html
@@ -115,7 +115,7 @@
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-row">
                                        <div class="layui-inline">
                                            <label class="layui-form-label">记录事项</label>
@@ -245,7 +245,15 @@
        <!--<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="HDotCheckType">
        <select name="HDotCheckType" lay-filter="HDotCheckType" id="HDotCheckType{{d.LAY_TABLE_INDEX+1}}">
            <option value="设备" selected>设备</option>
            <option value="模具">模具</option>
            <option value="作业指导书">作业指导书</option>
            <option value="检验指导书">检验指导书</option>
        </select>
    </script>
    <script>
        layui.config({
@@ -296,7 +304,7 @@
            //#endregion
            //#region åˆ¤æ–­å¹¶è®¾ç½®æ“ä½œç±»åž‹ã€é¡µé¢åˆå§‹åŒ–
            if (OperationType == null || OperationType == 1) {                            //新增
@@ -306,7 +314,7 @@
                //初始化制单人和制单时间
                $("#HMaker").val(sessionStorage["HUserName"]);
                $("#HMakerDate").val(Format(new Date(), "yyyy-MM-dd"));
                $("#HMakeDate").val(Format(new Date(), "yyyy-MM-dd"));
                //初始化日期
                $("#HDate").val(Format(new Date(), "yyyy-MM-dd"));
@@ -317,12 +325,25 @@
                $('#HOrgID').attr("disabled", true);
            }
            else if (OperationType == 2) {//如果修改则走下面 new                                        //编辑
                //初始化项目阶段表
                get_InitGrid();
                RoadBillMain(linterid);
                //生成并设置主表的内码和单据号
                createBillNo();
                //初始化制单人和制单时间
                $("#HMaker").val(sessionStorage["HUserName"]);
                $("#HMakerDate").val(Format(new Date(), "yyyy-MM-dd"));
                //初始化日期
                $("#HDate").val(Format(new Date(), "yyyy-MM-dd"));
                OperationType = 1;
            }
            else if (OperationType == 3) {//如果修改则走下面 new
                //初始化子表
                get_InitGrid();
                RoadBillMain(linterid);
                //禁用组织选项
@@ -340,7 +361,7 @@
            //#region è§¦å‘事件:包括form.on(){}格式的所有点击事件、选择事件等
            //#region å¼¹çª—选择触发事件
            //#region å¼¹çª—选择触发事件
            //#region é€‰æ‹©ç‰©æ–™æŒ‰é’®
            form.on('submit(btnSearchHMater)', function () {
@@ -352,7 +373,7 @@
            form.on('submit(btnSearchHSource)', function () {
                get_checkSearchHSource();
            });
            //#endregion
            //#endregion
            //#region é€‰æ‹©å·¥åºæŒ‰é’®
            form.on('submit(btnSearchHProc)', function () {
@@ -389,15 +410,18 @@
                //新增行表格数据
                var NewRow = {
                    "HCheckNoteItemID": "0", "HCheckNoteItemName": "", "HCheckPostID": "0", "HCheckPostName": "","HRemark":"",
                    "HCheckNoteItemID": "0", "HCheckNoteItemName": "", "HCheckPostID": "0", "HCheckPostName": "", "HDotCheckType": "设备", "HRelationID": "0","HRelationName":"", "HRemark": "",
                    "HSourceBillNo": 0, "HSourceBillType": 0, "HSourceInterID": 0, "HSourceEntryID": 0,
                };
                switch (obj.event) {
                    case 'btn-AddLine':
                        table.cache["mainTable"].push(NewRow);
                        option.data = table.cache["mainTable"];
                        table.render(option);
                        table.render(option);
                        for (var i = 1; i <= option.data.length; i++) {
                            $('#HDotCheckType' + i + '').find("option[value='" + option.data[i - 1].HDotCheckType + "']").attr("selected", true);
                        }
                        form.render('select');
                        break;
                    case 'btn-CopyLine':
                        var copydata = JSON.stringify(data);
@@ -411,15 +435,19 @@
                            var copydata2 = copydata.substring(1, copydata.length);//去除首行字符'['
                            var copyrow = copydata2.substring(0, copydata2.length - 1);//去除末尾字符']'
                            table.cache["mainTable"].push(JSON.parse(copyrow));//将复制的行强转成json追加到表格上
                            option.data = table.cache["mainTable"];//将数据绑定到data上
                            table.render(option);//将数据渲染到表格上
                            option.data = table.cache["mainTable"];//将数据绑定到data上
                            table.render(option);//将数据渲染到表格上
                            for (var i = 1; i <= option.data.length; i++) {
                                $('#HDotCheckType' + i + '').find("option[value='" + option.data[i - 1].HDotCheckType + "']").attr("selected", true);
                            }
                            form.render('select');
                        }
                        break;
                }
            });
            //#region å­è¡¨ï¼šè¡Œå†…事件
            table.on('tool(mainTable)', function (obj) {
                set_GridDelete(obj);   //行内删除
@@ -428,7 +456,7 @@
            });
            //#endregion
            //#endregion
@@ -475,8 +503,11 @@
                        , { type: 'numbers', title: '序号', style: 'background-color: #f9f9f9;' }
                        , { field: 'HCheckNoteItemID', title: 'HCheckNoteItemID', hide: true, style: 'background-color: #f9f9f9;' }
                        , { field: 'HCheckNoteItemName', title: '检查项目', edit: 'text', event: "HCheckNoteItemID", style: 'background-color: #f9f9f9;' }     //f7
                        , { field: 'HCheckPostID', title: 'HCheckPostID', hide: true, style: 'background-color: #f9f9f9;'}
                        , { field: 'HCheckPostID', title: 'HCheckPostID', hide: true, style: 'background-color: #f9f9f9;' }
                        , { field: 'HCheckPostName', title: '确认者角色', edit: 'text', event: "HCheckPostID", style: 'background-color: #f9f9f9;' }
                        , { field: 'HDotCheckType', title: '点检类型', templet: '#HDotCheckType' }
                        , { field: 'HRelationID', title: 'HRelationID', hide: true, style: 'background-color: #f9f9f9;' }
                        , { field: 'HRelationName', title: '编码', edit: 'text', event: "HRelationID" }
                        , { field: 'HRemark', title: '备注', edit: 'text' }
                        , { field: 'HSourceInterID', title: '源单内码', hide: true, style: 'background-color: #f9f9f9;' }
                        , { field: 'HSourceEntryID', title: '源单子内码', hide: true, style: 'background-color: #f9f9f9;' }
@@ -492,7 +523,10 @@
                        , "HCheckNoteItemName": ""
                        , "HCheckPostID": "0"
                        , "HCheckPostName": ""
                        , "HRemark":""
                        , "HDotCheckType": "设备"
                        , "HRelationID": "0"
                        , "HRelationName": ""
                        , "HRemark": ""
                        , "HSourceInterID": "0"
                        , "HSourceEntryID": "0"
                        , "HSourceBillNo": ""
@@ -502,7 +536,20 @@
                option.data = rowdata;
                table.render(option);
            }
            //#endregion
            //#endregion
            //#region è¡¨æ ¼è¡Œé€‰æ‹©å¤„理
            form.on('select(HDotCheckType)', function (data) {
                //获取下拉框选中的值
                var elem = data.othis.parents('tr');
                var dataindex = elem.attr("data-index");
                $.each(option.data, function (index, value) {
                    if (value.LAY_TABLE_INDEX == dataindex) {
                        value.HDotCheckType = data.value;//把选中下拉框id值赋值给表格缓存
                    }
                });
            });
            //#endregion
            //#region èŽ·å–å‚æ•°
            function getUrlVars() {
@@ -533,7 +580,7 @@
                });
            }
            //#endregion
            //#region ç‰©æ–™é€‰æ‹©é¡µé¢
            function get_checkSearchHMater() {
                layer.open({
@@ -707,6 +754,71 @@
                                }
                            })
                        }
                        //类型信息
                        if (obj.event == "HRelationID") {
                            if (obj.data.HDotCheckType == "设备") {
                                layer.open({
                                    type: 2
                                    , skin: "layui-layer-rim"                           //加上边框
                                    , title: "设备列表"                             //标题
                                    , closeBtn: 1                                       //窗体右上角关闭 çš„ æ ·å¼
                                    , shift: 2                                          //弹出动画
                                    , area: ["90%", "90%"]                              //窗体大小
                                    , maxmin: true                                      //设置最大最小按钮是否显示
                                    , content: ["../../设备管理/设备档案/Gy_EquipFileMainList.html", "yes"]
                                    , btn: ["确定", "取消"]
                                    , btn1: function (index, laero) {
                                        //按钮一  çš„回调
                                        var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
                                        var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
                                        if (checkStatus.data.length != 1) {
                                            return layer.msg("请选择一条数据");
                                        }
                                        //更新表格缓存的数据
                                        obj.update({
                                            "HRelationID": checkStatus.data[0].hmainid,
                                            "HRelationName": checkStatus.data[0].设备名称
                                        })
                                        layer.close(index);//关闭弹窗
                                    }
                                    , btn2: function (index, layero) { }
                                    , end: function () {
                                    }
                                })
                            } else if (obj.data.HDotCheckType=="模具") {
                                layer.open({
                                    type: 2
                                    , skin: "layui-layer-rim"                           //加上边框
                                    , title: "模具列表"                             //标题
                                    , closeBtn: 1                                       //窗体右上角关闭 çš„ æ ·å¼
                                    , shift: 2                                          //弹出动画
                                    , area: ["90%", "90%"]                              //窗体大小
                                    , maxmin: true                                      //设置最大最小按钮是否显示
                                    , content: ["../../模治具管理/模治具管理/Gy_MouldFileList.html", "yes"]
                                    , btn: ["确定", "取消"]
                                    , btn1: function (index, laero) {
                                        //按钮一  çš„回调
                                        var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
                                        var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
                                        if (checkStatus.data.length != 1) {
                                            return layer.msg("请选择一条数据");
                                        }
                                        //更新表格缓存的数据
                                        obj.update({
                                            "HRelationID": checkStatus.data[0].hmainid,
                                            "HRelationName": checkStatus.data[0].模具名称
                                        })
                                        layer.close(index);//关闭弹窗
                                    }
                                    , btn2: function (index, layero) { }
                                    , end: function () {
                                    }
                                })
                            }
                        }
                        obj.event = "";
                        return false;
                    }
@@ -723,6 +835,7 @@
                for (var i = 0; i < table.cache["mainTable"].length; i++) {
                    if (table.cache["mainTable"][i] != "") {
                        table.cache["mainTable"][i].LAY_TABLE_INDEX = i;
                        table.cache["mainTable"][i].HRelationID == null ? 0 : table.cache["mainTable"][i].HRelationID;
                        num.push(table.cache["mainTable"][i])
                    }
                }
@@ -791,12 +904,12 @@
                            "HInterID": tableMain[0]["HInterID"]
                            , "HBillNo": tableMain[0]["单据号"]
                            , "HDate": Format(new Date(tableMain[0]["日期"]), "yyyy-MM-dd")
                            , "HMaterID": tableMain[0]["HMaterID"]
                            , "HMaterName": tableMain[0]["物料名称"]
                            , "HSourceID": tableMain[0]["HSourceID"]
                            , "HSourceName": tableMain[0]["生产资源"]
                            , "HProcID": tableMain[0]["HProcID"]
                            , "HProcName": tableMain[0]["工序"]
                            , "HNote": tableMain[0]["记录事项"]
@@ -820,18 +933,31 @@
                        //子表  èµ‹å€¼
                        var rowdata = [];
                        for (var i = 0; i < tableSub.length; i++) {
                            var relationName = "";
                            if (tableSub[i]["点检类型"] == "设备") {
                                relationName = tableSub[i]["设备名称"];
                            } else if (tableSub[i]["点检类型"] == "模具") {
                                relationName = tableSub[i]["模具名称"];
                            }
                            rowdata.push(
                                {
                                    "HCheckNoteItemID": tableSub[i]["HCheckNoteItemID"],
                                    "HCheckNoteItemName": tableSub[i]["检查项目"],
                                    "HCheckPostID": tableSub[i]["HCheckPostID"],
                                    "HCheckPostName": tableSub[i]["确认者角色"],
                                     "HRemark": tableSub[i]["表体备注"]
                                    "HDotCheckType": tableSub[i]["点检类型"] == null ? "设备" : tableSub[i]["点检类型"],
                                    "HRelationID": tableSub[i]["HRelationID"] == null ? "0" : tableSub[i]["HRelationID"],
                                    "HRelationName": relationName,
                                    "HRemark": tableSub[i]["表体备注"]
                                }
                            );
                        }
                        option.data = rowdata;
                        table.render(option);
                        table.render(option);
                        for (var i = 0; i < rowdata.length; i++) {
                            $('#HDotCheckType' + (i + 1)).find("option[value='" + tableSub[i].点检类型 + "']").attr("selected", true);
                        }
                        form.render('select');
                    }
                })
            }
@@ -839,7 +965,7 @@
            //#region é¡¹ç›®é˜¶æ®µè¡¨ï¼šåˆ é™¤æŒ‡å®šè¡Œ
            //#region åˆ é™¤æŒ‡å®šè¡Œ
            function set_GridDelete(obj) {
                var data = obj.data;
                var rowIndex = $(obj.tr).attr("data-index");
@@ -854,7 +980,7 @@
                            option.data = oldData;//将数据绑定到data上
                            table.render(option);
                            for (var i = 0; i < oldData.length; i++) {
                                $('#HCheckResult' + (i + 1)).find("option[value='" + oldData[i].HCheckResult + "']").attr("selected", true);
                                $('#HDotCheckType' + (i + 1)).find("option[value='" + oldData[i].HDotCheckType + "']").attr("selected", true);
                            }
                            form.render('select');
                            layer.close(index);
@@ -882,19 +1008,19 @@
                if ($("#HDate").val() == "") {
                    layer.msg("日期不能为空!");
                    return false;
                }
                }
                if ($("#HProcID").val() == "0") {
                    layer.msg("工序不能为空!");
                    return false;
                }
                //#region å­è¡¨ æ•°æ®æ£€éªŒ
                for (var i = 0; i < option.data.length; i++) {
                    if (typeof option.data[i] !== 'object' || option.data[i] === null || Array.isArray(option.data[i])) {
                        continue; // è·³è¿‡éžå¯¹è±¡é¡¹ï¼ˆå¦‚空数组)
                        continue; // è·³è¿‡éžå¯¹è±¡é¡¹ï¼ˆå¦‚空数组)
                    }
                    if (option.data[i]["HCheckNoteItemID"] == "0") {
@@ -906,7 +1032,7 @@
                        layer.msg("第" + i + "行:确认者角色未选择!");
                        return false;
                    }
                }
                //#endregion
@@ -933,10 +1059,9 @@
            $("#HSourceName").val(obj[0].生产资源名称);
        }
        //工序
        function GetProcessValue(obj)
        {
        function GetProcessValue(obj) {
            $("#HProcName").val(obj[0].工序名称);
            $("#HProcID").val(obj[0].HItemID);
        }
@@ -949,7 +1074,7 @@
        function GetGyPostValue(obj) {
            OptionData = obj[0];
        }
    </script>
</body>
</html>