0
0
Fork 0

feat(orderList): use orderFilter and fixed this

This commit is contained in:
Alex Moreno 2024-08-09 13:07:37 +02:00
parent 5741cca878
commit ee71ae9d24
2 changed files with 94 additions and 152 deletions

View File

@ -21,15 +21,13 @@ const salesPersonFilter = {
fields: ['id', 'nickname'], fields: ['id', 'nickname'],
}; };
const salesPersonList = ref(null); const salesPersonList = ref(null);
const sourceFilter = { fields: ['value'] }; const sourceList = ref([]);
const sourceList = ref(null);
</script> </script>
<template> <template>
<FetchData <FetchData
url="AgencyModes/isActive" url="AgencyModes/isActive"
:filter="agencyFilter" :filter="agencyFilter"
limit="30"
sort-by="name ASC" sort-by="name ASC"
auto-load auto-load
@on-fetch="(data) => (agencyList = data)" @on-fetch="(data) => (agencyList = data)"
@ -37,7 +35,6 @@ const sourceList = ref(null);
<FetchData <FetchData
url="Workers/search" url="Workers/search"
:filter="salesPersonFilter" :filter="salesPersonFilter"
limit="30"
sort-by="nickname ASC" sort-by="nickname ASC"
@on-fetch="(data) => (salesPersonList = data)" @on-fetch="(data) => (salesPersonList = data)"
:params="{ departmentCodes: ['VT'] }" :params="{ departmentCodes: ['VT'] }"
@ -45,8 +42,7 @@ const sourceList = ref(null);
/> />
<FetchData <FetchData
url="Orders/getSourceValues" url="Orders/getSourceValues"
:filter="sourceFilter" :filter="{ fields: ['value'] }"
limit="30"
sort-by="value ASC" sort-by="value ASC"
@on-fetch="(data) => (sourceList = data)" @on-fetch="(data) => (sourceList = data)"
auto-load auto-load
@ -59,56 +55,34 @@ const sourceList = ref(null);
</div> </div>
</template> </template>
<template #body="{ params }"> <template #body="{ params }">
<QItem> <div class="q-px-md q-gutter-y-sm">
<QItemSection>
<VnInput <VnInput
is-outlined
:label="t('customerId')" :label="t('customerId')"
v-model="params.clientFk" v-model="params.clientFk"
lazy-rules lazy-rules
> dense
<template #prepend> outlined
<QIcon name="badge" size="sm"></QIcon> rounded
</template> />
</VnInput>
</QItemSection>
</QItem>
<QItem>
<QItemSection v-if="agencyList">
<VnSelect <VnSelect
:label="t('agency')" :label="t('agency')"
v-model="params.agencyModeFk" v-model="params.agencyModeFk"
:options="agencyList" :options="agencyList"
option-value="id" :input-debounce="0"
option-label="name"
dense dense
outlined outlined
rounded rounded
emit-value
map-options
use-input
:input-debounce="0"
/> />
</QItemSection>
<QItemSection v-else>
<QSkeleton type="QInput" class="full-width" />
</QItemSection>
</QItem>
<QItem>
<QItemSection v-if="salesPersonList">
<VnSelect <VnSelect
:label="t('salesPerson')" :label="t('salesPerson')"
v-model="params.workerFk" v-model="params.workerFk"
:options="salesPersonList" url="Workers/search"
option-value="id" :filter="{ departmentCodes: ['VT'] }"
option-label="name" sort-by="nickname ASC"
option-label="nickname"
dense dense
outlined outlined
rounded rounded
emit-value
map-options
use-input
:input-debounce="0"
> >
<template #option="{ itemProps, opt }"> <template #option="{ itemProps, opt }">
<QItem v-bind="itemProps"> <QItem v-bind="itemProps">
@ -121,13 +95,6 @@ const sourceList = ref(null);
</QItem> </QItem>
</template> </template>
</VnSelect> </VnSelect>
</QItemSection>
<QItemSection v-else>
<QSkeleton type="QInput" class="full-width" />
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInputDate <VnInputDate
v-model="params.from" v-model="params.from"
:label="t('fromLanded')" :label="t('fromLanded')"
@ -135,10 +102,6 @@ const sourceList = ref(null);
outlined outlined
rounded rounded
/> />
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInputDate <VnInputDate
v-model="params.to" v-model="params.to"
:label="t('toLanded')" :label="t('toLanded')"
@ -146,61 +109,34 @@ const sourceList = ref(null);
outlined outlined
rounded rounded
/> />
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInput <VnInput
:label="t('orderId')" :label="t('orderId')"
v-model="params.orderFk" v-model="params.orderFk"
lazy-rules lazy-rules
is-outlined is-outlined
/> />
</QItemSection>
</QItem>
<QItem>
<QItemSection v-if="sourceList">
<VnSelect <VnSelect
:label="t('application')" :label="t('application')"
v-model="params.sourceApp" v-model="params.sourceApp"
:options="sourceList" :options="sourceList"
option-label="value" option-label="value"
emit-value
map-options
use-input
dense dense
outlined outlined
rounded rounded
:input-debounce="0" :input-debounce="0"
/> />
</QItemSection>
<QItemSection v-else>
<QSkeleton type="QInput" class="full-width" />
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QCheckbox <QCheckbox
v-model="params.myTeam" v-model="params.myTeam"
:label="t('myTeam')" :label="t('myTeam')"
toggle-indeterminate toggle-indeterminate
/> />
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QCheckbox <QCheckbox
v-model="params.isConfirmed" v-model="params.isConfirmed"
:label="t('isConfirmed')" :label="t('isConfirmed')"
toggle-indeterminate toggle-indeterminate
/> />
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QCheckbox v-model="params.showEmpty" :label="t('showEmpty')" /> <QCheckbox v-model="params.showEmpty" :label="t('showEmpty')" />
</QItemSection> </div>
</QItem>
</template> </template>
</VnFilterPanel> </VnFilterPanel>
</template> </template>

