diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue index 41327248..68d4dbcd 100644 --- a/src/views/system/dept/index.vue +++ b/src/views/system/dept/index.vue @@ -46,7 +46,7 @@ import { nextTick, ref } from 'vue' import { getListSimpleUsersApi } from '@/api/system/user' import { onMounted } from 'vue' -const { createMessage } = useMessage() +const { createConfirm, createMessage } = useMessage() const [registerModal, { openModal }] = useModal() const [register, { expandAll, collapseAll, getForm, reload }] = useTable({ @@ -113,12 +113,16 @@ function handleEdit(record: Recordable) { } async function handleDelete(record: Recordable) { - console.log(record) - const res = await deleteDeptApi(record.id) - if (res) { - createMessage.success('删除成功') - reload() - } + createConfirm({ + title: '删除', + iconType: 'warning', + content: '是否要删除数据?', + async onOk() { + await deleteDeptApi(record.id) + createMessage.success('删除成功') + reload() + } + }) } function onFetchSuccess() { diff --git a/src/views/system/errorCode/index.vue b/src/views/system/errorCode/index.vue index 1b34bade..ac4bcd17 100644 --- a/src/views/system/errorCode/index.vue +++ b/src/views/system/errorCode/index.vue @@ -87,11 +87,15 @@ async function handleExport() { } async function handleDelete(record: Recordable) { - console.log(record) - const res = await deleteErrorCodeApi(record.id) - if (res) { - createMessage.success('删除成功') - reload() - } + createConfirm({ + title: '删除', + iconType: 'warning', + content: '是否要删除数据?', + async onOk() { + await deleteErrorCodeApi(record.id) + createMessage.success('删除成功') + reload() + } + }) } diff --git a/src/views/system/menu/index.vue b/src/views/system/menu/index.vue index d5eb512b..b31e2826 100644 --- a/src/views/system/menu/index.vue +++ b/src/views/system/menu/index.vue @@ -33,15 +33,14 @@ diff --git a/src/views/system/notice/index.vue b/src/views/system/notice/index.vue index 5167e24d..8ee936b7 100644 --- a/src/views/system/notice/index.vue +++ b/src/views/system/notice/index.vue @@ -37,7 +37,7 @@ import NoticeModal from './NoticeModel.vue' import { columns, searchFormSchema } from './notice.data' import { useMessage } from '@/hooks/web/useMessage' -const { createMessage } = useMessage() +const { createConfirm, createMessage } = useMessage() const [registerModal, { openModal }] = useModal() const [registerTable, { reload }] = useTable({ title: '公告列表', @@ -72,11 +72,15 @@ function handleEdit(record: Recordable) { } async function handleDelete(record: Recordable) { - console.log(record) - const res = await deleteNoticeApi(record.id) - if (res) { - createMessage.success('删除成功') - reload() - } + createConfirm({ + title: '删除', + iconType: 'warning', + content: '是否要删除数据?', + async onOk() { + await deleteNoticeApi(record.id) + createMessage.success('删除成功') + reload() + } + }) } diff --git a/src/views/system/post/index.vue b/src/views/system/post/index.vue index 1b1156c7..6481b440 100644 --- a/src/views/system/post/index.vue +++ b/src/views/system/post/index.vue @@ -87,11 +87,15 @@ async function handleExport() { } async function handleDelete(record: Recordable) { - console.log(record) - const res = await deletePostApi(record.id) - if (res) { - createMessage.success('删除成功') - reload() - } + createConfirm({ + title: '删除', + iconType: 'warning', + content: '是否要删除数据?', + async onOk() { + await deletePostApi(record.id) + createMessage.success('删除成功') + reload() + } + }) } diff --git a/src/views/system/sensitiveWord/index.vue b/src/views/system/sensitiveWord/index.vue index 75cb28a9..f64359e8 100644 --- a/src/views/system/sensitiveWord/index.vue +++ b/src/views/system/sensitiveWord/index.vue @@ -92,11 +92,15 @@ async function handleExport() { } async function handleDelete(record: Recordable) { - console.log(record) - const res = await deleteSensitiveWordApi(record.id) - if (res) { - createMessage.success('删除成功') - reload() - } + createConfirm({ + title: '删除', + iconType: 'warning', + content: '是否要删除数据?', + async onOk() { + await deleteSensitiveWordApi(record.id) + createMessage.success('删除成功') + reload() + } + }) } diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index eea04d1e..6beeca8a 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -39,8 +39,10 @@ import { useModal } from '@/components/Modal' import UserModel from './UserModel.vue' import DeptTree from './DeptTree.vue' import { columns, searchFormSchema } from './user.data' -import { getUserPageApi } from '@/api/system/user' +import { deleteUserApi, getUserPageApi } from '@/api/system/user' +import { useMessage } from '@/hooks/web/useMessage' +const { createConfirm, createMessage } = useMessage() const [registerModal, { openModal }] = useModal() const searchInfo = reactive({}) @@ -71,15 +73,23 @@ function handleCreate() { } function handleEdit(record: Recordable) { - console.log(record) openModal(true, { record, isUpdate: true }) } -function handleDelete(record: Recordable) { - console.log(record) +async function handleDelete(record: Recordable) { + createConfirm({ + title: '删除', + iconType: 'warning', + content: '是否要删除数据?', + async onOk() { + await deleteUserApi(record.id) + createMessage.success('删除成功') + reload() + } + }) } function handleSuccess({ isUpdate, values }) {