fix: refs #8227 fix front descriptor, Form
gitea/salix-front/pipeline/pr-test This commit looks good
Details
gitea/salix-front/pipeline/pr-test This commit looks good
Details
This commit is contained in:
parent
da295685a3
commit
d8559f9b18
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { ref, computed, onMounted } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||
|
@ -7,7 +7,7 @@ import VnLv from 'components/ui/VnLv.vue';
|
|||
import useCardDescription from 'composables/useCardDescription';
|
||||
import { dashIfEmpty, toDate } from 'src/filters';
|
||||
import RouteDescriptorMenu from 'pages/Route/Card/RouteDescriptorMenu.vue';
|
||||
|
||||
import axios from 'axios';
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
|
@ -18,10 +18,27 @@ const $props = defineProps({
|
|||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
||||
const zone = ref();
|
||||
const zoneId = ref();
|
||||
const entityId = computed(() => {
|
||||
return $props.id || route.params.id;
|
||||
});
|
||||
const getZone = async () => {
|
||||
const filter = {
|
||||
where: { routeFk: $props.id ? $props.id : route.params.id },
|
||||
};
|
||||
const { data } = await axios.get('Tickets/findOne', {
|
||||
params: {
|
||||
filter: JSON.stringify(filter),
|
||||
},
|
||||
});
|
||||
console.log(data);
|
||||
zoneId.value = data.zoneFk;
|
||||
console.log('zone: ', zoneId.value);
|
||||
const { data: zoneData } = await axios.get(`Zones/${zoneId.value}`);
|
||||
zone.value = zoneData.name;
|
||||
console.log('zone: ', zone.value);
|
||||
};
|
||||
|
||||
const filter = {
|
||||
fields: [
|
||||
|
@ -49,8 +66,8 @@ const filter = {
|
|||
{
|
||||
relation: 'ticket',
|
||||
scope: {
|
||||
fields: ['id', 'name', 'routeFk'],
|
||||
include: { relation: 'route', scope: { fields: ['id', 'name'] } },
|
||||
fields: ['id', 'name', 'zoneFk'],
|
||||
include: { relation: 'zone', scope: { fields: ['id', 'name'] } },
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -70,6 +87,9 @@ const filter = {
|
|||
};
|
||||
const data = ref(useCardDescription());
|
||||
const setData = (entity) => (data.value = useCardDescription(entity.code, entity.id));
|
||||
onMounted(async () => {
|
||||
getZone();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -86,7 +106,7 @@ const setData = (entity) => (data.value = useCardDescription(entity.code, entity
|
|||
<template #body="{ entity }">
|
||||
<VnLv :label="t('Date')" :value="toDate(entity?.dated)" />
|
||||
<VnLv :label="t('Agency')" :value="entity?.agencyMode?.name" />
|
||||
<VnLv :label="t('Zone')" :value="entity?.ticket?.route?.name" />
|
||||
<VnLv :label="t('Zone')" :value="zone" />
|
||||
<VnLv
|
||||
:label="t('Volume')"
|
||||
:value="`${dashIfEmpty(entity?.m3)} / ${dashIfEmpty(
|
||||
|
|
|
@ -43,7 +43,6 @@ const routeFilter = {
|
|||
'started',
|
||||
'finished',
|
||||
'cost',
|
||||
'zoneFk',
|
||||
'isOk',
|
||||
],
|
||||
include: [
|
||||
|
@ -52,7 +51,13 @@ const routeFilter = {
|
|||
relation: 'vehicle',
|
||||
scope: { fields: ['id', 'm3'] },
|
||||
},
|
||||
{ relation: 'zone', scope: { fields: ['id', 'name'] } },
|
||||
{
|
||||
relation: 'ticket',
|
||||
scope: {
|
||||
fields: ['id', 'name', 'zoneFk'],
|
||||
include: { relation: 'zone', scope: { fields: ['id', 'name'] } },
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'worker',
|
||||
scope: {
|
||||
|
|
Loading…
Reference in New Issue