yusijie
2024-04-02 1ade401c90b87d507ab70cf40e08441cbfe52421
WebTM/views/ÏîÄ¿¹ÜÀí/¹¤³ÌÏîÄ¿/PM_ProjectBill.html
@@ -424,7 +424,7 @@
        </div>
    </script>
    <script>
        layui.config({
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
@@ -446,6 +446,17 @@
            var option1 = {};           //项目成员表渲染参数
            //记录组织的值
            var HOrgIDBar = 0;
            //全局变量
            window.CusType = 0;
            window.ProjectStageData = [];//项目阶段
            window.HEmpData = [];   //阶段负责人
            window.ProjectCheckData = [];   //阶段审核人
            window.RowDatas = [];   //f6阶段负责人
            window.RowDatass = [];  //f6阶段审核人
            window.MemberData = []; //项目成员
            //获取参数
            var params = getUrlVars();
            var OperationType = params[params[0]]; //从参数中获取 æ•°æ®ç±»åž‹  1添加 ä¿å­˜  2复制  3 ç¼–辑
@@ -534,7 +545,10 @@
            //#region å¼¹çª—选择触发事件
            //#region é€‰æ‹©å®¢æˆ·ä»£ç æŒ‰é’®
            form.on('submit(btnSearchHCus)', function () {
                CusType = 1;
                get_checkSearchHCus();
            });
            //#endregion
@@ -564,6 +578,7 @@
            //#region é€‰æ‹©ç»“算方按钮
            form.on('submit(btnSearchHPayCus)', function () {
                CusType = 2;
                get_checkSearchHPayCus();
            });
            //#endregion
@@ -1083,6 +1098,7 @@
                        layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) { }
                    , end: function () { }
                })
            }
            //#endregion
@@ -1096,7 +1112,7 @@
                    , area: ['90%', '90%']//大小
                    , title: '员工表'//标题
                    , shift: 2//弹出动画
                    , content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html?openType=2&HOrgID=' + HOrgID, 'yes']
                    , content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html?openType=HPM&HOrgID=' + HOrgID, 'yes']
                    , btn: ['确定', '取消']
                    , btn1: function (index, layero) {//按钮【按钮一】的回调
                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
@@ -1113,6 +1129,7 @@
                        layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) { }
                    , end: function () { }
                })
            }
            //#endregion
@@ -1126,7 +1143,7 @@
                    , area: ['90%', '90%']//大小
                    , title: '员工表'//标题
                    , shift: 2//弹出动画
                    , content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html?openType=2&HOrgID=' + HOrgID, 'yes']
                    , content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html?openType=HWorker&HOrgID=' + HOrgID, 'yes']
                    , btn: ['确定', '取消']
                    , btn1: function (index, layero) {//按钮【按钮一】的回调
                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
@@ -1156,7 +1173,7 @@
                    , area: ['90%', '90%']//大小
                    , title: '员工表'//标题
                    , shift: 2//弹出动画
                    , content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html?openType=2&HOrgID=' + HOrgID, 'yes']
                    , content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html?openType=HEmp&HOrgID=' + HOrgID, 'yes']
                    , btn: ['确定', '取消']
                    , btn1: function (index, layero) {//按钮【按钮一】的回调
                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
@@ -1186,7 +1203,7 @@
                    , area: ['90%', '90%']//大小
                    , title: '产品表'//标题
                    , shift: 2//弹出动画
                    , content: ['../../基础资料/公用基础资料/Gy_Material.html?openType=2&HOrgID=' + HOrgID, 'yes']
                    , content: ['../../基础资料/公用基础资料/Gy_Material.html', 'yes']
                    , btn: ['确定', '取消']
                    , btn1: function (index, layero) {//按钮【按钮一】的回调
                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
@@ -1204,6 +1221,7 @@
                        layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) { }
                    , end: function () { }
                })
            }
            //#endregion
@@ -1234,6 +1252,7 @@
                        layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) { }
                    , end: function () { }
                })
            }
            //#endregion
