WebTM/views/Éú²ú¹ÜÀí/°à´Î¿ª°àµ¥/Sc_ShiftsBeginInfoBill_Add_Edit.html
@@ -29,6 +29,7 @@
                <form class="layui-form" action="" lay-filter="formData" style="background-color:white;">
                    <div style="padding: 2px; ">
                        <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnSave" id="btnSave">保存</button>
                        <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="set_CheckBill" id="set_CheckBill">审核</button>
                        <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnEdit" id="btnEdit">退出</button>
                    </div>
                    <div class="layui-tab" lay-filter="tab-POStockInBill">
@@ -118,14 +119,20 @@
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-row">
                                    <div class="layui-row">
                                        <div class="layui-col-xs3 layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">应到岗人数<label style="color:red"> * </label></label>
                                            <div class="layui-input-inline">
                                                <input type="text" class="layui-input" lay-verify="HStdEmpQty" name="HStdEmpQty" id="HStdEmpQty" value="">
                                            </div>
                                        </div>
                                        <div class="layui-col-xs9 layui-inline">
                                        <div class="layui-col-xs3 layui-inline">
                                            <label class="layui-form-label" style="width: 95px; margin-left: -15px;">计划停工时长<label style="color:red"> * </label></label>
                                            <div class="layui-input-inline">
                                                <input type="text" class="layui-input" lay-verify="HPlanShutdownTimes" name="HPlanShutdownTimes" id="HPlanShutdownTimes" value="0">
                                            </div>
                                        </div>
                                        <div class="layui-col-xs3 layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">备注</label>
                                            <div class="layui-input-inline">
                                                <input type="text" class="layui-input" lay-verify="HRemark" name="HRemark" id="HRemark">
@@ -305,7 +312,7 @@
                $("#HMakerDate").val(Format(new Date(), "yyyy-MM-dd"));
                //初始化日期
                $("#HDate").val(Format(new Date(), "yyyy-MM-dd"));
                GetDefValByUser();
            }
            else if (OperationType == 2) {//如果修改则走下面 new                                        //复制
                OperationType = 1;
@@ -317,6 +324,14 @@
                //初始化制单人和制单时间
                $("#HMaker").val(sessionStorage["HUserName"]);
                $("#HMakerDate").val(Format(new Date(), "yyyy-MM-dd"));
                $("#HUpDater").val('');
                $("#HUpDateDate").val('');
                $("#HChecker").val('');
                $("#HCheckDate").val('');
                $("#HCloseMan").val('');
                $("#HCloseDate").val('');
                $("#HDeleteMan").val('');
                $("#HDeleteDate").val('');
                //初始化日期
                $("#HDate").val(Format(new Date(), "yyyy-MM-dd"));
            }
