refactor(antdv-next): 将message组件调用统一改为window.message

将项目中直接导入的antdv-next的message组件调用改为通过window.message调用,提升代码一致性
移除不再需要的message组件导入
新增api-switch组件用于统一处理状态切换逻辑
This commit is contained in:
dap
2026-01-15 09:35:54 +08:00
parent 2312f438ac
commit ee1b37c787
23 changed files with 211 additions and 90 deletions

View File

@@ -11,7 +11,6 @@ import { ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { cloneDeep } from '@vben/utils';
import { message } from 'antdv-next';
import { omit } from 'lodash-es';
import { useVbenForm } from '#/adapter/form';
@@ -173,7 +172,7 @@ async function handleSubmit() {
// 判断是否选中
for (const item of nextNodeInfo.value) {
if (item.selectUserList.length === 0) {
message.warn(`未选择节点[${item.nodeName}]审批人`);
window.message.warning(`未选择节点[${item.nodeName}]审批人`);
return;
}
}

View File

@@ -16,7 +16,7 @@ import { cn } from '@vben/utils';
import { CopyOutlined } from '@ant-design/icons-vue';
import { useClipboard } from '@vueuse/core';
import { Card, Divider, message, TabPane, Tabs } from 'antdv-next';
import { Card, Divider, TabPane, Tabs } from 'antdv-next';
import { flowInfo } from '#/api/workflow/instance';
import { getTaskByTaskId } from '#/api/workflow/task';
@@ -130,7 +130,7 @@ watch(() => props.task, handleLoadInfo);
const { copy } = useClipboard({ legacy: true });
async function handleCopy(text: string) {
await copy(text);
message.success('复制成功');
window.message.success('复制成功');
}
</script>
@@ -153,7 +153,7 @@ async function handleCopy(text: string) {
<template #extra>
<a-button size="small" @click="() => handleLoadInfo(task)">
<div class="flex items-center justify-center">
<span class="icon-[material-symbols--refresh] size-24px"></span>
<span class="size-24px icon-[material-symbols--refresh]"></span>
</div>
</a-button>
</template>
@@ -174,7 +174,7 @@ async function handleCopy(text: string) {
<div class="flex items-center gap-2">
<VbenAvatar
:alt="task?.createByName ?? ''"
class="bg-primary size-[28px] rounded-full text-white"
class="size-[28px] rounded-full bg-primary text-white"
src=""
/>

View File

@@ -14,14 +14,7 @@ import { Page, useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { getVxePopupContainer } from '@vben/utils';
import {
message,
Modal,
Popconfirm,
RadioGroup,
Space,
Switch,
} from 'antdv-next';
import { Modal, Popconfirm, RadioGroup, Space, Switch } from 'antdv-next';
import { useVbenVxeGrid, vxeCheckboxChecked } from '#/adapter/vxe-table';
import {
@@ -219,7 +212,10 @@ function handleEdit(row: any) {
* @param row row
*/
async function handleExportXml(row: any) {
const hideLoading = message.loading($t('pages.common.downloadLoading'), 0);
const hideLoading = window.message.loading(
$t('pages.common.downloadLoading'),
0,
);
try {
const blob = await workflowDefinitionExport(row.id);
downloadByData(blob, `${row.flowName}-${Date.now()}.json`);
@@ -239,12 +235,12 @@ const [ProcessDefinitionDeployModal, deployModalApi] = useVbenModal({
*/
function handleDeploy() {
if (selectedCode.value.length === 0) {
message.warning('请先选择流程分类');
window.message.warning('请先选择流程分类');
return;
}
const selectedCategory = selectedCode.value[0];
if (selectedCategory === 0) {
message.warning('不可选择根目录进行部署, 请选择子分类');
window.message.warning('不可选择根目录进行部署, 请选择子分类');
return;
}
deployModalApi.setData({ category: selectedCategory });

View File

@@ -4,7 +4,7 @@ import { ref } from 'vue';
import { JsonPreview, useVbenModal } from '@vben/common-ui';
import { cn, getPopupContainer } from '@vben/utils';
import { message, Modal, Tag } from 'antdv-next';
import { Modal, Tag } from 'antdv-next';
import { useVbenForm } from '#/adapter/form';
import { instanceVariable, updateFlowVariable } from '#/api/workflow/instance';
@@ -168,7 +168,7 @@ async function handleSubmit(values: any) {
} catch (error) {
console.error(error);
if (error instanceof Error) {
message.error(error.message);
window.message.error(error.message);
}
throw error;
}