yusijie
2024-04-25 3de6a9eb5d6c00a756831fbab13da264c198ece7
WebTM/views/ÏîÄ¿¹ÜÀí/ÏîÄ¿½×¶Î/PM_ProjectReportBill.html
@@ -92,9 +92,7 @@
                                            <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="HProNumber" name="HProNumber" id="HProNumber" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
                                                <input type="hidden" name="HProID" id="HProID" lay-verify="HProID" 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">
                                                <input type="hidden" name="HProjectID" id="HProjectID" lay-verify="HProjectID" 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>
@@ -201,6 +199,11 @@
                                                <select name="HOrgID" id="HOrgID" lay-verify="HOrgID">
                                                    <!--动态渲染组织-->
                                                </select>
                                                <input type="hidden" name="HMainSourceInterID" id="HMainSourceInterID" lay-verify="HMainSourceInterID" value="0">
                                                <input type="hidden" name="HMainSourceEntryID" id="HMainSourceEntryID" lay-verify="HMainSourceEntryID" value="0">
                                                <input type="hidden" name="HMainSourceBillType" id="HMainSourceBillType" lay-verify="HMainSourceBillType" value="">
                                                <input type="hidden" name="HMainSourceBillNo" id="HMainSourceBillNo" lay-verify="HMainSourceBillNo" value="">
                                            </div>
                                        </div>
                                    </div>
@@ -384,7 +387,7 @@
        </div>
    </script>
    <script>
        var optiondata = [];
        layui.config({
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
@@ -475,6 +478,9 @@
                OperationType = 4;
                //生成并设置主表的内码和单据号
                createBillNo();
                //汇报人初始化
                getHEmpByHUserName();
                //初始化制单人和制单时间
                $("#HMaker").val(sessionStorage["HUserName"]);
@@ -799,6 +805,7 @@
                        }
                        //设置表头数据
                        //设置文本框值
                        $("#HProjectID").val(checkStatus.data[0].HInterID);
                        $("#HProNumber").val(checkStatus.data[0].项目代码);
                        $("#HProjectStageID").val(checkStatus.data[0].HProjectStageID);
                        $("#HProjectStageName").val(checkStatus.data[0].项目阶段);
@@ -807,6 +814,13 @@
                        $("#HRelationGoods").val(checkStatus.data[0].阶段相关交付物);
                        $("#HIsKey").val((checkStatus.data[0].里程碑=='Y'?true:false));
                        $("#HRate").val(checkStatus.data[0].阶段业绩占比);
                        $("#HMainSourceInterID").val(checkStatus.data[0].HInterID);
                        $("#HMainSourceEntryID").val(checkStatus.data[0].HEntryID);
                        $("#HMainSourceBillNo").val(checkStatus.data[0].单据号);
                        $("#HMainSourceBillType").val(checkStatus.data[0].单据类型);
                        //设置复选框选中状态
                        if ($("#HIsKey").val() == "true") {
@@ -818,46 +832,56 @@
                        }
                        //设置表体数据
                        var HBillInterID = checkStatus.data[0].HInterID;
                        $.ajax({
                            url: GetWEBURL() + "/PM_ProjectBill/editInit",
                            type: "GET",
                            async: false,
                            data: { "HInterID": HBillInterID, "user": sessionStorage["HUserName"] },
                            success: function (result) {
                                //获取数据库中该项目的项目成员数据
                                var tableSub_Emp = result.data[2];
                                //根据表体列,填充表体数据
                                var num = [];
                                for (var i = 0; i < tableSub_Emp.length; i++) {
                                    var rowdata =
                                    {
                                        "RowID": (i + 1) * 10
                                        , 'HEmpID': tableSub_Emp[i]["HEmployeeID"]
                                        , 'HEmpName': tableSub_Emp[i]["HEmployeeName"]
                                        , 'HIsPM': tableSub_Emp[i]["HIsPM"]
                                        , 'HRate': tableSub_Emp[i]["HRate"]
                                        , 'HAvgMoney': '0'
                                        , 'HCountMoney': '0'
                                        , 'HRemarkSub': ''
                                    };
                                    num.push(rowdata);
                                }
                                option.data = num;
                                table.render(option);
                                //设置复选框选中状态
                                for (var i = 0; i < tableSub_Emp.length; i++) {
                                    if (tableSub_Emp[i].HIsPM) {
                                        $('#HIsPM' + (i + 1)).attr("checked", true);
                                    }
                                }
                                form.render('checkbox');
                            }
                        })
                        get_NumberNum(HBillInterID);
                        layer.close(index);//关闭弹窗
                    }
                    , btn2: function (index, layero) { }
                    , end: function () {
                        get_NumberNum($("#HProjectID").val());
                    }
                })
            }
            //#endregion
            //#region   é€‰æ‹©é¡¹ç›®ä»£ç ,带出子表数据
            function get_NumberNum(HBillInterID) {
                $.ajax({
                    url: GetWEBURL() + "/PM_ProjectBill/editInit",
                    type: "GET",
                    async: false,
                    data: { "HInterID": HBillInterID, "user": sessionStorage["HUserName"] },
                    success: function (result) {
                        //获取数据库中该项目的项目成员数据
                        var tableSub_Emp = result.data[2];
                        //根据表体列,填充表体数据
                        var num = [];
                        for (var i = 0; i < tableSub_Emp.length; i++) {
                            var rowdata =
                            {
                                "RowID": (i + 1) * 10
                                , 'HEmpID': tableSub_Emp[i]["HEmployeeID"]
                                , 'HEmpName': tableSub_Emp[i]["HEmployeeName"]
                                , 'HIsPM': tableSub_Emp[i]["HIsPM"]
                                , 'HRate': tableSub_Emp[i]["HRate"]
                                , 'HAvgMoney': '0'
                                , 'HCountMoney': '0'
                                , 'HRemarkSub': ''
                            };
                            num.push(rowdata);
                        }
                        option.data = num;
                        table.render(option);
                        //设置复选框选中状态
                        for (var i = 0; i < tableSub_Emp.length; i++) {
                            if (tableSub_Emp[i].HIsPM) {
                                $('#HIsPM' + (i + 1)).attr("checked", true);
                            }
                        }
                        form.render('checkbox');
                    }
                })
            }
            //#endregion
            //#region é¡¹ç›®é˜¶æ®µé€‰æ‹©é¡µé¢
