fix: refactor createTicket function to use formData directly and remove unused reactive state
gitea/salix-front/pipeline/pr-master This commit looks good
Details
gitea/salix-front/pipeline/pr-master This commit looks good
Details
This commit is contained in:
parent
794afc77c4
commit
bcdb89d1a7
|
@ -1,5 +1,4 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive } from 'vue';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
|
||||||
|
@ -30,31 +29,29 @@ const { t } = useI18n();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
|
|
||||||
const newTicketFormData = reactive({});
|
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
|
|
||||||
const createTicket = async () => {
|
async function createTicket(formData) {
|
||||||
const expeditionIds = $props.selectedExpeditions.map((expedition) => expedition.id);
|
const expeditionIds = $props.selectedExpeditions.map((expedition) => expedition.id);
|
||||||
const params = {
|
const params = {
|
||||||
clientId: $props.ticket.clientFk,
|
clientId: $props.ticket.clientFk,
|
||||||
landed: newTicketFormData.landed,
|
landed: formData.landed,
|
||||||
warehouseId: $props.ticket.warehouseFk,
|
warehouseId: $props.ticket.warehouseFk,
|
||||||
addressId: $props.ticket.addressFk,
|
addressId: $props.ticket.addressFk,
|
||||||
agencyModeId: $props.ticket.agencyModeFk,
|
agencyModeId: $props.ticket.agencyModeFk,
|
||||||
routeId: newTicketFormData.routeFk,
|
routeId: formData.routeFk,
|
||||||
expeditionIds: expeditionIds,
|
expeditionIds: expeditionIds,
|
||||||
};
|
};
|
||||||
|
|
||||||
const { data } = await axios.post('Expeditions/moveExpeditions', params);
|
const { data } = await axios.post('Expeditions/moveExpeditions', params);
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
router.push({ name: 'TicketSummary', params: { id: data.id } });
|
router.push({ name: 'TicketSummary', params: { id: data.id } });
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FormModelPopup
|
<FormModelPopup
|
||||||
model="expeditionNewTicket"
|
model="expeditionNewTicket"
|
||||||
:form-initial-data="newTicketFormData"
|
:form-initial-data="{}"
|
||||||
:save-fn="createTicket"
|
:save-fn="createTicket"
|
||||||
>
|
>
|
||||||
<template #form-inputs="{ data }">
|
<template #form-inputs="{ data }">
|
||||||
|
|
Loading…
Reference in New Issue