1
0
mirror of https://github.com/FatttSnake/Pinnacle-OA.git synced 2026-04-05 23:11:24 +08:00

Add batch deletion judgment prompt

This commit is contained in:
gzw
2023-06-10 01:15:08 +08:00
parent d0462a592c
commit e5450792c3
2 changed files with 61 additions and 23 deletions

View File

@@ -60,13 +60,14 @@
style="margin-top: 10px" style="margin-top: 10px"
> >
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column prop="user.username" label="用户名" align="center" /> <el-table-column type="index" label="序号" width="80" align="center" :index="indexFormat" />
<el-table-column prop="attTime" label="考勤时间" width="250" align="center"> <el-table-column prop="user.username" label="名称" align="center" />
<el-table-column prop="attTime" label="考勤时间" width="300" align="center">
<template #default="scope"> <template #default="scope">
{{ formatDate(scope.row.attTime) }} {{ formatDate(scope.row.attTime) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="status" label="考勤状态" width="150" align="center"> <el-table-column prop="status" label="考勤状态" width="180" align="center">
<template v-slot="scope"> <template v-slot="scope">
<el-tag <el-tag
:type=" :type="
@@ -233,7 +234,12 @@ export default {
.then((response) => { .then((response) => {
this.users = response.data.data this.users = response.data.data
}) })
.catch((reportError) => {}) .catch((reportError) => {
ElMessage({
message: '失败',
type: 'error'
})
})
}, },
// 获取所有考勤信息 // 获取所有考勤信息
getAttendances() { getAttendances() {
@@ -248,6 +254,10 @@ export default {
}) })
.catch((reportError) => { .catch((reportError) => {
this.dataLoading = false this.dataLoading = false
ElMessage({
message: '失败',
type: 'error'
})
}) })
}, },
getAttendancesByTime() { getAttendancesByTime() {
@@ -293,7 +303,9 @@ export default {
newFormat = yy + '-' + mm + '-' + dd + ' ' + hh + ':' + mf + ':' + ss newFormat = yy + '-' + mm + '-' + dd + ' ' + hh + ':' + mf + ':' + ss
return newFormat return newFormat
}, },
indexFormat(index) {
return index + 1
},
// 重置参数 // 重置参数
resetParam() { resetParam() {
this.attTime = [] this.attTime = []
@@ -323,7 +335,12 @@ export default {
.then((response) => { .then((response) => {
this.getAttendances() this.getAttendances()
}) })
.catch((reportError) => {}) .catch((reportError) => {
ElMessage({
message: '失败',
type: 'error'
})
})
}, },
// 获取更改数据 // 获取更改数据
viewUpdate(row) { viewUpdate(row) {
@@ -340,7 +357,6 @@ export default {
}, },
// 点击取消 // 点击取消
cancel() { cancel() {
this.resetForm()
ElMessage({ ElMessage({
message: '取消操作', message: '取消操作',
type: 'warning' type: 'warning'
@@ -372,7 +388,12 @@ export default {
}) })
} }
}) })
.catch((reportError) => {}) .catch((reportError) => {
ElMessage({
message: '删除失败',
type: 'error'
})
})
}, },
// 批量删除 // 批量删除
handleSelectionChange(val) { handleSelectionChange(val) {
@@ -381,6 +402,8 @@ export default {
// 批量删除 // 批量删除
delBatch() { delBatch() {
const map = this.multipleSelection.map((v) => v.id) const map = this.multipleSelection.map((v) => v.id)
// eslint-disable-next-line eqeqeq
if (map != '') {
request request
.post('/attendance/delBatchAttendance', map) .post('/attendance/delBatchAttendance', map)
.then((response) => { .then((response) => {
@@ -397,7 +420,18 @@ export default {
}) })
} }
}) })
.catch((reportError) => {}) .catch((reportError) => {
ElMessage({
message: '批量删除失败',
type: 'error'
})
})
} else {
ElMessage({
message: '批量删除失败,请至少选择一条数据',
type: 'error'
})
}
} }
}, },
created() { created() {

View File

@@ -41,13 +41,14 @@
:header-cell-style="{ background: 'aliceblue' }" :header-cell-style="{ background: 'aliceblue' }"
style="margin-top: 10px" style="margin-top: 10px"
> >
<el-table-column prop="user.username" label="用户名" align="center"></el-table-column> <el-table-column type="index" label="序号" width="80" align="center" :index="indexFormat" />
<el-table-column prop="attTime" label="考勤时间" width="250" align="center"> <el-table-column prop="user.username" label="名称" align="center"></el-table-column>
<el-table-column prop="attTime" label="考勤时间" width="300" align="center">
<template #default="scope"> <template #default="scope">
{{ formatDate(scope.row.attTime) }} {{ formatDate(scope.row.attTime) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="status" label="考勤状态" width="150" align="center"> <el-table-column prop="status" label="考勤状态" width="200" align="center">
<template v-slot="scope"> <template v-slot="scope">
<el-tag <el-tag
:type=" :type="
@@ -155,6 +156,9 @@ export default {
}) })
}, },
indexFormat(index) {
return index + 1
},
getOneAttendancesByTime() { getOneAttendancesByTime() {
this.dataLoading = true this.dataLoading = true
if (this.attTimeB.length !== 0) { if (this.attTimeB.length !== 0) {