diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue index e9234e33..ec6722ca 100644 --- a/src/views/system/dept/index.vue +++ b/src/views/system/dept/index.vue @@ -283,12 +283,20 @@ function handleDelete(deptId?: number) { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning", - }).then(() => { - DeptAPI.deleteByIds(deptIds).then(() => { - ElMessage.success("删除成功"); - handleResetQuery(); - }); - }); + }).then( + () => { + loading.value = true; + DeptAPI.deleteByIds(deptIds) + .then(() => { + ElMessage.success("删除成功"); + handleResetQuery(); + }) + .finally(() => (loading.value = false)); + }, + () => { + ElMessage.info("已取消删除"); + } + ); } /** 关闭弹窗 */ diff --git a/src/views/system/dict/index.vue b/src/views/system/dict/index.vue index 9e69f0b7..273560ce 100644 --- a/src/views/system/dict/index.vue +++ b/src/views/system/dict/index.vue @@ -30,7 +30,7 @@ 删除 @@ -75,7 +75,7 @@ type="danger" link size="small" - @click.stop="handleDeleteClick(scope.row.id)" + @click.stop="handleDelete(scope.row.id)" >删除 @@ -333,7 +333,7 @@ function handleCloseDialog() { * * @param id 字典ID */ -function handleDeleteClick(id?: number) { +function handleDelete(id?: number) { const attrGroupIds = [id || ids.value].join(","); if (!attrGroupIds) { ElMessage.warning("请勾选删除项"); @@ -343,12 +343,17 @@ function handleDeleteClick(id?: number) { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning", - }).then(() => { - DictAPI.deleteByIds(attrGroupIds).then(() => { - ElMessage.success("删除成功"); - handleResetClick(); - }); - }); + }).then( + () => { + DictAPI.deleteByIds(attrGroupIds).then(() => { + ElMessage.success("删除成功"); + handleResetClick(); + }); + }, + () => { + ElMessage.info("已取消删除"); + } + ); } // 新增字典 diff --git a/src/views/system/menu/index.vue b/src/views/system/menu/index.vue index e67ad2ad..d4dbace2 100644 --- a/src/views/system/menu/index.vue +++ b/src/views/system/menu/index.vue @@ -592,14 +592,22 @@ function handleDelete(menuId: number) { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning", - }) - .then(() => { - MenuAPI.deleteById(menuId).then(() => { - ElMessage.success("删除成功"); - handleQuery(); - }); - }) - .catch(() => ElMessage.info("已取消删除")); + }).then( + () => { + loading.value = true; + MenuAPI.deleteById(menuId) + .then(() => { + ElMessage.success("删除成功"); + handleQuery(); + }) + .finally(() => { + loading.value = false; + }); + }, + () => { + ElMessage.info("已取消删除"); + } + ); } // 关闭弹窗 diff --git a/src/views/system/role/index.vue b/src/views/system/role/index.vue index 968a1173..b64ffa95 100644 --- a/src/views/system/role/index.vue +++ b/src/views/system/role/index.vue @@ -363,15 +363,20 @@ function handleDelete(roleId?: number) { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning", - }).then(() => { - loading.value = true; - RoleAPI.deleteByIds(roleIds) - .then(() => { - ElMessage.success("删除成功"); - handleResetQuery(); - }) - .finally(() => (loading.value = false)); - }); + }).then( + () => { + loading.value = true; + RoleAPI.deleteByIds(roleIds) + .then(() => { + ElMessage.success("删除成功"); + handleResetQuery(); + }) + .finally(() => (loading.value = false)); + }, + () => { + ElMessage.info("已取消删除"); + } + ); } /** 打开分配菜单权限弹窗 */ diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index 6124a205..544c620e 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -375,7 +375,7 @@ function handleResetQuery() { handleQuery(); } -/** 行选中 */ +/** 行复选框选中记录选中ID集合 */ function handleSelectionChange(selection: any) { removeIds.value = selection.map((item: any) => item.id); } @@ -472,12 +472,20 @@ function handleDelete(id?: number) { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning", - }).then(function () { - UserAPI.deleteByIds(userIds).then(() => { - ElMessage.success("删除成功"); - handleResetQuery(); - }); - }); + }).then( + function () { + loading.value = true; + UserAPI.deleteByIds(userIds) + .then(() => { + ElMessage.success("删除成功"); + handleResetQuery(); + }) + .finally(() => (loading.value = false)); + }, + function () { + ElMessage.info("已取消删除"); + } + ); } /** 打开导入弹窗 */ function handleOpenImportDialog() {