refactor: change property assignment logic in DialogProperties to options store
This commit is contained in:
parent
c2f3260d13
commit
c9c0535fa1
2 changed files with 34 additions and 27 deletions
|
|
@ -271,33 +271,7 @@ function confirmDelete(items: unknown[], index: number) {
|
|||
}
|
||||
|
||||
async function assignTemp() {
|
||||
const res = await getPropertyList({ pageSize: 999, activeOnly: true });
|
||||
const targetOptions = optionStore.globalOption?.propertiesField ?? [];
|
||||
|
||||
if (!res) return;
|
||||
|
||||
const propList = res.result.map((v) => {
|
||||
return {
|
||||
label: locale.value === 'eng' ? v.nameEN : v.name,
|
||||
value: toCamelCase(v.nameEN),
|
||||
type: v.type.type,
|
||||
};
|
||||
});
|
||||
|
||||
propertiesOption.value = [...targetOptions];
|
||||
|
||||
const existingValues = new Set(
|
||||
propertiesOption.value.map((item: { value: string }) => item.value),
|
||||
);
|
||||
const newProps = propList.filter((prop) => !existingValues.has(prop.value));
|
||||
|
||||
if (newProps) {
|
||||
propertiesOption.value.splice(
|
||||
propertiesOption.value.length - 4,
|
||||
0,
|
||||
...newProps,
|
||||
);
|
||||
}
|
||||
propertiesOption.value = optionStore.globalOption?.propertiesField;
|
||||
|
||||
tempStep.value = JSON.parse(JSON.stringify(dataStep.value));
|
||||
tempWorkflowId.value = workflowId.value;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue