diff --git a/src/components/common/VnTable.vue b/src/components/common/VnTable.vue index 1f4af98cf..877788061 100644 --- a/src/components/common/VnTable.vue +++ b/src/components/common/VnTable.vue @@ -54,7 +54,7 @@ const router = useRouter(); const mode = ref('card'); const selected = ref([]); const params = ref({}); -const VnPaginateRef = ref(); +const VnPaginateRef = ref({}); const showForm = ref(false); const splittedColumns = ref({ columns: [] }); const tableModes = [ @@ -118,22 +118,34 @@ function splitColumns(columns) { field: 'status', label: t('status'), name: 'status', - customFilter: false, + columnFilter: false, }); } } const rowClickFunction = computed(() => { if ($props.rowClick) return $props.rowClick; - if ($props.redirect) - return ({ id }) => router.push({ path: `/${$props.redirect}/${id}` }); + if ($props.redirect) return ({ id }) => redirectFn(id); return () => {}; }); +function redirectFn(id) { + router.push({ path: `/${$props.redirect}/${id}` }); +} + function stopEventPropagation(event) { event.preventDefault(); event.stopPropagation(); } + +function reload() { + VnPaginateRef.value.fetch(); +} + +defineExpose({ + reload, + redirect: redirectFn, +}); @@ -317,7 +330,11 @@ function stopEventPropagation(event) { :icon="btn.icon" class="q-pa-xs" flat - :class="{ 'text-primary-light': btn.isPrimary }" + :class=" + btn.isPrimary + ? 'text-primary-light' + : 'color-vn-text ' + " @click="btn.action(row)" /> @@ -337,6 +354,7 @@ function stopEventPropagation(event) { diff --git a/src/components/common/VnTableFilter.vue b/src/components/common/VnTableFilter.vue index 212eab1b1..bfb62a0cf 100644 --- a/src/components/common/VnTableFilter.vue +++ b/src/components/common/VnTableFilter.vue @@ -18,7 +18,7 @@ default="input" v-model="model" :components="components" - :component-prop="`columnFilter`" + component-prop="columnFilter" /> diff --git a/src/components/ui/VnFilterPanel.vue b/src/components/ui/VnFilterPanel.vue index c37652b15..f128e7177 100644 --- a/src/components/ui/VnFilterPanel.vue +++ b/src/components/ui/VnFilterPanel.vue @@ -85,14 +85,6 @@ watch( } ); -watch( - () => arrayData.store.filter, - (val) => { - console.log('watch filter: ', val); - }, - { deep: true } -); - const isLoading = ref(false); async function search() { store.filter.where = {}; @@ -184,7 +176,7 @@ function formatValue(value) { - + [ where: { role: 'salesPerson' }, }, create: true, + columnField: { + component: null, + }, + format: (row, dashIfEmpty) => dashIfEmpty(row.salesPerson), }, { align: 'left', @@ -406,6 +411,10 @@ const columns = computed(() => [ optionLabel: 'description', optionValue: 'code', }, + columnField: { + component: null, + }, + format: (row, dashIfEmpty) => dashIfEmpty(row.businessType), }, { align: 'left', @@ -463,7 +472,7 @@ const columns = computed(() => [ name: 'isFreezed', chip: { color: null, - condition: (v, { isActive, isFreezed }) => isActive && isFreezed == true, + condition: (v, { isActive, isFreezed }) => isActive && isFreezed, icon: 'vn:frozen', }, }, @@ -570,15 +579,29 @@ function handleLocation(data, location) { -->