refs #6897 fix columns

This commit is contained in:
Carlos Satorres 2024-06-28 09:01:28 +02:00
parent 67f89dfde2
commit 8ec51ff8fd
1 changed files with 93 additions and 422 deletions

View File

@ -4,29 +4,16 @@ import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import VnTable from 'components/VnTable/VnTable.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import { useStateStore } from 'stores/useStateStore';
import { toDate, toCurrency } from 'src/filters';
// import { useSession } from 'composables/useSession';
import { dashIfEmpty } from 'src/filters';
import { useArrayData } from 'composables/useArrayData';
const router = useRouter();
// const { getTokenMultimedia } = useSession();
// const token = getTokenMultimedia();
const stateStore = useStateStore();
const { t } = useI18n();
const rowsFetchDataRef = ref(null);
const itemTypesOptions = ref([]);
const originsOptions = ref([]);
const itemFamiliesOptions = ref([]);
const intrastatOptions = ref([]);
const packagingsOptions = ref([]);
const editTableCellDialogRef = ref(null);
const visibleColumns = ref([]);
const allColumnNames = ref([]);
const exprBuilder = (param, value) => {
@ -88,470 +75,154 @@ const getInputEvents = (col) => {
const columns = computed(() => [
{
label: t('entry.latestBuys.picture'),
label: t('entry.latestBuys.tableVisibleColumns.picture'),
name: 'picture',
align: 'left',
},
{
label: t('entry.latestBuys.itemFk'),
align: 'left',
label: t('entry.latestBuys.tableVisibleColumns.itemFk'),
name: 'itemFk',
field: 'itemFk',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
isTitle: true,
},
{
label: t('entry.latestBuys.packing'),
field: 'packing',
align: 'left',
label: t('entry.latestBuys.tableVisibleColumns.packing'),
name: 'packing',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
format: (val) => dashIfEmpty(val),
},
{
label: t('entry.latestBuys.grouping'),
field: 'grouping',
align: 'left',
label: t('entry.latestBuys.tableVisibleColumns.grouping'),
name: 'grouping',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
format: (val) => dashIfEmpty(val),
},
{
label: t('entry.latestBuys.quantity'),
field: 'quantity',
align: 'left',
label: t('entry.latestBuys.tableVisibleColumns.quantity'),
name: 'quantity',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
},
{
label: t('entry.latestBuys.description'),
field: 'description',
align: 'left',
label: t('entry.latestBuys.tableVisibleColumns.description'),
name: 'description',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
format: (val) => dashIfEmpty(val),
},
{
label: t('entry.latestBuys.size'),
field: 'size',
align: 'left',
label: t('entry.latestBuys.tableVisibleColumns.size'),
name: 'size',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
},
{
label: t('entry.latestBuys.tags'),
align: 'left',
label: t('entry.latestBuys.tableVisibleColumns.tags'),
name: 'tags',
align: 'left',
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
},
{
label: t('entry.latestBuys.type'),
field: 'code',
align: 'left',
label: t('entry.latestBuys.tableVisibleColumns.type'),
name: 'type',
align: 'left',
sortable: true,
columnFilter: {
component: VnSelect,
type: 'select',
filterValue: null,
event: getInputEvents,
attrs: {
options: itemTypesOptions.value,
'option-value': 'code',
'option-label': 'code',
dense: true,
},
},
},
{
label: t('entry.latestBuys.intrastat'),
field: 'intrastat',
align: 'left',
label: t('entry.latestBuys.tableVisibleColumns.intrastat'),
name: 'intrastat',
align: 'left',
sortable: true,
columnFilter: {
component: VnSelect,
type: 'select',
filterValue: null,
event: getInputEvents,
attrs: {
options: intrastatOptions.value,
'option-value': 'description',
'option-label': 'description',
dense: true,
},
},
},
{
label: t('entry.latestBuys.origin'),
field: 'origin',
align: 'left',
label: t('entry.latestBuys.tableVisibleColumns.origin'),
name: 'origin',
align: 'left',
sortable: true,
columnFilter: {
component: VnSelect,
type: 'select',
filterValue: null,
event: getInputEvents,
attrs: {
options: originsOptions.value,
'option-value': 'code',
'option-label': 'code',
dense: true,
},
},
},
{
label: t('entry.latestBuys.weightByPiece'),
field: 'weightByPiece',
align: 'left',
label: t('entry.latestBuys.tableVisibleColumns.weightByPiece'),
name: 'weightByPiece',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
format: (val) => dashIfEmpty(val),
},
{
label: t('entry.latestBuys.isActive'),
field: 'isActive',
align: 'left',
label: t('entry.latestBuys.tableVisibleColumns.isActive'),
name: 'isActive',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
},
{
label: t('entry.latestBuys.family'),
field: 'family',
name: 'family',
align: 'left',
sortable: true,
columnFilter: {
component: VnSelect,
type: 'select',
filterValue: null,
event: getInputEvents,
attrs: {
options: itemFamiliesOptions.value,
'option-value': 'code',
'option-label': 'code',
dense: true,
},
},
},
{
label: t('entry.latestBuys.entryFk'),
field: 'entryFk',
name: 'entryFk',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
},
{
label: t('entry.latestBuys.buyingValue'),
field: 'buyingValue',
name: 'buyingValue',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
format: (val) => toCurrency(val),
},
{
label: t('entry.latestBuys.freightValue'),
field: 'freightValue',
name: 'freightValue',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
format: (val) => toCurrency(val),
},
{
label: t('entry.latestBuys.comissionValue'),
field: 'comissionValue',
name: 'comissionValue',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
format: (val) => toCurrency(val),
},
{
label: t('entry.latestBuys.packageValue'),
field: 'packageValue',
name: 'packageValue',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
format: (val) => toCurrency(val),
},
{
label: t('entry.latestBuys.isIgnored'),
field: 'isIgnored',
name: 'isIgnored',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
},
{
label: t('entry.latestBuys.price2'),
field: 'price2',
name: 'price2',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
format: (val) => toCurrency(val),
},
{
label: t('entry.latestBuys.price3'),
field: 'price3',
name: 'price3',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
format: (val) => toCurrency(val),
label: t('entry.latestBuys.tableVisibleColumns.family'),
name: 'family'
},
{
label: t('entry.latestBuys.minPrice'),
field: 'minPrice',
name: 'minPrice',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
format: (val) => toCurrency(val),
label: t('entry.latestBuys.tableVisibleColumns.entryFk'),
name: 'entryFk'
},
{
label: t('entry.latestBuys.ektFk'),
field: 'ektFk',
name: 'ektFk',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
format: (val) => dashIfEmpty(val),
label: t('entry.latestBuys.tableVisibleColumns.buyingValue'),
name: 'buyingValue'
},
{
label: t('entry.latestBuys.weight'),
field: 'weight',
name: 'weight',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
label: t('entry.latestBuys.tableVisibleColumns.freightValue'),
name: 'freightValue'
},
{
label: t('entry.latestBuys.packagingFk'),
field: 'packagingFk',
name: 'packagingFk',
align: 'left',
sortable: true,
columnFilter: {
component: VnSelect,
type: 'select',
filterValue: null,
event: getInputEvents,
attrs: {
options: packagingsOptions.value,
'option-value': 'id',
'option-label': 'id',
dense: true,
},
},
label: t('entry.latestBuys.tableVisibleColumns.comissionValue'),
name: 'comissionValue'
},
{
label: t('entry.latestBuys.packingOut'),
field: 'packingOut',
name: 'packingOut',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
format: (val) => dashIfEmpty(val),
label: t('entry.latestBuys.tableVisibleColumns.packageValue'),
name: 'packageValue'
},
{
label: t('entry.latestBuys.landing'),
field: 'landing',
name: 'landing',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
label: t('entry.latestBuys.tableVisibleColumns.isIgnored'),
name: 'isIgnored'
},
{
align: 'left',
label: t('entry.latestBuys.tableVisibleColumns.price2'),
name: 'price2'
},
format: (val) => toDate(val),
{
align: 'left',
label: t('entry.latestBuys.tableVisibleColumns.price3'),
name: 'price3'
},
{
align: 'left',
label: t('entry.latestBuys.tableVisibleColumns.minPrice'),
name: 'minPrice'
},
{
align: 'left',
label: t('entry.latestBuys.tableVisibleColumns.ektFk'),
name: 'ektFk'
},
{
align: 'left',
label: t('entry.latestBuys.tableVisibleColumns.weight'),
name: 'weight'
},
{
align: 'left',
label: t('entry.latestBuys.tableVisibleColumns.packagingFk'),
name: 'packagingFk'
},
{
align: 'left',
label: t('entry.latestBuys.tableVisibleColumns.packingOut'),
name: 'packingOut'
},
{
align: 'left',
label: t('entry.latestBuys.tableVisibleColumns.landing'),
name: 'landing'
},
]);
@ -602,10 +273,10 @@ onUnmounted(() => (stateStore.rightDrawer = false));
<template>
<VnTable
ref="tableRef"
data-key="EntryLatestBuysList"
url="EntryLatestBuys"
url-create="EntryLatestBuys"
save-url="EntryLatestBuys/crud"
data-key="LatestBuys"
url="Entries/LatestBuys"
url-create="Entries/LatestBuys"
save-url="Entries/LatestBuys/crud"
order="id DESC"
:columns="columns"
redirect="entry"