0
0
Fork 0

perf: #7260 change params by filter

This commit is contained in:
Javier Segarra 2024-11-20 11:19:58 +01:00
parent 74f1ce88c7
commit 09c0a590cd
1 changed files with 17 additions and 7 deletions

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { onMounted, ref, reactive, onUnmounted, nextTick, computed } from 'vue'; import { onMounted, ref, onUnmounted, nextTick, computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import FetchedTags from 'components/ui/FetchedTags.vue'; import FetchedTags from 'components/ui/FetchedTags.vue';
@ -37,11 +37,9 @@ const fixedPrices = ref([]);
const warehousesOptions = ref([]); const warehousesOptions = ref([]);
const rowsSelected = ref([]); const rowsSelected = ref([]);
const itemFixedPriceFilterRef = ref(); const itemFixedPriceFilterRef = ref();
const params = reactive({});
onMounted(async () => { onMounted(async () => {
stateStore.rightDrawer = true; stateStore.rightDrawer = true;
params.warehouseFk = user.value.warehouseFk;
}); });
onUnmounted(() => (stateStore.rightDrawer = false)); onUnmounted(() => (stateStore.rightDrawer = false));
@ -132,13 +130,21 @@ const columns = computed(() => [
{ {
label: t('item.fixedPrice.warehouse'), label: t('item.fixedPrice.warehouse'),
field: 'warehouseFk',
name: 'warehouseFk',
...defaultColumnAttrs, ...defaultColumnAttrs,
name: 'warehouseFk',
columnClass: 'shrink', columnClass: 'shrink',
component: 'select', component: 'select',
options: warehousesOptions, options: warehousesOptions,
columnFilter: {
name: 'warehouseFk',
inWhere: true,
component: 'select',
attrs: {
options: warehousesOptions,
'option-label': 'name',
'option-value': 'id',
},
},
}, },
{ {
align: 'right', align: 'right',
@ -418,9 +424,13 @@ function handleOnDataSave({ CrudModelRef }) {
url="FixedPrices/filter" url="FixedPrices/filter"
:order="['itemFk DESC', 'name DESC']" :order="['itemFk DESC', 'name DESC']"
save-url="FixedPrices/crud" save-url="FixedPrices/crud"
:user-params="{ warehouseFk: user.warehouseFk }"
ref="tableRef" ref="tableRef"
dense dense
:filter="{
where: {
warehouseFk: user.warehouseFk,
},
}"
:columns="columns" :columns="columns"
default-mode="table" default-mode="table"
auto-load auto-load