@@ -1262,66 +1281,76 @@
                        //获取数据
                        var HBillInterID = checkStatus.data[0].HInterID;
                        //获取项目阶段清单中的项目阶段列表
                        $.ajax({
                            url: GetWEBURL() + "/PM_ProjectStageBill/editInit",
                            type: "GET",
                            async: false,
                            data: { "HInterID": HBillInterID, "user": sessionStorage["HUserName"] },
                            success: function (result) {
                                var tableMain = result.data[0];
                                var tableSub = result.data[1];
                                //合并现有子表数据和项目阶段清单的数据
                                var num = [];
                                var len = 0;        //记录num长度,用于作为RowID的系数,为RowID的赋值
                                for (var i = 0; i < tableSub.length; i++) {
                                    var NewRow =
                                    {
                                        "RowID": (i + 1) * 10
                                        , 'HProjectStageID': tableSub[i]["HProjectStageID"]
                                        , 'HProjectStageName': tableSub[i]["HProjectStageName"]
                                        , 'HStageNote': tableSub[i]["HStageNote"]
                                        , 'HPMGoodsID': (tableSub[i]["HPMGoodsID"] != null) ? tableSub[i]["HPMGoodsID"] : '0'
                                        , 'HPMGoodsName': tableSub[i]["HPMGoodsName"]
                                        , 'HIsKey': tableSub[i]["HIsKey"]
                                        , 'HRate': tableSub[i]["HRate"]
                                        , 'HEmpID': '0'
                                        , 'HEmpName': ''
                                        , 'HCheckEmpID': '0'
                                        , 'HCheckEmpName': ''
                                        , 'HFinishDate': ''
                                        , 'HWorkDays': '0'
                                        , 'HRemarkSub': tableSub[i]["HRemarkSub"]
                                    };
                                    num.push(NewRow);
                                }
                                len = num.length;
                                for (var i = 0; i < option.data.length; i++) {
                                    option.data[i].RowID = (len + i + 1) * 10;
                                    num.push(option.data[i]);
                                }
                                //子表  èµ‹å€¼
                                option.data = num;
                                table.render(option);
                                //对子表中的复选框进行选中
                                for (var i = 0; i < num.length; i++) {
                                    if (num[i].HIsKey) {
                                        $('#HIsKey' + (i + 1)).attr("checked", true);
                                    }
                                }
                                form.render('checkbox');
                            }
                        })
                        get_BT(HBillInterID);
                        layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) { }
                    , end: function () {
                        get_BT($("#HProjectStageBillInterID").val());
                    }
                })
            }
            //#endregion
            //#region  é¡¹ç›®é˜¶æ®µæ¸…单 é€‰æ‹© å¸¦å‡ºè¡¨ä½“数据
            function get_BT(HBillInterID) {
                $.ajax({
                    url: GetWEBURL() + "/PM_ProjectStageBill/editInit",
                    type: "GET",
                    async: false,
                    data: { "HInterID": HBillInterID, "user": sessionStorage["HUserName"] },
                    success: function (result) {
                        var tableMain = result.data[0];
                        var tableSub = result.data[1];
                        //合并现有子表数据和项目阶段清单的数据
                        var num = [];
                        var len = 0;        //记录num长度,用于作为RowID的系数,为RowID的赋值
                        for (var i = 0; i < tableSub.length; i++) {
                            var NewRow =
                            {
                                "RowID": (i + 1) * 10
                                , 'HProjectStageID': tableSub[i]["HProjectStageID"]
                                , 'HProjectStageName': tableSub[i]["HProjectStageName"]
                                , 'HStageNote': tableSub[i]["HStageNote"]
                                , 'HPMGoodsID': (tableSub[i]["HPMGoodsID"] != null) ? tableSub[i]["HPMGoodsID"] : '0'
                                , 'HPMGoodsName': tableSub[i]["HPMGoodsName"]
                                , 'HIsKey': tableSub[i]["HIsKey"]
                                , 'HRate': tableSub[i]["HRate"]
                                , 'HEmpID': '0'
                                , 'HEmpName': ''
                                , 'HCheckEmpID': '0'
                                , 'HCheckEmpName': ''
                                , 'HFinishDate': ''
                                , 'HWorkDays': '0'
                                , 'HRemarkSub': tableSub[i]["HRemarkSub"]
                            };
                            num.push(NewRow);
                        }
                        len = num.length;
                        for (var i = 0; i < option.data.length; i++) {
                            option.data[i].RowID = (len + i + 1) * 10;
                            num.push(option.data[i]);
                        }
                        //子表  èµ‹å€¼
                        option.data = num;
                        table.render(option);
                        //对子表中的复选框进行选中
                        for (var i = 0; i < num.length; i++) {
                            if (num[i].HIsKey) {
                                $('#HIsKey' + (i + 1)).attr("checked", true);
                            }
                        }
                        form.render('checkbox');
                    }
                })
            }
            //#endregion
            //#region ä¿å­˜HMaker
            function set_AddNew(data) {
@@ -1857,6 +1886,17 @@
                                    CheckedSet_tableSub();
                                    layer.close(index);//关闭弹窗
                                }
                                , end: function () {
                                    obj.update({
                                        "HProjectStageID": ProjectStageData[0].HItemID
                                        , "HProjectStageName": ProjectStageData[0].阶段名称
                                        , "HStageNote": ProjectStageData[0].项目阶段详细内容
                                        , "HPMGoodsID": ProjectStageData[0].HPMGoodsID == null ? 0 : ProjectStageData[0].HPMGoodsID
                                        , "HPMGoodsName": ProjectStageData[0].相关交付物
                                        , "HIsKey": ProjectStageData[0].里程碑 == "Y" ? true : false
                                        , "HRate": ProjectStageData[0].理论业绩占比
                                    })
                                }
                            })
                        }
                        //阶段负责人
