forked from verdnatura/salix-front
refs #7283 filter
This commit is contained in:
parent
168201c755
commit
16b5b5d9a1
|
@ -1,30 +1,39 @@
|
|||
<script setup>
|
||||
import { onMounted, ref, computed, reactive, onUnmounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useRouter, useRoute } from 'vue-router';
|
||||
import VnImg from 'src/components/ui/VnImg.vue';
|
||||
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { toDateFormat } from 'src/filters/date.js';
|
||||
import { toDate } from 'src/filters';
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
import axios from 'axios';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
const entityId = computed(() => route.params.id);
|
||||
|
||||
const router = useRouter();
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
const tableRef = ref();
|
||||
const route = useRoute();
|
||||
|
||||
const itemFilter = {
|
||||
include: [
|
||||
{
|
||||
relation: 'trainingCourseType',
|
||||
relation: 'itemType',
|
||||
scope: {
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'trainingCenter',
|
||||
relation: 'intrastat',
|
||||
scope: {
|
||||
fields: ['id', 'description'],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'origin',
|
||||
scope: {
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
|
@ -34,8 +43,18 @@ const itemFilter = {
|
|||
const columns = computed(() => [
|
||||
{
|
||||
label: '',
|
||||
name: 'picture',
|
||||
name: 'image',
|
||||
align: 'left',
|
||||
columnField: {
|
||||
component: VnImg,
|
||||
attrs: (id) => {
|
||||
return {
|
||||
id,
|
||||
width: '50px',
|
||||
};
|
||||
},
|
||||
},
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
label: t('item.list.id'),
|
||||
|
@ -88,6 +107,10 @@ const columns = computed(() => [
|
|||
url: 'ItemType',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
create: true,
|
||||
},
|
||||
|
||||
{
|
||||
|
@ -100,6 +123,9 @@ const columns = computed(() => [
|
|||
url: 'ItemCategory',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
|
@ -112,6 +138,10 @@ const columns = computed(() => [
|
|||
url: 'Intrastat',
|
||||
fields: ['id', 'description'],
|
||||
},
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
create: true,
|
||||
},
|
||||
{
|
||||
label: t('item.list.origin'),
|
||||
|
@ -123,6 +153,10 @@ const columns = computed(() => [
|
|||
url: 'Origin',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
create: true,
|
||||
},
|
||||
{
|
||||
label: t('item.list.userName'),
|
||||
|
@ -136,7 +170,9 @@ const columns = computed(() => [
|
|||
name: 'weightByPiece',
|
||||
align: 'left',
|
||||
component: 'input',
|
||||
format: (val) => dashIfEmpty(val),
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('item.list.stemMultiplier'),
|
||||
|
@ -144,7 +180,9 @@ const columns = computed(() => [
|
|||
name: 'stemMultiplier',
|
||||
align: 'left',
|
||||
component: 'input',
|
||||
format: (val) => dashIfEmpty(val),
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('item.list.isActive'),
|
||||
|
@ -163,6 +201,9 @@ const columns = computed(() => [
|
|||
url: 'Producer',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('item.list.landed'),
|
||||
|
@ -170,7 +211,10 @@ const columns = computed(() => [
|
|||
name: 'landed',
|
||||
align: 'left',
|
||||
component: 'date',
|
||||
format: (val) => dashIfEmpty(toDateFormat(val)),
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.landed)),
|
||||
},
|
||||
]);
|
||||
|
||||
|
@ -209,9 +253,10 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="ItemList"
|
||||
url="Items"
|
||||
url="Items/filter"
|
||||
url-create="Items"
|
||||
save-url="Items/crud"
|
||||
:filter="itemFilter"
|
||||
:create="{
|
||||
urlCreate: 'Items',
|
||||
title: 'Create Item',
|
||||
|
@ -223,6 +268,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
order="id ASC"
|
||||
:columns="columns"
|
||||
auto-load
|
||||
redirect="Item"
|
||||
:right-search="false"
|
||||
:is-editable="false"
|
||||
:use-model="true"
|
||||
|
|
Loading…
Reference in New Issue