refactor: add prefixId

This commit is contained in:
Net 2024-07-25 14:44:32 +07:00
parent 1e4e2c2927
commit 1bbb5007d3
17 changed files with 241 additions and 175 deletions

View file

@ -16,6 +16,22 @@ const { t } = useI18n();
const propertiesOption = defineModel<Option[]>('propertiesOption');
const formServiceProperties = defineModel<Attributes>('formServiceProperties');
// const abilitys = ref<Record<AdditionalType, Ability[AdditionalType]>>({
// string: { phoneNumber: { length: 10 } },
// number: { comma: true, decimal: { point: 2 } },
// date: '2024-07-25',
// array: ['item1', 'item2'],
// });
const abilitys = ref<Ability[]>([
{
string: { phoneNumber: { length: 10 } },
number: { comma: true, decimal: { point: 2 } },
date: '2024-07-25',
array: ['item1', 'item2'],
},
]);
const telMax = ref();
const pointNum = ref();
@ -51,13 +67,6 @@ const typeOption = ref([
},
]);
const abilitys = ref<Record<AdditionalType, Ability[AdditionalType]>>({
string: { phoneNumber: { length: 10 } },
number: { comma: true, decimal: { point: 2 } },
date: '2024-07-25',
array: ['item1', 'item2'],
});
function manageProperties(properties?: string, type?: string | AdditionalType) {
if (properties === 'all' && propertiesOption.value) {
if (
@ -75,17 +84,7 @@ function manageProperties(properties?: string, type?: string | AdditionalType) {
formServiceProperties.value?.additional.push({
fieldName: ops.value,
type: ops.type as AdditionalType,
ability: {
string:
ops.type === 'string' ? abilitys.value['string'] : undefined,
number:
ops.type === 'number' ? abilitys.value['number'] : undefined,
date: ops.type === 'date' ? abilitys.value['date'] : undefined,
array: ops.type === 'array' ? abilitys.value['array'] : undefined,
},
});
console.log(abilitys.value['number']);
}
});
return;
@ -102,12 +101,6 @@ function manageProperties(properties?: string, type?: string | AdditionalType) {
formServiceProperties.value.additional.push({
fieldName: properties ?? null,
type: type as AdditionalType,
ability: {
string: type === 'string' ? abilitys.value['string'] : undefined,
number: type === 'number' ? abilitys.value['number'] : undefined,
date: type === 'date' ? abilitys.value['date'] : undefined,
array: type === 'array' ? abilitys.value['array'] : undefined,
},
});
}
}
@ -149,6 +142,17 @@ function confirmDelete(items: unknown[], index: number) {
cancel: () => {},
});
}
// function addProperties() {
// formServiceProperties.value?.additional.forEach((item, i) => {
// if (!!formServiceProperties.value?.additional) {
// formServiceProperties.value.additional[i] = {
// ...item,
// ability: abilitys.value[i],
// };
// }
// });
// }
</script>
<template>
<div class="full-width column no-wrap">