From 3352fb94134b1824ab6b09288b168d85782c9414 Mon Sep 17 00:00:00 2001 From: Net Date: Thu, 25 Jul 2024 11:07:58 +0700 Subject: [PATCH] refactor: set data ability --- .../04_product-service/ServiceProperties.vue | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/components/04_product-service/ServiceProperties.vue b/src/components/04_product-service/ServiceProperties.vue index a4ff57e5..c663a918 100644 --- a/src/components/04_product-service/ServiceProperties.vue +++ b/src/components/04_product-service/ServiceProperties.vue @@ -2,7 +2,11 @@ import { ref } from 'vue'; import { useI18n } from 'vue-i18n'; import { Option } from 'src/stores/options/types'; -import { AdditionalType, Attributes } from 'src/stores/product-service/types'; +import { + AdditionalType, + Attributes, + Ability, +} from 'src/stores/product-service/types'; import { moveItemUp, moveItemDown, deleteItem, dialog } from 'src/stores/utils'; import NoData from '../NoData.vue'; @@ -47,6 +51,13 @@ const typeOption = ref([ }, ]); +const abilitys = ref>({ + 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 ( @@ -64,7 +75,17 @@ 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; @@ -81,6 +102,12 @@ 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, + }, }); } } @@ -136,6 +163,7 @@ function confirmDelete(items: unknown[], index: number) { menu-anchor="bottom end" > + asdas
+ dasdsad