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 {
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: [],

View file

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