fix: service workflow & work fallback name

This commit is contained in:
puriphatt 2024-11-04 10:35:26 +07:00
parent 4fa0159c02
commit 980bb86574
2 changed files with 6 additions and 5 deletions

View file

@ -87,11 +87,10 @@ defineEmits<{
// ); // );
function mapFlowName(id: string): string { function mapFlowName(id: string): string {
const targetFlow = workflowData.value.find( if (!id) return workName.value || '';
(w) => w.id === attributes.value.workflowId, const targetFlow = workflowData.value.find((w) => w.id === id);
); workName.value = targetFlow?.name;
workName.value = targetFlow?.name || workName.value; return targetFlow?.name || attributes.value.workflowName || '';
return targetFlow?.name || '';
} }
function mapStepName(id: string) { function mapStepName(id: string) {
@ -106,6 +105,7 @@ function mapStepName(id: string) {
function selectFlow(workflow: WorkflowTemplate) { function selectFlow(workflow: WorkflowTemplate) {
workName.value = workflow.name; workName.value = workflow.name;
attributes.value.workflowId = workflow.id; attributes.value.workflowId = workflow.id;
attributes.value.workflowName = workflow.name;
attributes.value.stepProperties = workflow.step.map((s) => ({ attributes.value.stepProperties = workflow.step.map((s) => ({
id: s.id, id: s.id,
attributes: [], attributes: [],

View file

@ -73,6 +73,7 @@ export interface Attributes {
showTotalPrice: boolean; showTotalPrice: boolean;
additional?: (PropString | PropNumber | PropDate | PropOptions)[]; additional?: (PropString | PropNumber | PropDate | PropOptions)[];
workflowId: string; workflowId: string;
workflowName: string;
stepProperties: { stepProperties: {
id: string; id: string;
productsId: string[]; productsId: string[];