制作通用的单据编辑样例模块(生产汇报单列表/编辑),以方便其他开发人员可以借鉴。
4个文件已修改
1228 ■■■■■ 已修改文件
WebTM/layuiadmin/Scripts/webConfig.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebTM/views/生产管理/生产开工单/Sc_Add_MESBeginWorkBillList.html 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebTM/views/生产管理/生产汇报单/Sc_Add_ICMOReportBillList.html 496 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebTM/views/生产管理/生产汇报单/Sc_ICMOReportBillList.html 726 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebTM/layuiadmin/Scripts/webConfig.js
@@ -6,10 +6,10 @@
     //var WEBURL = "http://101.37.171.70/API/";   //公司服务器
    //var WEBURL = "http://localhost:8080/API/";   //颜晓军本地配置
    //var WEBURL = "http://localhost:8082/lubao";   //颜晓军本地配置
    //var WEBURL = "http://localhost:8082/LuBaoAPI/";    //杨露本地配置
    var WEBURL = "http://localhost:8082/LuBaoAPI/";    //杨露本地配置
    //var WEBURL = "http://10.1.4.154/API/";   //江丰客户
    //var WEBURL = "http://10.1.4.155/API/";   //江丰客户NEW
    var WEBURL = "http://47.96.97.237/API/";   //智云服务器
    //var WEBURL = "http://47.96.97.237/API/";   //智云服务器
    //var WEBURL = "http://183.129.128.86:9090/API/";   //凯贝奈特客户服务器
    return WEBURL
}
WebTM/views/Éú²ú¹ÜÀí/Éú²ú¿ª¹¤µ¥/Sc_Add_MESBeginWorkBillList.html
@@ -434,10 +434,12 @@
                    $("#HMainSourceBillType").val("");
                    $('#HMainSourceBillNo').attr("disabled", false);
                    $('#XDHList').addClass("layui-btn-disabled").attr("disabled", true);
                    Type = 1;
                }
                else {
                    $('#HMainSourceBillNo').attr("disabled", true);
                    $('#XDHList').removeClass("layui-btn-disabled").attr("disabled", false);
                    Type = 2;
                }
            });
WebTM/views/Éú²ú¹ÜÀí/Éú²ú»ã±¨µ¥/Sc_Add_ICMOReportBillList.html
@@ -90,18 +90,18 @@
                                            <div class="layui-inline">
                                                <label class="layui-form-label">源单类型</label>
                                                <div class="layui-input-inline">
                                                    <select name="HSourceBillType" lay-filter="HSourceBillType" id="HSourceBillType">
                                                        <option value="0" selected="selected">生产任务单</option>
                                                        <option value="1">手工录入</option>
                                                    <select name="HMainSourceBillType" lay-filter="HMainSourceBillType" id="HMainSourceBillType">
                                                        <option value="2">生产任务单</option>
                                                        <option value="1" selected="selected">手工录入</option>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="layui-inline">
                                                <label class="layui-form-label">选单号</label>
                                                <div class="layui-input-inline">
                                                    <input type="text" name="HSourceBillNo" id="HSourceBillNo" class="layui-input" value="" style="float:left;width:150px;">
                                                    <input type="hidden" name="HSourceInterID" id="HSourceInterID" class="layui-input" value="" style="float:left;width:150px;">
                                                    <input type="hidden" name="HSourceEntryID" id="HSourceEntryID" class="layui-input" value="" style="float:left;width:150px;">
                                                    <input type="text" name="HMainSourceBillNo" id="HMainSourceBillNo" class="layui-input" value="" style="float:left;width:150px;">
                                                    <input type="hidden" name="HMainSourceInterID" id="HMainSourceInterID" class="layui-input" value="" style="float:left;width:150px;">
                                                    <input type="hidden" name="HMainSourceEntryID" id="HMainSourceEntryID" class="layui-input" value="" style="float:left;width:150px;">
                                                    <button type="button" lay-submit="" class="layui-btn" lay-filter="XDHList" id="XDHList" style="width:40px;">
                                                        <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
                                                    </button>
