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';
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;

View File

@ -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',
},
{

View File

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