@@ -381,6 +396,11 @@
                }
            });
            //#endregion
            //审核
            form.on('submit(set_CheckBill)', function (data) {
                set_CheckBill(1);
            });
            //#region é€€å‡º
            form.on('submit(btnEdit)', function (data) {
@@ -569,7 +589,7 @@
                    , area: ['90%', '90%']//大小
                    , title: '部门列表'//标题
                    , shift: 2//弹出动画
                    , content: ['../../基础资料/公用基础资料/Gy_DepartmentList.html', 'yes']
                    , content: ['../../基础资料/公用基础资料/Gy_DepartmentList.html?openType=2&HOrgName=' + sessionStorage["Organization"], 'yes']
                    , btn: ['确定', '取消']
                    , btn1: function (index, layero) {//按钮【按钮一】的回调
                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
@@ -597,7 +617,7 @@
                    , area: ['90%', '90%']//大小
                    , title: '工作中心列表'//标题
                    , shift: 2//弹出动画
                    , content: ['../../基础资料/公用基础资料/Gy_WorkCenter.html', 'yes']
                    , content: ['../../基础资料/公用基础资料/Gy_WorkCenter.html?openType=2', 'yes']
                    , btn: ['确定', '取消']
                    , btn1: function (index, layero) {//按钮【按钮一】的回调
                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
@@ -625,7 +645,7 @@
                    , area: ['90%', '90%']//大小
                    , title: '班次列表'//标题
                    , shift: 2//弹出动画
                    , content: ['../../基础资料/生产基础资料/Gy_WorkShiftList.html?type=HWorkShifts&OperationType=2', 'yes']
                    , content: ['../../基础资料/生产基础资料/Gy_WorkShiftList.html?type=HWorkShifts&openType=2', 'yes']
                    , btn: ['确定', '取消']
                    , btn1: function (index, layero) {//按钮【按钮一】的回调
                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
@@ -653,7 +673,7 @@
                    , area: ['90%', '90%']//大小
                    , title: '班组列表'//标题
                    , shift: 2//弹出动画
                    , content: ['../../基础资料/工资基础资料/Gy_Group.html?type=HGroup', 'yes']
                    , content: ['../../基础资料/工资基础资料/Gy_Group.html?type=HGroup&openType=2', 'yes']
                    , btn: ['确定', '取消']
                    , btn1: function (index, layero) {//按钮【按钮一】的回调
                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
@@ -681,7 +701,7 @@
                    , area: ['90%', '90%']//大小
                    , title: '班组列表'//标题
                    , shift: 2//弹出动画
                    , content: ['../../基础资料/生产基础资料/Gy_Source.html', 'yes']
                    , content: ['../../基础资料/生产基础资料/Gy_Source.html?Htype=&openType=2', 'yes']
                    , btn: ['确定', '取消']
                    , btn1: function (index, layero) {//按钮【按钮一】的回调
                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
@@ -737,15 +757,20 @@
                var index = layer.load();
                $.ajax({
                    type: "POST",
                    url: GetWEBURL() + "Sc_ShiftsBeginInfoBill/SaveSc_ShiftsBeginInfoBillMain",
                    url: GetWEBURL() + "Sc_ShiftsBeginInfoBill/SaveSc_ShiftsBeginInfoBillMain ",
                    async: true,
                    data: { "sMainSub": sMainSub },
                    dataType: "json",
                    success: function (data) {
                        if (data.count == 1) {
                            layer.msg(data.Message, { icon: 1 });
                            $('#btnSave').addClass("layui-btn-disabled").attr("disabled", true);
                            if (data.Verify == "Y") //自动审核
                            {
                                $("#HInterID").val(data.HInterID);//获取提交成功返回的单据主ID
                                set_CheckBill(1); //审核
                            }
                            layer.close(index);
                            layer.msg("提交成功");
                        }
                        else {
@@ -791,6 +816,7 @@
                            , "HGroupLeaderID": data[0]["HGroupLeaderID"]
                            , "HGroupLeaderName": data[0]["班组长"]                        
                            , "HStdEmpQty": data[0]["应到岗人数"]
                            , "HPlanShutdownTimes": data[0]["计划停工时长"]
                            , "HRemark": data[0]["表头备注"]
                            , "HMaker": data[0]["制单人"]
@@ -825,6 +851,39 @@
            }
            //#endregion          
            //#region é€šè¿‡ç™»å½•用户获取默认值
            function GetDefValByUser() {
                var index = layer.load();
                $.ajax({
                    url: GetWEBURL() + "/Cj_StationInBill/GetDefValByUser",
                    type: "GET",
                    async: false,
                    data: { "Czybm": sessionStorage["Czybm"], "Czymc": sessionStorage["HUserName"] },
                    success: function (result) {
                        var data = result.data[0];
                        form.val("formData", {
                            //"HSourceID": data.HSourceID,
                            //"HSourceName": data.生产资源名称,
                            "HDeptID": data["HDeptID"]
                            , "HDeptName": data["部门名称"]
                            , "HWorkCenterID": data["HWorkCenterID"]
                            , "HWorkCenterName": data["工作中心名称"]
                            , "HSourceID": data["HSourceID"]
                            , "HSourceName": data["生产资源名称"]
                            , "HGroupID": data["HGroupID"]
                            , "HGroupName": data["生产班组名称"]
                        });
                        layer.close(index);
                    }
                    , error: function () {
                        layer.close(index);
                        layer.msg("接口请求失败");
                    }
                })
            }
            //#endregion
            //#region éžç©ºéªŒè¯
            function AllowLoadData(data) {
                //#region è¡¨å¤´æ•°æ®æ£€éªŒ
@@ -852,6 +911,7 @@
                    layer.msg("应到岗人数不能为空!");
                    return false;
                }
                //#region å­è¡¨æ•°æ®æ£€éªŒ
                //for (var i = 0; i < option.data.length; i++) {
@@ -907,7 +967,7 @@
                                , shift: 2                                          //弹出动画
                                , area: ["90%", "90%"]                              //窗体大小
                                , maxmin: true                                      //设置最大最小按钮是否显示
                                , content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html', "yes"]
                                , content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html?Type=HEmp', "yes"]
                                , btn: ["确定", "取消"]
                                , btn1: function (index, laero) {
                                    //按钮一  çš„回调
@@ -949,6 +1009,16 @@
                                }
                                , btn2: function (index, layero) { }
                                , end: function () {
                                    if (typeof (OptionData[0].HItemID) != "undefined") {
                                        obj.update({
                                            "HWorkEmpID": OptionData[0].HItemID
                                            , "HWorkEmpNumber": OptionData[0].职员代码
                                            , "HWorkEmpName": OptionData[0].职员名称
                                        })
                                    }
                                    OptionData = "";
                                }
                            });
                        }
@@ -957,92 +1027,33 @@
                    }
                })
            }
            //#endregion
            //#endregion
            //#region æ˜¾ç¤ºåˆ—数据
            function DisPlay_HideColumn() {
            //审核
            function set_CheckBill(num) {
                $.ajax({
                    url: GetWEBURL() + '/Xt_grdAlignment_WMES/grdAlignmentWMESList',
                    type: "GET",
                    data: { "HModName": HModName, "user": sessionStorage["HUserName"] },
                    async: false,
                    success: function (data1) {
                        if (data1.data.length != 0) {
                            var dataCol = [];//数据库查询出的列数据
                    url: GetWEBURL() + "/Sc_ShiftsBeginInfoBill/AuditSc_ShiftsBeginInfoBill", //方法所在页面和方法名
                    data: { "HInterID": $("#HInterID").val(),"Type": num, "user": 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);
                            });
                            dataCol = data1.data[0].HGridString.split(',');
                            for (var i = 0; i < option.cols[0].length - 2; i++) {
                                var dataCols = dataCol[i].split('|');
                                //隐藏列
                                if (dataCols[1] == 1) {
                                    option.cols[0][i + 1]["hide"] = true;
                                }
                                //设置列宽
                                if (dataCols[3] > 0) {
                                    option.cols[0][i + 1]["width"] = dataCols[3];
                                }
                                //设置内容字体大小
                                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[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);
                            for (var i = 0; i < option.data.length; i++) {
                                $('#HReceiveType' + (i + 1)).find("option[value='" + option.data[i].HReceiveType + "']").attr("selected", true);
                            }
                            form.render('select');
                        } else {
                            table.render(option);
                            for (var i = 0; i < option.data.length; i++) {
                                $('#HReceiveType' + (i + 1)).find("option[value='" + option.data[i].HReceiveType + "']").attr("selected", true);
                            }
                            form.render('select');
                            layer.alert(result.code + result.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                })
                });
            }
            //#endregion
            //#endregion