diff --git a/src/views/projectFront/laborManage/attendanceGroup.vue b/src/views/projectFront/laborManage/attendanceGroup.vue index a51b7453..755ecceb 100644 --- a/src/views/projectFront/laborManage/attendanceGroup.vue +++ b/src/views/projectFront/laborManage/attendanceGroup.vue @@ -965,6 +965,7 @@ export default { teamOptions: [], departmentOptions: [], addPersonnelDialog: false, + selectListAll: [], title: "", }; }, diff --git a/src/views/projectFront/laborManage/attendanceManage/attendanceManage.vue b/src/views/projectFront/laborManage/attendanceManage/attendanceManage.vue index fafc9923..7761804c 100644 --- a/src/views/projectFront/laborManage/attendanceManage/attendanceManage.vue +++ b/src/views/projectFront/laborManage/attendanceManage/attendanceManage.vue @@ -444,11 +444,17 @@ + diff --git a/src/views/projectFront/laborManage/newAttendanceRules.vue b/src/views/projectFront/laborManage/newAttendanceRules.vue index ec503e9b..7a621dd1 100644 --- a/src/views/projectFront/laborManage/newAttendanceRules.vue +++ b/src/views/projectFront/laborManage/newAttendanceRules.vue @@ -278,34 +278,39 @@
根据不同工时段换算工日

例:可设置0~~6工时(包含6工时)算0.5工日:6~~24工时算1工日

-
-
{{ index }}
+
+
{{ index }}
{{ index }}
-
+
规则

工时至

工时等于

工日

+
@@ -380,13 +385,13 @@
设置特定时间范围:

-

@@ -403,38 +408,43 @@ >工时段换算工日
-
根据不同工时段换算工日
-

例:可设置0~~6工时(包含6工时)算0.5工日:6~~24工时算1工日

-
-
-
{{ index }}
-
-
{{ index }}
+
根据不同工时段换算工日
+

例:可设置0~~6工时(包含6工时)算0.5工日:6~~24工时算1工日

+
+
+
{{ index }}
+
+
{{ index }}
-
-
+
+
规则

工时至

工时等于

工日

