From 5fa437d9d088b55a72c9d4256e0f18225f2d0812 Mon Sep 17 00:00:00 2001 From: lzh Date: Sun, 15 Mar 2026 16:51:12 +0800 Subject: [PATCH] =?UTF-8?q?feat(@vben/web-antd):=20=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E9=A1=B5=E9=9D=A2=E8=BF=94=E5=9B=9E=E6=97=B6?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=88=B7=E6=96=B0=E5=88=97=E8=A1=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 onActivated 钩子,页面从详情返回时自动刷新工单列表和统计栏 - 使用 isFirstActivate 标记避免首次挂载时与 onMounted 重复请求 - 移除 PAUSED 状态的 Tab 计数 Co-Authored-By: Claude Opus 4.6 --- apps/web-antd/src/views/ops/work-order/index.vue | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/apps/web-antd/src/views/ops/work-order/index.vue b/apps/web-antd/src/views/ops/work-order/index.vue index b35d73f12..29a9f4190 100644 --- a/apps/web-antd/src/views/ops/work-order/index.vue +++ b/apps/web-antd/src/views/ops/work-order/index.vue @@ -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>({ ALL: 0, PENDING: 0, IN_PROGRESS: 0, - PAUSED: 0, COMPLETED: 0, CANCELLED: 0, }); @@ -282,8 +281,18 @@ const [Grid, gridApi] = useVbenVxeGrid({ } as VxeTableGridOptions, }); +let isFirstActivate = true; onMounted(() => { - // 默认使用卡片视图 + handleRefresh(); +}); + +onActivated(() => { + // 首次 activated 与 onMounted 同时触发,跳过以避免重复请求 + if (isFirstActivate) { + isFirstActivate = false; + return; + } + handleRefresh(); });