1
duhe
2024-05-11 2b2dee6429828108c44b3bfa9eb630603479b6ea
WebTM/views/Ä£Öξ߹ÜÀí/Ä£Öξ߹ÜÀí/Sc_Add_MouldDotCheckBillList.html
@@ -12,10 +12,19 @@
        .layui-form-label {
            width: 85px;
        }
        /* é˜²æ­¢ä¸‹æ‹‰æ¡†çš„下拉列表被隐藏---必须设置--- */
        .layui-table-cell {
            overflow: visible !important;
        }
        /* ä½¿å¾—下拉框与单元格刚好合适 */
        td .layui-form-select {
            margin-top: -10px;
            margin-left: -15px;
            margin-right: -15px;
        }
    </style>
</head>
<body>
    <div id="layout1" class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
@@ -107,6 +116,36 @@
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <div class="layui-inline">
                                                <label class="layui-form-label">异常情况记录</label>
                                                <div class="layui-input-inline">
                                                    <input type="text" name="HErrNote" id="HErrNote" class="layui-input">
                                                </div>
                                            </div>
                                            <div class="layui-inline">
                                                <label class="layui-form-label">重大安全<br />隐患记录</label>
                                                <div class="layui-input-inline" style="margin-top:10px;">
                                                    <input type="text" name="HBigSafeNote" id="HBigSafeNote" class="layui-input">
                                                </div>
                                            </div>
                                            <div class="layui-inline">
                                                <label class="layui-form-label">点检数据</label>
                                                <div class="layui-input-inline">
                                                    <input type="text" name="HDotCheckNote" id="HDotCheckNote" class="layui-input">
                                                </div>
                                            </div>
                                            <div class="layui-inline">
                                                <label class="layui-form-label">生产班次</label>
                                                <div class="layui-input-inline">
                                                    <input type="hidden" name="HShiftsID" id="HShiftsID" class="layui-input" value="0" style="float:left;width:150px;">
                                                    <input type="text" name="HShiftsName" id="HShiftsName" class="layui-input" value="" style="float:left;width:150px;background-color:#efefef4d;" readonly="readonly">
                                                    <button type="button" lay-submit="" class="layui-btn" lay-filter="btnHShifts" 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>
@@ -118,6 +157,13 @@
                                                <label class="layui-form-label">备注</label>
                                                <div class="layui-input-inline">
                                                    <textarea placeholder="请输入维备注" class="layui-textarea" name="HRemark" id="HRemark"></textarea>
                                                </div>
                                            </div>
                                            <div class="layui-inline">
                                                <label class="layui-form-label">最终结论</label>
                                                <div class="layui-input-inline">
                                                    <input type="radio" name="HLastResult" id="HLastResult" value="OK" title="OK" checked>
                                                    <input type="radio" name="HLastResult" id="HLastResult" value="NG" title="NG">
                                                </div>
                                            </div>
                                        </div>
@@ -162,6 +208,14 @@
    <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="del1">删除</a>
    </script>
    <!--行下拉选择(点检结果)-->
    <script type="text/html" id="HDotCheckResult">
        <select name="HDotCheckResult" lay-filter="HDotCheckResult" id="HDotCheckResult{{d.LAY_TABLE_INDEX+1}}">
            <!--<option value="">请选择</option>-->
            <option value="Y" selected>Y</option>
            <option value="X">X</option>
        </select>
    </script>
    <script src="../../../layuiadmin/layui/layui.js"></script>
    <script src="../../../layuiadmin/Scripts/json2.js"></script>
@@ -209,7 +263,7 @@
            //通过单据类型,从数据库动态获取单据模块命名,引用js文件 PageTitle.js
            var HPageTitle = get_PageTitle(HModuleType) == "" ? $("h1").html() : get_PageTitle(HModuleType);
            $("h1").html('<b>' + HPageTitle + '</b>');
         //#endregion
            //#endregion
            //初始化表单插件
            set_InitFrom();
