wtt
2025-05-16 24efc0b0d99502afdebb6ef678b0cf4e91dcb084
WebTM/views/¹¤×ʹÜÀí/¿¼Çڻ㱨µ¥/Pay_WorkTimesBillEdit.html
@@ -238,7 +238,8 @@
            var HInterID = $('#HInterID').val()
            var HMaker = sessionStorage["HUserName"]
            var HStockOrgID = sessionStorage["OrganizationID"]  //组织ID
            var OperationType = 1       //操作类型(1新增、2编辑)
            var OperationType = 1       //操作类型(1新增、2编辑、3复制)
            var CloseType = 2           //关闭类型(1关闭弹窗、2关闭页签)
            var option = {};
            var titleData = [];         //不需要显示的字段
            //#endregion
@@ -305,8 +306,20 @@
            }
            else if (OperationType == 2) {  //编辑
                $("#HInterID").val(HInterID);//修改时主表ID
                CloseType = 1;
                //编辑状态时,根据内码,获取信息并写入界面
                RoadBillMain(HInterID);
            }
            else if (OperationType == 3) {  //复制
                //获取最大单据号
                get_MAXNum();
                //初始化日期、创建人、创建时间
                $("#HDate").val(Pub_Format(new Date(), "yyyy-MM-dd"));
                $("#HMaker").val(HMaker);
                $("#HMakeDate").val(Pub_Format(new Date(), "yyyy-MM-dd"));
                OperationType = 1;
                CloseType = 1;
                CopyBill(HInterID);
            }
            else {
                layer.alert("未知操作类型!", { icon: 5 });
@@ -381,6 +394,91 @@
                                        , "HPMTimes": result.data[i].HPMTimes
                                        , "HAMTimes": result.data[i].HAMTimes
                                        , 'HBaseTimes': result.data[i].HBaseTimes
                                        , 'HBaseTimes_Sec': result.data[i].HBaseTimes_Sec
                                        , 'HBaseDays': result.data[i].HBaseDays
                                        , 'HOverTimes': result.data[i].HOverTimes
                                        , 'HOverDays': result.data[i].HOverDays
                                        , 'HLeaveTimes': result.data[i].HLeaveTimes
                                        , 'HLeaveDays': result.data[i].HLeaveDays
                                        , 'HLateQty': result.data[i].HLateQty
                                        , 'HLateTimes': result.data[i].HLateTimes
                                        , 'HEarlyQty': result.data[i].HEarlyQty
                                        , 'HEarlyTimes': result.data[i].HEarlyTimes
                                        , 'HOutForEmpQty': result.data[i].HOutForEmpQty
                                        , 'HOutForEmpTimes': result.data[i].HOutForEmpTimes
                                        , 'HOutForComQty': result.data[i].HOutForComQty
                                        , 'HOutForComTimes': result.data[i].HOutForComTimes
                                        , 'HAbsentDays': result.data[i].HAbsentDays
                                        , 'HRestFlag': result.data[i].HRestFlag
                                        , 'HSchClassID': result.data[i].HSchClassID
                                        , 'HSchClassNumber': result.data[i].HSchClassNumber
                                        , 'HSchClassName': result.data[i].HSchClassName
                                        , 'HNeedTimes': result.data[i].HNeedTimes
                                        , 'HCTPrjID': result.data[i].HCTPrjID
                                        , 'HCTPrjNumber': result.data[i].HCTPrjNumber
                                        , 'HCTPrjName': result.data[i].HCTPrjName
                                        , 'HWorkTypeID': result.data[i].HWorkTypeID
                                        , 'HWorkTypeNumber': result.data[i].HWorkTypeNumber
                                        , 'HWorkTypeName': result.data[i].HWorkTypeName
                                        , 'HPayMoney': result.data[i].HPayMoney
                                        , 'HMoney': result.data[i].HMoney
                                        , 'HRemark': result.data[i].HRemark
                                    }
                                )
                            }
                            option.data = rowdata;
                            table.render(option);
                            //刷新设置复选框状态
                            CheckedSet_tableSub();
                            layer.close(ajaxLoad);
                        } else {
                            layer.close(ajaxLoad);
                            layer.alert(result.msg, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        }
                    },
                    complete: function (XHR, TS) { XHR = null },//回收资源
                    error: function () {
                        layer.close(ajaxLoad);
                        layer.alert("发生错误!", { icon: 5 });
                    }
                });
            }
            //#endregion
            //#region å¤åˆ¶æ¨¡å¼  é¡µé¢åˆå§‹åŒ–
            function CopyBill(HInterID) {
                var ajaxLoad = layer.load();
                $.ajax({
                    type: "GET",
                    url: GetWEBURL() + "/Pay_WorkTimesBillController/GetPay_WorkTimesBill_Json",
                    async: false,    //async用于控制(false)同步和(true)异步,默认的是true,即请求默认的是异步请求
                    data: { "HInterID": HInterID, "HMaker": HMaker },
                    success: function (result) {
                        if (result.count == 1) {
                            var data = result.data[0];
                            form.val("component-form-group", { //formTest å³ class="layui-form" æ‰€åœ¨å…ƒç´ å±žæ€§ lay-filter="" å¯¹åº”的值
                                "HDeptID": data.HDeptID
                                , "HDeptName": data.部门
                                , "HGroupID": data.HGroupID
                                , "HGroupName": data.班组
                                , "HRemark": data.表头备注
                                , "HStockOrgID": data.HStockOrgID
                            });
                            HStockOrgID = data.HStockOrgID == null ? 0 : data.HStockOrgID;
                            //子表  èµ‹å€¼
                            var rowdata = [];
                            for (let i = 0; i < result.data.length; i++) {
                                rowdata.push(
                                    {
                                        "HEmpID": result.data[i].HEmpID
                                        , "HEmpNumber": result.data[i].HEmpNumber
                                        , "HEmpName": result.data[i].HEmpName
                                        , "HEmpRate": result.data[i].HEmpRate
                                        , "HPMTimes": result.data[i].HPMTimes
                                        , "HAMTimes": result.data[i].HAMTimes
                                        , 'HBaseTimes': result.data[i].HBaseTimes
                                        , 'HBaseTimes_Sec': result.data[i].HBaseTimes_Sec
                                        , 'HBaseDays': result.data[i].HBaseDays
                                        , 'HOverTimes': result.data[i].HOverTimes
                                        , 'HOverDays': result.data[i].HOverDays
@@ -438,7 +536,7 @@
                    , toolbar: '#toolbarDemo'
                    , totalRow: true
                    , limit: 500
                    , height: 500
                    , height: 'full-250'
                    , loading: false
                    , cols: [[
                        { type: 'checkbox', totalRowText: '合计行' }
@@ -450,6 +548,7 @@
                        , { field: 'HAMTimes', title: '上午工时', width: 100, edit: 'text', totalRow: true }
                        , { field: 'HPMTimes', title: '下午工时', width: 100, edit: 'text', totalRow: true }
                        , { field: 'HBaseTimes', title: '基本工时', width: 100, edit: 'text', totalRow: true, event: "HBaseTimes" }
                        , { field: 'HBaseTimes_Sec', title: '计时工时', width: 100, edit: 'text', totalRow: true, event: "HBaseTimes_Sec" }
                        , { field: 'HBaseDays', title: '基本天数', width: 100, edit: 'text', totalRow: true }
                        , { field: 'HOverTimes', title: '加班工时', width: 100, edit: 'text', totalRow: true }
                        , { field: 'HOverDays', title: '加班天数', width: 100, edit: 'text', totalRow: true }
@@ -490,6 +589,7 @@
                    , "HPMTimes": "0"
                    , "HAMTimes": "0"
                    , "HBaseTimes": "0"
                    , "HBaseTimes_Sec": "0"
                    , "HBaseDays": "0"
                    , "HOverTimes": "0"
                    , "HOverDays": "0"
@@ -592,8 +692,10 @@
                        }
                        $("#HGroupName").val(checkStatus.data[0].班组名称);
                        $("#HGroupID").val(checkStatus.data[0].HItemID);
                        $("#HDeptID").val(checkStatus.data[0].HDeptID);//部门代码
                        $("#HDeptName").val(checkStatus.data[0].部门名称);//部门名称
                        if (checkStatus.data[0].HDeptID != 0) {
                            $("#HDeptID").val(checkStatus.data[0].HDeptID);
                            $("#HDeptName").val(checkStatus.data[0].部门名称);
                        }
                        layer.close(index); //关闭弹窗  å®ƒèŽ·å–çš„å§‹ç»ˆæ˜¯æœ€æ–°å¼¹å‡ºçš„æŸä¸ªå±‚ï¼Œå€¼æ˜¯ç”±layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) { }
@@ -614,6 +716,10 @@
            }
            function GetEmployee() {
                if ($("#HGroupName").val() == '') {
                    return;
                }
                $.ajax({
                    type: "GET",
                    url: GetWEBURL() + "/Gy_EmployeeController/GetEmpInfoByGroup_Json",
@@ -633,6 +739,7 @@
                                        , "HPMTimes": "0"
                                        , "HAMTimes": "0"
                                        , "HBaseTimes": "0"
                                        , "HBaseTimes_Sec": "0"
                                        , "HBaseDays": "0"
                                        , "HOverTimes": "0"
                                        , "HOverDays": "0"
@@ -697,6 +804,7 @@
                    , "HPMTimes": "0"
                    , "HAMTimes": "0"
                    , "HBaseTimes": "0"
                    , "HBaseTimes_Sec": "0"
                    , "HBaseDays": "0"
                    , "HOverTimes": "0"
                    , "HOverDays": "0"
@@ -1271,6 +1379,37 @@
                            CheckedSet_tableSub();
                        }
                        //计时工时
                        if (obj.event == "HBaseTimes_Sec") {
                            var oldText = table.cache["mainTable"][rowIndex].HBaseTimes_Sec;
                            var value = e.target.value; //得到修改后的值
                            //数据格式校验
                            temp = value + "";
                            if (!ref.test(temp) || temp == 0) {
                                //恢复数据到编辑前
                                option.data[rowIndex].HBaseTimes_Sec = oldText;
                                table.render(option);
                                //刷新设置复选框状态
                                CheckedSet_tableSub();
                                layer.msg("所输入值必须为大于0的数字!");
                                return;
                            }
                            for (var i = rowIndex * 1; i < option.data.length; i++) {
                                //数据校验合格,重算记录
                                var HBaseTimes_Sec = isNaN(value) ? 0 : value * 1;  //计时工时
                                //同步更新表格和缓存对应的值
                                option.data[i].HBaseTimes_Sec = HBaseTimes_Sec;
                            }
                            table.render(option);
                            //刷新设置复选框状态
                            CheckedSet_tableSub();
                        }
                        obj.event = "";
                        return false;
                    }
@@ -1491,13 +1630,7 @@
            //#region é€€å‡º
            form.on('submit(btn_Cancel)', function () {
                layer.confirm('您确定要退出吗?', { icon: 3, title: '提示' }, function (index) {
                    //操作类型(OperationType=1新增、OperationType=2编辑)
                    if (OperationType == 2) {
                        Pub_Close(1);
                    }
                    else {
                        Pub_Close(2);
                    }
                    Pub_Close(CloseType);
                });
            })
            //#endregion
@@ -1532,8 +1665,10 @@
        {
            $("#HGroupName").val(obj[0].班组名称);
            $("#HGroupID").val(obj[0].HItemID);
            $("#HDeptID").val(obj[0].HDeptID);//部门代码
            $("#HDeptName").val(obj[0].部门名称);//部门名称
            if (obj[0].HDeptID != 0) {
                $("#HDeptID").val(obj[0].HDeptID);
                $("#HDeptName").val(obj[0].部门名称);
            }
        }
        //双击返回基础资料数据    åˆ—表
        function GetHEmpListValue(data)  //返回职员