From 094864b73b1386ca74e4805d85b5dc4842f25b81 Mon Sep 17 00:00:00 2001 From: Mickey wu Date: Sun, 24 May 2026 17:14:51 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=9B=BF=E6=8D=A2=20messageBox=20?= =?UTF-8?q?=E4=B8=BA=20confirm=20=E5=B9=B6=E8=A1=A5=E5=85=85=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E6=B3=A8=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/work/config/index.vue | 8 ++++---- src/pages/work/dept/index.vue | 8 ++++---- src/pages/work/dict/index.vue | 6 +++--- src/pages/work/dict/item/index.vue | 8 ++++---- src/pages/work/menu/index.vue | 14 +++++++------- src/pages/work/notice/index.vue | 8 ++++---- src/pages/work/role/assign-perm.vue | 9 +++++---- src/pages/work/role/index.vue | 6 +++--- src/pages/work/user/index.vue | 8 ++++---- 9 files changed, 38 insertions(+), 37 deletions(-) diff --git a/src/pages/work/config/index.vue b/src/pages/work/config/index.vue index aeba2a7..162877b 100644 --- a/src/pages/work/config/index.vue +++ b/src/pages/work/config/index.vue @@ -111,7 +111,7 @@ import ConfigAPI, { type ConfigPageQuery, ConfigItem, ConfigForm } from "@/api/c import { hasPermission } from "@/utils/permission"; const toast = useToast(); -const { messageBox } = useDialog(); + const { confirm } = useDialog(); const loadMoreState = ref("loading"); const formRef = ref(); const isSubmitting = ref(false); @@ -154,7 +154,7 @@ function loadConfigList() { function fetchConfigList() { loadMoreState.value = "loading"; ConfigAPI.getPage(queryParams) - .then((data) => { + .then((data: any) => { pageData.value = data.list; total.value = data.total; queryParams.pageNum++; @@ -211,10 +211,10 @@ function handleActionSelect({ item }: { item: any }) { if (value === "编辑") { openConfigDialog(configItem.id); } else if (value === "删除") { - messageBox({ + confirm({ title: "确认删除", msg: `确定要删除配置「${configItem.configName}」吗?`, - type: "warning", + headerImage: "warning", }).then(async () => { await ConfigAPI.deleteById(configItem.id!); toast.success("删除成功"); diff --git a/src/pages/work/dept/index.vue b/src/pages/work/dept/index.vue index c67229a..4cf7a41 100644 --- a/src/pages/work/dept/index.vue +++ b/src/pages/work/dept/index.vue @@ -100,7 +100,7 @@ import { hasPermission } from "@/utils/permission"; import CustomTree from "@/components/custom-tree/index.vue"; const toast = useToast(); -const { messageBox } = useDialog(); + const { confirm } = useDialog(); const formRef = ref(); const isSubmitting = ref(false); @@ -215,10 +215,10 @@ function handleActionSelect({ item }: { item: any }) { } else if (value === "编辑") { openDeptDialog(dept); } else if (value === "删除") { - messageBox({ + confirm({ title: "确认删除", msg: `确定要删除部门「${dept.name}」吗?`, - type: "warning", + headerImage: "warning", }).then(async () => { await DeptAPI.deleteByIds(String(dept.id)); toast.success("删除成功"); @@ -284,7 +284,7 @@ async function openDeptDialog(dept?: DeptItem) { const columns: OptionType[][] = [firstColumn]; let currentLevel = data; for (let i = 0; i < path.length - 1; i++) { - const found = currentLevel.find((item) => String(item.value) === path[i]); + const found = currentLevel.find((item: any) => String(item.value) === path[i]); if (found && found.children) { columns.push(found.children); currentLevel = found.children; diff --git a/src/pages/work/dict/index.vue b/src/pages/work/dict/index.vue index 002d6fd..1490cd2 100644 --- a/src/pages/work/dict/index.vue +++ b/src/pages/work/dict/index.vue @@ -107,7 +107,7 @@ import { hasPermission } from "@/utils/permission"; const router = useRouter(); const toast = useToast(); -const { messageBox } = useDialog(); + const { confirm } = useDialog(); const loadMoreState = ref("loading"); const formRef = ref(); const isSubmitting = ref(false); @@ -218,10 +218,10 @@ function showDictActions(item: DictTypeItem) { actions.push({ name: "删除", color: "var(--color-danger)" }); actionMap["删除"] = async () => { try { - await messageBox({ + await confirm({ title: "确认删除", msg: `确定要删除字典「${item.name}」吗?`, - type: "warning", + headerImage: "warning", }); if (item.id) { await DictAPI.deleteByIds(String(item.id)); diff --git a/src/pages/work/dict/item/index.vue b/src/pages/work/dict/item/index.vue index 2a511aa..ae6b21f 100644 --- a/src/pages/work/dict/item/index.vue +++ b/src/pages/work/dict/item/index.vue @@ -115,7 +115,7 @@ import DictAPI, { type DictItemForm, type DictItemPageQuery, type DictDataItem } import { hasPermission } from "@/utils/permission"; const toast = useToast(); -const { messageBox } = useDialog(); + const { confirm } = useDialog(); const dictCode = ref(""); const pageTitle = ref("字典数据"); @@ -238,10 +238,10 @@ function showItemActions(item: DictDataItem) { actions.push({ name: "删除", color: "var(--color-danger)" }); actionMap["删除"] = async () => { try { - await messageBox({ + await confirm({ title: "确认删除", msg: `确定要删除字典数据「${item.label}」吗?`, - type: "warning", + headerImage: "warning", }); if (item.id) { await DictAPI.deleteItems(dictCode.value, String(item.id)); @@ -276,7 +276,7 @@ onReachBottom(() => { } }); -onLoad((query) => { + onLoad((query: any) => { dictCode.value = String((query as any)?.dictCode || ""); pageTitle.value = String((query as any)?.title || "字典数据"); if (pageTitle.value) { diff --git a/src/pages/work/menu/index.vue b/src/pages/work/menu/index.vue index bdb6ddc..082e6e2 100644 --- a/src/pages/work/menu/index.vue +++ b/src/pages/work/menu/index.vue @@ -126,7 +126,7 @@ import { hasPermission } from "@/utils/permission"; import CustomTree from "@/components/custom-tree/index.vue"; const toast = useToast(); -const { messageBox } = useDialog(); + const { confirm } = useDialog(); const formRef = ref(); const isSubmitting = ref(false); @@ -154,7 +154,7 @@ const initialFormData: MenuForm = { const formData = reactive({ ...initialFormData }); // 转换为树组件数据格式 -const treeData = computed(() => menuList.value.map((menu) => transformMenuToTree(menu))); + const treeData = computed(() => menuList.value.map((menu: MenuItem) => transformMenuToTree(menu))); function transformMenuToTree(menu: MenuItem): any { return { @@ -166,7 +166,7 @@ function transformMenuToTree(menu: MenuItem): any { icon: menu.icon, visible: menu.visible, perm: menu.perm, - children: menu.children?.map((child) => transformMenuToTree(child)) || [], + children: menu.children?.map((child: MenuItem) => transformMenuToTree(child)) || [], }; } @@ -252,7 +252,7 @@ const rules = toFormSchema({ const handleSearch = () => loadMenuList(); function loadMenuList() { - MenuAPI.getList(queryParams).then((data) => { + MenuAPI.getList(queryParams).then((data: any) => { menuList.value = data; }); } @@ -266,10 +266,10 @@ function handleActionSelect({ item }: { item: any }) { } else if (value === "编辑") { openMenuDialog(menu); } else if (value === "删除") { - messageBox({ + confirm({ title: "确认删除", msg: `确定要删除菜单「${menu.name}」吗?`, - type: "warning", + headerImage: "warning", }).then(async () => { await MenuAPI.deleteById(menu.id!); toast.success("删除成功"); @@ -336,7 +336,7 @@ async function openMenuDialog(menu?: MenuItem) { const columns: OptionType[][] = [firstColumn]; let currentLevel = data; for (let i = 0; i < path.length - 1; i++) { - const found = currentLevel.find((item) => String(item.value) === String(path[i])); + const found = currentLevel.find((item: any) => String(item.value) === String(path[i])); if (found && found.children && found.children.length > 0) { columns.push(found.children); currentLevel = found.children; diff --git a/src/pages/work/notice/index.vue b/src/pages/work/notice/index.vue index f6d0fec..ea09cf3 100644 --- a/src/pages/work/notice/index.vue +++ b/src/pages/work/notice/index.vue @@ -176,7 +176,7 @@ import NoticeAPI, { import { hasPermission } from "@/utils/permission"; const toast = useToast(); -const { messageBox } = useDialog(); + const { confirm } = useDialog(); const loadMoreState = ref("loading"); const formRef = ref(); const isSubmitting = ref(false); @@ -335,7 +335,7 @@ function showNoticeActions(item: NoticeItem) { actions.push({ name: "删除", color: "var(--color-danger)" }); actionMap["删除"] = async () => { try { - await messageBox({ + await confirm({ title: "确认删除", msg: `确定要删除通知「${item.title}」吗?`, type: "warning", @@ -352,7 +352,7 @@ function showNoticeActions(item: NoticeItem) { actions.push({ name: "发布" }); actionMap["发布"] = async () => { try { - await messageBox({ + await confirm({ title: "确认发布", msg: `确定要发布通知「${item.title}」吗?`, type: "warning", @@ -370,7 +370,7 @@ function showNoticeActions(item: NoticeItem) { actions.push({ name: "撤回", color: "var(--color-warning)" }); actionMap["撤回"] = async () => { try { - await messageBox({ + await confirm({ title: "确认撤回", msg: `确定要撤回通知「${item.title}」吗?`, type: "warning", diff --git a/src/pages/work/role/assign-perm.vue b/src/pages/work/role/assign-perm.vue index b2e15b8..e69afc0 100644 --- a/src/pages/work/role/assign-perm.vue +++ b/src/pages/work/role/assign-perm.vue @@ -76,10 +76,6 @@