From 81436a164170ef4018c5c115330f63ebe88b329f Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 27 Mar 2024 12:02:57 +0100 Subject: [PATCH] refs #6321 feat changeState --- src/pages/Ticket/Negative/NegativeOriginDialog.vue | 12 ++++++++---- src/pages/Ticket/Negative/TicketLackDialog.vue | 12 ++++++++---- src/pages/Ticket/Negative/TicketLackList.vue | 1 + 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/pages/Ticket/Negative/NegativeOriginDialog.vue b/src/pages/Ticket/Negative/NegativeOriginDialog.vue index 7c0639f1a..64c8215cc 100644 --- a/src/pages/Ticket/Negative/NegativeOriginDialog.vue +++ b/src/pages/Ticket/Negative/NegativeOriginDialog.vue @@ -5,21 +5,25 @@ import axios from 'axios'; import { useDialogPluginComponent } from 'quasar'; const { t } = useI18n(); -const selectedRows = ref([]); const showNegativeOriginDialog = ref(false); const reasonegativeOriginDialog = ref(null); const { dialogRef, onDialogHide } = useDialogPluginComponent(); - +const $props = defineProps({ + selectedRows: { + type: Array, + default: () => [], + }, +}); const updateNegativeOrigin = async () => { showNegativeOriginDialog.value = true; - const negativeOrigins = selectedRows.value.map(({ itemFk, lack }) => ({ + const negativeOrigins = $props.selectedRows.map(({ itemFk, lack }) => ({ itemFk, negativeType: reasonegativeOriginDialog.value, lack, })); try { - await axios.post(`Tickets/itemLack`, negativeOrigins); + await axios.post(`Tickets/itemLackOrigin`, negativeOrigins); dialogRef.value.hide(); } catch (err) { return err; diff --git a/src/pages/Ticket/Negative/TicketLackDialog.vue b/src/pages/Ticket/Negative/TicketLackDialog.vue index 7cb61c364..254366f43 100644 --- a/src/pages/Ticket/Negative/TicketLackDialog.vue +++ b/src/pages/Ticket/Negative/TicketLackDialog.vue @@ -2,6 +2,7 @@ import { computed, ref } from 'vue'; import { useI18n } from 'vue-i18n'; import { QBtn, QCheckbox } from 'quasar'; +import axios from 'axios'; import VnPaginate from 'src/components/ui/VnPaginate.vue'; import FetchData from 'src/components/FetchData.vue'; @@ -33,7 +34,6 @@ const copyOriginalRowsData = (rows) => { const getInputEvents = (colField, props) => ({ 'update:modelValue': () => saveChange(colField, props), 'keyup.enter': () => saveChange(colField, props), - blur: () => saveChange(colField, props), }); const saveChange = async (field, { rowIndex, row }) => { try { @@ -65,8 +65,12 @@ const saveChange = async (field, { rowIndex, row }) => { // Buscador_Ticket (vNewTicketFk) // Call Form_Requery break; - case 'stateId': + case 'code': // Call ticketChangeState(ticketFk, stateFk) + await axios.post(`Tickets/state`, { + ticketFk: row.ticketFk, + code: row[field], + }); break; case 'quantity': @@ -135,7 +139,7 @@ const tableColumnComponents = computed(() => ({ filterValue: null, props: { - 'option-value': 'id', + 'option-value': 'code', 'option-label': 'name', 'emit-value': true, 'map-options': true, @@ -249,7 +253,7 @@ const columns = computed(() => [ { name: 'state', label: t('ticket.negative.detail.state'), - field: 'stateId', + field: 'code', align: 'left', }, { diff --git a/src/pages/Ticket/Negative/TicketLackList.vue b/src/pages/Ticket/Negative/TicketLackList.vue index 7917d5b65..98e37a4c5 100644 --- a/src/pages/Ticket/Negative/TicketLackList.vue +++ b/src/pages/Ticket/Negative/TicketLackList.vue @@ -300,6 +300,7 @@ const updateNegativeOrigin = async () => { ref="originDialogRef" @hide="onDialogHide" v-model="showNegativeOriginDialog" + :selected-rows="selectedRows" >