From cbbd5b2abeb8ca7efffe8a445ce8acc306ec5ab2 Mon Sep 17 00:00:00 2001 From: burakovec Date: Thu, 26 Mar 2026 12:37:32 +0300 Subject: [PATCH] Enhance TabPiyangoKatilimciListesi component by adding conditional rendering for job completion statistics, including inserted and duplicate counts. Implement toast notifications for handling upload conflicts and ensure proper cleanup of upload handlers on component unmount. This improves user feedback and data management during file uploads. --- .../components/TabPiyangoKatilimciListesi.vue | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/module/cekilisler/components/TabPiyangoKatilimciListesi.vue b/src/module/cekilisler/components/TabPiyangoKatilimciListesi.vue index c2ec219..5e9760d 100644 --- a/src/module/cekilisler/components/TabPiyangoKatilimciListesi.vue +++ b/src/module/cekilisler/components/TabPiyangoKatilimciListesi.vue @@ -86,6 +86,10 @@ {{ job.fileName }} {{ statusText(job.status) }} {{ job.progress }}% + + +{{ job.insertedCount ?? 0 }} + + {{ formatDate(job.createdAt) }} @@ -164,13 +168,16 @@ import { useDialogStore } from '@/components/global/dialogStore' const dialogStore = useDialogStore() + const toastStore = useToastStore() import { usePiyangoOnayStore } from '../stores/piyangoOnayStore' const piyangoOnayStore = usePiyangoOnayStore() import { usePiyangoOnayService } from '../service/piyangoOnayService' const piyangoOnayService = usePiyangoOnayService() - import { connectToHub, onProgress, onInsertProgress, onCompleted, onError } from '../service/signalrService' + import { onUnmounted } from 'vue' + import { connectToHub, onProgress, onInsertProgress, onCompleted, onError, removeUploadHandlers } from '../service/signalrService' + import { useToastStore } from '@/components/global/toastStore' const uploadProgressValue = ref(0) const uploadProgressPanel = ref(false) @@ -299,6 +306,7 @@ uploadJobs.value = cekilisId !== null ? await piyangoKatilimciService.GetUploadJobs(cekilisId) : [] uploadJobsLoading.value = false + removeUploadHandlers() // İşleniyor durumundaki job varsa SignalR ile abone ol (gerçek zamanlı progress almak için) const processingJob = uploadJobs.value.find( (j: Record) => j.status?.toLowerCase() === 'processing' @@ -361,6 +369,7 @@ return } + removeUploadHandlers() uploadProgressValue.value = 0 uploadProgressPanel.value = true @@ -389,10 +398,22 @@ `Katilimci/ExcelleYukle/${piyangoStore.selectedLottery}?connectionId=${connId}`, { data: formData, - headers: { 'Content-Type': 'multipart/form-data' } + headers: { 'Content-Type': 'multipart/form-data' }, + skipErrorForStatuses: [409] } ) + if (response?._error && response.status === 409) { + uploadProgressPanel.value = false + const msg = response.data?.message || 'Bu çekiliş için zaten devam eden bir Excel yükleme işlemi var.' + toastStore.AddToast(msg, 'alert', 6000) + if (response.data?.existingJobId) { + refreshUploadJobsAndPollProcessing() + OpenUploadDetail(response.data.existingJobId) + } + return + } + if (response !== 'errorfalse' && response?.jobId) { startPolling(response.jobId) } else { @@ -511,6 +532,11 @@ startPollingForExistingJob(processingJob.guid) } } + + onUnmounted(() => { + stopPolling() + removeUploadHandlers() + })