From 026c632a4cf78db451dc5ccbeaf95215e4e091eb Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 26 Jul 2024 09:47:28 +0200 Subject: [PATCH 1/5] feat(customer): improve basicData to balance --- src/components/VnTable/VnColumn.vue | 20 +- src/components/VnTable/VnFilter.vue | 4 +- src/components/VnTable/VnTable.vue | 53 +- src/components/common/VnComponent.vue | 6 +- src/components/common/VnInputNumber.vue | 8 + src/components/common/VnSelect.vue | 14 +- src/components/ui/VnNotes.vue | 4 +- src/components/ui/VnPaginate.vue | 4 +- src/components/ui/VnUserLink.vue | 1 - src/pages/Customer/Card/CustomerBalance.vue | 536 +++++++++--------- src/pages/Customer/Card/CustomerBasicData.vue | 69 +-- src/pages/Customer/Card/CustomerCredits.vue | 62 +- .../Customer/Card/CustomerFiscalData.vue | 8 +- src/pages/Customer/Card/CustomerGreuges.vue | 192 +++---- src/pages/Customer/Card/CustomerNotes.vue | 78 +-- src/pages/Customer/CustomerList.vue | 4 +- .../components/CustomerCreditCreate.vue | 67 --- .../components/CustomerGreugeCreate.vue | 97 ---- .../components/CustomerNewPayment.vue | 47 +- .../components/CustomerNoteCreate.vue | 57 -- src/pages/Entry/EntryLatestBuys.vue | 4 +- src/pages/Entry/EntryList.vue | 3 +- src/pages/Order/OrderLines.vue | 4 +- src/pages/Ticket/TicketWeekly.vue | 4 +- src/router/modules/customer.js | 95 +--- 25 files changed, 527 insertions(+), 914 deletions(-) create mode 100644 src/components/common/VnInputNumber.vue delete mode 100644 src/pages/Customer/components/CustomerCreditCreate.vue delete mode 100644 src/pages/Customer/components/CustomerGreugeCreate.vue delete mode 100644 src/pages/Customer/components/CustomerNoteCreate.vue diff --git a/src/components/VnTable/VnColumn.vue b/src/components/VnTable/VnColumn.vue index 9f6c6d53d..b2d36ebe0 100644 --- a/src/components/VnTable/VnColumn.vue +++ b/src/components/VnTable/VnColumn.vue @@ -7,9 +7,11 @@ import { dashIfEmpty } from 'src/filters'; import VnSelect from 'components/common/VnSelect.vue'; import VnSelectCache from 'components/common/VnSelectCache.vue'; import VnInput from 'components/common/VnInput.vue'; +import VnInputNumber from 'components/common/VnInputNumber.vue'; import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputTime from 'components/common/VnInputTime.vue'; import VnComponent from 'components/common/VnComponent.vue'; +import VnUserLink from 'components/ui/VnUserLink.vue'; const model = defineModel(undefined, { required: true }); const $props = defineProps({ @@ -66,7 +68,7 @@ const defaultComponents = { }, }, number: { - component: markRaw(VnInput), + component: markRaw(VnInputNumber), attrs: { disable: !$props.isEditable, class: 'fit', @@ -98,14 +100,14 @@ const defaultComponents = { }, checkbox: { component: markRaw(QCheckbox), - attrs: (prop) => { + attrs: ({ model }) => { const defaultAttrs = { disable: !$props.isEditable, - 'model-value': Boolean(prop), + 'model-value': Boolean(model), class: 'no-padding fit', }; - if (typeof prop == 'number') { + if (typeof model == 'number') { defaultAttrs['true-value'] = 1; defaultAttrs['false-value'] = 0; } @@ -126,6 +128,9 @@ const defaultComponents = { icon: { component: markRaw(QIcon), }, + userLink: { + component: markRaw(VnUserLink), + }, }; const value = computed(() => { @@ -152,6 +157,7 @@ const col = computed(() => { newColumn.component = 'checkbox'; if ($props.default && !newColumn.component) newColumn.component = $props.default; + if ($props.componentProp == 'columnCreate') console.log('newColumn: ', newColumn); return newColumn; }); @@ -163,14 +169,14 @@ const components = computed(() => $props.components ?? defaultComponents); v-if="col.before" :prop="col.before" :components="components" - :value="model" + :value="{ row, model }" v-model="model" /> {{ value }} @@ -178,7 +184,7 @@ const components = computed(() => $props.components ?? defaultComponents); v-if="col.after" :prop="col.after" :components="components" - :value="model" + :value="{ row, model }" v-model="model" /> diff --git a/src/components/VnTable/VnFilter.vue b/src/components/VnTable/VnFilter.vue index e1faec0a0..82bcb42a6 100644 --- a/src/components/VnTable/VnFilter.vue +++ b/src/components/VnTable/VnFilter.vue @@ -10,6 +10,8 @@ import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputTime from 'components/common/VnInputTime.vue'; import VnTableColumn from 'components/VnTable/VnColumn.vue'; +defineExpose({ addFilter }); + const $props = defineProps({ column: { type: Object, @@ -32,7 +34,7 @@ const model = defineModel(undefined, { required: true }); const arrayData = useArrayData($props.dataKey, { searchUrl: $props.searchUrl }); const columnFilter = computed(() => $props.column?.columnFilter); -const updateEvent = { 'update:modelValue': addFilter }; +const updateEvent = { 'update:modelValue': addFilter, remove: () => addFilter(null) }; const enterEvent = { 'keyup.enter': () => addFilter(model.value), remove: () => addFilter(null), diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 15cf39bd6..fa87bf662 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -311,11 +311,6 @@ defineExpose({ :params="params" :columns="splittedColumns.columns" /> - @@ -326,6 +321,7 @@ defineExpose({ v-bind="$attrs" :limit="20" ref="CrudModelRef" + @on-fetch="(...args) => emit('onFetch', ...args)" :search-url="searchUrl" :disable-infinite-scroll="isTableMode" @save-changes="reload" @@ -363,7 +359,7 @@ defineExpose({ -