@@ -889,6 +913,9 @@
                        layer.close(index);//关闭弹窗
                    }
                    , btn2: function (index, layero) { }
                    , end: function () {
                    }
                })
            }
            //#endregion
@@ -902,7 +929,7 @@
                    , area: ['90%', '90%']//大小
                    , title: '员工表'//标题
                    , shift: 2//弹出动画
                    , content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html?openType=2&HOrgID=' + HOrgID, 'yes']
                    , content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html?openType=HReport&HOrgID=' + HOrgID, 'yes']
                    , btn: ['确定', '取消']
                    , btn1: function (index, layero) {//按钮【按钮一】的回调
                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
@@ -919,6 +946,7 @@
                        layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) { }
                    , end: function () { }
                })
            }
            //#endregion
@@ -1009,7 +1037,7 @@
                    , area: ['90%', '90%']//大小
                    , title: '员工表'//标题
                    , shift: 2//弹出动画
                    , content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html?openType=2&HOrgID=' + HOrgID, 'yes']
                    , content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html?openType=HReceive&HOrgID=' + HOrgID, 'yes']
                    , btn: ['确定', '取消']
                    , btn1: function (index, layero) {//按钮【按钮一】的回调
                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
@@ -1025,6 +1053,9 @@
                        layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) { }
                    , end: function () {
                    }
                })
            }
            //#endregion
@@ -1230,6 +1261,12 @@
                            , "HRate": tableMain[0]["HRate"]
                            , "HOrgID": tableMain[0]["HOrgID"]
                            , "HRemark": tableMain[0]["HRemark"]
                            , "HMainSourceInterID": tableMain[0]["HMainSourceInterID"]
                            , "HMainSourceEntryID": tableMain[0]["HMainSourceEntryID"]
                            , "HMainSourceBillNo": tableMain[0]["HMainSourceBillNo"]
                            , "HMainSourceBillType": tableMain[0]["HMainSourceBillType"]
                            , "HMaker": tableMain[0]["HMaker"]
                            , "HUpdater": tableMain[0]["HUpdater"]
                            , "HChecker": tableMain[0]["HChecker"]