@@ -238,7 +292,7 @@
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;;
                var AddRow = table.cache['mainTable'];
                var NewRow = { "HDotCheckItemID": 0, "HDotCheckItem": "", "HDotCheckPart": "", "HClaim": "", "HManagerID": "0", "HManagerNumber": "", "HManagerName": "", "HRemark": "" };
                var NewRow = { "HDotCheckItemID": 0, "HDotCheckItem": "", "HDotCheckPart": "", "HClaim": "", "HManagerID": "0", "HManagerNumber": "", "HManagerName": "", "HRemark": "", "HDotCheckItemClassID": 0, "HDotCheckItemClassName": "", "HDotCheckItemMethodID": 0, "HDotCheckItemMethodName": "", "HDotCheckResult": "Y" };
                switch (obj.event) {
                    //新增一行
                    case 'btn-AddLine': btnAddLine(NewRow);
@@ -301,6 +355,41 @@
                    }
                });
            });
            //表头信息生产班次弹窗
            form.on('submit(btnHShifts)', function () {
                //页面层-自定义
                layer.open({
                    type: 2,
                    skin: 'layui-layer-rim', //加上边框
                    title: '生产班次列表',
                    closeBtn: 1,
                    shift: 2,
                    area: ['80%', '80%'],
                    maxmin: true
                    , content: ['../../基础资料/生产基础资料/Gy_ShiftsList.html', 'yes']
                    , btn: ['确定', '取消']
                    , btn1: function (index, layero) {
                        //按钮【按钮一】的回调
                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
                        var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
                        if (checkStatus.data.length === 0) {
                            return layer.msg('请选择数据');
                        }
                        $("#HShiftsID").val(checkStatus.data[0].HItemID);
                        $("#HShiftsName").val(checkStatus.data[0].班次名称);
                        layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) {
                        //按钮【按钮二】的回调
                        //return false å¼€å¯è¯¥ä»£ç å¯ç¦æ­¢ç‚¹å‡»è¯¥æŒ‰é’®å…³é—­
                    },
                    end: function () {
                    },
                    success: function (layero, index) {
                    }
                });
            });
            //表头产品模具信息
@@ -370,7 +459,32 @@
                });
            });
            //行选择处理(点检结果)
            form.on('select(HDotCheckResult)', 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.HDotCheckResult = data.value;//把选中下拉框id值赋值给表格缓存
                    }
                });
                var HQty = 0;//表体行不合格数量
                for (let i = 0; i < table.cache['mainTable'].length; i++) {
                    if (table.cache['mainTable'][i].HDotCheckResult == "X") {
                        HQty++;
                    }
                }
                if (HQty > 0) {
                    document.querySelectorAll("[name='HLastResult']")[0].removeAttribute('checked'); //删除选择属性
                    $("input:radio[name=HLastResult][value=" + "NG" + "]").attr("checked", "true"); //添加选择属性
                } else {
                    document.querySelectorAll("[name='HLastResult']")[1].removeAttribute('checked'); //删除选择属性
                    $("input:radio[name=HLastResult][value=" + "OK" + "]").attr("checked", "true"); //添加选择属性
                }
                form.render('radio');
            });
            //表格行内事件快捷键筛选
@@ -449,6 +563,73 @@
                                }
                            });
                        }
                        if (obj.event === 'HDotCheckItemClassName')  //点检项目分类
                        {
                            //页面层-自定义
                            layer.open({
                                type: 2,
                                skin: 'layui-layer-rim', //加上边框
                                title: '点检项目分类列表',
                                closeBtn: 1,
                                shift: 2,
                                area: ['90%', '90%'],
                                maxmin: true
                                , content: ['../../基础资料/基础资料/Gy_DotCheckItemClassList.html', 'yes']
                                , btn: ['确定', '取消']
                                , btn1: function (index, layero) {
                                    //按钮【按钮一】的回调
                                    var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
                                    var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
                                    if (checkStatus.data.length === 0) {
                                        return layer.msg('请选择数据');
                                    }
                                    //同步更新表格和缓存对应的值
                                    obj.update({
                                        HDotCheckItemClassID: checkStatus.data[0].HItemID,
                                        HDotCheckItemClassName: checkStatus.data[0].点检项目分类名称
                                    });
                                    layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                                }
                                , btn2: function (index, layero) {
                                    //按钮【按钮二】的回调
                                    //return false å¼€å¯è¯¥ä»£ç å¯ç¦æ­¢ç‚¹å‡»è¯¥æŒ‰é’®å…³é—­
                                }
                            });
                        }
                        if (obj.event === 'HDotCheckItemMethodName')  //点检方法
                        {
                            //页面层-自定义
                            layer.open({
                                type: 2,
                                skin: 'layui-layer-rim', //加上边框
                                title: '点检方法列表',
                                closeBtn: 1,
                                shift: 2,
                                area: ['90%', '90%'],
                                maxmin: true
                                , content: ['../../基础资料/基础资料/Gy_DotCheckItemMethodList.html', 'yes']
                                , btn: ['确定', '取消']
                                , btn1: function (index, layero) {
                                    //按钮【按钮一】的回调
                                    var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
                                    var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
                                    if (checkStatus.data.length === 0) {
                                        return layer.msg('请选择数据');
                                    }
                                    //同步更新表格和缓存对应的值
                                    obj.update({
                                        HDotCheckItemMethodID: checkStatus.data[0].HItemID,
                                        HDotCheckItemMethodName: checkStatus.data[0].点检方法名称
                                    });
                                    layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                                }
                                , btn2: function (index, layero) {
                                    //按钮【按钮二】的回调
                                    //return false å¼€å¯è¯¥ä»£ç å¯ç¦æ­¢ç‚¹å‡»è¯¥æŒ‰é’®å…³é—­
                                }
                            });
                        }
                        obj.event = "";
                        return false;