@@ -162,6 +162,8 @@
        var params = getUrlVars();
        var hID = params[params[0]];//编辑查看
        var Type = params[params[1]] == undefined ? "1" : params[params[1]];//单据编辑状态: 1.无源单新增  Â 2.有源单新增  Â 3.编辑  4.浏览  5.变更
        var Sctag = "0";
        layui.config({
@@ -177,122 +179,83 @@
                , laydate = layui.laydate
                , element = layui.element;
            //常规用法
            laydate.render({
                elem: '#HDate'
            //公共变量
            var option = [];
            });
            //判断是否登录 æœªç™»å½•则跳到登录页
            //if (sessionStorage.login != "login") {
            //    layer.confirm("登录失效,请重新登录!", {
            //        icon: 4, skin: 'layui-layer-lan', title: "温馨提示", closeBtn: 0, btn: ['重新登录']
            //    }, function () { window.location.href = "../../user/login.html"; });
            //}
            //var tableReload = table.reload;
            var option = {
                id:'mainTable'
                ,elem: '#mainTable'
                , toolbar: '#toolbarDemo'
                , height: 500
                //,url: '/demo/table/user/' //数据接口
                , page: true //开启分页
                , cols: [[ //表头
                    { type: 'checkbox', fixed: 'left' }
                    , { templet: '#xuhao', title: '序号', sort: true, fixed: 'left', event: "qwe", width: 100 }
                    , { field: 'HMaterID', title: 'HMaterID', edit: 'text', width: 100, hide: true }
                    , { field: 'HMaterCode', title: '物料代码', edit: 'text', event: 'HMaterCode', width: 100 }
                    , { field: 'HMaterName', title: '物料名称', edit: 'text', width: 100 }
                    , { field: 'HMaterSpec', title: '规格型号', edit: 'text', width: 100 }
                    , { field: 'HUnitID', title: 'HUnitID', edit: 'text', width: 100, hide: true }
                    , { field: 'HUnitCode', title: '单位代码', edit: 'text', event: 'HUnitCode', width: 100 }
                    , { field: 'HUnitName', title: '单位名称', edit: 'text', width: 100 }
                    , { field: 'HSourceID', title: 'HSourceID', edit: 'text', width: 100, hide: true }
                    , { field: 'HSourceCode', title: '资源代码', edit: 'text', event: 'HSourceCode', width: 100 }
                    , { field: 'HSourceName', title: '资源名称', edit: 'text', width: 100 }
                    , { field: 'HWorkerid', title: 'HWorkerid', edit: 'text', width: 100, hide: true }
                    , { field: 'HWorkerCode', title: '操作员代码', edit: 'text', event: 'HWorkerCode', width: 100 }
                    , { field: 'HWorkerName', title: '操作员名称', edit: 'text', width: 100 }
                    , { field: 'HQty', title: '生产数量', edit: 'text', width: 100 }
                    , { field: 'HRemark', title: '表体备注', edit: 'text', width: 100 }
                    , { fixed: 'right', title: '操作', toolbar: '#barDemo', width: 150 }
                ]]
                , limit: 500 //每页默认显示的数量
            };
            //判断是否新增
            if (hID == null || hID == 0) {
                //初始加载表格{ "ID": 0, "HWasterReasonName": " ","HBadReasonID":0,"HEmpName": "  ", "HSQProcName": "   ","HProcID":0, "HZRProcName": "  ", "HMRBChecker": "  ", "HRemark": "  ", "HPSProcName": "  ", "HCloseMan": "   " }
                option.data = [TabRow];
                table.render(option);
            }
            else {
                $("#HInterID").val(hID);//修改时主表ID
                //编辑加载数据
                $.ajax({
                    url: GetWEBURL() + 'Sc_ICMOReportBill/Sc_ICMOReportBillListProjectDetai',
                    type: "GET",
                    data: { "sqlWhere": "and hmainid=" + hID },
                    success: function (result) {
                        //console.log(result);
                        //console.log('gouba' + result);
                        if (result.count == 1) {
                            option.data = result.data;
                            table.render(option);
                        } else {
                            layer.alert(result.code + result.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.close(index0);
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
            }
            //初始化表单插件
            set_InitFrom();
            //头工具栏事件
            var rowid = 0;
            var rows = 0;
            table.on('toolbar(mainTable)', function (obj) {
                var rowid = 0;
                var rows = 0;
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;;
                var AddRow = table.cache['mainTable'];
                var NewRow = TabRow;
                switch (obj.event) {
                    case 'btn-AddLine':
                        //table.cache["mainTable"].push(AddRow[rows]);
                        table.cache["mainTable"].push(NewRow);
                        option.data = table.cache["mainTable"];
                        table.render(option);
                        rows++;
                        layer.msg('增加一行按钮!')
                    case 'btn-AddLine': btnAddLine(NewRow);
                        break;
                    case 'btn-CopyLine':
                        var copydata = JSON.stringify(data);
                        if (data.length <= 0) {
                            layer.alert("请选择需要复制的一行!");
                        }
                        else if (data.length > 1) {
                            layer.alert("只能选择复制一行!");
                        }
                        else {
                            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);//将数据渲染到表格上
                            //layer.alert(copyrow);
                        }
                    case 'btn-CopyLine': btnCopyLine(data);
                        break;
                }
            });
            //行内事件
            table.on('tool(mainTable)', function (obj) {
                set_GridDelete(obj);   //行内删除
                set_GridCellCheck(obj); //行内快捷键筛选
            });
            //初始化表格
            set_InitGrid();
            //判断是源单新增、无源单新增、编辑
            set_Type(Type);
            //判断是否源单新增、或者编辑
            set_CheckSelect();
            //初始化表单
            function set_InitFrom() {
                laydate.render({
                    elem: '#HDate'
                });
            }
            //表格增加行事件
            function btnAddLine(NewRow) {
                table.cache["mainTable"].push(NewRow);
                option.data = table.cache["mainTable"];
                table.render(option);
                rows++;
                layer.msg('增加一行按钮!')
            }
            //表格复制行事件
            function btnCopyLine(data) {
                var copydata = JSON.stringify(data);
                if (data.length <= 0) {
                    layer.alert("请选择需要复制的一行!");
                }
                else if (data.length > 1) {
                    layer.alert("只能选择复制一行!");
                }
                else {
                    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);//将数据渲染到表格上
                }
            }
            //表格行内事件删除
            function set_GridDelete(obj) {
                var data = obj.data;
                var rowIndex = $(obj.tr).attr("data-index");
                if (obj.event === 'del') {
@@ -305,17 +268,13 @@
                            option.data = table.cache["mainTable"];//将数据绑定到data上
                            table.reload(option);
                            layer.close(index);
                            //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 set_GridCellCheck(obj) {
                $(document).off('keydown', ".layui-table-edit").on('keydown', '.layui-table-edit', function (e) {
                    if (event.key == "F7") {
                        if (obj.event === 'HMaterCode')  //物料信息
@@ -487,19 +446,115 @@
                    }
                })
            }
            });
            //初始化表格
            function set_InitGrid() {
                var columns = [
                    { type: 'checkbox', fixed: 'left' }
                    , { templet: '#xuhao', title: '序号', sort: true, fixed: 'left', event: "qwe", width: 100 }
                    , { field: 'HMaterID', title: 'HMaterID', edit: 'text', width: 100, hide: true }
                    , { field: 'HMaterCode', title: '物料代码', edit: 'text', event: 'HMaterCode', width: 100 }
                    , { field: 'HMaterName', title: '物料名称', edit: 'text', width: 100 }
                    , { field: 'HMaterSpec', title: '规格型号', edit: 'text', width: 100 }
                    , { field: 'HUnitID', title: 'HUnitID', edit: 'text', width: 100, hide: true }
                    , { field: 'HUnitCode', title: '单位代码', edit: 'text', event: 'HUnitCode', width: 100 }
                    , { field: 'HUnitName', title: '单位名称', edit: 'text', width: 100 }
                    , { field: 'HSourceID', title: 'HSourceID', edit: 'text', width: 100, hide: true }
                    , { field: 'HSourceCode', title: '资源代码', edit: 'text', event: 'HSourceCode', width: 100 }
                    , { field: 'HSourceName', title: '资源名称', edit: 'text', width: 100 }
                    , { field: 'HWorkerid', title: 'HWorkerid', edit: 'text', width: 100, hide: true }
                    , { field: 'HWorkerCode', title: '操作员代码', edit: 'text', event: 'HWorkerCode', width: 100 }
                    , { field: 'HWorkerName', title: '操作员名称', edit: 'text', width: 100 }
                    , { field: 'HQty', title: '生产数量', edit: 'text', width: 100 }
                    , { field: 'HRemark', title: '表体备注', edit: 'text', width: 100 }
                    , { fixed: 'right', title: '操作', toolbar: '#barDemo', width: 150 }
                ];
                option = {
                    id: 'mainTable'
                    , elem: '#mainTable'
                    , toolbar: '#toolbarDemo'
                    , page: false
                    , cellMinWidth: 120
                    , height: 500
                    , cols: [columns]
                    , done: function (res, curr, count) {
                    }
                };
            }
            //获取最大单据号
            function set_MAXNum() {
                var date = new Date();
                var day = date.getDate();
                var month = date.getMonth() + 1;
                var year = date.getFullYear();
                var shijian = year + "-" + month + "-" + day;
                //获取最大单据号 new
                $("#HInterID").val("0");
                $("#HBillNo").val("");
                $.ajax({
                    url: GetWEBURL() + "/Web/GetMAXNum",
                    type: "GET",
                    data: { "HBillType": '3711' },
                    success: function (d) {
                        //console.log(d.data);
                        $("#HBillNo").val(d.data[0].HBillNo);
                        $("#HDate").val(shijian);
                        $("#HInterID").val(0);
                    }
                });
            }
            //判断是源单新增、无源单新增、编辑
            function set_Type(Type) {
                console.log(Type);
                switch (Type) {
                    //无源单新增
                    case '1': set_AddFNew();
                        break;
                    //有源单新增  Â 
                    case '2': set_AddNew();
                        break;
                    //编辑 
                    case '3': set_EditFromGrid();
                        break;
                }
            }
            function RoadBillMain(hID)//加载表头
            //无源单新增
            function set_AddFNew()
            {
                //获取最大单据号
                set_MAXNum();
                $('#HMainSourceBillNo').attr("disabled", false);
                $('#XDHList').addClass("layui-btn-disabled").attr("disabled", true);
                option.data = [TabRow];
                table.render(option);
            }
            //有源单新增
            function set_AddNew() {
                //获取最大单据号
                set_MAXNum();
                option.data = [TabRow];
                table.render(option);
            }
            //编辑获取表头、获取表体
            function set_EditFromGrid() {
                set_EditForm(hID);  //编辑获取表头
                set_EditGrid(hID);  //编辑获取表体
                option.data = [TabRow];
                table.render(option);
            }
            //编辑获取表头
            function set_EditForm(hID) {
                //查询检验方案单是否存在
                $.ajax({
                    url: GetWEBURL() + "Sc_ICMOReportBill/Sc_GetICMOReportBillListCheckDetai",
@@ -523,8 +578,9 @@
                                , "HGroupName": data.班组                //班组名称
                                , "HEmpID": data.HEmpID                  //统计员ID
                                , "HEmpName": data.统计员                //统计员名称
                                , "HSourceBillType": ""                   //源单类型
                                , "XDH": ""                               //选单号
                                , "HMainSourceBillNo": data.HMainSourceBillNo
                                , "HMainSourceInterID": data.HMainSourceInterID
                                , "HMainSourceEntryID": data.HMainSourceEntryID
                                , "HExplanation": ""                      //摘要
                                , "HRemark": data.表头备注                //备注
                            });
@@ -538,46 +594,56 @@
                });
            }
            var date = new Date();
            var day = date.getDate();
            var month = date.getMonth() + 1;
            var year = date.getFullYear();
            var shijian = year + "-" + month + "-" + day;
            //判断是否新增
            if (hID == null || hID == 0) {
                //获取最大单据号 new
                $("#HInterID").val("0");
                $("#HBillNo").val("");
            //编辑获取表体
            function set_EditGrid(hID) {
                $("#HInterID").val(hID);//修改时主表ID
                //编辑加载数据
                $.ajax({
                    url: GetWEBURL() + "/Web/GetMAXNum",
                    url: GetWEBURL() + 'Sc_ICMOReportBill/Sc_ICMOReportBillListProjectDetai',
                    type: "GET",
                    data: { "HBillType": '3711' },
                    success: function (d) {
                        //console.log(d.data);
                        $("#HBillNo").val(d.data[0].HBillNo);
                        $("#HDate").val(shijian);
                        $("#HInterID").val(0);
                    data: { "sqlWhere": "and hmainid=" + hID },
                    success: function (result) {
                        if (result.count == 1) {
                            option.data = result.data;
                            table.render(option);
                        } else {
                            layer.alert(result.code + result.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.close(index0);
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
            }
            else {//如果修改则走下面 new
                RoadBillMain(hID);
                /* RoadBillSub(linterid);*/
            }
            //获取下拉选中值
            form.on('select(HSourceBillType)', function (data) {
                Sctag = data.value;
                form.render('select');
                if (Sctag != "0") {
                    $('#XDHList').addClass("layui-btn-disabled").attr("disabled", true);
                }
                else {
                    $('#XDHList').removeClass("layui-btn-disabled").attr("disabled", false);
                }
            });
            //监视下拉框是否源单
            function set_CheckSelect() {
                //获取下拉选中值
                form.on('select(HMainSourceBillType)', function (data) {
                    Sctag = data.value;
                    form.render('select');
                    switch (Sctag) {
                        //无源单新增
                        case '1':
                            $("#HMainSourceInterID").val("0");
                            $("#HMainSourceEntryID").val("0");
                            $('#HMainSourceBillNo').attr("disabled", false);
                            $('#XDHList').addClass("layui-btn-disabled").attr("disabled", true);
                            Type = 1;
                            break;
                        //有源单新增  Â 
                        case '2':
                            $("#HMainSourceInterID").val("0");
                            $("#HMainSourceEntryID").val("0");
                            $('#HMainSourceBillNo').attr("disabled", true);
                            $('#XDHList').removeClass("layui-btn-disabled").attr("disabled", false);
                            Type = 2;
                            break;
                    }
                });
            }
            //表头信息车间弹窗
@@ -721,18 +787,18 @@
                        //var rowIndex = $("#mainTable").find("tbody tr").attr('data-index');//当前行的索引
                        //$(".layui-table-view .layui-table tbody tr[data-index=" + 1+ "]").remove();
                        $("#HSourceBillNo").val(checkStatus.data[0].单据号);
                        $("#HSourceInterID").val(checkStatus.data[0].hmainid);
                        $("#HSourceEntryID").val(checkStatus.data[0].HEntryID);
                        $("#HMainSourceBillNo").val(checkStatus.data[0].单据号);
                        $("#HMainSourceInterID").val(checkStatus.data[0].hmainid);
                        $("#HMainSourceEntryID").val(checkStatus.data[0].HEntryID);
                        var list = [];
                        for (var i = 0; i <checkStatus.data.length; i++) {
                        for (var i = 0; i < checkStatus.data.length; i++) {
                            list.push(checkStatus.data[i].单据号)
                        }
                        if (isAllEqual(list))  //相同单号
                        {
                            if (checkStatus.data.length>1)
                            {
                                for (var i = 0; i < checkStatus.data.length-1; i++) //补行
                            console.log(checkStatus.data);
                            if (checkStatus.data.length > 1) {
                                for (var i = 0; i < checkStatus.data.length - 1; i++) //补行
                                {
                                    //var NewRow = { "HMaterID": 0, "HMaterCode": "", "HMaterName": "", "HMaterSpec": "", "HUnitID": 0, "HUnitCode": "", "HUnitName": "", "HSourceID": 0, "HSourceCode": "", "HSourceName": "", "HWorkerid": 0, "HWorkerCode": "", "HWorkerName": "", "HQty": 0, "HRemark": "" };
                                    table.cache["mainTable"].push(TabRow);
@@ -751,11 +817,10 @@
                            }
                            layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                        }
                        else
                        {
                        else {
                            layer.msg("请选择相同单号!", { time: 1 * 2000, icon: 5 });
                        }
                    }
                    , btn2: function (index, layero) {
                        //按钮【按钮二】的回调
@@ -771,22 +836,13 @@
            });
            //退出
            form.on('submit(Exit)', function (data) {//
                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                parent.layer.close(index); //再执行关闭
            });
            form.on('submit(Cancel)', function () {
                //sessionStorage["SourceFlag"] = false;
                parent.location.href = "../../../views/index.html"
                //window.close();//关闭当前页
            })
            //编辑获取表体时时间格式矫正方式
            function formatDate(date) {
                var d = new Date(date),
                    month = '' + (d.getMonth() + 1),
@@ -799,6 +855,7 @@
                return [year, month, day].join('-');
            }
            //提交保存
            form.on('submit(Saver)', function (data) {//保存
                var refSav = "";
                if (hID == "" || hID == null) {
@@ -819,7 +876,6 @@
                    return false;
                }
                $.ajax(
                    {
                        type: "POST",
@@ -836,39 +892,18 @@
                                });
                            }
                            else {
                                f_alert(data.Message);
                                console.log("Reason" + sMainStr + "sub:" + JSON.stringify(layui.table.cache.mainTable));
                                layer.alert(data.Message, { icon: 5 });
                            }
                            layer.closeAll("loading");
                        },
                        error: function (err) {
                            f_alert("错误:" + err);
                            console.log("Reason" + sMainStr);
                            layer.alert(err.Message, { icon: 5 });
                        }
                    });
            });
            function f_alert(sMsg) {
                layer.alert(sMsg, { icon: 5 });
            }
            //监听提交
            form.verify({
                numberOrEmpty: function (value, item) {
                    // if (value != '') {
                    if (!/^\d+$/.test(value)) {
                        return '不能为空或数字或者0';
                    }
                    //}
                }
            });
            })
        });
        //判断数组中的值是否相同
        //判断源单带回数据数组中的值是否相同
        function isAllEqual(array) {
            if (array.length > 0) {
                return !array.some(function (value, index) {
@@ -879,61 +914,8 @@
            }
        }
        //定义全局变量
        var HReasonName, ReasonID, EmpName, SQProcName,
            ProcID, ZRProcName, QRName
            ;
        function GetHReasonValue(obj)  //返回不良原因
        {
            HReasonName = obj[0].HName;
            ReasonID = obj[0].HItemID;
        }
        //返回物料
        function GetHMaterNameValue(obj) {  //返回物料
            $("#HMater").val(obj[0].HName);
            $("#HMaterID").val(obj[0].HItemID);
            $("#HMaterNumber").val(obj[0].HNumber);
        }
        //返回工序
        function GetHProcValue(obj) {  //返回工序
            $("#HProcName").val(obj[0].工序);
            $("#HProcID").val(obj[0].HItemID);
            $("#HProcNumber").val(obj[0].工序代码);
        }
        function GetHDeptNameValue(obj) {  //返回部门
            $("#HDepName").val(obj[0].HName);
            $("#HDeptID").val(obj[0].HItemID);
            $("#HDeptNumber").val(obj[0].HNumber);
        }
        //返回单位
        function GetHUnitNameValue(obj) {
            $("#HUName").val(obj[0].HName);
            $("#HUnitID").val(obj[0].HItemID);
            $("#HUnitNumber").val(obj[0].HNumber);
        }
        function GetHKeeperValue(obj) {  //返回责任人
            EmpName = obj[0].HName;
            // $("#HEmpName").val(obj[0].HName);
            //$("#HItemID").val(obj[0].HItemID);
        }
        //function GetHProcValue(obj) {  //返回申请工序
        //    SQProcName = obj[0].工序;
        //    ProcID = obj[0].HItemID;
        //    //$("#HSQProcName").val(obj[0].工序);
        //    //$("#HProcID").val(obj[0].HItemID);
        //}
        function GetHZRValue(obj) {   //返回责任工序
            ZRProcName = obj[0].工序;
            //$("#HZRProcName").val(obj[0].工序);
            //$("#HItemID").val(obj[0].HItemID);
        }
        //HWorker
        function GetHWorkerValue(obj) {  //返回不良确认人
            QRName = obj[0].HName;
            //$("#HQRName").val(obj[0].HName);
            //$("#HItemID").val(obj[0].HItemID);
        }
        function AllowLoadData(sSubStr) {  //非空验证
            var Result = true;
            if ($("#HDeptID").val() == '' || $("#HDeptID").val() == null) {
WebTM/views/Éú²ú¹ÜÀí/Éú²ú»ã±¨µ¥/Sc_ICMOReportBillList.html
@@ -1,8 +1,8 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>生产汇报单列表</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <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">
@@ -15,7 +15,7 @@
        }
    </style>
    <script src="../../../layuiadmin/layui/layui.js"></script>
    <script src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
</head>
<body>
    <div class="layui-fluid">
@@ -32,7 +32,7 @@
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">状态</label>
                                    <div class="layui-input-block" >
                                    <div class="layui-input-block">
                                        <select name="Status" lay-filter="Status" style="width:190px;">
                                            <option value="-1" selected="selected">全部</option>
                                            <option value="0">未审核</option>
@@ -44,13 +44,13 @@
                                <div class="layui-inline">
                                    <label class="layui-form-label">开始日期</label>
                                    <div class="layui-input-block">
                                        <input type="date" class="layui-input" id="HDate" style="width:190px;">
                                        <input type="date" class="layui-input" id="HBeginDate" style="width:190px;">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">结束日期</label>
                                    <div class="layui-input-block">
                                        <input type="date" class="layui-input" id="HDate1" style="width:190px;">
                                        <input type="date" class="layui-input" id="HEndDate" style="width:190px;">
                                    </div>
                                </div>
                                <div class="layui-inline">
@@ -93,6 +93,9 @@
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Delete"><i class="layui-icon layui-icon-delete"></i>删除</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Audit"><i class="layui-icon layui-icon-radio"></i>审核</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-DeAudit"><i class="layui-icon layui-icon-circle"></i>反审核</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Print"><i class="layui-icon layui-icon-circle"></i>预览</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Cell"><i class="layui-icon layui-icon-ok"></i>保存列宽</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-RefreshCell"><i class="layui-icon layui-icon-refresh"></i>默认列宽</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-reload" style="display:none;"><i class="layui-icon layui-icon-refresh"></i>刷新</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-confirm" id="btn_confirm" style="display:none;"><i class="layui-icon layui-icon-ok-circle"></i>确认</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-back" id="btn_back" style="display:none;"><i class="layui-icon layui-icon-close-fill"></i>驳回</button>
@@ -125,257 +128,118 @@
            , form = layui.form
            , element = layui.element
            , laypage = layui.laypage
            , laydate = layui.laydate
            var sWhere = "";
                , laydate = layui.laydate
            var option = {
                elem: '#mainTable'
                , toolbar: '#toolbarDemo'
                ,height: 'full-50'
                , page: true
                ,cellMinWidth: 90
                , cols: [[
                     { type: 'checkbox', fixed: 'left' }
                    , { field: 'hmainid', title: 'hmainid', sort: true, hide: true, width: 200}
                    , { field: '日期', title: '日期', width: 160,templet: "<div>{{d.日期 ==null ?'':layui.util.toDateString(d.日期, 'yyyy-MM-dd')}}</div>"}
                    , { field: '单据号', title: '单据号', width: 200}
                    , { field: '班组代码', title: '班组代码', width: 200 }
                    , { field: '班组', title: '班组', width: 200 }
                    , { field: '操作员', title: '操作员', width: 200}
                    , { field: '生产资源代码', title: '生产资源代码', width: 200 }
                    , { field: '生产资源', title: '生产资源', width: 200}
                    , { field: '表头备注', title: '表头备注', width: 200 }
                    , { field: 'hsubid', title: 'hsubid', hide: true, width: 200}
                    , { field: 'hmaterid', title: 'hmaterid', hide: true, width: 200}
                    , { field: '物料代码', title: '物料代码', width: 200}
                    , { field: '物料名称', title: '物料名称', width: 200}
                    , { field: '规格型号', title: '规格型号', width: 200}
                    , { field: 'hunitid', title: 'hunitid', hide: true, width: 200}
                    , { field: '计量单位代码', title: '计量单位代码', width: 200}
                    , { field: '计量单位', title: '计量单位', width: 200}
                    , { field: '生产数量', title: '生产数量', width: 200}
                    , { field: '生产任务单号', title: '生产任务单号', width: 200}
                    , { field: '表体备注', title: '表体备注', width: 200}
                    , { field: '制单人', title: '制单人', width: 200}
                    , { field: '制单日期', title: '制单日期', width: 200, templet: "<div>{{d.制单日期 ==null ?'':layui.util.toDateString(d.制单日期, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
                    , { field: '审核人', title: '审核人', width: 200 }
                    , { field: '审核日期', title: '审核日期', width: 200, templet: "<div>{{d.审核日期 ==null ? '':layui.util.toDateString(d.审核日期, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
                    , { field: '修改人', title: '修改人', width: 200 }
                    , { field: '修改日期', title: '修改日期', width: 200, templet: "<div>{{d.修改日期 ==null ?'':layui.util.toDateString(d.修改日期, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
                    , { field: '关闭人', title: '关闭人', width: 200 }
                    , { field: '关闭日期', title: '关闭日期', width: 200, templet: "<div>{{d.关闭日期 ==null ?'':layui.util.toDateString(d.关闭日期, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
                    , { field: '作废人', title: '作废人', width: 200 }
                    , { field: '作废日期', title: '作废日期', width: 200, templet: "<div>{{d.作废日期 ==null ?'':layui.util.toDateString(d.作废日期, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
                    , { field: 'HICMOInterID', title: 'HICMOInterID', hide: true, width: 200}
                    , { field: 'HEmpID', title: 'HEmpID', hide: true, width: 200}
                    , { field: 'HEmpName', title: 'HEmpName', hide: true, width: 200}
                    , { field: 'HSourceID', title: 'HSourceID', hide: true, width: 200}
                    , { field: 'HSourceName', title: 'HSourceName', hide: true, width: 200}
                    , { field: 'HGroupID', title: 'HGroupID', hide: true, width: 200}
                    , { field: 'HGroupName', title: 'HGroupName', hide: true, width: 200}
                    , { field: 'HEmpNumber', title: 'HEmpNumber', hide: true, width: 200}
                ]]
            };
            //公共变量
            var sWhere = "";
            var option = [];
            var DataList;
            var Name = "ICMReportCellWidth";
            //初始化表格
            set_InitGrid();
            //加载数据到网格
            get_Display(sWhere);
            //头工具栏事件
            table.on('toolbar(mainTable)', function (obj) {
                var checkStatus = table.checkStatus(obj.config.id);
                switch (obj.event) {
                    case 'btn-Add':
                        //页面层-自定义
                        layer.open({
                            type: 2,
                            skin: 'layui-layer-rim', //加上边框
                            title: '新增生产汇报单',
                            closeBtn: 1,
                            shift: 2,
                            area: ['100%', '100%'],
                            maxmin: true,
                            content: '../生产汇报单/Sc_Add_ICMOReportBillList.html',
                            end: function () {
                                //刷新页面,
                                location.reload();
                            },
                            success: function (layero, index) {
                            }
                        });
                    //新增按钮
                    case 'btn-Add': set_AddNew();
                        break;
                    case 'btn-Edit':
                        var checkStatus = table.checkStatus('mainTable')
                            , data = checkStatus.data;
                        if (checkStatus.data.length === 1) {
                            var hID = data[0].hmainid.toString();
                            //if (AllowLoadData(sSubStr) != false) {//非空验证
                            layer.open({
                                type: 2
                                , area: ['100%', '100%']
                                , title: '编辑生产汇报单'
                                , closeBtn: 1
                                , shade: 0.6 //遮罩透明度
                                , maxmin: true //允许全屏最小化
                                , anim: 0 //0-6的动画形式,-1不开启
                                , content: '../生产汇报单/Sc_Add_ICMOReportBillList.html?hID=' + hID
                                , resize: false,
                                end: function () {
                                    //刷新页面,
                                    location.reload();
                                }
                                , cancel: function () {
                                    //$(".layui-btn").removeClass("layui-btn-disabled");
                                }
                            })
                        } else {
                            layer.msg('请选择一行数据编辑!');
                        }
                    //编辑按钮
                    case 'btn-Edit': set_ShowBill();
                        break;
                    case 'btn-Delete':
                        var checkStatus = table.checkStatus('mainTable')
                            , data = checkStatus.data;
                        if (checkStatus.data.length === 1) {
                            var InterID = data[0].hmainid.toString();
                            //逻辑删除方法
                            layer.confirm("确认要删除吗,删除后不能恢复", { title: "删除确认" }, function (index) {
                                $.ajax({
                                    type: "GET",
                                    url: GetWEBURL() + "Sc_ICMOReportBill/DeltetICMOReportBill", //方法所在页面和方法名
                                    data: { "HInterID": InterID },
                                    success: function (result) {
                                        if (result.count == 1) {
                                            layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
                                                // å¾—到frame索引
                                                var index = layer.getFrameIndex(window.name);
                                                //关闭当前frame
                                                layer.close(index);
                                                //修改为功后刷新界面
                                                window.location.reload();
                                            });
                                        } else {
                                            layer.alert(result.code + result.Message, { icon: 5 });
                                        }
                                    }, error: function () {
                                        layer.alert("接口请求失败!", { icon: 5 });
                                    }
                                });
                            })
                        }
                        else {
                            layer.msg('请选择一行数据删除!');
                        }
                    //删除按钮
                    case 'btn-Delete': set_DeleteBill();
                        break;
                    case 'btn-Audit':
                        var checkStatus = table.checkStatus('mainTable')
                            , data = checkStatus.data;
                        if (checkStatus.data.length === 1) {
                            var InterID = data[0].hmainid.toString();
                            //逻辑审核方法
                            $.ajax({
                                type: "GET",
                                url: GetWEBURL() + "/Sc_ICMOReportBill/AuditProcessReportList", //方法所在页面和方法名
                                data: { "HInterID": InterID, "IsAudit": 0, "CurUserName": sessionStorage["HUserName"] },
                                success: function (result) {
                                    if (result.count == 1) {
                                        layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
                                            // å¾—到frame索引
                                            var index = layer.getFrameIndex(window.name);
                                            //关闭当前frame
                                            layer.close(index);
                                            //修改为功后刷新界面
                                            $("#btnSearch").trigger('click');
                                        });
                                    } else {
                                        layer.alert(result.code + result.Message, { icon: 5 });
                                    }
                                }, error: function () {
                                    layer.alert("接口请求失败!", { icon: 5 });
                                }
                            });
                        }
                        else {
                            layer.msg('请选择一行数据审核!');
                        }
                    //审核按钮
                    case 'btn-Audit': set_CheckBill();
                        break;
                    case 'btn-DeAudit':
                        var checkStatus = table.checkStatus('mainTable')
                            , data = checkStatus.data;
                        if (checkStatus.data.length === 1) {
                            var InterID = data[0].hmainid.toString();
                            //逻辑审核方法
                            $.ajax({
                                type: "GET",
                                url: GetWEBURL() + "/Sc_ICMOReportBill/AuditProcessReportList", //方法所在页面和方法名
                                data: { "HInterID": InterID, "IsAudit": 1, "CurUserName": sessionStorage["HUserName"] },
                                success: function (result) {
                                    if (result.count == 1) {
                                        layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
                                            // å¾—到frame索引
                                            var index = layer.getFrameIndex(window.name);
                                            //关闭当前frame
                                            layer.close(index);
                                            //修改为功后刷新界面
                                            $("#btnSearch").trigger('click');
                                        });
                                    } else {
                                        layer.alert(result.code + result.Message, { icon: 5 });
                                    }
                                }, error: function () {
                                    layer.alert("接口请求失败!", { icon: 5 });
                                }
                            });
                        }
                        else {
                            layer.msg('请选择一行数据反审核!');
                        }
                    //反审核按钮
                    case 'btn-DeAudit': set_AbandonCheck();
                        break;
                    //预览按钮
                    case 'btn-Print': get_PrintReport();
                        break;
                    //保存列宽按钮
                    case 'btn-Cell': set_SaveGridColWidth();
                        break;
                    //默认列宽按钮
                    case 'btn-RefreshCell': set_DefaultGridColWidth();
                        break;
                };
            });
            var index = layer.load(0, { shade: false });
            //进入页面显示的缓存列表
            $.ajax({
                //url: "http://61.130.49.162:9090/WMSAPI///Web/GetMAXNum",
                url: GetWEBURL() + '/Sc_ICMOReportBill/list',
                type: "GET",
                data: { "sWhere": sWhere },
                success: function (data1) {
                    if (data1.count == 1) {
                        option.data = data1.data;
                        table.render(option);
                        layer.close(index);
                    } else {
                        layer.close(index);
                        layer.alert(data1.code + data1.Message, { icon: 5 });
                    }
                }, error: function () {
                    layer.close(index);
                    layer.alert("接口请求失败!", { icon: 5 });
                }
            });
            //查询按钮
            form.on('submit(btnSearch)', function (data) {
                get_FastQuery(table, option);
            });
            //重置按钮
            form.on('submit(btnReSearch)', function (data) {
                $('#Status').find("option[value='-1']").attr("selected", true);
                $("#HDate").val("");//开始日期
                $("#HDate1").val("");//结束日期
                $("#HBillNo").val("");
                $("#Dept").val("");
                $("#Part").val("");
                $("#btnSearch").click();
                set_ClearQuery();
            });
            //查询按钮
            form.on('submit(btnSearch)', function (data) {
            //获取列宽
            function getColumnsWidth() {
                var result = [];
                var colNum = $(".layui-table-header").find("tr").eq(0).find("th").length;
                //获取列宽
                $.ajax({
                    url: GetWEBURL() + '/tb_CellWidth/GetMouldScrapInHouseCellWidthList',
                    async: false,
                    type: "Get",
                    dataType: "json",
                    data: { "colNum": colNum, "Name": Name },
                    success: function (data1) {
                        if (data1.code == 1) {
                            result = data1.data;
                        }
                        else if (data1.code == -1) {
                        }
                        else {
                            layer.alert(data1.Message, { icon: 5 });
                        }
                    }, error: function (e) {
                        layer.alert(e.Message, { icon: 5 });
                    }
                });
                return result;
            }
            //加载网格
            function get_Display(sWhere) {
                //加载网格
                var wait = layer.load();//遮罩
                $.ajax({
                    url: GetWEBURL() + '/Sc_ICMOReportBill/list',
                    type: "GET",
                    data: { "sWhere": sWhere },
                    success: function (data1) {
                        if (data1.count == 1) {
                            option.data = data1.data;
                            table.render(option);
                            layer.close(wait);
                        } else {
                            layer.close(wait);
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.close(wait);
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
            }
            //快速过滤
            function get_FastQuery(table, option) {
                var Status = $("select[name='Status']").val();//状态
                var HDate = $("#HDate").val();//开始日期
                var HDate1 = $("#HDate1").val();//结束日期
                var HDate = $("#HBeginDate").val();//开始日期
                var HDate1 = $("#HEndDate").val();//结束日期
                var HBillNo = $("#HBillNo").val(); //单据号
                var Dept = $("#Dept").val();       //部门信息
                var Part = $("#Part").val();       //物料信息
@@ -411,39 +275,371 @@
                if (Part) {
                    sWhere += " and concat(物料代码,物料名称,规格型号) like '%" + Part + "%'";
                }
                $.ajax({
                    //url: "http://61.130.49.162:9090/WMSAPI///Web/GetMAXNum",
                    url: GetWEBURL() + '/Sc_ICMOReportBill/list',
                    type: "GET",
                    data: { "sWhere": sWhere },
                    success: function (data1) {
                        if (data1.count == 1) {
                            option.data = data1.data;
                            table.render(option);
                            layer.alert("查询成功", { icon: 1 });
                        } else {
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                var index = layer.load(0);
                get_Display(sWhere);
                //调用接口后清空sWhere缓存
                sWhere = "";
            }
            //重置过滤条件
            function set_ClearQuery() {
                $('#Status').find("option[value='-1']").attr("selected", true);
                $("#HBeginDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * 30), "yyyy-MM-dd"));
                $("#HEndDate").val(Format(new Date(), "yyyy-MM-dd"));
                $("#HBillNo").val("");
                $("#Dept").val("");
                $("#Part").val("");
            }
            //初始化表格
            function set_InitGrid() {
                $("#HBeginDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * 30), "yyyy-MM-dd"));
                $("#HEndDate").val(Format(new Date(), "yyyy-MM-dd"));
                var columns = [
                    { type: 'checkbox', fixed: 'left' }
                    , { field: 'hmainid', title: 'hmainid', sort: true, hide: true, width: 200 }
                    , { field: '日期', title: '日期', width: 160, templet: "<div>{{d.日期 ==null ?'':layui.util.toDateString(d.日期, 'yyyy-MM-dd')}}</div>" }
                    , { field: '单据号', title: '单据号', width: 200 }
                    , { field: '班组代码', title: '班组代码', width: 200 }
                    , { field: '班组', title: '班组', width: 200 }
                    , { field: '操作员', title: '操作员', width: 200 }
                    , { field: '生产资源代码', title: '生产资源代码', width: 200 }
                    , { field: '生产资源', title: '生产资源', width: 200 }
                    , { field: '表头备注', title: '表头备注', width: 200 }
                    , { field: 'hsubid', title: 'hsubid', hide: true, width: 200 }
                    , { field: 'hmaterid', title: 'hmaterid', hide: true, width: 200 }
                    , { field: '物料代码', title: '物料代码', width: 200 }
                    , { field: '物料名称', title: '物料名称', width: 200 }
                    , { field: '规格型号', title: '规格型号', width: 200 }
                    , { field: 'hunitid', title: 'hunitid', hide: true, width: 200 }
                    , { field: '计量单位代码', title: '计量单位代码', width: 200 }
                    , { field: '计量单位', title: '计量单位', width: 200 }
                    , { field: '生产数量', title: '生产数量', width: 200 }
                    , { field: '生产任务单号', title: '生产任务单号', width: 200 }
                    , { field: '表体备注', title: '表体备注', width: 200 }
                    , { field: '制单人', title: '制单人', width: 200 }
                    , { field: '制单日期', title: '制单日期', width: 200, templet: "<div>{{d.制单日期 ==null ?'':layui.util.toDateString(d.制单日期, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
                    , { field: '审核人', title: '审核人', width: 200 }
                    , { field: '审核日期', title: '审核日期', width: 200, templet: "<div>{{d.审核日期 ==null ? '':layui.util.toDateString(d.审核日期, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
                    , { field: '修改人', title: '修改人', width: 200 }
                    , { field: '修改日期', title: '修改日期', width: 200, templet: "<div>{{d.修改日期 ==null ?'':layui.util.toDateString(d.修改日期, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
                    , { field: '关闭人', title: '关闭人', width: 200 }
                    , { field: '关闭日期', title: '关闭日期', width: 200, templet: "<div>{{d.关闭日期 ==null ?'':layui.util.toDateString(d.关闭日期, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
                    , { field: '作废人', title: '作废人', width: 200 }
                    , { field: '作废日期', title: '作废日期', width: 200, templet: "<div>{{d.作废日期 ==null ?'':layui.util.toDateString(d.作废日期, 'yyyy-MM-dd HH:mm:ss')}}</div>" }
                    , { field: 'HICMOInterID', title: 'HICMOInterID', hide: true, width: 200 }
                    , { field: 'HEmpID', title: 'HEmpID', hide: true, width: 200 }
                    , { field: 'HEmpName', title: 'HEmpName', hide: true, width: 200 }
                    , { field: 'HSourceID', title: 'HSourceID', hide: true, width: 200 }
                    , { field: 'HSourceName', title: 'HSourceName', hide: true, width: 200 }
                    , { field: 'HGroupID', title: 'HGroupID', hide: true, width: 200 }
                    , { field: 'HGroupName', title: 'HGroupName', hide: true, width: 200 }
                    , { field: 'HEmpNumber', title: 'HEmpNumber', hide: true, width: 200 }
                ];
                option = {
                    elem: '#mainTable'
                    , toolbar: '#toolbarDemo'
                    , page: true
                    , cellMinWidth: 120
                    , totalRow: true
                    , limit: 10
                    , height: 'full-50'
                    , cols: [columns]
                    , limits: [50, 500, 1000, 5000]
                    , done: function (res, curr, count) {
                    }
                };
                //设置列宽
                var colWidth = getColumnsWidth();
                if (colWidth == "" || colWidth == []) {
                }
                else {
                    $.each(columns, function (x, m) {
                        m["width"] = colWidth[x];
                    });
                }
            }
            //新增
            function set_AddNew() {
                layer.open({
                    type: 2,
                    skin: 'layui-layer-rim', //加上边框
                    title: '新增生产汇报单',
                    closeBtn: 1,
                    shift: 2,
                    area: ['100%', '100%'],
                    maxmin: true,
                    content: '../生产汇报单/Sc_Add_ICMOReportBillList.html?hID=&Type=1',
                    end: function () {
                        //刷新页面,
                        location.reload();
                    },
                    success: function (layero, index) {
                    }
                });
                sWhere = "";//调用接口后清空sWhere缓存
            }
            //编辑
            function set_ShowBill()
            {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1) {
                    var hID = data[0].hmainid.toString();
                    //if (AllowLoadData(sSubStr) != false) {//非空验证
                    layer.open({
                        type: 2
                        , area: ['100%', '100%']
                        , title: '编辑生产汇报单'
                        , closeBtn: 1
                        , shade: 0.6 //遮罩透明度
                        , maxmin: true //允许全屏最小化
                        , anim: 0 //0-6的动画形式,-1不开启
                        , content: '../生产汇报单/Sc_Add_ICMOReportBillList.html?hID=' + hID + '&Type=3'
                        , resize: false,
                        end: function () {
                            //刷新页面,
                            location.reload();
                        }
                        , cancel: function () {
                            //$(".layui-btn").removeClass("layui-btn-disabled");
                        }
                    })
                } else {
                    layer.msg('请选择一行数据编辑!');
                }
            }
            //删除
            function set_DeleteBill() {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1) {
                    var InterID = data[0].hmainid.toString();
                    //逻辑删除方法
                    layer.confirm("确认要删除吗,删除后不能恢复", { title: "删除确认" }, function (index) {
                        $.ajax({
                            type: "GET",
                            url: GetWEBURL() + "Sc_ICMOReportBill/DeltetICMOReportBill", //方法所在页面和方法名
                            data: { "HInterID": InterID },
                            success: function (result) {
                                if (result.count == 1) {
                                    layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
                                        // å¾—到frame索引
                                        var index = layer.getFrameIndex(window.name);
                                        //关闭当前frame
                                        layer.close(index);
                                        //修改为功后刷新界面
                                        window.location.reload();
                                    });
                                } else {
                                    layer.alert(result.code + result.Message, { icon: 5 });
                                }
                            }, error: function () {
                                layer.alert("接口请求失败!", { icon: 5 });
                            }
                        });
                    })
                }
                else {
                    layer.msg('请选择一行数据删除!');
                }
            }
            //审核
            function set_CheckBill() {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1) {
                    var InterID = data[0].hmainid.toString();
                    //逻辑审核方法
                    $.ajax({
                        type: "GET",
                        url: GetWEBURL() + "/Sc_ICMOReportBill/AuditProcessReportList", //方法所在页面和方法名
                        data: { "HInterID": InterID, "IsAudit": 0, "CurUserName": sessionStorage["HUserName"] },
                        success: function (result) {
                            if (result.count == 1) {
                                layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
                                    // å¾—到frame索引
                                    var index = layer.getFrameIndex(window.name);
                                    //关闭当前frame
                                    layer.close(index);
                                    //修改为功后刷新界面
                                    $("#btnSearch").trigger('click');
                                });
                            } else {
                                layer.alert(result.code + result.Message, { icon: 5 });
                            }
                        }, error: function () {
                            layer.alert("接口请求失败!", { icon: 5 });
                        }
                    });
                }
                else {
                    layer.msg('请选择一行数据审核!');
                }
            }
            //反审核
            function set_AbandonCheck() {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1) {
                    var InterID = data[0].hmainid.toString();
                    //逻辑审核方法
                    $.ajax({
                        type: "GET",
                        url: GetWEBURL() + "/Sc_ICMOReportBill/AuditProcessReportList", //方法所在页面和方法名
                        data: { "HInterID": InterID, "IsAudit": 1, "CurUserName": sessionStorage["HUserName"] },
                        success: function (result) {
                            if (result.count == 1) {
                                layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
                                    // å¾—到frame索引
                                    var index = layer.getFrameIndex(window.name);
                                    //关闭当前frame
                                    layer.close(index);
                                    //修改为功后刷新界面
                                    $("#btnSearch").trigger('click');
                                });
                            } else {
                                layer.alert(result.code + result.Message, { icon: 5 });
                            }
                        }, error: function () {
                            layer.alert("接口请求失败!", { icon: 5 });
                        }
                    });
                }
                else {
                    layer.msg('请选择一行数据反审核!');
                }
            }
            //预览
            function get_PrintReport() {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1) {
                    var InterID = data[0].hmainid.toString();
                    layer.alert("我是打印按钮!单据主ID是:" + InterID);
                    //window.open("../生产工序管理/工序汇报单/HBarPlanPrint.html?linterid=" + linterid + "&Type=HDepartMent" + "&OpenTmp=b");
                    window.open("../../基础资料/公用基础资料/HBarPlanPrint.html?linterid=" + InterID + "&Type=HDepartMent" + "&OpenTmp=b");
                }
                else {
                    layer.msg('请选择一行数据打印!');
                }
            }
            //保存列宽
            function set_SaveGridColWidth() {
                var arr = [];
                // åˆ—æ•°
                var colNum = $(".layui-table-header").find("tr").eq(0).find("th").length;
                for (var i = 0; i <= colNum; i++) {
                    var colName = $(".layui-table-header").find("tr").eq(0).find("th").eq(i).text();
                    var colWidth = $(".layui-table-header").find("tr").eq(0).find("th").eq(i).width();
                    if (colName != "" && colName != null) {
                        arr.push(colWidth == -1 ? 200 : colWidth);
                    }
                }
                arr.unshift(40); //首位追加
                $.ajax({
                    url: GetWEBURL() + '/tb_CellWidth/GetMouldScrapInHouseCellWidth',
                    async: false,
                    type: "POST",
                    dataType: "json",
                    data: { "myMap": JSON.stringify(arr), "Name": Name },
                    success: function (data1) {
                        if (data1.count == 1) {
                            layer.alert(data1.Message, { icon: 1 });
                        } else {
                            layer.alert(data1.Message, { icon: 5 });
                        }
                    }, error: function (e) {
                        layer.alert(e.Message, { icon: 5 });
                    }
                });
                //设置赋值列宽
                var colWidth = getColumnsWidth();
                if (colWidth == "" || colWidth == []) {
                }
                else {
                    $.each(columns, function (x, m) {
                        m["width"] = colWidth[x];
                    });
                }
                get_FastQuery(table, option);
            }
            //默认列宽
            function set_DefaultGridColWidth() {
                var arr = [];
                // åˆ—æ•°
                var colNum = $(".layui-table-header").find("tr").eq(0).find("th").length;
                for (var i = 0; i <= colNum; i++) {
                    var colName = $(".layui-table-header").find("tr").eq(0).find("th").eq(i).text();
                    if (colName != "" && colName != null) {
                        arr.push(200);   //默认宽度200
                    }
                }
                arr.unshift(40); //首位追加
                $.ajax({
                    url: GetWEBURL() + '/tb_CellWidth/GetMouldScrapInHouseCellWidth',
                    async: false,
                    type: "POST",
                    dataType: "json",
                    data: { "myMap": JSON.stringify(arr), "Name": Name },
                    success: function (data1) {
                        if (data1.count == 1) {
                            layer.alert(data1.Message, { icon: 1 });
                        } else {
                            layer.alert(data1.Message, { icon: 5 });
                        }
                    }, error: function (e) {
                        layer.alert(e.Message, { icon: 5 });
                    }
                });
                //设置赋值列宽
                var colWidth = getColumnsWidth();
                if (colWidth == "" || colWidth == []) {
                }
                else {
                    $.each(columns, function (x, m) {
                        m["width"] = colWidth[x];
                    });
                }
                get_FastQuery(table, option);
            }
            //重置按钮
            form.on('submit(btnReSearch)', function (data) {
                $('#Status').find("option[value='-1']").attr("selected", true);
                $("#HBeginDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * 30), "yyyy-MM-dd"));
                $("#HEndDate").val(Format(new Date(), "yyyy-MM-dd"));
                $("#HBillNo").val("");
                $("#Dept").val("");
                $("#Part").val("");
                $("#btnSearch").click();
            });
            //laydate.render({
            //    elem: '#HDate'
            //    , type: 'datetime'
            //    , trigger: 'click'
            //    , format:'yyyy-MM-dd HH:mm'
            //});
            //以上是layui模块
        });
    </script>