1
duhe
2023-07-11 6a6a57007747cc7760156c4dcfe0a9955aa2a912
WebTM/views/ÏîÄ¿¹ÜÀí/ÏîÄ¿½×¶Î/PM_ProjectReportBill.html
@@ -87,10 +87,20 @@
                                                <input type="date" class="layui-input" lay-verify="HDate" name="HDate" id="HDate" style="padding-left: 80px;">
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                        <!--<div class="layui-inline">
                                            <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" lay-verify="HProNumber" name="HProNumber" id="HProNumber">
                                            </div>
                                        </div>-->
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;padding: 9px 18px;">项目代码*</label>
                                            <div class="layui-input-block" style="margin-left: 77px;">
                                                <input type="text" class="layui-input" lay-verify="HProNumber" name="HProNumber" id="HProNumber" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
                                                <!--<input type="hidden" name="HProjectStageID" id="HProjectStageID" lay-verify="HProjectStageID" value="0">-->
                                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearchHProNumber" id="btnSearchHProNumber" style="padding: 0 10px;float: right;margin-right: 3px;">
                                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                                </button>
                                            </div>
                                        </div>
                                        <div class="layui-inline">
@@ -108,7 +118,7 @@
                                        <div class="layui-inline">
                                            <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="HStageNote" name="HStageNote" id="HStageNote">
                                                <input type="text" class="layui-input" lay-verify="HStageNote" name="HStageNote" id="HStageNote" readonly>
                                            </div>
                                        </div>
                                        <div class="layui-inline">
@@ -212,7 +222,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">
@@ -233,7 +243,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">
@@ -324,6 +334,12 @@
        <!--<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>-->
        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
    </script>
    <!--项目经理-->
    <script type="text/html" id="HIsPM">
        <div class="layui-input-block" style="margin-left: 20px;">
            <input type="checkbox" name="HIsPM" lay-filter="HIsPM" id="HIsPM{{d.LAY_TABLE_INDEX+1}}" lay-skin="primary">
        </div>
    </script>
    <script>
        layui.config({
@@ -343,6 +359,8 @@
            var HModName = "PM_ProjectReportBill";
            //表格渲染参数
            var option = {};            //项目阶段表渲染参数
            //记录组织的值
            var HOrgIDBar = 0;
            //获取参数
            var params = getUrlVars();
            var OperationType = params[params[0]]; //从参数中获取 æ•°æ®ç±»åž‹  1添加 ä¿å­˜  2复制  3 ç¼–辑
@@ -369,6 +387,8 @@
            //#region åˆ¤æ–­å¹¶è®¾ç½®æ“ä½œç±»åž‹ã€é¡µé¢åˆå§‹åŒ–
            if (OperationType == null || OperationType == 1) {                            //新增
                //禁用组织选项
                $("#HOrgID").attr("disabled", true);
                OperationType = 1;
                //生成并设置主表的内码和单据号
                createBillNo();
@@ -407,11 +427,21 @@
            }
            //#endregion
            //#region åˆå§‹åŒ–表格
            DisPlay_HideColumn();
            //#endregion
            //#endregion
            //#region è§¦å‘事件:包括form.on(){}格式的所有点击事件、选择事件等
            //#region å¼¹çª—选择触发事件
            //#region é€‰æ‹©é¡¹ç›®ä»£ç æŒ‰é’®
            form.on('submit(btnSearchHProNumber)', function () {
                get_checkSearchHProNumber();
            });
            //#endregion
            //#region é€‰æ‹©é¡¹ç›®é˜¶æ®µæŒ‰é’®
            form.on('submit(btnSearchHProjectStage)', function () {
                get_checkSearchHProjectStage();
@@ -441,6 +471,18 @@
            //#region æ˜¯å¦é‡Œç¨‹ç¢‘
            form.on('checkbox(checkboxHIsKey)', function (data) {
                $("#HIsKey").val(data.elem.checked);
            });
            //#endregion
            //#region é¡¹ç›®ç»ç†
            form.on('checkbox(HIsPM)', function (data) {
                var elem = data.othis.parents('tr');
                var dataindex = elem.attr("data-index");
                $.each(option.data, function (index, value) {
                    if (value.LAY_TABLE_INDEX == dataindex) {
                        value.HIsPM = data.elem.checked;//把选中下拉框id值赋值给表格缓存
                    }
                });
            });
            //#endregion
            //#endregion
@@ -502,7 +544,7 @@
                    "RowID": (table.cache["mainTable"].length + 1) * 10
                    , 'HEmpID': '0'
                    , 'HEmpName': ''
                    , 'HIsPM': '0'
                    , 'HIsPM': false
                    , 'HRate': '0'
                    , 'HAvgMoney': '0'
                    , 'HCountMoney': '0'
@@ -532,7 +574,7 @@
                        break;
                    //列设置
                    case 'set_HideColumn':
                        //get_HideColumn();
                        get_HideColumn();
                        break;
                    //上一行
                    case 'btn_up':
@@ -571,7 +613,7 @@
            })
            //#endregion
            //
            form.on('submit(Cancel)', function () {
                //sessionStorage["SourceFlag"] = false;
@@ -615,7 +657,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");
@@ -669,7 +714,7 @@
                        , { field: 'RowID', title: '行号', hide: true }                                                   //行标识,用于下一行、上一行识别所在行
                        , { field: 'HEmpID', title: '成员ID', hide: true }
                        , { field: 'HEmpName', title: '成员', edit: 'text', event: "HEmpName" }     //f7
                        , { field: 'HIsPM', title: '项目经理', edit: 'text' }
                        , { field: 'HIsPM', title: '项目经理', templet: "#HIsPM" }
                        , { field: 'HRate', title: '项目占比', hide: true }
                        , { field: 'HAvgMoney', title: '分配业绩', edit: 'text' }
                        , { field: 'HCountMoney', title: '提成', edit: 'text' }
@@ -683,7 +728,7 @@
                        "RowID": 10
                        , 'HEmpID': '0'
                        , 'HEmpName': ''
                        , 'HIsPM': '0'
                        , 'HIsPM': false
                        , 'HRate': '0'
                        , 'HAvgMoney': '0'
                        , 'HCountMoney': '0'
@@ -692,6 +737,36 @@
                ];
                option.data = rowdata;
                table.render(option);
            }
            //#endregion
            //#region é¡¹ç›®ä»£ç é€‰æ‹©é¡µé¢
            function get_checkSearchHProNumber() {
                //打开工程项目小窗体
                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("请选择一条数据");
                        }
                        $("#HProNumber").val(checkStatus.data[0].HProNumber);//工程项目代码
                        layer.close(index);//关闭弹窗
                    }
                    , btn2: function (index, layero) { }
                })
            }
            //#endregion
