refactor: refs #7553 added clickable event in transfer sales like Salix
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jon Elias 2024-09-13 12:07:45 +02:00
parent 4a0b92eded
commit c291ea267c
2 changed files with 14 additions and 3 deletions

View File

@ -28,7 +28,7 @@ const $props = defineProps({
const { t } = useI18n(); const { t } = useI18n();
const QPopupProxyRef = ref(null); const QPopupProxyRef = ref(null);
const transferFormRef = ref(null);
const _transfer = ref(); const _transfer = ref();
const transferLinesColumns = computed(() => [ const transferLinesColumns = computed(() => [
@ -80,6 +80,14 @@ const destinationTicketColumns = computed(() => [
}, },
]); ]);
const handleRowClick = (row) => {
console.log('row: ', row);
const ticketId = row.id;
if (transferFormRef.value) {
transferFormRef.value.transferSales(ticketId);
}
};
onMounted(() => (_transfer.value = $props.transfer)); onMounted(() => (_transfer.value = $props.transfer));
</script> </script>
@ -113,6 +121,7 @@ onMounted(() => (_transfer.value = $props.transfer));
:title="t('Destination ticket')" :title="t('Destination ticket')"
row-key="id" row-key="id"
class="full-width q-mt-md" class="full-width q-mt-md"
@row-click="(_, row) => handleRowClick(row)"
> >
<template #body-cell-address="{ row }"> <template #body-cell-address="{ row }">
<QTd @click.stop> <QTd @click.stop>
@ -134,10 +143,10 @@ onMounted(() => (_transfer.value = $props.transfer));
</template> </template>
<template #no-data> <template #no-data>
<TicketTransferForm v-bind="$props" /> <TicketTransferForm ref="transferFormRef" v-bind="$props" />
</template> </template>
<template #bottom> <template #bottom>
<TicketTransferForm v-bind="$props" /> <TicketTransferForm ref="transferFormRef" v-bind="$props" />
</template> </template>
</QTable> </QTable>
</QCard> </QCard>

View File

@ -47,6 +47,8 @@ const transferSales = async (ticketId) => {
if (data && data.id === $props.ticket.id) emit('refreshData'); if (data && data.id === $props.ticket.id) emit('refreshData');
else router.push({ name: 'TicketSale', params: { id: data.id } }); else router.push({ name: 'TicketSale', params: { id: data.id } });
}; };
defineExpose({ transferSales });
</script> </script>
<template> <template>