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

add the function of deleteBatchNoticeType

This commit is contained in:
cccccyb
2023-05-30 01:56:18 +08:00
parent c5a131ea9f
commit 81ab047f20
10 changed files with 85 additions and 6 deletions

View File

@@ -99,13 +99,13 @@ export default {
'dataLoading',
'hackReset',
'showTypeData',
'addTypeData'
'addTypeData',
'multiDeleteSelection'
])
},
data() {
return {
filterSenderName: [],
multipleSelection: [],
search: ''
}
},
@@ -113,7 +113,9 @@ export default {
methods: {
handleSelectionChange(val) {
// val的值为所勾选行的数组对象
this.multipleSelection = val
noticeTypeStore.$patch((state) => {
state.multiDeleteSelection = val
})
},
indexFormat(index) {
return (this.currentPage - 1) * this.pageSize + index + 1

View File

@@ -160,6 +160,11 @@ export default {
})
})
.catch(() => {})
} else {
ElMessage({
message: '请至少选择一项进行删除',
type: 'warning'
})
}
}
},

View File

@@ -6,7 +6,7 @@
<icon-pinnacle-add /> </el-icon
>添加类型</el-button
>
<el-button type="primary" :size="'large'"
<el-button type="primary" :size="'large'" @click="deleteBatchByTypeIds"
><el-icon :size="SIZE_ICON_MD()" style="color: white; margin-right: 3px">
<icon-pinnacle-delete /> </el-icon
>批量删除</el-button
@@ -63,7 +63,8 @@ export default {
'hackReset',
'addTypeData',
'currentPage',
'pageSize'
'pageSize',
'multiDeleteSelection'
])
},
data() {
@@ -127,6 +128,41 @@ export default {
})
})
.catch(() => {})
},
deleteBatchByTypeIds() {
const multiDeleteTypeIds = []
if (this.multiDeleteSelection.length > 0) {
for (let i = 0; i < this.multiDeleteSelection.length; i++) {
multiDeleteTypeIds.push(this.multiDeleteSelection[i].id)
}
ElMessageBox.confirm('确定是否要批量删除?该操作将无法回退', '警告', {
confirmButtonText: '确定',
cancelButtonText: '我再想想',
type: 'warning'
})
.then(() => {
request.post('/notice_type/batch', multiDeleteTypeIds).then((response) => {
if (response.data.code === 20024) {
ElMessage({
message: '删除成功.',
type: 'success'
})
noticeTypeStore.selectNoticeType(this.currentPage, this.pageSize)
} else if (response.data.code === 20034) {
ElMessage({
message: response.data.msg,
type: 'error'
})
}
})
})
.catch(() => {})
} else {
ElMessage({
message: '请至少选择一项进行删除',
type: 'warning'
})
}
}
},
mounted() {}

View File

@@ -6,7 +6,8 @@ const noticeRouter = {
icon: shallowRef(IconPinnacleNotice),
requiresMenu: true,
requiresScrollbar: false,
requiresPadding: true
requiresPadding: true,
requiresAuth: true
},
children: [
{

View File

@@ -236,6 +236,7 @@ export const useNoticeTypeStore = defineStore('notice_type', {
hackReset: true,
editFlag: false,
enableNoticeTypeList: [],
multiDeleteSelection: [],
noticeTypeList: [
{
id: '',