From 6ff2c0d772444457fea2916a746318f9e0f96d80 Mon Sep 17 00:00:00 2001 From: jason <2667446@qq.com> Date: Fri, 11 Jul 2025 21:51:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20[BPM=20=E5=B7=A5=E4=BD=9C=E6=B5=81]=20bu?= =?UTF-8?q?g=20=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/api/bpm/definition/index.ts | 1 + .../bpm/processInstance/create/index.vue | 47 ++++++++++++++----- 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/apps/web-antd/src/api/bpm/definition/index.ts b/apps/web-antd/src/api/bpm/definition/index.ts index b591de12d..c7facf6ec 100644 --- a/apps/web-antd/src/api/bpm/definition/index.ts +++ b/apps/web-antd/src/api/bpm/definition/index.ts @@ -8,6 +8,7 @@ export namespace BpmProcessDefinitionApi { id: string; version: number; name: string; + description: string; deploymentTime: number; suspensionState: number; modelType: number; diff --git a/apps/web-antd/src/views/bpm/processInstance/create/index.vue b/apps/web-antd/src/views/bpm/processInstance/create/index.vue index 8684f183e..95c1e45f4 100644 --- a/apps/web-antd/src/views/bpm/processInstance/create/index.vue +++ b/apps/web-antd/src/views/bpm/processInstance/create/index.vue @@ -2,7 +2,7 @@ import type { BpmCategoryApi } from '#/api/bpm/category'; import type { BpmProcessDefinitionApi } from '#/api/bpm/definition'; -import { computed, nextTick, onMounted, ref } from 'vue'; +import { computed, nextTick, onMounted, ref, watch } from 'vue'; import { useRoute } from 'vue-router'; import { Page } from '@vben/common-ui'; @@ -146,6 +146,11 @@ function handleQuery() { // 如果没有搜索关键字,恢复所有数据 isSearching.value = false; filteredProcessDefinitionList.value = processDefinitionList.value; + + // 恢复到第一个可用分类 + if (availableCategories.value.length > 0) { + activeCategory.value = availableCategories.value[0].code; + } } } @@ -216,11 +221,28 @@ const availableCategories = computed(() => { }); /** 获取 tab 的位置 */ - const tabPosition = computed(() => { return window.innerWidth < 768 ? 'top' : 'left'; }); +/** 监听可用分类变化,自动设置正确的活动分类 */ +watch( + availableCategories, + (newCategories) => { + if (newCategories.length > 0) { + // 如果当前活动分类不在可用分类中,切换到第一个可用分类 + const currentCategoryExists = newCategories.some( + (category: BpmCategoryApi.Category) => + category.code === activeCategory.value, + ); + if (!currentCategoryExists) { + activeCategory.value = newCategories[0].code; + } + } + }, + { immediate: true }, +); + /** 初始化 */ onMounted(() => { getList(); @@ -241,10 +263,10 @@ onMounted(() => { :loading="loading" >