0
0
Fork 0

refs #7406 fix VnTable columns

This commit is contained in:
Carlos Satorres 2024-05-28 10:41:24 +02:00
parent d8512e2033
commit ffe15da7cf
2 changed files with 33 additions and 37 deletions

View File

@ -13,7 +13,7 @@ import useNotify from 'src/composables/useNotify.js';
import { toDate } from 'src/filters'; import { toDate } from 'src/filters';
import { downloadFile } from 'src/composables/downloadFile'; import { downloadFile } from 'src/composables/downloadFile';
const route = useRoute(); const {{id}} = useRoute();
const quasar = useQuasar(); const quasar = useQuasar();
const router = useRouter(); const router = useRouter();
const { t } = useI18n(); const { t } = useI18n();
@ -29,7 +29,7 @@ const thermographFilter = {
fields: ['id', 'name'], fields: ['id', 'name'],
}, },
}, },
where: { travelFk: route.params.id }, where: { travelFk: id },
order: ['created'], order: ['created'],
}; };
@ -137,7 +137,7 @@ const removeThermograph = async (id) => {
data-key="TravelThermographs" data-key="TravelThermographs"
url="TravelThermographs" url="TravelThermographs"
:filter="thermographFilter" :filter="thermographFilter"
:params="{ travelFk: route.params.id }" :params="{ travelFk: id }"
auto-load auto-load
> >
<template #body="{ rows }"> <template #body="{ rows }">

View File

@ -1,7 +1,6 @@
<script setup> <script setup>
import { ref, computed, onMounted } from 'vue'; import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import VnTable from 'components/VnTable/VnTable.vue'; import VnTable from 'components/VnTable/VnTable.vue';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
@ -9,50 +8,54 @@ const tableRef = ref();
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const entityId = computed(() => route.params.id); const entityId = computed(() => route.params.id);
const courseFilter = {
include: [
{
relation: 'trainingCourseType',
scope: {
fields: ['id', 'name'],
},
},
{
relation: 'trainingCenter',
scope: {
fields: ['id', 'name'],
},
},
],
};
const columns = computed(() => [ const columns = computed(() => [
{ {
align: 'left', align: 'left',
name: 'course', name: 'trainingCourseTypeFk',
label: t('worker.formation.tableVisibleColumns.course'), label: t('worker.formation.tableVisibleColumns.course'),
isTitle: true, isTitle: true,
component: 'select', component: 'select',
attrs: { field: 'trainingCourseTypeFk',
url: 'TrainingCourse/trainingCourseType',
fields: ['id', 'name'],
},
create: true, create: true,
}, },
{ {
align: 'left', align: 'left',
name: 'startDate', name: 'started',
label: t('worker.formation.tableVisibleColumns.startDate'), label: t('worker.formation.tableVisibleColumns.startDate'),
component: VnInputDate, component: VnInputDate,
props: (prop) => ({ field: 'started',
disable: true,
'model-value': prop.row.started,
}),
create: true, create: true,
}, },
{ {
align: 'left', align: 'left',
name: 'endDate', name: 'ended',
label: t('worker.formation.tableVisibleColumns.endDate'), label: t('worker.formation.tableVisibleColumns.endDate'),
component: VnInputDate, component: VnInputDate,
props: (prop) => ({ field: 'ended',
disable: true,
'model-value': prop.row.ended,
}),
create: true, create: true,
}, },
{ {
align: 'left', align: 'left',
name: 'center', name: 'centerFk',
label: t('worker.formation.tableVisibleColumns.center'), label: t('worker.formation.tableVisibleColumns.center'),
component: 'select', component: 'select',
attrs: { field: 'centerFk',
url: 'Workers/trainingCenter',
fields: ['id', 'name'],
},
create: true, create: true,
}, },
{ {
@ -60,16 +63,14 @@ const columns = computed(() => [
name: 'invoice', name: 'invoice',
label: t('worker.formation.tableVisibleColumns.invoice'), label: t('worker.formation.tableVisibleColumns.invoice'),
component: 'input', component: 'input',
field: 'invoice',
}, },
{ {
align: 'left', align: 'left',
name: 'amount', name: 'amount',
label: t('worker.formation.tableVisibleColumns.amount'), label: t('worker.formation.tableVisibleColumns.amount'),
component: 'input', component: 'input',
props: (prop) => ({ field: 'amount',
disable: true,
'model-value': prop.row.amount,
}),
create: true, create: true,
}, },
{ {
@ -77,20 +78,14 @@ const columns = computed(() => [
name: 'remark', name: 'remark',
label: t('worker.formation.tableVisibleColumns.remark'), label: t('worker.formation.tableVisibleColumns.remark'),
component: 'checkbox', component: 'checkbox',
props: (prop) => ({ field: 'remark',
disable: true,
'model-value': prop.row.remark,
}),
create: true, create: true,
}, },
{ {
align: 'left', align: 'left',
name: 'hasDiploma', name: 'hasDiploma',
label: t('worker.formation.tableVisibleColumns.hasDiploma'), label: t('worker.formation.tableVisibleColumns.hasDiploma'),
props: (prop) => ({ field: 'hasDiploma',
disable: true,
'model-value': prop.row.hasDiploma,
}),
create: true, create: true,
}, },
]); ]);
@ -101,6 +96,7 @@ const columns = computed(() => [
data-key="WorkerFormation" data-key="WorkerFormation"
:url="`Workers/${entityId}/trainingCourse`" :url="`Workers/${entityId}/trainingCourse`"
:url-create="`Workers/${entityId}/trainingCourse`" :url-create="`Workers/${entityId}/trainingCourse`"
:filter="courseFilter"
:create="{ :create="{
urlCreate: 'Workers/trainingCourse', urlCreate: 'Workers/trainingCourse',
title: 'Create trainingCourse', title: 'Create trainingCourse',