feat: refs #8422 add Vehicle DMS import functionality and routing
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
4a2074dc9d
commit
8f0a4da245
|
@ -0,0 +1,76 @@
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
|
import FormModelPopup from 'components/FormModelPopup.vue';
|
||||||
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
|
||||||
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
const emit = defineEmits(['onDataSaved']);
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
const { notify } = useNotify();
|
||||||
|
const route = useRoute();
|
||||||
|
|
||||||
|
const dmsOptions = ref([]);
|
||||||
|
const dmsId = ref(null);
|
||||||
|
|
||||||
|
const importDms = async () => {
|
||||||
|
try {
|
||||||
|
if (!dmsId.value) throw new Error(t(`The document identifier can't be empty`));
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
vehicleFk: route.params.id,
|
||||||
|
dmsFk: dmsId.value,
|
||||||
|
};
|
||||||
|
|
||||||
|
await axios.post('vehicleDms', data);
|
||||||
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
|
dmsId.value = null;
|
||||||
|
emit('onDataSaved');
|
||||||
|
} catch (e) {
|
||||||
|
throw new Error(e.message);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<FetchData
|
||||||
|
url="Dms"
|
||||||
|
:filter="{ fields: ['id'], order: 'id ASC' }"
|
||||||
|
auto-load
|
||||||
|
@on-fetch="(data) => (dmsOptions = data)"
|
||||||
|
/>
|
||||||
|
<FormModelPopup
|
||||||
|
url-create="genera"
|
||||||
|
model="DmsImport"
|
||||||
|
:title="t('Select document id')"
|
||||||
|
:form-initial-data="{}"
|
||||||
|
:save-fn="importDms"
|
||||||
|
>
|
||||||
|
<template #form-inputs>
|
||||||
|
<VnRow>
|
||||||
|
<VnSelect
|
||||||
|
:label="t('Document')"
|
||||||
|
:options="dmsOptions"
|
||||||
|
hide-selected
|
||||||
|
option-label="id"
|
||||||
|
option-value="id"
|
||||||
|
v-model="dmsId"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
</template>
|
||||||
|
</FormModelPopup>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
Select document id: Introduzca id de gestion documental
|
||||||
|
Document: Documento
|
||||||
|
The document indentifier can't be empty: El número de documento no puede estar vacío
|
||||||
|
</i18n>
|
|
@ -0,0 +1,46 @@
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
|
import VnDmsList from 'src/components/common/VnDmsList.vue';
|
||||||
|
import VehicleDmsImportForm from 'src/pages/Route/Vehicle/Card/VehicleDmsImportForm.vue';
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
const dmsListRef = ref(null);
|
||||||
|
const showImportDialog = ref(false);
|
||||||
|
|
||||||
|
const onDataSaved = () => dmsListRef.value.dmsRef.fetch();
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<VnDmsList
|
||||||
|
ref="dmsListRef"
|
||||||
|
model="VehicleDms"
|
||||||
|
update-model="vehicles"
|
||||||
|
delete-model="VehicleDms"
|
||||||
|
download-model="dms"
|
||||||
|
default-dms-code="vehicles"
|
||||||
|
filter="vehicleFk"
|
||||||
|
/>
|
||||||
|
<QDialog v-model="showImportDialog">
|
||||||
|
<VehicleDmsImportForm @on-data-saved="onDataSaved()" />
|
||||||
|
</QDialog>
|
||||||
|
<QPageSticky position="bottom-right" :offset="[25, 90]">
|
||||||
|
<QBtn
|
||||||
|
fab
|
||||||
|
color="primary"
|
||||||
|
icon="file_copy"
|
||||||
|
@click="showImportDialog = true"
|
||||||
|
class="fill-icon"
|
||||||
|
>
|
||||||
|
<QTooltip>
|
||||||
|
{{ t('Import from existing') }}
|
||||||
|
</QTooltip>
|
||||||
|
</QBtn>
|
||||||
|
</QPageSticky>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
Import from existing: Importar desde existente
|
||||||
|
</i18n>
|
|
@ -166,7 +166,10 @@ const vehicleCard = {
|
||||||
component: () => import('src/pages/Route/Vehicle/Card/VehicleCard.vue'),
|
component: () => import('src/pages/Route/Vehicle/Card/VehicleCard.vue'),
|
||||||
redirect: { name: 'VehicleSummary' },
|
redirect: { name: 'VehicleSummary' },
|
||||||
meta: {
|
meta: {
|
||||||
menu: ['VehicleBasicData'],
|
menu: [
|
||||||
|
'VehicleBasicData',
|
||||||
|
'VehicleDms',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
@ -187,6 +190,15 @@ const vehicleCard = {
|
||||||
},
|
},
|
||||||
component: () => import('src/pages/Route/Vehicle/Card/VehicleBasicData.vue'),
|
component: () => import('src/pages/Route/Vehicle/Card/VehicleBasicData.vue'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'VehicleDms',
|
||||||
|
path: 'dms',
|
||||||
|
meta: {
|
||||||
|
title: 'dms',
|
||||||
|
icon: 'cloud_upload',
|
||||||
|
},
|
||||||
|
component: () => import('src/pages/Route/Vehicle/VehicleDms.vue'),
|
||||||
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue