diff --git a/klp-ui/src/api/wms/attendanceSchedule.js b/klp-ui/src/api/wms/attendanceSchedule.js index 29093434..f09d31d6 100644 --- a/klp-ui/src/api/wms/attendanceSchedule.js +++ b/klp-ui/src/api/wms/attendanceSchedule.js @@ -38,8 +38,9 @@ export function updateAttendanceSchedule(data) { // 删除排班记录(支持批量删除,传递csv格式字符串如:1,2,3) export function delAttendanceSchedule(ids) { return request({ - url: '/wms/attendanceSchedule/' + ids, - method: 'delete' + url: '/wms/attendanceSchedule/remove', + method: 'delete', + data: ids, }) } diff --git a/klp-ui/src/views/wms/hrm/attendance/drag.vue b/klp-ui/src/views/wms/hrm/attendance/drag.vue index c9f74b38..e5a563bc 100644 --- a/klp-ui/src/views/wms/hrm/attendance/drag.vue +++ b/klp-ui/src/views/wms/hrm/attendance/drag.vue @@ -26,6 +26,7 @@ 管理模板 批量修改 批量编辑 + 批量删除整行 @@ -53,7 +54,9 @@
- + + + @@ -405,6 +408,7 @@ export default { batchCellSelection: {}, batchCellDialogVisible: false, batchCellEditShiftId: '', + selectedRows: [], rules: { dateRange: [ { required: true, message: '请选择时间段', trigger: 'change' } @@ -908,7 +912,52 @@ export default { }) }, - // 删除整行排班 + handleSelectionChange(rows) { + this.selectedRows = rows + }, + + handleBatchDelete() { + const selectedRows = this.selectedRows + if (selectedRows.length === 0) { + this.$message.warning('请至少选择一名员工') + return + } + + const scheduleIds = [] + let totalRecords = 0 + selectedRows.forEach(row => { + this.dateList.forEach(date => { + if (row[date] && row[date].scheduleId) { + scheduleIds.push(row[date].scheduleId) + totalRecords++ + } + }) + }) + + if (scheduleIds.length === 0) { + this.$message.info('所选行没有排班记录') + return + } + + this.$confirm(`确定要删除 ${selectedRows.length} 名员工的共 ${totalRecords} 条排班记录吗?`, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + delAttendanceSchedule(scheduleIds.join(',')).then(() => { + this.$message.success('批量删除成功') + this.selectedRows = [] + this.getScheduleList() + }).catch(() => { + this.$message.error('批量删除失败,正在重新获取数据') + this.selectedRows = [] + this.getScheduleList() + }) + }).catch(() => { + this.$message.info('已取消删除') + }) + }, + handleDeleteRow(row) { const scheduleIds = [] this.dateList.forEach(date => {