From ac7c330e2f5ee0affb61fe67d5427b4644e7698b Mon Sep 17 00:00:00 2001 From: jxxghp Date: Wed, 23 Jul 2025 15:33:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B7=A5=E4=BD=9C=E6=B5=81?= =?UTF-8?q?=E5=8D=A1=E7=89=87=E5=92=8C=E5=AF=B9=E8=AF=9D=E6=A1=86=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E4=BA=8B=E4=BB=B6=E7=B1=BB=E5=9E=8B=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/cards/WorkflowShareCard.vue | 5 +++++ src/components/cards/WorkflowTaskCard.vue | 12 +++++++++++- src/components/dialog/ForkWorkflowDialog.vue | 12 +++++++++++- src/views/workflow/WorkflowListView.vue | 15 ++++++++++++++- src/views/workflow/WorkflowShareView.vue | 20 +++++++++++++++++++- 5 files changed, 60 insertions(+), 4 deletions(-) diff --git a/src/components/cards/WorkflowShareCard.vue b/src/components/cards/WorkflowShareCard.vue index b2526bbe..49d6cfbc 100644 --- a/src/components/cards/WorkflowShareCard.vue +++ b/src/components/cards/WorkflowShareCard.vue @@ -6,6 +6,10 @@ import ForkWorkflowDialog from '../dialog/ForkWorkflowDialog.vue' // 输入参数 const props = defineProps({ workflow: Object as PropType, + eventTypes: { + type: Array as PropType>, + default: () => [], + }, }) // 定义删除事件 @@ -135,6 +139,7 @@ function doDelete() { v-if="forkWorkflowDialog" v-model="forkWorkflowDialog" :workflow="props.workflow" + :event-types="props.eventTypes" @close="forkWorkflowDialog = false" @fork="finishForkWorkflow" @delete="doDelete" diff --git a/src/components/cards/WorkflowTaskCard.vue b/src/components/cards/WorkflowTaskCard.vue index 56278c68..18cc3672 100644 --- a/src/components/cards/WorkflowTaskCard.vue +++ b/src/components/cards/WorkflowTaskCard.vue @@ -16,6 +16,10 @@ const props = defineProps({ required: true, type: Object as PropType, }, + eventTypes: { + type: Array as PropType>, + default: () => [], + }, }) // 定义事件 @@ -39,6 +43,12 @@ const shareDialog = ref(false) // 加载中 const loading = ref(false) +// 根据事件类型值获取显示文本 +const getEventTypeText = (eventTypeValue: string) => { + const eventType = props.eventTypes.find(item => item.value === eventTypeValue) + return eventType ? eventType.title : eventTypeValue +} + // 编辑任务 function handleEdit(item: Workflow) { editDialog.value = true @@ -305,7 +315,7 @@ const resolveProgress = (item: Workflow) => { - {{ workflow?.event_type }} + {{ getEventTypeText(workflow?.event_type || '') }} diff --git a/src/components/dialog/ForkWorkflowDialog.vue b/src/components/dialog/ForkWorkflowDialog.vue index 682dc83e..6d7f1a15 100644 --- a/src/components/dialog/ForkWorkflowDialog.vue +++ b/src/components/dialog/ForkWorkflowDialog.vue @@ -13,6 +13,10 @@ const { t } = useI18n() // 输入参数 const props = defineProps({ workflow: Object as PropType, + eventTypes: { + type: Array as PropType>, + default: () => [], + }, }) // 定义事件 @@ -32,6 +36,12 @@ const processing = ref(false) // 删除中 const deleting = ref(false) +// 根据事件类型值获取显示文本 +const getEventTypeText = (eventTypeValue: string) => { + const eventType = props.eventTypes.find(item => item.value === eventTypeValue) + return eventType ? eventType.title : eventTypeValue +} + // 流程图相关 const { nodes, edges } = useVueFlow() @@ -200,7 +210,7 @@ async function doDelete() { - {{ props.workflow?.event_type }} + {{ getEventTypeText(props.workflow?.event_type || '') }} diff --git a/src/views/workflow/WorkflowListView.vue b/src/views/workflow/WorkflowListView.vue index 6146ef43..f03686c9 100644 --- a/src/views/workflow/WorkflowListView.vue +++ b/src/views/workflow/WorkflowListView.vue @@ -26,6 +26,18 @@ const addDialog = ref(false) // 所有任务 const workflowList = ref([]) +// 事件类型列表 +const eventTypes = ref>([]) + +// 加载事件类型列表 +async function loadEventTypes() { + try { + eventTypes.value = await api.get('workflow/event_types') + } catch (error) { + console.error('Failed to load event types:', error) + } +} + // 加载数据 async function fetchData() { try { @@ -51,6 +63,7 @@ useDynamicButton({ }) onMounted(() => { + loadEventTypes() fetchData() }) @@ -62,7 +75,7 @@ onActivated(() => {
- +
([]) const currData = ref([]) +// 事件类型列表 +const eventTypes = ref>([]) + +// 加载事件类型列表 +async function loadEventTypes() { + try { + eventTypes.value = await api.get('workflow/event_types') + } catch (error) { + console.error('Failed to load event types:', error) + } +} + // 拼装参数 function getParams() { let params = { @@ -121,6 +133,7 @@ function removeData(id: string) { } onActivated(() => { + loadEventTypes() fetchData({ done: () => {} }) }) @@ -133,7 +146,12 @@ onActivated(() => {