@@ -1871,7 +1911,7 @@
                                , shift: 2                                          //弹出动画
                                , area: ["90%", "90%"]                              //窗体大小
                                , maxmin: true                                      //设置最大最小按钮是否显示
                                , content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html?openType=2&HOrgID=' + HOrgID, "yes"]
                                , content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html?openType=HProject&HOrgID=' + HOrgID, "yes"]
                                , btn: ["确定", "取消"]
                                , btn1: function (index, laero) {
                                    //按钮一  çš„回调
@@ -1888,6 +1928,12 @@
                                    })
                                    layer.close(index);//关闭弹窗
                                }
                                , end: function () {
                                    obj.update({
                                        "HEmpID": HEmpData[0].HItemID
                                        , "HEmpName": HEmpData[0].职员名称
                                    })
                                }
                            })
                        }
                        //阶段审核人
@@ -1902,7 +1948,7 @@
                                , shift: 2                                          //弹出动画
                                , area: ["90%", "90%"]                              //窗体大小
                                , maxmin: true                                      //设置最大最小按钮是否显示
                                , content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html?openType=2&HOrgID=' + HOrgID, "yes"]
                                , content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html?openType=HProjectCheck&HOrgID=' + HOrgID, "yes"]
                                , btn: ["确定", "取消"]
                                , btn1: function (index, laero) {
                                    //按钮一  çš„回调
@@ -1918,6 +1964,12 @@
                                        , "HCheckEmpName": checkStatus.data[0].职员名称
                                    })
                                    layer.close(index);//关闭弹窗
                                }
                                , end: function () {
                                    obj.update({
                                        "HCheckEmpID": ProjectCheckData[0].HItemID
                                        , "HCheckEmpName": ProjectCheckData[0].职员名称
                                    })
                                }
                            })
                        }
@@ -1941,7 +1993,7 @@
                                , shift: 2                                          //弹出动画
                                , area: ["90%", "90%"]                              //窗体大小
                                , maxmin: true                                      //设置最大最小按钮是否显示
                                , content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html?openType=2&HOrgID=' + HOrgID, "yes"]
                                , content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html?openType=HManager&HOrgID=' + HOrgID, "yes"]
                                , btn: ["确定", "取消"]
                                , btn1: function (index, laero) {
                                    //按钮一  çš„回调
@@ -1965,6 +2017,18 @@
                                    layer.close(index);//关闭弹窗
                                }
                                , end: function () {
                                    var rowIndex = $(obj.tr).attr("data-index");
                                    for (var i = 0; i < option.data.length; i++) {
                                        if (i >= rowIndex) {
                                            option.data[i]["HEmpID"] = RowDatas[0].HItemID;
                                            option.data[i]["HEmpName"] = RowDatas[0].职员名称;
                                        }
                                    }
                                    table.render(option);
                                    CheckedSet_tableSub();
                                }
                            })
                        }
                        //阶段审核人
