1
cwjbxqmz
2023-11-10 293fb733b30362766e13023967452e6bf52cac6f
WebTM/views/É豸¹ÜÀí/Sb_EquipDotCheckBillList_PDA.html
@@ -1,817 +1,419 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>设备点检记录单</title>
    <title>设备点检记录单列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <!--引用layui样式文件-->
    <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
    <!--引用layui js文件-->
    <script src="../../layuiadmin/layui/layui.js"></script>
    <script src="../../layuiadmin/Scripts/json2.js"></script>
    <script src="../../layuiadmin/Scripts/jquery-1.4.1.js"></script>
    <script src="../../layuiadmin/Scripts/webConfig.js"></script>
    <script src="../../layuiadmin/PubCustom.js"></script>
    <script src="../../layuiadmin/zgqCustom/zgqCustom.js"></script>
    <!--自定义样式-->
    <style>
        /* .maintitle {
            background-color: #1492ff;
            color: #fff;
            padding: 5px 10px;
            border: none;
            border-radius: 4px;
        }
        .title {
            border-left: 4px solid #1492ff;
            padding-left: 6px;
            margin: 20px 10px 4px;
            font-size: 16px;
            color: #333;
        }
        .buttom_box_little {
            width: 60px;
            height: 36px;
            color: #fff;
            background-color: #1492ff;
            border-radius: 4px;
            border: none;
            margin: 10px;
        }
        .layui-input {
            width: 93%;
        }
        .layui-inline, img {
            display: block;
            vertical-align: middle
        }
        .layui-input, .layui-textarea {
            display: inline-block;
            width: 100%;
            padding-left: 10px;
        }
        .laydate-time-list ol {
            overflow-x: hidden !important;
            overflow-y: auto !important;
        }
        .layui-form-label {
            padding: 9px 5px;
            width: 85px;
        }
        .layui-input-block {
            margin-left: 85px;
            min-height: 36px;
        }*/
        .layui-form-label {
            font-size: 14px;
            width: 85px;
            text-align: inherit;
        }
        /*全局设置输入框高度*/
        .layui-input {
            height: 30px;
        }
        /*设置表头输入框*/
        .t1_input {
            padding: 1%;
        }
        /*本站信息td*/
        .bz_td {
            display: -webkit-box; /*设置按钮不换行*/
            padding: 1%; /*设置输入框边距*/
        }
        /*设置本站信息按钮高度*/
        .bz_btu {
            height: 30px;
            width: 60px;
            line-height: 30px;
        }
        th {
            width: 70px;
            text-align: center;
    <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
    <script src="../../../layuiadmin/layui/layui.js"></script>
    <script src="../../../layuiadmin/Scripts/json2.js"></script>
    <script src="../../../layuiadmin/Scripts/jquery-1.4.1.js"></script>
    <script src="../../../layuiadmin/Scripts/webConfig.js"></script>
    <script src="../../../layuiadmin/PubCustom.js"></script>
    <script src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
    <style type="text/css">
        input.layui-input.layui-unselect {
            padding-right: 0;
        }
    </style>
</head>
<body>
    <div class="layui-fluid" style="padding: 0;">
        <div class="layui-card">
            <div class="layui-card-body" style="padding: 1px;">
                <form class="layui-form" action="" lay-filter="formData" id="formData" style="background-color:white;">
                    <div style="background-color:#0085E8;">
                        <span style="color: white;"><i class="layui-icon layui-icon-form"></i>设备点检记录单</span>
                    </div>
                    <div class="layui-form-item" style="margin: 1% 2%;text-align: right;">
                        <button type="button" lay-submit="" lay-filter="Add" class="layui-btn layui-btn-radius">新增</button>
                        <!--<button type="button" lay-submit="" lay-filter="" class="layui-btn layui-btn-radius">清空</button>-->
                        <button type="button" lay-submit="" lay-filter="Saver" class="layui-btn layui-btn-radius">保存</button>
                        <button type="button" lay-submit="" lay-filter="Cancel" class="layui-btn layui-btn-radius layui-btn-danger">退出</button>
                    </div>
                    <div class="layui-tab layui-tab-card" lay-filter="TabTest">
                        <div class="layui-tab-content">
                            <div class="layui-tab-item layui-show">
                                <table style="width:80%;">
                                    <tbody>
                                        <tr>
                                            <th>设备条码</th>
                                            <td class="bz_td">
                                                <input type="text" name="HBarCode" class="layui-input" id="HBarCode" placeholder="请输入设备条码后回车" style="border-radius: 50px;">
                                                <button type="button" lay-submit="" class="layui-btn layui-col-xs2 bz_btu layui-btn-radius" lay-filter="QueDin" style="line-height: 30px;">确定</button>
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>点检开始</th>
                                            <td class="bz_td">
                                                <input type="datetime" name="HBeginDate" class="layui-input" id="HBeginDate" placeholder="请选择日期" style="border-radius: 50px;">
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>点检结束</th>
                                            <td class="bz_td">
                                                <input type="datetime" name="HEndDate" class="layui-input" id="HEndDate" placeholder="请选择日期" style="border-radius: 50px;">
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>数量</th>
                                            <td class="bz_td">
                                                <input type="text" name="HQty" class="layui-input" id="HQty" value="0" placeholder="请输入数量" style="border-radius: 50px;">
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>单据号</th>
                                            <td class="bz_td">
                                                <input type="text" name="HBillNo" class="layui-input" id="HBillNo" placeholder="请输入单据号" style="border-radius: 50px;">
                                                <input type="hidden" name="HInterID" id="HInterID" value="0" autocomplete="off" class="layui-input">
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>单据日期</th>
                                            <td class="bz_td">
                                                <input type="datetime" name="HDate" class="layui-input" id="HDate" placeholder="请选择日期" style="border-radius: 50px;">
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>部门</th>
                                            <td class="bz_td">
                                                <input type="text" name="HDeptName" class="layui-input" id="HDeptName" placeholder="选择部门" style="background-color:#efefef4d;">
                                                <input type="hidden" name="HDeptID" id="HDeptID" value="0" autocomplete="off" class="layui-input">
                                                <button type="button" lay-submit="" class="layui-btn layui-col-xs2 bz_btu" lay-filter="Department" id="Department" style="font-weight:bolder">...</button>
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>设备名称</th>
                                            <td class="bz_td">
                                                <input type="text" name="HBarName" class="layui-input" id="HBarName" placeholder="请输入设备名称" style="border-radius: 50px;">
                                                <input type="hidden" name="HEquipID" id="HEquipID" value="0" autocomplete="off" class="layui-input">
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>设备规格</th>
                                            <td class="bz_td">
                                                <input type="text" name="HBarSpec" class="layui-input" id="HBarSpec" placeholder="请输入设备规格" style="border-radius: 50px;">
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>设备型号</th>
                                            <td class="bz_td">
                                                <input type="text" name="HBarModel" class="layui-input" id="HBarModel" placeholder="请输入设备型号" style="border-radius: 50px;">
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                            <div class="layui-tab-item">
                                <table style="width:80%;">
                                    <tbody>
                                        <tr>
                                            <th>创建人</th>
                                            <td class="bz_td">
                                                <input type="text" name="HMaker" class="layui-input" id="HMaker" style="border-radius: 50px;">
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>创建日期</th>
                                            <td class="bz_td">
                                                <input type="text" name="HMakeDate" class="layui-input" id="HMakeDate" style="border-radius: 50px;">
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>修改人</th>
                                            <td class="bz_td">
                                                <input type="text" name="HUpDater" class="layui-input" id="HUpDater" style="border-radius: 50px;">
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>修改日期</th>
                                            <td class="bz_td">
                                                <input type="text" name="HUpDateDate" class="layui-input" id="HUpDateDate" style="border-radius: 50px;">
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>审核人</th>
                                            <td class="bz_td">
                                                <input type="text" name="HChecker" class="layui-input" id="HChecker" style="border-radius: 50px;">
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>审核日期</th>
                                            <td class="bz_td">
                                                <input type="text" name="HCheckDate" class="layui-input" id="HCheckDate" style="border-radius: 50px;">
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>作废人</th>
                                            <td class="bz_td">
                                                <input type="text" name="HDeleteMan" class="layui-input" id="HDeleteMan" style="border-radius: 50px;">
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>作废日期</th>
                                            <td class="bz_td">
                                                <input type="text" name="HDeleteDate" class="layui-input" id="HDeleteDate" style="border-radius: 50px;">
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                            <div class="layui-tab-item">
    <div class="layui-fluid">
        <div class="layui-col-md12">
            <div class="layui-card" style="padding: 1px">
                <div class="layui-card-body" style="padding: 1px;">
                    <form class="layui-form" action="" lay-filter="component-form-group">
                        <div class="layui-collapse">
                            <div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">设备点检规程</label>
                                    <div class="layui-input-inline">
                                        <input type="hidden" name="HEquipDotCheckRuleInterID" id="HEquipDotCheckRuleInterID" class="layui-input" value="" style="float:left;width:150px;">
                                        <input type="text" name="HEquipDotCheckRuleInterNo" id="HEquipDotCheckRuleInterNo" class="layui-input" value="" style="float:left;width:150px;" readonly="readonly">
                                        <button type="button" lay-submit="" class="layui-btn layui-btn-primary" lay-filter="HEquipDotCheckRuleInterist" style="width:40px;">
                                            <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
                                        </button>
                                    </div>
                                    <label class="layui-form-label" style="width: 30px;">日期</label>
                                    <input type="date" class="layui-input" id="HBeginDate" style="width:110px;" placeholder="yyyy-MM-dd">
                                </div>
                                <table class="" id="mainTable" lay-filter="mainTable"></table>
                                <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-Edit"><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="barDemo">
                                    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
                                </script>
                                <div class="layui-inline">
                                    <label class="layui-form-label" style="width:5px">-</label>
                                </div>
                                <div class="layui-inline">
                                    <input type="date" class="layui-input" id="HEndDate" style="width:110px;" placeholder="yyyy-MM-dd">
                                </div>
                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearch" id="btnSearch">
                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                </button>
                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnReSearch" id="btnReSearch" style="padding:0 5px">重置</button>
                            </div>
                        </div>
                        <ul class="layui-tab-title">
                            <li class="layui-this">基本信息</li>
                            <li>其他信息</li>
                            <li>明细信息</li>
                        </ul>
                    </div>
                    <!--隐藏字段-->
                    <input type="hidden" name="lngBillKey" id="lngBillKey">
                    <input type="hidden" name="lngBillSubKey" id="lngBillSubKey">
                </form>
                        <table class="" id="mainTable" lay-filter="mainTable"></table>
                        <script type="text/html" id="toolbarDemo">
                            <div class="layui-btn-container">
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btnDel"><i class="layui-icon layui-icon-delete"></i>删除</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-exit"><i class="layui-icon layui-icon-return"></i>退出</button>
                            </div>
                        </script>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <script>
        layui.config({
            base: '../../layuiadmin/' //静态资源所在路径
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
            index: 'lib/index', //主入口模块
        }).use(['index', 'form', 'table', 'element', 'laypage', 'laydate'], function () {
            //#region å…¬å…±å˜é‡
            var $ = layui.$
                , admin = layui.admin
                , layer = layui.layer
                , table = layui.table
                , form = layui.form
                , element = layui.element
                , laypage = layui.laypage
                , laydate = layui.laydate
                , element = layui.element;
                , util = layui.util
            //查询条件
            var sWhere = "";
            var option = [];
            var HModName = "Sb_EquipDotCheckBillList_PDA";
            //#region åˆå§‹åŒ–页面
            laydate.render({
                elem: '#HBeginDate'
                , type: 'datetime'
            });
            laydate.render({
                elem: '#HEndDate'
                , type: 'datetime'
            });
            laydate.render({
                elem: '#HDate'
                , type: 'datetime'
            });
            laydate.render({
                elem: '#HMakeDate'
                , type: 'datetime'
            });
            laydate.render({
                elem: '#HUpDateDate'
                , type: 'datetime'
            });
            laydate.render({
                elem: '#HCheckDate'
                , type: 'datetime'
            });
            laydate.render({
                elem: '#HDeleteDate'
                , type: 'datetime'
            });
            //初始化表格
            set_InitGrid();
            //获取最大单据号
            $.ajax({
                url: GetWEBURL() + "/Web/GetMAXNum",
                type: "GET",
                data: { "HBillType": '3903' },
                success: function (d) {
                    //console.log(d.data);
                    $("#HInterID").val("0");
                    $("#HBillNo").val(d.data[0].HBillNo);
                }
            });
            //#endregion
            //#region è¿›å…¥é¡µé¢æ—¢åŠ è½½
            //#region åˆå§‹åŒ–界面
            set_ClearBill();
            //#endregion
            //#region ç‚¹å‡»äº‹ä»¶åŒ…括on form事件等
            //头工具栏事件
            table.on('toolbar(mainTable)', function (obj) {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                var NewRow = { "HDotCheckItemID": 0, "HDotCheckCode": "", "HDotCheckItem": "", "HDotCheckPart": "", "HClaim": "", "HManagerID": 0, "HManagerCode": "", "HManagerName": "" };
                switch (obj.event) {
                    //新增一行
                    case 'btn-AddLine': btnAddLine(NewRow);
                    //审核
                    case 'btnCheck': btnCheck(1);
                        break;
                    case 'btn-Edit': btnEditLine(obj);
                    //反审核
                    case 'btnAdutCheck': btnCheck(2);
                        break;
                    //删除
                    case 'btnDel': btnDel();
                        break;
                    //退出
                    case 'btn-exit': Pub_Close(2);
                        break;
                    //隐藏列设置
                    case 'HideColumn':
                        get_HideColumn();
                        break;
                };
            });
            //重置按钮
            form.on('submit(btnReSearch)', function (data) {
                set_ClearQuery();
            });
            //查询按钮
            form.on('submit(btnSearch)', function (data) {
                get_FastQuery();
            });
            //行监听事件-单击
            table.on('row(mainTable)', function (obj) {
                var flag = !obj.tr.find(':checkbox:first').prop('checked');
                obj.tr.find(':checkbox').prop('checked', flag);
                if (flag) {
                    obj.tr.find('.layui-form-checkbox').addClass('layui-form-checked');  //设置复选框选中样式
                    $(obj.tr.selector).attr({ "style": "background:#ceedfa;color:black" });//改变当前tr背景颜色和字体颜色
                } else {
                    obj.tr.find('.layui-form-checkbox').removeClass('layui-form-checked');//取消复选框选中样式
                    $(obj.tr.selector).attr({ "style": "background:" });//取消当前tr颜色
                }
            });
            //行内事件
            table.on('tool(mainTable)', function (obj) {
                set_GridDelete(obj);   //行内删除
                set_GridCellCheck(obj); //行内快捷键筛选
            });
            //进入页面默认光标在条形码上
            $("#HBarCode").focus();
            //初始基本信息赋值
            $("#HBeginDate").val(Format(new Date(), "yyyy-MM-dd hh:mm:ss"));  //点检开始时间
            $("#HEndDate").val(Format(new Date(), "yyyy-MM-dd hh:mm:ss"));    //点检结束时间
            $("#HDate").val(Format(new Date(), "yyyy-MM-dd hh:mm:ss"));      //单据日期
            $("#HMakeDate").val(Format(new Date(), "yyyy-MM-dd hh:mm:ss"));  //创建日期
            $("#HDeptID").val(sessionStorage["HDeptID"]);            //部门ID
            $("#HDeptName").val(sessionStorage["HDept"]);            //部门
            $("#HManagerID").val(sessionStorage["HBillerID"]);       //负责人ID
            $("#HManagerName").val(sessionStorage["HUserName"]);     //负责人
            $("#HMaker").val(sessionStorage["HUserName"]);     //创建人
            //模治具条码是否扫描标记
            var HProcExchBillNoFlag = false;
            //条形码回车方法
            $('#HBarCode').on('keydown', function (event) {
                if (event.keyCode == 13) {
                    GetMeesageByBarCode();
                }
            });
            //确定
            form.on('submit(QueDin)', function (data) {
                GetMeesageByBarCode();
            });
            //退出-关闭页面方法
            $('#Cancel').on('click', function () {
                layer.confirm('您确定要退出吗?', { icon: 3, title: '提示' }, function (index) {
                    parent.layui.admin.events.closeThisTabs(); //关闭页签
                });
            })
            //提交
            form.on('submit(Saver)', function (data) {//提交
                data.field.HMaker = sessionStorage["HUserName"];//制单人
                var oMain = JSON.stringify(data.field);
                var sSubStr = JSON.stringify(table.cache['mainTable']);
                var sMainSub = oMain + ';' + sSubStr;
                if (AllowLoadData(sSubStr)) {
                    $.ajax({
                        type: "POST",
                        url: GetWEBURL() + "/Sb_PDA_EquipDotCheckBill/SaveGetEquipDotCheckBillList",
                        async: true,
                        data: { "msg": sMainSub },
                        dataType: "json",
                        success: function (data) {
                            if (data.count == 1) {
                                layer.msg("提交成功");
                                $('#Saver').removeClass("buttom_box_little");
                                $('#Saver').addClass("layui-btn-disabled").attr("disabled", true);
                            }
                            else {
                                layer.close(index);
                                layer.msg(data.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            }
                        },
                        error: function (err) {
                            layer.close(index);
                            layer.msg("错误:" + err, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                        }
                    });
                }
            });
            //新增
            form.on('submit(Add)', function (data) {
                $('#Saver').addClass("buttom_box_little");
                $('#Saver').addClass("layui-btn-disabled").attr("disabled", false);
                $("#HBarCode").removeAttr("readonly");//条形码清除只读
                $("#HBarCode").removeAttr("background-color");//条形码清除背景色
                // æ¸…空表单 ï¼ˆâ€œformData”是表单的id)
                $("#formData")[0].reset();
                layui.form.render();
                option.data = [{ "HDotCheckItemID": 0, "HDotCheckCode": "", "HDotCheckItem": "", "HDotCheckPart": "", "HClaim": "", "HManagerID": 0, "HManagerCode": "", "HManagerName": ""}];
                table.render(option);
                $("#HBarCode").focus();
                //获取最大单据号
                $.ajax({
                    url: GetWEBURL() + "/Web/GetMAXNum",
                    type: "GET",
                    data: { "HBillType": '3903' },
                    success: function (d) {
                        //console.log(d.data);
                        $("#HInterID").val("0");
                        $("#HBillNo").val(d.data[0].HBillNo);
                //mainTable ä¸ºè¡¨æ ¼ID   æ³¨æ„æ­¤å¤„如果ID不正确将导致你在监听复选框时获取不到你选择的数据,前面的只是添加或删除选中未选中样式以及设置背景色,字体颜色
                layui.each(table.cache.mainTable, function (i, l) {
                    if (obj.tr.index() == l.LAY_TABLE_INDEX) {
                        l.LAY_CHECKED = flag;
                    }
                });
                $("#HBeginDate").val(Format(new Date(), "yyyy-MM-dd hh:mm:ss"));  //点检开始时间
                $("#HEndDate").val(Format(new Date(), "yyyy-MM-dd hh:mm:ss"));    //点检结束时间
                $("#HDate").val(Format(new Date(), "yyyy-MM-dd hh:mm:ss"));      //单据日期
                $("#HMakeDate").val(Format(new Date(), "yyyy-MM-dd hh:mm:ss"));  //创建日期
                $("#HMaker").val(sessionStorage["HUserName"]);     //创建人
            })
             //#region é€€å‡ºæŒ‰é’®
            form.on('submit(Cancel)', function () {
                layer.confirm('您确定要退出吗?', { icon: 3, title: '提示' }, function (index) {
                    Pub_Close(2);
                });
            })
            });
            //#endregion
            //部门弹窗
            form.on('submit(Department)', function () {
                //页面层-自定义
                layer.open({
                    type: 2,
                    skin: 'layui-layer-rim', //加上边框
                    title: '部门列表',
                    closeBtn: 1,
                    shift: 2,
                    area: ['80%', '80%'],
                    maxmin: true,
                    content: ['../../views/PublicPage/DeptInformation.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('请选择数据');
                        }
                        $("#HDeptName").val(checkStatus.data[0].HName);
                        $("#HDeptID").val(checkStatus.data[0].HItemID);
                        layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) {
                        //按钮【按钮二】的回调
                        //return false å¼€å¯è¯¥ä»£ç å¯ç¦æ­¢ç‚¹å‡»è¯¥æŒ‰é’®å…³é—­
                    },
                    end: function () {
            //#region æ­¤é¡µé¢æ‰€æœ‰çš„æ–¹æ³•
                    },
                    success: function (layero, index) {
            //初始化界面
            function set_ClearBill() {
                //初始化时间
                $("#HBeginDate").val(Format(new Date() - 1000 * 60 * 60 * 24 * 30, "yyyy-MM-dd"));
                $("#HEndDate").val(Format(new Date(), "yyyy-MM-dd"));
                    }
                });
            });
                //加载数据到网格
                get_FastQuery();
                DisPlay_HideColumn();
            }
            //表头信息设备保养规程
            form.on('submit(HEquipDotCheckRuleInterist)', function () {
                //页面层-自定义
                layer.open({
                    type: 2,
                    skin: 'layui-layer-rim', //加上边框
                    title: '设备点检规程列表',
                    closeBtn: 1,
                    shift: 2,
                    area: ['80%', '80%'],
                    maxmin: true,
                    content: ['../设备管理/设备规程单/Sb_EquipDotCheckRuleList.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('请选择数据');
                        }
                        $("#HEquipDotCheckRuleInterNo").val(checkStatus.data[0].单据号);
                        $("#HEquipDotCheckRuleInterID").val(checkStatus.data[0].hmainid);
                        get_DocCheckItem2();
                        layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
            //列明显示下拉框
            function ColFilter() {
                var Organization = '<option  value="0" selected="selected" ></option>';
                for (var i = 1; i < option.cols[0].length; i++) {
                    if (option.cols[0][i].hide != true) {
                        Organization += '<option  style="color:blue;" value="' + option.cols[0][i].field + '">' + option.cols[0][i].field + '</option>';
                    }
                    , btn2: function (index, layero) {
                        //按钮【按钮二】的回调
                        //return false å¼€å¯è¯¥ä»£ç å¯ç¦æ­¢ç‚¹å‡»è¯¥æŒ‰é’®å…³é—­
                    },
                    end: function () {
                    },
                    success: function (layero, index) {
                    }
                });
            });
            function get_DocCheckItem2() {
                }
                $("#ColName").empty();
                $("#ColName").append(Organization);
                form.render('select');
            }
            //加载网格
            function get_Display(sWhere) {
                //动态列-缓存列表
                $.ajax({
                    url: GetWEBURL() + "/Web/GetDotCheckRuleItemByDotCheckRuleID",
                    url: GetWEBURL() + "/Web/GetEquipmentBillsList",
                    type: "GET",
                    data: { "HDotCheckRuleInterID": $("#HEquipDotCheckRuleInterID").val() },
                    success: function (result) {
                        if (result != null) {
                            if (result.count == 1) {
                                var BYData = result;//
                                var rowdate1 = layui.table.cache["mainTable"];
                                option.data = [{ "HDotCheckItemID": 0, "HDotCheckCode": "", "HDotCheckItem": "", "HDotCheckPart": "", "HClaim": "", "HManagerID": 0, "HManagerCode": "", "HManagerName": ""}];
                                table.render(option);
                    async: false,
                    data: { "sWhere": sWhere, "Type": "DJ" },
                    success: function (data1) {
                                if (BYData.data.length != 0)  //表体数据为空时
                                {
                                    buttonArr = [];//清空数组
                                    for (var i = 0; i < BYData.data.length; i++) {
                                        var checkrow = {
                                            "HDotCheckItemID": BYData.data[i].HDotCheckItemID, "HDotCheckCode": BYData.data[i].HDotCheckCode, "HDotCheckItem": BYData.data[i].HDotCheckItem,
                                            "HDotCheckPart": BYData.data[i].HDotCheckPart, "HClaim": rowdate1[i].HClaim, "HManagerID": BYData.data[i].HManagerID, "HManagerCode": BYData.data[i].HManagerCode,
                                            "HManagerName": BYData.data[i].HManagerName
                                        };
                                        buttonArr.push(checkrow);  //将之前的数据存储
                        if (data1.count == 1) {
                            var data = [];
                            var col = [];
                            //给空的数组赋值
                            for (var key in data1.list) {
                                data.push({ "id": data1.list[key].ColmCols, "name": data1.list[key].ColmCols, "Type": data1.list[key].ColmType });
                            }
                            //在列表左边添加勾选框
                            col.push({ type: 'checkbox', fixed: 'left' });
                            for (var i = 0; i < data.length; i++) {
                                if ($.inArray(data[i].name, "") > -1) {
                                    col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true }); //隐藏id列
                                }
                                else {
                                    switch (data[i].Type) {
                                        //int
                                        case 'DateTime':
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true });
                                            break;
                                        default:
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true });
                                    }
                                    table.reload("mainTable", {
                                        data: buttonArr    //将数据重新载入表格
                                    })
                                }
                            }
                            else {
                                option.data = [{ "HDotCheckItemID": 0, "HDotCheckCode": "", "HDotCheckItem": "", "HDotCheckPart": "", "HClaim": "", "HManagerID": 0, "HManagerCode": "", "HManagerName": "" }];
                                table.render(option);
                                layer.alert("该设备暂无默认点检记录", { icon: 5 });
                            }
                        }
                    }
                })
            }
            //初始化表格
            function set_InitGrid() {
                //表头
                columns = [
                    { type: 'checkbox', fixed: 'left' }
                    , { templet: '#xuhao', title: '序号', sort: true, fixed: 'left', event: "qwe" }
                    , { field: 'HDotCheckItemID', title: '点检项目ID', edit: 'text', hide: true }
                    , { field: 'HDotCheckCode', title: '点检项目代码', edit: 'text', event: "HDotCheckCode" }
                    , { field: 'HDotCheckItem', title: '点检项目', edit: 'text', event: "" }
                    , { field: 'HDotCheckPart', title: '点检部位', edit: 'text', event: "" }
                    , { field: 'HClaim', title: '具体要求', edit: 'text' }
                    , { field: 'HManagerID', title: '负责人代码', edit: 'text', hide: true }
                    , { field: 'HManagerCode', title: '负责人代码', edit: 'text', event: 'HManagerCode' }
                    , { field: 'HManagerName', title: '负责人名称', edit: 'text' }
                    , { fixed: 'right', title: '操作', toolbar: '#barDemo', width: 150 }
                ];
                option = {
                    id: 'mainTable'
                    , elem: '#mainTable'
                    , toolbar: '#toolbarDemo'
                    , page: true
                    , cellMinWidth: 120
                    , height: 500
                    , cols: [columns]
                    , done: function (res, curr, count) {
                    }
                };
                option.data = [{ "HDotCheckItemID": 0, "HDotCheckCode": "", "HDotCheckItem": "", "HDotCheckPart": "", "HClaim": "", "HManagerID": 0, "HManagerCode": "", "HManagerName": ""}];
                table.render(option);
            }
            //增加一行
            function btnAddLine(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 btnEditLine() {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1) {
                    layer.open({
                        type: 2
                        , area: ['80%', '80%']
                        , title: '编辑PDA设备点检'
                        , shade: 0.6 //遮罩透明度
                        , maxmin: true //允许全屏最小化
                        , anim: 0 //0-6的动画形式,-1不开启
                        , content: '../设备管理/Sb_EquipDocCheckItemBillList_PDAEdit.html?OperationType=3&linterid=&HSouceBillType='
                        , resize: false
                        , btn: ['确定', '取消']
                        , yes: function (index, layero) {
                            //按钮【按钮一】的回调
                            var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
                            var HDotCheckItemID = parent.layer.getChildFrame('#HDotCheckItemID').val();
                            var HDotCheckCode = parent.layer.getChildFrame('#HDotCheckCode').val();
                            var HDotCheckItem = parent.layer.getChildFrame('#HDotCheckItem').val();
                            var HDotCheckPart = parent.layer.getChildFrame('#HDotCheckPart').val();
                            var HClaim = parent.layer.getChildFrame('#HClaim').val();
                            var HManagerID = parent.layer.getChildFrame('#HManagerID').val();
                            var HManagerCode = parent.layer.getChildFrame('#HManagerCode').val();
                            var HManagerName = parent.layer.getChildFrame('#HManagerName').val();
                            if (HDotCheckItemID == "") {
                                return layer.msg('请选择点检项目');
                            }
                            if (HManagerID == "") {
                                return layer.msg('请选择责任人');
                            }
                            buttonArr = [];//清空数组
                            var checkrow = {
                                "HDotCheckItemID": HDotCheckItemID, "HDotCheckCode": HDotCheckCode, "HDotCheckItem": HDotCheckItem,
                                "HDotCheckPart": HDotCheckPart, "HClaim": HClaim, "HManagerID": HManagerID, "HManagerCode":HManagerCode,
                                "HManagerName":HManagerName
                            option = {
                                elem: '#mainTable'
                                , toolbar: '#toolbarDemo'
                                , cellMinWidth: 120
                                , page: true
                                , limit: 50
                                , limits: [50, 500, 5000, 20000]
                                , height: 'full-70'
                                , totalRow: false //开启合计
                                , cols: [col]
                                , data: data1.data
                            };
                            buttonArr.push(checkrow);  //将之前的数据存储
                            table.reload("mainTable", {
                                data: buttonArr    //将数据重新载入表格
                            })
                            layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                        }
                        , end: function () {
                            table.render(option);
                        }
                        , cancel: function () {
                        }
                    })
                } else {
                    layer.msg('请选择一行数据编辑!');
                }
            }
            // è¡¨æ ¼è¡Œå†…事件删除
            function set_GridDelete(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["mainTable"];
                            oldData.splice(obj.tr.data('index'), 1);
                            table.reload('mainTable', { data: oldData });
                            layer.close(index);
                        }
                    });
                }
            }
            //数据验证
            function AllowLoadData(sSubStr) {
                if ($("#HEquipName").val() == '') {
                    layer.msg("设备没有选择", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    return false;
                }
                //判断物料明细项
                if (typeof (sSubStr) == "undefined" || sSubStr == "" || sSubStr == "[]") {
                    layer.msg("没有物料明细记录", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    return false;
                }
                if (typeof (sSubStr) != "undefined" && typeof (sSubStr) != "") {
                    sSubStr = JSON.parse(sSubStr);
                    for (var i = 0; i < sSubStr.length; i++) {
                        if (sSubStr[i].HDotCheckCode == "" || sSubStr[i].HDotCheckItemID == "") {
                            layer.msg("明细记录第" + (i + 1) + "行,点检项目代码信息为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            return false;
                        }
                        if (sSubStr[i].HManagerCode == "") {
                            layer.msg("明细记录第" + (i + 1) + "行,负责人代码信息为空!", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            return false;
                        }
                        else {
                            return true;
                        }
                    }
                }
                else {
                    return true;
                }
            }
            //扫条码
            function GetMeesageByBarCode(obj) {  //返回工作中心
                var HBarCode = $('#HBarCode').val();//条形码(流转卡号)(数据库中为单据号)
                if (!HBarCode) {
                    layer.msg("条形码不能为空!")
                    return;
                }
                var index = layer.load();
                $.ajax({
                    url: GetWEBURL() + "/Sb_PDA_EquipDotCheckBill/txtHBarCode_KeyDown",
                    type: "GET",
                    data: { "HBarCode": HBarCode },
                    success: function (result) {
                        if (result.data.length == 1) {
                            var data = result.data[0];
                            $("#HEquipID").val(data.HItemID);
                            $("#HBarName").val(data.HName);
                            $("#HBarSpec").val(data.HModel);
                            $("#HBarModel").val(data.HModel2);
                            $("#HQty").val(1);
                            $("#HBarCode").attr("readonly", "readonly");//条形码只读
                            $("#HBarCode").css("background-color", "#efefef4d");
                            HProcExchBillNoFlag = true;
                            get_DocCheckItem();
                            layer.close(index);
                        }
                        else {
                            layer.close(index);
                            layer.msg("未查找到数据", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            if ($("#Comparator").val() == 0 && $("#ColContent").val() == "") {
                                ColFilter();
                            }
                        }
                    },
                    error: function (err) {
                        layer.close(index);
                        layer.msg("接口请求失败!" + err, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    }
                });
            }
            function get_DocCheckItem() {
                $.ajax({
                    url: GetWEBURL() + "/Web/GetDotCheckRuleItemByEquipProjectID",
                    type: "GET",
                    data: { "EquipProjectID": $("#HEquipID").val() },
                    success: function (result) {
                        if (result != null) {
                            if (result.count == 1) {
                                var BYData = result;//
                                var rowdate1 = layui.table.cache["mainTable"];
                                option.data = [{ "HDotCheckItemID": 0, "HDotCheckCode": "", "HDotCheckItem": "", "HDotCheckPart": "", "HClaim": "", "HManagerID": 0, "HManagerCode": "", "HManagerName": "" }];
                                table.render(option);
                                if (BYData.data.length != 0)  //表体数据为空时
                                {
                                    buttonArr = [];//清空数组
                                    for (var i = 0; i < BYData.data.length; i++) {
                                        var checkrow = {
                                            "HDotCheckItemID": BYData.data[i].HDotCheckItemID, "HDotCheckCode": BYData.data[i].HDotCheckCode, "HDotCheckItem": BYData.data[i].HDotCheckItem,
                                            "HDotCheckPart": BYData.data[i].HDotCheckPart, "HClaim": rowdate1[i].HClaim, "HManagerID": BYData.data[i].HManagerID, "HManagerCode": BYData.data[i].HManagerCode,
                                            "HManagerName": BYData.data[i].HManagerName
                                        };
                                        buttonArr.push(checkrow);  //将之前的数据存储
                                    }
                                    table.reload("mainTable", {
                                        data: buttonArr    //将数据重新载入表格
                                    })
                                }
                            }
                            else {
                                option.data = [{ "HDotCheckItemID": 0, "HDotCheckCode": "", "HDotCheckItem": "", "HDotCheckPart": "", "HClaim": "", "HManagerID": 0, "HManagerCode": "", "HManagerName": "" }];
                                table.render(option);
                                layer.alert("该设备暂无默认点检记录", { icon: 5 });
                            }
                        }
                        layer.msg('错误' + err, {
                            icon: 5,
                            time: 20000
                        }, function () {
                            //do something
                        });
                    }
                })
            }
            //以上为layui模块
            //快速过滤
            function get_FastQuery() {
                var HBeginDate = $("#HBeginDate").val();//下达日期 å¼€å§‹æ—¥æœŸ
                var HEndDate = $("#HEndDate").val();//结束日期
                if (HBeginDate != "" && HEndDate != "") {
                    sWhere += " and æ—¥æœŸ between '" + HBeginDate + "' and '" + HEndDate + "' ";
                }
                get_Display(sWhere);
                //调用接口后清空sWhere缓存
                sWhere = "";
            }
            //重置过滤条件
            function set_ClearQuery() {
                //初始化时间
                $("#HBeginDate").val(Format(new Date() - 1000 * 60 * 60 * 24 * 30, "yyyy-MM-dd"));
                $("#HEndDate").val(Format(new Date(), "yyyy-MM-dd"));
                $("#HMaterNumber").val("");
                $("#HBillNo").val("");
                $("#HProductName").val("");
                $("#HProductModel").val("");
                $("#ColContent").val("");
                $("#ColName").val("0");
                $("#Comparator").val("0");
                ColFilter();
                sWhere = "";
            }
            //删除
            function btnDel() {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1) {
                    var hmainid = data[0].hmainid;
                    layer.confirm("确认要删除吗,删除后不能恢复", { title: "删除确认" }, function (index) {
                        var wait = layer.load();
                        //逻辑删除方法
                        $.ajax({
                            url: GetWEBURL() + '/ProcessCheck/DelProcessCheckBill',
                            type: "GET",
                            data: { "lngBillKey": hmainid, "user": sessionStorage["HUserName"] },
                            success: function (result) {
                                console.log('gouba' + result);
                                if (result.count == 1) {
                                    layer.msg(result.Message, { icon: 1 }, function () {
                                        // å¾—到frame索引
                                        var index = layer.getFrameIndex(window.name);
                                        //关闭当前frame
                                        layer.close(wait);
                                        //修改为功后刷新界面
                                        get_FastQuery();
                                    });
                                } else {
                                    layer.alert(result.code + result.Message, { icon: 5 });
                                    layer.close(wait);
                                }
                            }, error: function () {
                                layer.alert("接口请求失败!", { icon: 5 });
                                layer.close(wait);
                            }
                        });
                    })
                }
                else {
                    layer.msg('请选择一行数据删除!');
                }
            }
            //隐藏列设置
            function get_HideColumn() {
                var colName = "";
                for (var i = 1; i < option.cols[0].length; i++) {
                    colName += option.cols[0][i]["title"] + ",";
                }
                colName = encodeURI(colName.substring(0, colName.length - 1));//对 URI è¿›è¡Œç¼–码
                layer.open({
                    type: 2
                    , skin: "layui-layer-rim" //加上边框
                    , title: "隐藏列设置"  //标题
                    , closeBtn: 1  //窗体右上角关闭 çš„ æ ·å¼
                    , shift: 2 //弹出动画
                    , area: ["50%", "90%"] //窗体大小
                    , maxmin: true //设置最大最小按钮是否显示
                    , content: ['../../基础资料/隐藏列设置/Gy_GridView_Hide.html?HModName=' + HModName + '&colName=' + colName, "yes"]
                    , btn: ["确定", "取消"]
                    , btn1: function (index, laero) {
                        //刷新表格数据
                        DisPlay_HideColumn();
                        //更新表格缓存的数据
                        layer.close(index);//关闭弹窗
                    }
                })
            }
            //显示列数据
            function DisPlay_HideColumn() {
                $.ajax({
                    url: GetWEBURL() + '/Xt_grdAlignment_WMES/grdAlignmentWMESList',
                    type: "GET",
                    data: { "HModName": HModName, "user": sessionStorage["HUserName"] },
                    success: function (data1) {
                        if (data1.data.length != 0) {
                            var dataCol = [];//数据库查询出的列数据
                            var titleData = ["hmainid","HMaterID"];//不需要显示的字段 å¯æ‰©å±•
                            dataCol = data1.data[0].HGridString.split(',');
                            for (var i = 0; i < option.cols[0].length - 1; i++) {
                                if (dataCol[i]) {
                                    var dataCols = dataCol[i].split('|');
                                }
                                //隐藏列
                                if (dataCols[1] == 1) {
                                    option.cols[0][i + 1]["hide"] = true;
                                }
                                //设置内容字体大小
                                if (data1.data[0].HFontSize != 0) {
                                    option.cols[0][i + 1]["style"] = "font-size:" + data1.data[0].HFontSize + "px;";
                                } else {
                                    option.cols[0][i + 1]["style"] = "font-size:100%";
                                }
                                //设置列宽
                                if (dataCols[3] > 0) {
                                    option.cols[0][i + 1]["width"] = dataCols[3];
                                }
                                //显示列
                                if (dataCols[1] == 0 && $.inArray(option.cols[0][i + 1]["title"], titleData) == -1) {
                                    option.cols[0][i + 1]["hide"] = false;
                                }
                                //字体所在位置(å·¦ å±…中 å³)
                                switch (dataCols[2]) {
                                    case "L":
                                        option.cols[0][i + 1]["align"] = "left";
                                        break;
                                    case "M":
                                        option.cols[0][i + 1]["align"] = "center";
                                        break;
                                    case "R":
                                        option.cols[0][i + 1]["align"] = "right";
                                        break;
                                }
                            }
                            //取消冻结列
                            for (var i = 1; i < option.cols[0].length - 1; i++) {
                                if (option.cols[0][i]["fixed"] != null) {
                                    option.cols[0][i]["fixed"] = null;
                                }
                                else {
                                    break;
                                }
                            }
                            //冻结列
                            if (data1.data[0].HFixCols != 0) {
                                for (var i = 0; i < data1.data[0].HFixCols; i++) {
                                    if ($.inArray(option.cols[0][i + 1]["title"], titleData) != -1) {
                                        data1.data[0].HFixCols += 1;
                                    }
                                    option.cols[0][i + 1]["fixed"] = "left";
                                }
                            }
                            table.render(option);
                        } else {
                            table.render(option);
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                })
            }
            //#endregion
        });
    </script>
</body>
</html>
</html>