refs #6321 feat changeState

This commit is contained in:
Javier Segarra 2024-03-27 12:02:57 +01:00
parent d65caaad07
commit 81436a1641
3 changed files with 17 additions and 8 deletions

View File

@ -5,21 +5,25 @@ import axios from 'axios';
import { useDialogPluginComponent } from 'quasar'; import { useDialogPluginComponent } from 'quasar';
const { t } = useI18n(); const { t } = useI18n();
const selectedRows = ref([]);
const showNegativeOriginDialog = ref(false); const showNegativeOriginDialog = ref(false);
const reasonegativeOriginDialog = ref(null); const reasonegativeOriginDialog = ref(null);
const { dialogRef, onDialogHide } = useDialogPluginComponent(); const { dialogRef, onDialogHide } = useDialogPluginComponent();
const $props = defineProps({
selectedRows: {
type: Array,
default: () => [],
},
});
const updateNegativeOrigin = async () => { const updateNegativeOrigin = async () => {
showNegativeOriginDialog.value = true; showNegativeOriginDialog.value = true;
const negativeOrigins = selectedRows.value.map(({ itemFk, lack }) => ({ const negativeOrigins = $props.selectedRows.map(({ itemFk, lack }) => ({
itemFk, itemFk,
negativeType: reasonegativeOriginDialog.value, negativeType: reasonegativeOriginDialog.value,
lack, lack,
})); }));
try { try {
await axios.post(`Tickets/itemLack`, negativeOrigins); await axios.post(`Tickets/itemLackOrigin`, negativeOrigins);
dialogRef.value.hide(); dialogRef.value.hide();
} catch (err) { } catch (err) {
return err; return err;

View File

@ -2,6 +2,7 @@
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { QBtn, QCheckbox } from 'quasar'; import { QBtn, QCheckbox } from 'quasar';
import axios from 'axios';
import VnPaginate from 'src/components/ui/VnPaginate.vue'; import VnPaginate from 'src/components/ui/VnPaginate.vue';
import FetchData from 'src/components/FetchData.vue'; import FetchData from 'src/components/FetchData.vue';
@ -33,7 +34,6 @@ const copyOriginalRowsData = (rows) => {
const getInputEvents = (colField, props) => ({ const getInputEvents = (colField, props) => ({
'update:modelValue': () => saveChange(colField, props), 'update:modelValue': () => saveChange(colField, props),
'keyup.enter': () => saveChange(colField, props), 'keyup.enter': () => saveChange(colField, props),
blur: () => saveChange(colField, props),
}); });
const saveChange = async (field, { rowIndex, row }) => { const saveChange = async (field, { rowIndex, row }) => {
try { try {
@ -65,8 +65,12 @@ const saveChange = async (field, { rowIndex, row }) => {
// Buscador_Ticket (vNewTicketFk) // Buscador_Ticket (vNewTicketFk)
// Call Form_Requery // Call Form_Requery
break; break;
case 'stateId': case 'code':
// Call ticketChangeState(ticketFk, stateFk) // Call ticketChangeState(ticketFk, stateFk)
await axios.post(`Tickets/state`, {
ticketFk: row.ticketFk,
code: row[field],
});
break; break;
case 'quantity': case 'quantity':
@ -135,7 +139,7 @@ const tableColumnComponents = computed(() => ({
filterValue: null, filterValue: null,
props: { props: {
'option-value': 'id', 'option-value': 'code',
'option-label': 'name', 'option-label': 'name',
'emit-value': true, 'emit-value': true,
'map-options': true, 'map-options': true,
@ -249,7 +253,7 @@ const columns = computed(() => [
{ {
name: 'state', name: 'state',
label: t('ticket.negative.detail.state'), label: t('ticket.negative.detail.state'),
field: 'stateId', field: 'code',
align: 'left', align: 'left',
}, },
{ {

View File

@ -300,6 +300,7 @@ const updateNegativeOrigin = async () => {
ref="originDialogRef" ref="originDialogRef"
@hide="onDialogHide" @hide="onDialogHide"
v-model="showNegativeOriginDialog" v-model="showNegativeOriginDialog"
:selected-rows="selectedRows"
> >
</NegativeOriginDialog> </NegativeOriginDialog>
<!-- <QDialog <!-- <QDialog