@@ -722,6 +797,7 @@
                        if ($("#HProjectStageName").val() == "") {
                            $("#HProjectStageName").val(checkStatus.data[0].HNumber);
                        }
                        $("#HStageNote").val(checkStatus.data[0].HStageNote);//项目阶段详细内容
                        layer.close(index);//关闭弹窗
                    }
                    , btn2: function (index, layero) { }
@@ -824,10 +900,21 @@
                        num.push(table.cache["mainTable"][i])
                    }
                }
                //获取组织数据
                data.field.HPRDORGID = sessionStorage["OrganizationID"];//组织
                data.field.HIsKey = data.field.HIsKey ? 1 : 0;
                //转换里程碑数据
                if (data.field.HIsKey == "true") {
                    data.field.HIsKey = 1;
                } else {
                    data.field.HIsKey = 0;
                }
                //若为编辑-保存,则更新修改人和修改时间
                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);              //主表数据
                //子表数据序列化
@@ -898,9 +985,9 @@
                            , "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"]
@@ -909,18 +996,25 @@
                            , "HBackerDate": tableMain[0]["HBackerDate"] == null ? "" : Format(new Date(tableMain[0]["HBackerDate"]), "yyyy-MM-dd")
                            , "HBackRemark": tableMain[0]["HBackRemark"]
                        });
                        var HIsKey = tableMain[0].HIsKey;
                        if (HIsKey) {
                            $("input[name='checkboxHIsKey'][value='" + HIsKey + "']").attr("checked", true);
                        //若该阶段为里程碑,则设置里程碑复选框为选中
                        if (tableMain[0]["HIsKey"]) {
                            $("#checkboxHIsKey").attr("checked", true);
                            form.render("checkbox");
                        }
                        //子表  èµ‹å€¼
                        for (var i = 0; i < tableSub.length; i++) {
                            tableSub[i].HIsPM = (tableSub[i].HIsPM) ? 1 : 0;
                        }
                        //组织的值HOrgID变化,重新渲染
                        HOrgIDBar = tableMain[0]["HOrgID"];
                        //子表
                        option.data = tableSub;
                        table.render(option);
                        //对子表中的项目经理复选框进行选中
                        for (var i = 0; i < tableSub.length; i++) {
                            if (tableSub[i].HIsPM) {
                                $('#HIsPM' + (i + 1)).attr("checked", true);
                            }
                        }
                        form.render('checkbox');
                    }
                })
            }
@@ -1046,7 +1140,7 @@
                    layer.msg("汇报人没有选择!");
                    return false;
                }
                //本阶段业绩占比格式检验
                var HRate1 = $("#HRate").val() + "";
                if (HRate1.substring(HRate1.length - 1, HRate1.length) == ".") {
@@ -1080,7 +1174,7 @@
                        }
                        //是否项目经理格式检验
                        if (option.data[i]["HIsPM"] != "1" && option.data[i]["HIsPM"]!= '0') {
                        if (option.data[i]["HIsPM"] != "1" && option.data[i]["HIsPM"] != '0') {
                            layer.msg("第" + (i + 1) + "行:是否项目经理请输入0或1!");
                            return false;
                        }