@@ -547,6 +728,11 @@
                    , { templet: '#xuhao', title: '序号', sort: true, fixed: 'left', event: "qwe" }
                    , { field: 'HDotCheckItemID', title: '点检ID', edit: 'text', hide: true }
                    , { field: 'HDotCheckItem', title: '点检项目', edit: 'text', event: 'HDotCheckItem' }
                    , { field: 'HDotCheckItemClassID', title: '点检项目分类ID', edit: 'text', hide: true }
                    , { field: 'HDotCheckItemClassName', title: '点检项目分类', edit: 'text', event: 'HDotCheckItemClassName' }
                    , { field: 'HDotCheckItemMethodID', title: '点检方法ID', edit: 'text', hide: true }
                    , { field: 'HDotCheckItemMethodName', title: '点检方法', edit: 'text', event: 'HDotCheckItemMethodName' }
                    , { field: 'HDotCheckResult', title: '点检结果', templet: '#HDotCheckResult', event: 'HDotCheckResult' }
                    , { field: 'HDotCheckPart', title: '点检部位', edit: 'text' }
                    , { field: 'HClaim', title: '具体要求', edit: 'text' }
                    , { field: 'HManagerID', title: '负责人ID', edit: 'text', hide: true }
@@ -577,7 +763,7 @@
            function set_AddFNew() {
                //获取最大单据号
                get_MAXNum();
                option.data = [{ "HDotCheckItemID": 0, "HDotCheckItem": "", "HDotCheckPart": "", "HClaim": "", "HManagerID": "0", "HManagerNumber": "", "HManagerName": "", "HRemark": "" }];
                option.data = [{ "HDotCheckItemID": 0, "HDotCheckItem": "", "HDotCheckPart": "", "HClaim": "", "HManagerID": "0", "HManagerNumber": "", "HManagerName": "", "HRemark": "", "HDotCheckItemClassID": 0, "HDotCheckItemClassName": "", "HDotCheckItemMethodID": 0, "HDotCheckItemMethodName": "", "HDotCheckResult": "Y" }];
                table.render(option);
            }
@@ -585,7 +771,7 @@
            function set_EditFromGrid() {
                set_EditForm(linterid);  //编辑获取表头
                set_EditGrid(linterid);  //编辑获取表体
                option.data = [{ "HDotCheckItemID": 0, "HDotCheckItem": "", "HDotCheckPart": "", "HClaim": "", "HManagerID": "0", "HManagerNumber": "", "HManagerName": "", "HRemark": "" }];
                option.data = [{ "HDotCheckItemID": 0, "HDotCheckItem": "", "HDotCheckPart": "", "HClaim": "", "HManagerID": "0", "HManagerNumber": "", "HManagerName": "", "HRemark": "", "HDotCheckItemClassID": 0, "HDotCheckItemClassName": "", "HDotCheckItemMethodID": 0, "HDotCheckItemMethodName": "", "HDotCheckResult": "Y" }];
                table.render(option);
            }
