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" >