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" >