-
+ +
@@ -513,6 +523,8 @@ import { getProjectConfigListApi, editProjectConfigListApi, } from "@/assets/js/api/project.js"; +import { isJSON } from '@/util/nowDate'; +import dayjs from "dayjs"; export default { data() { return { @@ -540,7 +552,7 @@ export default { yesAdvance: "", }, rules: { - ruleName: [ + planName: [ { required: true, message: this.$t("message.workType.placeholder"), @@ -569,6 +581,8 @@ export default { }, workerAttendanceGroupList: [], batchSettingType: "", + hour2dayList: [0, 24], + overtimeHour2dayList: [0, 24], }; }, mounted() { @@ -577,6 +591,71 @@ export default { this.getProjectDetailFn(); }, methods: { + onHour2dayChange(currentValue, oldValue) { + const findIndex = this.hour2dayList.findIndex(item => item == oldValue); + if(findIndex != -1) { + this.hour2dayList.splice(findIndex, 1, currentValue); + this.generateHour2dayJson(); + } + }, + onOvertimeHour2dayChange(currentValue, oldValue) { + const findIndex = this.overtimeHour2dayList.findIndex(item => item == oldValue); + if(findIndex != -1) { + this.overtimeHour2dayList.splice(findIndex, 1, currentValue); + this.generateOvertimeHour2dayJson(); + } + }, + onClickPitch(item, type) { + if(type == 1) { + this.hour2dayList.push(item); + this.generateHour2dayJson(); + } else if(type == 2) { + this.overtimeHour2dayList.push(item); + this.generateOvertimeHour2dayJson(); + } + + }, + onDeletePitch(eIndex, type) { + if(type == 1) { + const findIndex = this.hour2dayList.findIndex(item => item == this.workerInfo.hour2dayJson[eIndex].hourMin); + if(findIndex != -1) { + this.hour2dayList.splice(findIndex, 1); + this.generateHour2dayJson(); + } + } else if (type == 2) { + const findIndex = this.overtimeHour2dayList.findIndex(item => item == this.workerInfo.overtimeHour2dayJson[eIndex].hourMin); + if(findIndex != -1) { + this.overtimeHour2dayList.splice(findIndex, 1); + this.generateOvertimeHour2dayJson(); + } + } + }, + generateHour2dayJson() { + const resultSortList = this.hour2dayList.sort((a,b) => a - b); + const oldSelectionList = this.workerInfo.hour2dayJson; + this.workerInfo.hour2dayJson = []; + resultSortList.forEach((ele, index) => { + if(index == 0) return; + this.workerInfo.hour2dayJson.push({ + hourMin: resultSortList[index-1], + hourMax: ele, + day: oldSelectionList[index-1] ? oldSelectionList[index-1].day : 0, + }) + }) + }, + generateOvertimeHour2dayJson() { + const resultSortList = this.overtimeHour2dayList.sort((a,b) => a - b); + const oldSelectionList = this.workerInfo.overtimeHour2dayJson; + this.workerInfo.overtimeHour2dayJson = []; + resultSortList.forEach((ele, index) => { + if(index == 0) return; + this.workerInfo.overtimeHour2dayJson.push({ + hourMin: resultSortList[index-1], + hourMax: ele, + day: oldSelectionList[index-1] ? oldSelectionList[index-1].day : 0, + }) + }) + }, getWorkerAttendanceGroupV2List() { getWorkerAttendanceGroupV2ListApi({ projectSn: this.$store.state.projectSn, @@ -687,8 +766,18 @@ export default { hour2dayStart: "", hour2dayEnd: "", hour2dayDay: "", + hour2dayJson: [{ + hourMin: 0, + hourMax: 24, + day: 0, + }], ratio2dayHour: "", ratio2dayDay: "", + overtimeHour2dayJson: [{ + hourMin: 0, + hourMax: 24, + day: 0, + }], ratio2dayLess1: "", isOpenOvertime: false, overtimeHourType: "", @@ -701,6 +790,8 @@ export default { overtimeRatio2dayHour: "", overtimeRatio2dayDay: "", } + this.hour2dayList = [0, 24]; + this.overtimeHour2dayList= [0, 24]; }, addBefore(type) { this.batchSettingType = type; @@ -735,10 +826,47 @@ export default { // console.log('编辑前的内容', worker) this.workerInfo = JSON.parse(JSON.stringify({ ...worker, + overtimeHourStart: worker.overtimeHourStart ? dayjs(worker.overtimeHourStart).format('HH:mm') : "", + overtimeHourEnd: worker.overtimeHourStart ? dayjs(worker.overtimeHourEnd).format('HH:mm') : "", isOpenOvertime: worker.isOpenOvertime == 1 ? true : false, ratio2dayLess1: worker.ratio2dayLess1 == 1 ? true : false, overtimeRatio2dayLess1: worker.overtimeRatio2dayLess1 == 1 ? true : false, + hour2dayJson: isJSON(worker.hour2dayJson) && worker.hour2dayJson ? JSON.parse(worker.hour2dayJson) : [{ + hourMin: 0, + hourMax: 24, + day: 0, + }], + overtimeHour2dayJson: isJSON(worker.overtimeHour2dayJson) && worker.overtimeHour2dayJson ? JSON.parse(worker.overtimeHour2dayJson) : [{ + hourMin: 0, + hourMax: 24, + day: 0, + }], })); + if(this.workerInfo.hour2dayJson.length > 2) { + this.workerInfo.hour2dayJson.forEach(item => { + if(!this.hour2dayList.includes(item.hourMin)) { + this.hour2dayList.push(item.hourMin) + } + if(!this.hour2dayList.includes(item.hourMax)) { + this.hour2dayList.push(item.hourMax) + } + }) + } else { + this.hour2dayList = [0, 24]; + } + if(this.workerInfo.overtimeHour2dayJson.length > 2) { + this.workerInfo.overtimeHour2dayJson.forEach(item => { + if(!this.overtimeHour2dayList.includes(item.hourMin)) { + this.overtimeHour2dayList.push(item.hourMin) + } + if(!this.overtimeHour2dayList.includes(item.hourMax)) { + this.overtimeHour2dayList.push(item.hourMax) + } + }) + }else { + this.overtimeHour2dayList= [0, 24]; + } + this.getWorkerAttendanceGroupV2List(); }, deleteBefore(worker) {}, @@ -775,9 +903,14 @@ export default { Submit() { this.$refs.form.validate((valid) => { if (valid) { + const defaultTime = dayjs().format('YYYY-MM-DD'); const params = { ...this.workerInfo, projectSn : this.$store.state.projectSn, + overtimeHourStart: this.workerInfo.overtimeHourStart ? dayjs(defaultTime + this.workerInfo.overtimeHourStart + ':00').format('YYYY-MM-DD HH:mm:ss') : "", + overtimeHourEnd: this.workerInfo.overtimeHourEnd ? dayjs(defaultTime + this.workerInfo.overtimeHourEnd + ':00').format('YYYY-MM-DD HH:mm:ss') : "", + hour2dayJson: JSON.stringify(this.workerInfo.hour2dayJson), + overtimeHour2dayJson: JSON.stringify(this.workerInfo.overtimeHour2dayJson), isOpenOvertime: this.workerInfo.isOpenOvertime ? 1 : 0, ratio2dayLess1: this.workerInfo.ratio2dayLess1 ? 1 : 0, overtimeRatio2dayLess1: this.workerInfo.overtimeRatio2dayLess1 ? 1 : 0, @@ -806,6 +939,13 @@ export default { }); }, }, + computed: { + activePitchUp() { + return (dataList, index) => { + return dataList.includes(index); + } + } + } };