|
|
@@ -103,7 +103,7 @@ |
|
|
|
format="HH:mm" |
|
|
|
value-format="HH:mm" |
|
|
|
placeholder="选择午休开始时间" |
|
|
|
@change="calculateLunchHours" |
|
|
|
@change="calculatelunchTime" |
|
|
|
></el-time-picker> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
@@ -113,13 +113,13 @@ |
|
|
|
format="HH:mm" |
|
|
|
value-format="HH:mm" |
|
|
|
placeholder="选择午休结束时间" |
|
|
|
@change="calculateLunchHours" |
|
|
|
@change="calculatelunchTime" |
|
|
|
></el-time-picker> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="午休时间" prop="lunchHours"> |
|
|
|
<el-form-item label="午休时间" prop="lunchTime"> |
|
|
|
<el-input |
|
|
|
v-model="lunchHoursDisplay" |
|
|
|
v-model="lunchTimeDisplay" |
|
|
|
placeholder="午休时间(小时)" |
|
|
|
readonly |
|
|
|
style="width: 200px" |
|
|
@@ -332,7 +332,7 @@ export default { |
|
|
|
workEndTime: '18:00', |
|
|
|
lunchStartTime: '12:00', |
|
|
|
lunchEndTime: '13:00', |
|
|
|
lunchHours: 1, |
|
|
|
lunchTime: 1, |
|
|
|
allowLate: false, |
|
|
|
lateRange: 15, |
|
|
|
allowEarly: false, |
|
|
@@ -351,7 +351,7 @@ export default { |
|
|
|
workEndTime: '18:00', |
|
|
|
lunchStartTime: '12:00', |
|
|
|
lunchEndTime: '13:00', |
|
|
|
lunchHours: 1, |
|
|
|
lunchTime: 1, |
|
|
|
allowLate: false, |
|
|
|
lateRange: 15, |
|
|
|
allowEarly: false, |
|
|
@@ -450,7 +450,7 @@ export default { |
|
|
|
); |
|
|
|
}, |
|
|
|
// 午休时间显示 |
|
|
|
lunchHoursDisplay() { |
|
|
|
lunchTimeDisplay() { |
|
|
|
// 实时计算午休时间 |
|
|
|
if (!this.attendanceGroup.lunchStartTime || !this.attendanceGroup.lunchEndTime) { |
|
|
|
return '0'; |
|
|
@@ -487,7 +487,7 @@ export default { |
|
|
|
console.log('午休开始时间变化:', newVal); |
|
|
|
if (newVal && this.attendanceGroup.lunchEndTime) { |
|
|
|
this.$nextTick(() => { |
|
|
|
this.calculateLunchHours(); |
|
|
|
this.calculatelunchTime(); |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
@@ -498,7 +498,7 @@ export default { |
|
|
|
console.log('午休结束时间变化:', newVal); |
|
|
|
if (newVal && this.attendanceGroup.lunchStartTime) { |
|
|
|
this.$nextTick(() => { |
|
|
|
this.calculateLunchHours(); |
|
|
|
this.calculatelunchTime(); |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
@@ -514,9 +514,9 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
// 计算午休时间 |
|
|
|
calculateLunchHours() { |
|
|
|
calculatelunchTime() { |
|
|
|
if (!this.attendanceGroup.lunchStartTime || !this.attendanceGroup.lunchEndTime) { |
|
|
|
this.attendanceGroup.lunchHours = 0; |
|
|
|
this.attendanceGroup.lunchTime = 0; |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
@@ -524,7 +524,7 @@ export default { |
|
|
|
const endTime = this.parseTimeToMinutes(this.attendanceGroup.lunchEndTime); |
|
|
|
|
|
|
|
if (endTime <= startTime) { |
|
|
|
this.attendanceGroup.lunchHours = 0; |
|
|
|
this.attendanceGroup.lunchTime = 0; |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
@@ -533,10 +533,10 @@ export default { |
|
|
|
|
|
|
|
// 以0.5为基准进行向下取整计算 |
|
|
|
// 例如:0.7按0.5算,1.7按1.5算 |
|
|
|
this.attendanceGroup.lunchHours = Math.floor(hours * 2) / 2; |
|
|
|
this.attendanceGroup.lunchTime = Math.floor(hours * 2) / 2; |
|
|
|
|
|
|
|
// 调试输出 |
|
|
|
console.log(`午休时间计算: ${this.attendanceGroup.lunchStartTime} - ${this.attendanceGroup.lunchEndTime} = ${hours}小时,计算结果: ${this.attendanceGroup.lunchHours}小时`); |
|
|
|
console.log(`午休时间计算: ${this.attendanceGroup.lunchStartTime} - ${this.attendanceGroup.lunchEndTime} = ${hours}小时,计算结果: ${this.attendanceGroup.lunchTime}小时`); |
|
|
|
}, |
|
|
|
|
|
|
|
test(){ |
|
|
@@ -550,7 +550,7 @@ export default { |
|
|
|
// this.reset() |
|
|
|
this.attendanceGroup = { ...this.attendanceGroupModel } |
|
|
|
// 确保午休时间正确初始化 |
|
|
|
this.calculateLunchHours(); |
|
|
|
this.calculatelunchTime(); |
|
|
|
this.open = true |
|
|
|
}, |
|
|
|
|
|
|
@@ -575,12 +575,12 @@ export default { |
|
|
|
if (!this.attendanceGroup.lunchEndTime) { |
|
|
|
this.attendanceGroup.lunchEndTime = '13:00'; |
|
|
|
} |
|
|
|
if (this.attendanceGroup.lunchHours === undefined) { |
|
|
|
this.attendanceGroup.lunchHours = 1; |
|
|
|
if (this.attendanceGroup.lunchTime === undefined) { |
|
|
|
this.attendanceGroup.lunchTime = 1; |
|
|
|
} |
|
|
|
|
|
|
|
// 重新计算午休时间 |
|
|
|
this.calculateLunchHours(); |
|
|
|
this.calculatelunchTime(); |
|
|
|
|
|
|
|
this.selectGroup(area.id) |
|
|
|
|
|
|
@@ -634,7 +634,7 @@ export default { |
|
|
|
this.$refs.groupForm.validate(valid => { |
|
|
|
if (valid) { |
|
|
|
// 计算午休时间 |
|
|
|
this.calculateLunchHours(); |
|
|
|
this.calculatelunchTime(); |
|
|
|
|
|
|
|
// 实际项目中调用API创建 |
|
|
|
const newGroup = { |
|
|
@@ -646,7 +646,7 @@ export default { |
|
|
|
workEndTime: this.attendanceGroup.workEndTime, |
|
|
|
lunchStartTime: this.attendanceGroup.lunchStartTime, |
|
|
|
lunchEndTime: this.attendanceGroup.lunchEndTime, |
|
|
|
lunchHours: this.attendanceGroup.lunchHours, |
|
|
|
lunchTime: this.attendanceGroup.lunchTime, |
|
|
|
allowLate: this.attendanceGroup.allowLate, |
|
|
|
lateRange: this.attendanceGroup.lateRange, |
|
|
|
allowEarly: this.attendanceGroup.allowEarly, |
|
|
@@ -815,7 +815,7 @@ export default { |
|
|
|
workEndTime: '18:00', |
|
|
|
lunchStartTime: '12:00', |
|
|
|
lunchEndTime: '13:00', |
|
|
|
lunchHours: 1, |
|
|
|
lunchTime: 1, |
|
|
|
allowLate: true, |
|
|
|
lateRange: 15, |
|
|
|
allowEarly: true, |