yangle
2023-08-24 22870b2ceda5ea1dc4e83c8b8d6a11973b834be3
WebTM/views/ÏîÄ¿¹ÜÀí/¹¤×÷ÈÎÎñ/PM_WorkTaskReportBill.html
@@ -14,7 +14,7 @@
    <script src="../../../layuiadmin/Scripts/jquery-1.4.1.js"></script>
    <script src="../../../layuiadmin/Scripts/webConfig.js"></script>
    <script src="../../../layuiadmin/PubCustom.js"></script>
    <style>
    <!--<style>
        .main-btn { /*头部主按钮*/
            padding: 0 2px; /*调整按钮左右空隙大小*/
            height: 30px;
@@ -44,7 +44,7 @@
        .layui-form-label {
            width: 25%;
        }
    </style>
    </style>-->
</head>
<body>
@@ -75,20 +75,20 @@
                                <div class="layui-form-item" style="padding-top: 10px;">
                                    <div class="layui-row">
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">单据号*</label>
                                            <label class="layui-form-label" style="width: 85px;">单据号<label style="color:red"> * </label></label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="text" class="layui-input" name="HBillNo" lay-verify="HBillNo" id="HBillNo" style="background-color:#efefef4d;" readonly>
                                                <input type="hidden" name="HInterID" id="HInterID" lay-verify="HInterID">
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">日期</label>
                                            <label class="layui-form-label" style="width: 85px;">日期<label style="color:red"> * </label></label>
                                            <div class="layui-input-block" style="margin-left: 120px; width:180px;">
                                                <input type="date" class="layui-input" lay-verify="HDate" name="HDate" id="HDate" style="padding-left: 80px;">
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;padding: 9px 18px;">汇报人*</label>
                                            <label class="layui-form-label" style="width: 85px;padding: 9px 18px;">汇报人<label style="color:red"> * </label></label>
                                            <div class="layui-input-block" style="margin-left: 77px;">
                                                <input type="text" class="layui-input" lay-verify="HReportEmpName" name="HReportEmpName" id="HReportEmpName" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
                                                <input type="hidden" name="HReportEmpID" id="HReportEmpID" lay-verify="HReportEmpID" value="0">
@@ -100,7 +100,7 @@
                                    </div>
                                    <div class="layui-row">
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">备注<label style="color:red"> * </label></label>
                                            <label class="layui-form-label" style="width: 85px;">备注</label>
                                            <div class="layui-input-block" style="margin-left: 120px; width: 501px;">
                                                <input type="text" class="layui-input" lay-verify="HRemark" name="HRemark" id="HRemark">
                                            </div>
@@ -108,11 +108,21 @@
                                    </div>
                                    <div class="layui-row">
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">组织*</label>
                                            <label class="layui-form-label" style="width: 85px;">组织<label style="color:red"> * </label></label>
                                            <div class="layui-input-block" style="margin-left: 120px; width: 501px;">
                                                <select name="HOrgID" id="HOrgID" lay-verify="HOrgID">
                                                    <!--动态渲染组织-->
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-row">
                                        <div class="layui-inline">
                                            <div class="layui-input-block" style="margin-left: 120px; width: 501px;">
                                                <input type="hidden" name="HProID" id="HProID" lay-verify="HProID" value="0">
                                                <input type="hidden" name="HProjectStageID" id="HProjectStageID" lay-verify="HProjectStageID" value="0">
                                                <input type="hidden" name="HMainSourceBillType" id="HMainSourceBillType" lay-verify="HMainSourceBillType" value="0">
                                                <input type="hidden" name="HMainSourceBillNo" id="HMainSourceBillNo" lay-verify="HMainSourceBillNo" value="0">
                                            </div>
                                        </div>
                                    </div>
@@ -131,7 +141,7 @@
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">修改人</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="text" class="layui-input" name="HUpDater" id="hupdater" style="background-color:#efefef4d;" readonly>
                                                <input type="text" class="layui-input" name="HUpdater" id="HUpdater" style="background-color:#efefef4d;" readonly>
                                            </div>
                                        </div>
                                        <div class="layui-inline">
@@ -152,7 +162,7 @@
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">修改日期</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="text" class="layui-input" name="HUpDaterDate" id="hupdatedate" style="background-color:#efefef4d;" readonly>
                                                <input type="text" class="layui-input" name="HUpdaterDate" id="HUpdaterDate" style="background-color:#efefef4d;" readonly>
                                            </div>
                                        </div>
                                        <div class="layui-inline">
@@ -227,8 +237,8 @@
                                        <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-CopyLine"><i class="layui-icon layui-icon-form"></i>复制一行</button>
                                        <button type="button" class="layui-btn layui-btn-sm" lay-event="set_HideColumn"><i class="layui-icon layui-icon-form"></i>列设置</button>
                                        <button type="button" class="layui-btn layui-btn-sm" lay-event="btn_up"><i class="layui-icon layui-icon-form"></i>上一行</button>
                                        <button type="button" class="layui-btn layui-btn-sm" lay-event="btn_under"><i class="layui-icon layui-icon-form"></i>下一行</button>
                                        <!--<button type="button" class="layui-btn layui-btn-sm" lay-event="btn_up"><i class="layui-icon layui-icon-form"></i>上一行</button>
                                        <button type="button" class="layui-btn layui-btn-sm" lay-event="btn_under"><i class="layui-icon layui-icon-form"></i>下一行</button>-->
                                    </div>
                                </script>
                            </div>
@@ -263,10 +273,13 @@
            var HModName = "PM_WorkTaskReportBill";
            //表格渲染参数
            var option = {};            //项目阶段表渲染参数
            //记录组织的值
            var HOrgIDBar = 0;
            //获取参数
            var params = getUrlVars();
            var OperationType = params[params[0]]; //从参数中获取 æ•°æ®ç±»åž‹  1添加 ä¿å­˜  2复制  3 ç¼–辑
            var linterid = params[params[1]]; //从参数中获取 å•据内码
            var HProjectStageID = params[params[3]]; //阶段内码
            //#endregion
@@ -289,6 +302,8 @@
            //#region åˆ¤æ–­å¹¶è®¾ç½®æ“ä½œç±»åž‹ã€é¡µé¢åˆå§‹åŒ–
            if (OperationType == null || OperationType == 1) {                            //新增
                //禁用组织选项
                $("#HOrgID").attr("disabled", true);
                OperationType = 1;
                //生成并设置主表的内码和单据号
                createBillNo();
@@ -319,12 +334,30 @@
            //    });
            //}
            else if (OperationType == 3) {//如果修改则走下面 new                                        //编辑
                ////禁用组织选项
                //$("#HOrgID").attr("disabled", true);
                //禁用组织选项
                $("#HOrgID").attr("disabled", true);
                //初始化项目阶段表
                get_InitGrid();
                RoadBillMain(linterid);
            } else if (OperationType == 4 && HProjectStageID != null) {
                //禁用组织选项
                $("#HOrgID").attr("disabled", true);
                //生成并设置主表的内码和单据号
                createBillNo();
                //初始化制单人和制单时间
                $("#HMaker").val(sessionStorage["HUserName"]);
                $("#HMakerDate").val(Format(new Date(), "yyyy-MM-dd"));
                //初始化日期
                $("#HDate").val(Format(new Date(), "yyyy-MM-dd"));
                //初始化项目阶段表
                get_InitGrid();
                //下推-页面设置
                set_WorkTaskReport();
            }
            //#endregion
            //#region åˆå§‹åŒ–表格
            DisPlay_HideColumn();
            //#endregion
            //#endregion
@@ -429,7 +462,7 @@
                        break;
                    //列设置
                    case 'set_HideColumn':
                        //get_HideColumn();
                        get_HideColumn();
                        break;
                    //上一行
                    case 'btn_up':
@@ -513,7 +546,10 @@
                                Organization += '<option  style="color:blue;" value="' + data[i].ID + '">' + data[i].Name + '</option>';
                            }
                            $("#HOrgID").append(Organization);
                            $("#HOrgID").val(sessionStorage["OrganizationID"])
                            if (OperationType == 1) {
                                HOrgIDBar = sessionStorage["OrganizationID"];
                            }
                            $("#HOrgID").val(HOrgIDBar);
                            form.render('select');
                        }
                        layer.closeAll("loading");
