From 980bb86574d1ce21d1858c64235fa831e6293a0e Mon Sep 17 00:00:00 2001 From: puriphatt Date: Mon, 4 Nov 2024 10:35:26 +0700 Subject: [PATCH] fix: service workflow & work fallback name --- .../04_product-service/WorkManagementComponent.vue | 10 +++++----- src/stores/product-service/types.ts | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/04_product-service/WorkManagementComponent.vue b/src/components/04_product-service/WorkManagementComponent.vue index 79b577a4..8c627c6e 100644 --- a/src/components/04_product-service/WorkManagementComponent.vue +++ b/src/components/04_product-service/WorkManagementComponent.vue @@ -87,11 +87,10 @@ defineEmits<{ // ); function mapFlowName(id: string): string { - const targetFlow = workflowData.value.find( - (w) => w.id === attributes.value.workflowId, - ); - workName.value = targetFlow?.name || workName.value; - return targetFlow?.name || ''; + if (!id) return workName.value || ''; + const targetFlow = workflowData.value.find((w) => w.id === id); + workName.value = targetFlow?.name; + return targetFlow?.name || attributes.value.workflowName || ''; } function mapStepName(id: string) { @@ -106,6 +105,7 @@ function mapStepName(id: string) { function selectFlow(workflow: WorkflowTemplate) { workName.value = workflow.name; attributes.value.workflowId = workflow.id; + attributes.value.workflowName = workflow.name; attributes.value.stepProperties = workflow.step.map((s) => ({ id: s.id, attributes: [], diff --git a/src/stores/product-service/types.ts b/src/stores/product-service/types.ts index dbc723b2..3a03ea34 100644 --- a/src/stores/product-service/types.ts +++ b/src/stores/product-service/types.ts @@ -73,6 +73,7 @@ export interface Attributes { showTotalPrice: boolean; additional?: (PropString | PropNumber | PropDate | PropOptions)[]; workflowId: string; + workflowName: string; stepProperties: { id: string; productsId: string[];