feat(wms/attendance): 新增考勤连续旷工天数计算功能,为保证速度把步骤拆分成两步
1. 前端新增“计算连续旷工”按钮,调用后端重算接口并优化加载状态管理 2. 后端新增recalcContinuousAbsent方法及接口,支持按指定员工或时间范围重算连续旷工天数 3. 优化考勤检查页面按钮布局,明确“生成考勤结果”操作
This commit is contained in:
@@ -51,3 +51,12 @@ export function generateAttendanceCheck(data) {
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 重算连续旷工天数
|
||||
export function recalcContinuousAbsent(data) {
|
||||
return request({
|
||||
url: '/wms/attendanceCheck/recalcContinuousAbsent',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -425,7 +425,8 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="checkLoading" type="primary" @click="submitCheck">确 定</el-button>
|
||||
<el-button :loading="recalcLoading" type="warning" @click="submitRecalc">计算连续旷工</el-button>
|
||||
<el-button :loading="checkLoading" type="primary" @click="submitCheck">确 定(生成考勤结果)</el-button>
|
||||
<el-button @click="cancelCheck">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
@@ -433,7 +434,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listAttendanceCheck, getAttendanceCheck, delAttendanceCheck, generateAttendanceCheck, updateAttendanceCheck } from "@/api/wms/attendanceCheck";
|
||||
import { listAttendanceCheck, getAttendanceCheck, delAttendanceCheck, generateAttendanceCheck, updateAttendanceCheck, recalcContinuousAbsent } from "@/api/wms/attendanceCheck";
|
||||
import TimeRangePicker from "@/views/wms/report/components/timeRangePicker";
|
||||
import { listOutRequest } from "@/api/wms/outRequest";
|
||||
import { listLeaveRequest } from "@/api/wms/leaveRequest";
|
||||
@@ -450,6 +451,7 @@ export default {
|
||||
return {
|
||||
loading: true,
|
||||
checkLoading: false,
|
||||
recalcLoading: false,
|
||||
showSearch: true,
|
||||
attendanceData: [],
|
||||
dateList: [],
|
||||
@@ -759,13 +761,13 @@ export default {
|
||||
|
||||
Object.values(dataMap).forEach(employeeData => {
|
||||
const dates = Object.keys(employeeData).filter(key => key !== 'employeeName' && key !== 'employeeId').sort()
|
||||
|
||||
|
||||
dates.forEach((date, index) => {
|
||||
const currentRecord = employeeData[date]
|
||||
if (currentRecord && currentRecord.shiftName === '生产倒班夜班') {
|
||||
const nextDate = dayjs(date).add(1, 'day').format('YYYY-MM-DD')
|
||||
const nextRecord = employeeData[nextDate]
|
||||
|
||||
|
||||
if (nextRecord && nextRecord.shiftName === '夜转白') {
|
||||
currentRecord.p1EndTime = ''
|
||||
currentRecord.p1LastCheck = ''
|
||||
@@ -875,6 +877,8 @@ export default {
|
||||
|
||||
cancelCheck() {
|
||||
this.checkOpen = false
|
||||
this.checkLoading = false
|
||||
this.recalcLoading = false
|
||||
this.checkForm = { startDate: undefined, endDate: undefined }
|
||||
this.selectedUserIds = []
|
||||
this.checkDept = ''
|
||||
@@ -907,6 +911,24 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
submitRecalc() {
|
||||
this.$refs["checkForm"].validate(valid => {
|
||||
if (valid) {
|
||||
this.recalcLoading = true
|
||||
const params = {
|
||||
...this.checkForm,
|
||||
userIds: this.selectedUserIds
|
||||
}
|
||||
recalcContinuousAbsent(params).then(response => {
|
||||
this.$modal.msgSuccess("重算成功")
|
||||
this.getList()
|
||||
}).finally(() => {
|
||||
this.recalcLoading = false
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
handleUpdate() {
|
||||
if (this.currentDetail) {
|
||||
const checkId = this.currentDetail.checkId
|
||||
@@ -1207,4 +1229,4 @@ export default {
|
||||
margin-right: 10px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user