From c68cbffb9cea76466206cff432d80dae3c5ff3ab Mon Sep 17 00:00:00 2001 From: puriphatt Date: Wed, 22 Jan 2025 14:07:35 +0700 Subject: [PATCH] fix: properties => update property assignment to use index instead of push for better handling --- src/components/dialog/DialogProperties.vue | 18 +++++++++--------- src/pages/04_flow-managment/FlowDialog.vue | 1 - 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/components/dialog/DialogProperties.vue b/src/components/dialog/DialogProperties.vue index 3218b54b..231937d0 100644 --- a/src/components/dialog/DialogProperties.vue +++ b/src/components/dialog/DialogProperties.vue @@ -201,40 +201,40 @@ function changeType(fieldName: string, stepIndex: number) { (p) => p.fieldName === fieldName, ); - if (!idx) return; + if (idx < 0) return; if (defaultPropType === 'date') { - tempStep.value[stepIndex].attributes.properties.push({ + tempStep.value[stepIndex].attributes.properties[idx] = { type: defaultPropType, fieldName, - }); + }; } if (defaultPropType === 'array') { - tempStep.value[stepIndex].attributes.properties.push({ + tempStep.value[stepIndex].attributes.properties[idx] = { type: defaultPropType, fieldName, options: [], - }); + }; } if (defaultPropType === 'string') { - tempStep.value[stepIndex].attributes.properties.push({ + tempStep.value[stepIndex].attributes.properties[idx] = { type: defaultPropType, fieldName, isPhoneNumber: false, phoneNumberLength: 10, - }); + }; } if (defaultPropType === 'number') { - tempStep.value[stepIndex].attributes.properties.push({ + tempStep.value[stepIndex].attributes.properties[idx] = { type: defaultPropType, fieldName, comma: false, decimal: false, decimalPlace: 2, - }); + }; } } diff --git a/src/pages/04_flow-managment/FlowDialog.vue b/src/pages/04_flow-managment/FlowDialog.vue index 112860c4..f2287655 100644 --- a/src/pages/04_flow-managment/FlowDialog.vue +++ b/src/pages/04_flow-managment/FlowDialog.vue @@ -315,7 +315,6 @@ function triggerPropertiesDialog(step: WorkFlowPayloadStep) { v-model:user-in-table="userInTable" v-model:flow-data="flowData" v-model:register-branch-id="registerBranchId" - v-model:messenger-by-area="messengerByArea" @change-status="$emit('changeStatus')" @trigger-properties="triggerPropertiesDialog" />