fix: properties => update property assignment to use index instead of push for better handling

This commit is contained in:
puriphatt 2025-01-22 14:07:35 +07:00
parent 363779a2bc
commit c68cbffb9c
2 changed files with 9 additions and 10 deletions

View file

@ -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,
});
};
}
}

View file

@ -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"
/>