@@ -1979,7 +2043,7 @@
                                , shift: 2                                          //弹出动画
                                , area: ["90%", "90%"]                              //窗体大小
                                , maxmin: true                                      //设置最大最小按钮是否显示
                                , content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html?openType=2&HOrgID=' + HOrgID, "yes"]
                                , content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html?openType=HKeeper&HOrgID=' + HOrgID, "yes"]
                                , btn: ["确定", "取消"]
                                , btn1: function (index, laero) {
                                    //按钮一  çš„回调
@@ -2004,6 +2068,20 @@
                                    layer.close(index);//关闭弹窗
                                }
                                , end: function () {
                                    //更新子表1数据
                                    var rowIndex = $(obj.tr).attr("data-index");
                                    for (var i = 0; i < option.data.length; i++) {
                                        if (i >= rowIndex) {
                                            option.data[i]["HCheckEmpID"] = RowDatass[0].HItemID;
                                            option.data[i]["HCheckEmpName"] = RowDatass[0].职员名称;
                                        }
                                    }
                                    table.render(option);
                                    CheckedSet_tableSub();
                                }
                            })
                        }
                    }
@@ -2027,7 +2105,7 @@
                                , shift: 2                                          //弹出动画
                                , area: ["90%", "90%"]                              //窗体大小
                                , maxmin: true                                      //设置最大最小按钮是否显示
                                , content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html?openType=2&HOrgID=' + HOrgID, "yes"]
                                , content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html?openType=HProjectMember&HOrgID=' + HOrgID, "yes"]
                                , btn: ["确定", "取消"]
                                , btn1: function (index, laero) {
                                    //按钮一  çš„回调
@@ -2043,6 +2121,12 @@
                                        , "HEmployeeName": checkStatus.data[0].职员名称
                                    })
                                    layer.close(index);//关闭弹窗
                                }
                                , end: function () {
                                    obj.update({
                                        "HEmployeeID": MemberData[0].HItemID
                                        , "HEmployeeName": MemberData[0].职员名称
                                    })
                                }
                            })
                        }
@@ -2346,12 +2430,69 @@
            //#endregion
            //#endregion
        });
        //客户
        function GetHCusNameValue(obj) {
            if (CusType == 1) {
                $("#HCusID").val(obj[0].HItemID);//客户id
                $("#HCusName").val(obj[0].客户名称);//客户名称
            }
            else if (CusType === 2) {
                $("#HPayCusID").val(obj[0].HItemID);//客户id
                $("#HPayCusName").val(obj[0].客户名称);//客户名称
            }
        }
        //项目经理
        function GetHPMValue(obj) {
            $("#HPMEmpID").val(obj[0].HItemID);//客户id
            $("#HPMEmpName").val(obj[0].职员名称);//客户名称
        }
        //实施担当
        function GetHWorkerValue(obj) {
            $("#HWorkEmpID").val(obj[0].HItemID);//员工id
            $("#HWorkEmpName").val(obj[0].职员名称);//员工名称
        }
        //开发担当
        function GetHEmpValue(obj) {
            $("#HDepEmpID").val(obj[0].HItemID);//员工id
            $("#HDepEmpName").val(obj[0].职员名称);//员工名称
        }
        //对应产品
        function GetMaterValue(obj) {
            $("#HMaterID").val(obj[0].HItemID);//产品内码
            $("#HMaterNumber").val(obj[0].物料代码);//产品代码
            $("#HMaterName").val(obj[0].物料名称);//产品名称
        }
        //项目阶段清单
        function GetProjectStageBillValue(obj) {
            $("#HProjectStageBillInterID").val(obj[0].HInterID);//客户id
            $("#HProjectStageBillNumber").val(obj[0].单据号);//客户名称
        }
        //项目阶段
        function GetProjectStageValue(obj) {
            ProjectStageData = obj;
        }
        //阶段负责人
        function GetHProjectValue(obj) {
            HEmpData = obj;
        }
        //阶段审核人
        function GetHProjectCheckValue(obj) {
            ProjectCheckData = obj;
        }
        //f6阶段负责人
        function GetHManagerValue(obj) {
            RowDatas = obj;
        }
        //阶段负责人
        function GetHKeeperValue(obj) {
            RowDatass = obj;
        }
        //阶段负责人
        function GetHProjectMemberValue(obj) {
            MemberData = obj;
        }
    </script>
</body>
</html>