@@ -556,22 +592,23 @@
                option = {
                    elem: '#mainTable'
                    , toolbar: '#toolbarDemo'
                    , page: true
                    , limit: 500
                    , limits: [50, 500, 5000, 50000]
                    //, page: true
                    //, limit: 500
                    //, limits: [50, 500, 5000, 50000]
                    , totalRow: true
                    , cellMinWidth: 120
                    , height: 400
                    , cols: [[
                        { type: 'checkbox', totalRowText: '合计行' }
                        , { type: 'numbers', title: '序号', totalRow: true }
                        , { field: 'RowID', title: '行号', hide: true }                                                   //行标识,用于下一行、上一行识别所在行
                        , { field: 'HProNumber', title: '项目代码', edit: 'text' }
                        , { field: 'HProjectStageID', title: '项目阶段ID', hide: true }
                        , { field: 'HProjectStageName', title: '项目阶段', edit: 'text', event: "HProjectStageName" }     //f7
                        , { field: 'HName', title: '任务名称', edit: 'text' }
                        , { field: 'HTaskNote', title: '任务描述', edit: 'text' }
                        , { field: 'HType', title: '任务类型', edit: 'text' }
                        , { field: 'HRelTimes', title: '耗用工时', edit: 'text' }
                        , { type: 'numbers', title: '序号', style: 'background-color: #f9f9f9;' }
                        , { field: 'RowID', title: '行号', hide: true, style: 'background-color: #f9f9f9;' }                                                   //行标识,用于下一行、上一行识别所在行
                        , { field: 'HProNumber', title: '项目代码', style: 'background-color: #f9f9f9;'}
                        , { field: 'HProjectStageID', title: '项目阶段ID', hide: true, style: 'background-color: #f9f9f9;' }
                        , { field: 'HProjectStageName', title: '项目阶段', style: 'background-color: #f9f9f9;' }     //f7
                        , { field: 'HName', title: '任务名称', edit: 'text', event: "HName" }
                        , { field: 'HTaskNote', title: '任务描述', style: 'background-color: #f9f9f9;' }
                        , { field: 'HType', title: '任务类型', style: 'background-color: #f9f9f9;'}
                        , { field: 'HRelTimes', title: '耗用工时', edit: 'text', totalRow: true }
                        , { field: 'HReportNote', title: '汇报内容', edit: 'text' }
                        , { field: 'HAdv', title: '优化建议', edit: 'text' }
                        , { field: 'HRemarkSub', title: '备注', edit: 'text' }
@@ -638,9 +675,15 @@
                        num.push(table.cache["mainTable"][i])
                    }
                }
                //获取组织数据
                data.field.HPRDORGID = sessionStorage["OrganizationID"];//组织
                //若为编辑-保存,则更新修改人和修改时间
                if (OperationType == 3) {
                    data.field.HUpdater = sessionStorage["HUserName"];
                    data.field.HUpdaterDate = Format(new Date(), "yyyy-MM-dd");
                    $("#HUpdater").val(sessionStorage["HUserName"]);
                    $("#HUpdaterDate").val(Format(new Date(), "yyyy-MM-dd"));
                }
                //获取表头数据并序列化
                var sMainStr = JSON.stringify(data.field);              //主表数据
                //子表数据序列化
@@ -698,21 +741,61 @@
                            , "HMaker": tableMain[0]["HMaker"]
                            , "HUpdater": tableMain[0]["HUpdater"]
                            , "HChecker": tableMain[0]["HChecker"]
                            , "HMakerDate": tableMain[0]["HMakerDate"] == null ? "" : Format(new Date(tableMain[0]["HMakerDate"]), "yy-MM-dd")
                            , "HUpdaterDate": tableMain[0]["HUpdaterDate"] == null ? "" : Format(new Date(tableMain[0]["HUpdaterDate"]), "yy-MM-dd")
                            , "HCheckerDate": tableMain[0]["HCheckerDate"] == null ? "" : Format(new Date(tableMain[0]["HCheckerDate"]), "yy-MM-dd")
                            , "HMakerDate": tableMain[0]["HMakerDate"] == null ? "" : Format(new Date(tableMain[0]["HMakerDate"]), "yyyy-MM-dd")
                            , "HUpdaterDate": tableMain[0]["HUpdaterDate"] == null ? "" : Format(new Date(tableMain[0]["HUpdaterDate"]), "yyyy-MM-dd")
                            , "HCheckerDate": tableMain[0]["HCheckerDate"] == null ? "" : Format(new Date(tableMain[0]["HCheckerDate"]), "yyyy-MM-dd")
                            , "HCloseMan": tableMain[0]["HCloseMan"]
                            , "HDeleteMan": tableMain[0]["HDeleteMan"]
                            , "HBacker": tableMain[0]["HBacker"]
                            , "HCloseManDate": tableMain[0]["HCloseManDate"] == null ? "" : Format(new Date(tableMain[0]["HCloseManDate"]), "yyyy-MM-dd")
                            , "HDeleteManDate": tableMain[0]["HDeleteManDate"] == null ? "" : tFormat(new Date(tableMain[0]["HDeleteManDate"]), "yyyy-MM-dd")
                            , "HCloseManDate": tableMain[0]["HCloseDate"] == null ? "" : Format(new Date(tableMain[0]["HCloseDate"]), "yyyy-MM-dd")
                            , "HDeleteManDate": tableMain[0]["HDeleteDate"] == null ? "" : Format(new Date(tableMain[0]["HDeleteDate"]), "yyyy-MM-dd")
                            , "HBackerDate": tableMain[0]["HBackerDate"] == null ? "" : Format(new Date(tableMain[0]["HBackerDate"]), "yyyy-MM-dd")
                            , "HBackRemark": tableMain[0]["HBackRemark"]
                            , "HReportEmpID": tableMain[0]["HReportEmpID"]
                            , "HReportEmpName": tableMain[0]["HReportEmpName"]
                        });
                        //组织的值HOrgID变化,重新渲染
                        HOrgIDBar = tableMain[0]["HOrgID"];
                        //子表  èµ‹å€¼
                        for (var i = 0; i < tableSub.length; i++) {
                            tableSub[i].RowID = (i + 1) * 10;
                        }
                        option.data = tableSub;
                        table.render(option);
                    }
                })
            }
            //#endregion
            //#region ä¸‹æŽ¨-页面赋值
            function set_WorkTaskReport() {
                $.ajax({
                    url: GetWEBURL() + "/PM_ProjectBill/set_WorkTaskReport",
                    type: "GET",
                    async: false,
                    data: { "HInterID": linterid, "HProjectStageID": HProjectStageID, "user": sessionStorage["HUserName"] },
                    success: function (result) {
                        var tableMain = result.data[0];
                        var tableSub = result.data[1];
                        //主表 èµ‹å€¼
                        form.val("formData", { //formTest å³ class="layui-form" æ‰€åœ¨å…ƒç´ å±žæ€§ lay-filter="" å¯¹åº”的值
                            "HOrgID": tableMain[0]["HOrgID"]
                            , "HProID": tableMain[0]["HInterID"]
                            , "HProjectStageID": tableMain[0]["HProjectStageID"]
                            , "HMainSourceBillNo": tableMain[0]["单据号"]
                            , "HMainSourceBillType": tableMain[0]["单据类型"]
                        });
                        //组织的值HOrgID变化,重新渲染
                        HOrgIDBar = tableMain[0]["HOrgID"];
                        //子表  èµ‹å€¼
                        for (var i = 0; i < tableSub.length; i++) {
                            tableSub[i].RowID = (i + 1) * 10;
                        }
                        option.data = tableSub;
                        table.render(option);
                    }
@@ -827,22 +910,31 @@
                    layer.msg("单据号不能为空!");
                    return false;
                }
                if ($("#HDate").val() == "") {
                    layer.msg("日期不能为空!");
                    return false;
                }
                if ($("#HReportEmpID").val() == "0") {
                    layer.msg("汇报人未选择!");
                    return false;
                }
                //#endregion
                //#region é¡¹ç›®é˜¶æ®µè¡¨æ•°æ®æ£€éªŒ
                var num = [];
                for (var i = 0; i < option.data.length; i++) {
                    if (option.data[i] != "") {
                        ////项目阶段重复检验
                        //if ($.inArray(option.data[i]["HProjectStageID"], num) == -1) {
                        //    num.push(option.data[i]["HProjectStageID"]);
                        //} else {
                        //    layer.msg("第" + (i + 1) + "行,项目阶段:" + option.data[i]["HProjectStageName"] + "重复!");
                        //    return false;
                        //}
                        //项目阶段非空检验
                        if (option.data[i]["HProjectStageName"] == "") {
                        if (option.data[i]["HProjectStageID"] == "0") {
                            layer.msg("第" + (i + 1) + "行:项目阶段不能为空!");
                            return false;
                        }
                        //任务名称非空检验
                        if (option.data[i]["HName"] == "") {
                            layer.msg("第" + (i + 1) + "行:任务名称不能为空!");
                            return false;
                        }
@@ -859,6 +951,18 @@
                            }
                        }
                    }
                }
                //#endregion
                //#region å­è¡¨å…³é”®å­—段重复检验
                var num = [];
                for (var i = 0; i < option.data.length; i++) {
                    temp = option.data[i]["HProNumber"] + "|" + option.data[i]["HProjectStageID"] + "|" + option.data[i]["HName"];
                    if ($.inArray(temp, num) != -1) {
                        layer.msg("第" + (i + 1) + "行:项目代码、项目阶段、任务名称重复,请重新选择!");
                        return false;
                    }
                    num.push(temp);
                }
                //#endregion
                return true;
@@ -958,16 +1062,85 @@
                                    //更新表格缓存的数据
                                    obj.update({
                                        "HProjectStageID": checkStatus.data[0].HItemID
                                        , "HProjectStageName": checkStatus.data[0].HName
                                        , "HProjectStageName": checkStatus.data[0].阶段名称
                                    })
                                    layer.close(index);//关闭弹窗
                                }
                            })
                        }
                        if (obj.event == "HProNumber") {
                            //工程项目代码
                            //打开工程项目小窗体
                            layer.open({
                                type: 2
                                , skin: "layui-layer-rim"                           //加上边框
                                , title: "工程项目列表"                             //标题
                                , closeBtn: 1                                       //窗体右上角关闭 çš„ æ ·å¼
                                , shift: 2                                          //弹出动画
                                , area: ["90%", "90%"]                              //窗体大小
                                , maxmin: true                                      //设置最大最小按钮是否显示
                                , content: ["../../项目管理/工程项目/PM_ProjectBillList.html", "yes"]
                                , btn: ["确定", "取消"]
                                , btn1: function (index, laero) {
                                    //按钮一  çš„回调
                                    var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
                                    var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
                                    if (checkStatus.data.length != 1) {
                                        return layer.msg("请选择一条数据");
                                    }
                                    //更新表格缓存的数据
                                    obj.update({
                                        "HProNumber": checkStatus.data[0].项目代码
                                    })
                                    layer.close(index);//关闭弹窗
                                }
                                , btn2: function (index, layero) { }
                            })
                        }
                        if (obj.event == "HName") {
                            //工作任务代码
                            //打开工作任务小窗体
                            layer.open({
                                type: 2
                                , skin: "layui-layer-rim"                           //加上边框
                                , title: "工作任务列表"                             //标题
                                , closeBtn: 1                                       //窗体右上角关闭 çš„ æ ·å¼
                                , shift: 2                                          //弹出动画
                                , area: ["90%", "90%"]                              //窗体大小
                                , maxmin: true                                      //设置最大最小按钮是否显示
                                , content: ["../../项目管理/工作任务/PM_WorkTaskBillList.html", "yes"]
                                , btn: ["确定", "取消"]
                                , btn1: function (index, laero) {
                                    //按钮一  çš„回调
                                    var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
                                    var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
                                    if (checkStatus.data.length != 1) {
                                        return layer.msg("请选择一条数据");
                                    }
                                    if (checkStatus.data[0].关闭人 == null || checkStatus.data[0].关闭人 == "") {
                                        //更新表格缓存的数据
                                        obj.update({
                                            "HName": checkStatus.data[0].任务名称
                                            , "HTaskNote": checkStatus.data[0].任务描述
                                            , "HType": checkStatus.data[0].任务类型
                                            , "HProNumber": checkStatus.data[0].项目代码
                                            , "HProjectStageID": checkStatus.data[0].HProjectStageID
                                            , "HProjectStageName": checkStatus.data[0].项目阶段
                                        })
                                    } else {
                                        layer.msg("该任务已关闭,请重新选择!");
                                    }
                                    layer.close(index);//关闭弹窗
                                }
                                , btn2: function (index, layero) { }
                            })
                        }
                        obj.event = "";
                        return false;
                    }
                })
            }
            //#endregion