@@ -610,7 +796,7 @@
            }
            // ç‚¹æ£€è®¡åˆ’ ç‚¹æ£€ä¿¡æ¯ é…ä»¶ä¿¡æ¯
            window.get_DocCheckItem = function(data) {
            window.get_DocCheckItem = function (data) {
                $.ajax({
                    url: GetWEBURL() + "/Sc_MouldDotCheckPlanBill/Sc_MouldDotCheckPlanBillListProjectDetai",
                    type: "GET",
@@ -622,7 +808,7 @@
                                var BYData = result.list[0];//点检
                                var PJData = result.list[1];//配件
                                var rowdate1 = layui.table.cache["mainTable"];
                                option.data = [{ "HDotCheckItemID": 0, "HDotCheckItem": "", "HDotCheckPart": "", "HClaim": "", "HManagerID": "0", "HManagerNumber": "", "HManagerName": "", "HRemark": "" }];
                                option.data = [{ "HDotCheckItemID": 0, "HDotCheckItem": "", "HDotCheckPart": "", "HClaim": "", "HManagerID": "0", "HManagerNumber": "", "HManagerName": "", "HRemark": "", "HDotCheckItemClassID": 0, "HDotCheckItemClassName": "", "HDotCheckItemMethodID": 0, "HDotCheckItemMethodName": "", "HDotCheckResult": "Y" }];
                                table.render(option);
                                if (BYData.length != 0)  //表体数据不为空时
@@ -632,16 +818,14 @@
                                        var checkrow = {
                                            "HDotCheckItemID": BYData[i].HDotCheckItemID, "HDotCheckItem": BYData[i].HDotCheckItem, "HDotCheckPart": BYData[i].HDotCheckPart,
                                            "HClaim": BYData[i].HClaim, "HManagerID": BYData[i].HManagerID, "HManagerNumber": BYData[i].HManagerCode,
                                            "HManagerName": BYData[i].HManagerName, "HRemark": BYData[i].HRemark
                                            "HManagerName": BYData[i].HManagerName, "HRemark": BYData[i].HRemark, "HDotCheckItemClassID": 0, "HDotCheckItemClassName": "", "HDotCheckItemMethodID": 0, "HDotCheckItemMethodName": "", "HDotCheckResult": "Y"
                                        };
                                        buttonArr.push(checkrow);  //将之前的数据存储
                                    }
                                    table.reload("mainTable", {
                                        data: buttonArr    //将数据重新载入表格
                                    })
                                    option.data = buttonArr;
                                    table.render(option);
                                }
                            } else {
                                layer.alert(result.code + result.Message, { icon: 5 });
                            }
@@ -651,7 +835,7 @@
            }
            //点检规程 ç‚¹æ£€ä¿¡æ¯ é…ä»¶ä¿¡æ¯
            window.get_DocCheckItem2 = function(data) {
            window.get_DocCheckItem2 = function (data) {
                $.ajax({
                    url: GetWEBURL() + "/Sc_MouldDotCheckRuleBill/Sc_MouldDotCheckRuleBillSubAndSubItem",
                    type: "GET",
@@ -663,7 +847,7 @@
                                var BYData = result.list[0];//点检
                                var PJData = result.list[1];//配件
                                var rowdate1 = layui.table.cache["mainTable"];
                                option.data = [{ "HDotCheckItemID": 0, "HDotCheckItem": "", "HDotCheckPart": "", "HClaim": "", "HManagerID": "0", "HManagerNumber": "", "HManagerName": "", "HRemark": "" }];
                                option.data = [{ "HDotCheckItemID": 0, "HDotCheckItem": "", "HDotCheckPart": "", "HClaim": "", "HManagerID": "0", "HManagerNumber": "", "HManagerName": "", "HRemark": "", "HDotCheckItemClassID": 0, "HDotCheckItemClassName": "", "HDotCheckItemMethodID": 0, "HDotCheckItemMethodName": "", "HDotCheckResult": "Y" }];
                                table.render(option);
                                if (BYData.length != 0)  //表体数据不为空时
@@ -673,13 +857,12 @@
                                        var checkrow = {
                                            "HDotCheckItemID": BYData[i].HDotCheckItemID, "HDotCheckItem": BYData[i].HDotCheckItem, "HDotCheckPart": BYData[i].HDotCheckPart,
                                            "HClaim": BYData[i].HClaim, "HManagerID": BYData[i].HManagerID, "HManagerNumber": BYData[i].HManagerNumber,
                                            "HManagerName": BYData[i].HManagerName, "HRemark": BYData[i].HRemark
                                            "HManagerName": BYData[i].HManagerName, "HRemark": BYData[i].HRemark, "HDotCheckItemClassID": 0, "HDotCheckItemClassName": "", "HDotCheckItemMethodID": 0, "HDotCheckItemMethodName": "", "HDotCheckResult": "Y"
                                        };
                                        buttonArr.push(checkrow);  //将之前的数据存储
                                    }
                                    table.reload("mainTable", {
                                        data: buttonArr    //将数据重新载入表格
                                    })
                                    option.data = buttonArr;
                                    table.render(option);
                                }
                            } else {
@@ -719,7 +902,20 @@
                                , "HMouldID": data.HMouldID
                                , "HMouldDotCheckRuleName": data.器具点检规程单据号
                                , "HMouldDotCheckRuleID": data.HMouldDotCheckRuleID
                                , "HErrNote": data.异常情况记录 //异常情况记录
                                , "HBigSafeNote": data.重大安全隐患记录 //重大安全隐患记录
                                , "HDotCheckNote": data.点检数据 //点检数据
                                , "HShiftsID": data.HShiftsID //
                                , "HShiftsName": data.班次名称 //班次名称
                            });
                            if (data.最终结论 == "不合格") {
                                document.querySelectorAll("[name='HLastResult']")[0].removeAttribute('checked'); //删除选择属性
                                $("input:radio[name=HLastResult][value=" + "NG" + "]").attr("checked", "true"); //添加选择属性
                            } else {
                                document.querySelectorAll("[name='HLastResult']")[1].removeAttribute('checked'); //删除选择属性
                                $("input:radio[name=HLastResult][value=" + "OK" + "]").attr("checked", "true"); //添加选择属性
                            }
                            form.render('radio');
                        } else {
                            layer.alert(result.msg, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
@@ -753,10 +949,18 @@
                    data: { "sqlWhere": "and HInterID=" + linterid },
                    success: function (result) {
                        if (result.count == 1) {
                            option.data = result.list[0];
                            var data = result.data;
                            var subarr = [];
                            for (var i = 0; i < data.length; i++) {
                                subarr.push({ "HDotCheckItemID": data[i].点检项目ID, "HDotCheckItem": data[i].点检项目, "HDotCheckPart": data[i].点检部位, "HClaim": data[i].具体要求, "HManagerID": data[i].负责人ID, "HManagerNumber": data[i].负责人代码, "HManagerName": data[i].负责人名称, "HRemark": data[i].子备注2, "HDotCheckItemClassID": data[i].HDotCheckItemClassID, "HDotCheckItemClassName": data[i].点检项目分类名称, "HDotCheckItemMethodID": data[i].HDotCheckItemMethodID, "HDotCheckItemMethodName": data[i].点检方法名称, "HDotCheckResult": data[i].点检结果 == "合格" ? 'Y' : 'X'  });
                            }
                            option.data = subarr;
                            table.render(option);
                            option1.data = result.list[1];
                            table.render(option1);
                            for (let j = 0; j < data.length; j++) {
                                $("#HDotCheckResult" + (j + 1)).val(data[j].点检结果 == "合格" ? 'Y' : 'X')
                            }
                            form.render('select');
                        } else {
                            layer.alert(result.code + result.Message, { icon: 5 });
@@ -771,15 +975,14 @@
            //增加一行
            function btnAddLine(NewRow) {
                var tableBak = table.cache["mainTable"]; //获取之前编辑过的表格数据
                buttonArr = [];//清空数组
                for (var i = 0; i < tableBak.length; i++) {
                    buttonArr.push(tableBak[i]);  //将之前的数据存储
                table.cache["mainTable"].push(NewRow);
                option.data = table.cache["mainTable"];
                table.render(option);
                for (var i = 1; i <= option.data.length; i++) {
                    $('#HDotCheckResult' + i + '').find("option[value='" + option.data[i - 1].HDotCheckResult + "']").attr("selected", true);
                }
                buttonArr.push(NewRow);  //在尾部加一行
                table.reload("mainTable", {
                    data: buttonArr    //将数据重新载入表格
                })
                form.render('select');
            }
            //复制一行
@@ -797,6 +1000,11 @@
                    table.cache["mainTable"].push(JSON.parse(copyrow));//将复制的行强转成json追加到表格上
                    option.data = table.cache["mainTable"];//将数据绑定到data上
                    table.render(option);//将数据渲染到表格上
                    for (var i = 1; i <= option.data.length; i++) {
                        $('#HDotCheckResult' + i + '').find("option[value='" + option.data[i - 1].HDotCheckResult + "']").attr("selected", true);
                    }
                    form.render('select');
                }
            }
@@ -861,7 +1069,7 @@
        function GetMouldDotCheckPlanValue(obj) {  //器具点检计划
            $("#HPlanNo").val(obj[0].单据号);
            $("#HPlanInterID").val(obj[0].hmainid);
            $("#HPlanInterID").val(obj[0].hmainid);
            get_DocCheckItem(obj[0].hmainid);
        }