View File

@ -9,6 +9,8 @@ import VnTable from 'src/components/VnTable/VnTable.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue'; import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import OrderSearchbar from './Card/OrderSearchbar.vue'; import OrderSearchbar from './Card/OrderSearchbar.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import OrderFilter from './Card/OrderFilter.vue';
const { t } = useI18n(); const { t } = useI18n();
const { viewSummary } = useSummaryDialog(); const { viewSummary } = useSummaryDialog();
@ -119,9 +121,6 @@ const columns = computed(() => [
align: 'left', align: 'left',
name: 'total', name: 'total',
label: t('module.total'), label: t('module.total'),
columnFilter: {
inWhere: true,
},
format: ({ total }) => toCurrency(total), format: ({ total }) => toCurrency(total),
cardVisible: true, cardVisible: true,
}, },
@ -147,10 +146,16 @@ async function fetchClientAddress(id, data) {
</script> </script>
<template> <template>
<OrderSearchbar /> <OrderSearchbar />
<RightMenu>
<template #right-panel>
<OrderFilter data-key="OrderList" />
</template>
</RightMenu>
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="OrderList" data-key="OrderList"
url="Orders/filter" url="Orders/filter"
:order="['landed DESC', 'clientFk ASC', 'id DESC']"
:create="{ :create="{
urlCreate: 'Orders/new', urlCreate: 'Orders/new',
title: 'Create Order', title: 'Create Order',
@ -162,9 +167,10 @@ async function fetchClientAddress(id, data) {
addressId: null, addressId: null,
}, },
}" }"
:user-params="{ showEmpty: false }"
:right-search="false"
:columns="columns" :columns="columns"
redirect="order" redirect="order"
auto-load
> >
<template #more-create-dialog="{ data }"> <template #more-create-dialog="{ data }">
<VnSelect <VnSelect