@@ -1017,7 +1190,7 @@
                    success: function (data1) {
                        if (data1.data.length != 0) {
                            var dataCol = [];//数据库查询出的列数据
                            var titleData = ["程序号", "本工序确认记录", "自动移转", "换单准备时间", "本道准备时间", "上道循环周期", "上道固定天数", "开工余量(固数)", "开工余量(天数)", "标准定额", "报废单价", "不合格单价", "工序工价", "班产定额", "可操作设备数", "标准人数", "流转工序", "下道流转工序", "固定生产天数", "生产周期", "暂放区", "周转箱", "周转箱标准", "换模时间", "转移时间", "排队时间", "准备时间", "产线人数", "产线产能", "产线中心", "良率", "加工数量", "运行时间", "时间单位", "图纸编号", "模具编号", "良品仓", "报废品仓", "不良品仓", "工序类型"];//不需要显示的字段 å¯æ‰©å±•
                            var titleData = ["行号","项目阶段ID"];//不需要显示的字段 å¯æ‰©å±•
                            dataCol = data1.data[0].HGridString.split(',');
@@ -1033,9 +1206,9 @@
                                }
                                //设置内容字体大小
                                if (data1.data[0].HFontSize != 0) {
                                    option.cols[0][i + 1]["style"] = "font-size:" + data1.data[0].HFontSize + "px;";
                                    option.cols[0][i + 1]["style"] += "font-size:" + data1.data[0].HFontSize + "px;";
                                } else {
                                    option.cols[0][i + 1]["style"] = "font-size:100%";
                                    option.cols[0][i + 1]["style"] += "font-size:100%";
                                }
                                //设置列宽
                                //if (data1.data[0].HColumnWidth != 0) {