@@ -1281,10 +1318,8 @@
                        //主表 èµ‹å€¼
                        form.val("formData", { //formTest å³ class="layui-form" æ‰€åœ¨å…ƒç´ å±žæ€§ lay-filter="" å¯¹åº”的值
                            "HProID": tableMain[0]["HInterID"]
                            "HProjectID": tableMain[0]["HInterID"]
                            , "HProNumber": tableMain[0]["项目代码"]
                            , "HMainSourceBillNo": tableMain[0]["单据号"]
                            , "HMainSourceBillType": tableMain[0]["单据类型"]
                            , "HProjectStageID": tableMain[0]["HProjectStageID"]
                            , "HProjectStageName": tableMain[0]["项目阶段"]
                            , "HStageNote": tableMain[0]["项目阶段详细内容"]
@@ -1292,6 +1327,11 @@
                            , "HIsKey": tableMain[0]["里程碑"]=="Y"?true:false
                            , "HRate": tableMain[0]["阶段业绩占比"]
                            , "HOrgID": tableMain[0]["HOrgID"]
                            , "HMainSourceInterID": tableMain[0]["HInterID"]
                            , "HMainSourceEntryID": tableMain[0]["HEntryID"]
                            , "HMainSourceBillNo": tableMain[0]["单据号"]
                            , "HMainSourceBillType": tableMain[0]["单据类型"]
                        });
                        //若该阶段为里程碑,则设置里程碑复选框为选中
                        if (tableMain[0]["里程碑"]=="Y") {
@@ -1508,7 +1548,7 @@
                                , shift: 2                                          //弹出动画
                                , area: ["90%", "90%"]                              //窗体大小
                                , maxmin: true                                      //设置最大最小按钮是否显示
                                , content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html?openType=2&HOrgID=' + HOrgID, 'yes']
                                , content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html?openType=HEmp&HOrgID=' + HOrgID, 'yes']
                                , btn: ["确定", "取消"]
                                , btn1: function (index, laero) {
                                    //按钮一  çš„回调
@@ -1524,6 +1564,12 @@
                                        , "HEmpName": checkStatus.data[0].职员名称
                                    })
                                    layer.close(index);//关闭弹窗
                                }
                                , end: function () {
                                    obj.update({
                                        "HEmpID": optiondata[0].HItemID
                                        , "HEmpName": optiondata[0].职员名称
                                    })
                                }
                            })
                        }
@@ -1744,6 +1790,48 @@
        }
            //#endregion
        //项目代码
        function GetProjectBillValue(obj) {
            $("#HProjectID").val(obj[0].HInterID);
            $("#HProNumber").val(obj[0].项目代码);
            $("#HProjectStageID").val(obj[0].HProjectStageID);
            $("#HProjectStageName").val(obj[0].项目阶段);
            $("#HStageNote").val(obj[0].项目阶段详细内容);
            $("#HPMGoodsID").val(obj[0].HPMGoodsID);
            $("#HRelationGoods").val(obj[0].阶段相关交付物);
            $("#HIsKey").val((obj[0].里程碑 == 'Y' ? true : false));
            $("#HRate").val(obj[0].阶段业绩占比);
            $("#HMainSourceInterID").val(obj[0].HInterID);
            $("#HMainSourceEntryID").val(obj[0].HEntryID);
            $("#HMainSourceBillNo").val(obj[0].单据号);
            $("#HMainSourceBillType").val(obj[0].单据类型);
        }
        //项目阶段
        function GetProjectStageValue(obj) {
            $("#HProjectStageID").val(obj[0].HItemID);//项目阶段id
            $("#HProjectStageName").val(obj[0].阶段名称);//项目阶段名称
            $("#HStageNote").val(obj[0].项目阶段详细内容);//项目阶段详细内容
        }
        //汇报人
        function GetHReportValue (obj) {
            $("#HReportEmpID").val(obj[0].HItemID);//客户id
            $("#HReportEmpName").val(obj[0].职员名称);//客户名称
        }
        //接收人
        function GetHReceiveValue(obj) {
            $("#HReceiveEmp").val(obj[0].职员名称);//接收人名称
        }
        //员工
        function GetHEmpValue(obj) {
            optiondata = obj
        }
    </script>
</body>
</html>