feat(@vben/web-antd): 工单中心页面返回时自动刷新列表数据

- 新增 onActivated 钩子,页面从详情返回时自动刷新工单列表和统计栏
- 使用 isFirstActivate 标记避免首次挂载时与 onMounted 重复请求
- 移除 PAUSED 状态的 Tab 计数

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
lzh
2026-03-15 16:51:12 +08:00
parent 0d32c21e93
commit 5fa437d9d0

View File

@@ -2,7 +2,7 @@
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { OpsOrderCenterApi } from '#/api/ops/order-center';
import { nextTick, onMounted, ref } from 'vue';
import { nextTick, onActivated, onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';
import { Page, useVbenModal } from '@vben/common-ui';
@@ -55,7 +55,6 @@ const tabCounts = ref<Record<string, number>>({
ALL: 0,
PENDING: 0,
IN_PROGRESS: 0,
PAUSED: 0,
COMPLETED: 0,
CANCELLED: 0,
});
@@ -282,8 +281,18 @@ const [Grid, gridApi] = useVbenVxeGrid({
} as VxeTableGridOptions<OpsOrderCenterApi.OrderItem>,
});
let isFirstActivate = true;
onMounted(() => {
// 默认使用卡片视图
handleRefresh();
});
onActivated(() => {
// 首次 activated 与 onMounted 同时触发,跳过以避免重复请求
if (isFirstActivate) {
isFirstActivate = false;
return;
}
handleRefresh();
});
</script>