signalr
This commit is contained in:
@ -10,7 +10,7 @@
|
||||
</h1>
|
||||
<div class="section-header-buttons-c">
|
||||
<icon-button
|
||||
toRoute="/piyangolar/piyango-listesi"
|
||||
@click="goToListWithFilter"
|
||||
icon="list"
|
||||
iconClass="ico-section ico-section-header-btn" />
|
||||
</div>
|
||||
@ -60,9 +60,11 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { useDateStore } from '@/stores/dateStore'
|
||||
import { useRouter } from 'vue-router'
|
||||
import icourl from '@/assets/images/icons.svg'
|
||||
|
||||
const dateStore = useDateStore()
|
||||
const router = useRouter()
|
||||
|
||||
const props = defineProps<{
|
||||
tableData: Record<string, any>
|
||||
@ -76,6 +78,7 @@
|
||||
dateKey: string
|
||||
iconBack: string
|
||||
total: number
|
||||
filterParams?: Record<string, any>
|
||||
}>()
|
||||
const totalData = ref<number>(props.total)
|
||||
|
||||
@ -92,4 +95,18 @@
|
||||
const OnClick = (e: Event, row: object) => {
|
||||
emit('click', row)
|
||||
}
|
||||
|
||||
const goToListWithFilter = () => {
|
||||
const query: Record<string, any> = {}
|
||||
|
||||
// Filtre parametrelerini query'ye ekle
|
||||
if (props.filterParams) {
|
||||
Object.assign(query, props.filterParams)
|
||||
}
|
||||
|
||||
router.push({
|
||||
path: '/piyangolar/piyango-listesi',
|
||||
query: query
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -590,6 +590,17 @@
|
||||
searchForm.value = false
|
||||
mobileButtons.value = false
|
||||
}
|
||||
|
||||
// Filtre başlığını almak için yardımcı fonksiyon
|
||||
const getFilterTitle = (key: string): string => {
|
||||
const filterTitles: Record<string, string> = {
|
||||
'durumId': 'Durum',
|
||||
'piyangoAmacId': 'Piyango Amacı',
|
||||
'cekilisYontemiId': 'Çekiliş Yöntemi'
|
||||
}
|
||||
return filterTitles[key] || key
|
||||
}
|
||||
|
||||
onBeforeMount(() => {
|
||||
if (globalStore.screenWidth >= globalStore.breakPoints.tabletp)
|
||||
mobileButtons.value = true
|
||||
@ -598,6 +609,21 @@
|
||||
RouteSearchControl()
|
||||
RouteFilterControl()
|
||||
|
||||
// URL query parametrelerini kontrol et ve filtreleri uygula (ilk istekten önce)
|
||||
if (Object.keys(route.query).length > 0) {
|
||||
Object.keys(route.query).forEach(key => {
|
||||
const value = route.query[key]
|
||||
if (value && typeof value === 'string') {
|
||||
// Filtre parametresini filterParams'a ekle
|
||||
filterParams[key] = {
|
||||
val: value,
|
||||
op: '=',
|
||||
title: getFilterTitle(key)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (props.apiList !== undefined) GetLocalData()
|
||||
|
||||
window.addEventListener('resize', Resize)
|
||||
|
||||
@ -148,6 +148,8 @@
|
||||
const uploadProgressValue = ref(0)
|
||||
const uploadProgressPanel = ref(false)
|
||||
|
||||
const connectionId = ref('')
|
||||
|
||||
const tableHeader = ref<Record<string, any>[]>([
|
||||
{
|
||||
name: 'cekilisKatilimSiraNo',
|
||||
@ -252,7 +254,8 @@
|
||||
else return ''
|
||||
})
|
||||
|
||||
const AddNewDocument = () => {
|
||||
const AddNewDocument = async () => {
|
||||
connectionId.value = await connectToHub()
|
||||
dataStore.panelData = {
|
||||
title: '',
|
||||
file: ''
|
||||
@ -277,7 +280,7 @@
|
||||
piyangoKatilimciStore.katilimciUserPanel = true
|
||||
}
|
||||
const FileUpload = async () => {
|
||||
const connectionId = await connectToHub()
|
||||
// Mevcut bağlantıyı kullan (AddNewDocument'te açıldı)
|
||||
|
||||
// Progress modal'ı aç
|
||||
uploadProgressValue.value = 0
|
||||
@ -302,7 +305,7 @@
|
||||
)
|
||||
console.log(dataStore.panelData)
|
||||
const response = await dataStore.dataPost(
|
||||
`Katilimci/ExcelleYukle/${piyangoStore.selectedLottery}?connectionId=${connectionId}`,
|
||||
`Katilimci/ExcelleYukle/${piyangoStore.selectedLottery}?connectionId=${connectionId.value}`,
|
||||
{
|
||||
data: formData,
|
||||
headers: { 'Content-Type': 'multipart/form-data' }
|
||||
|
||||
@ -82,9 +82,7 @@
|
||||
},
|
||||
{
|
||||
name: 'aciklama',
|
||||
title: 'Açıklama',
|
||||
sort: true,
|
||||
style: { width: '30%' }
|
||||
title: 'Açıklama'
|
||||
},
|
||||
{
|
||||
dosyaUrl: 'aciklama',
|
||||
@ -95,7 +93,19 @@
|
||||
}
|
||||
},
|
||||
style: { width: '20%' }
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'izinSayisi',
|
||||
title: 'İzin Sayısı'
|
||||
},
|
||||
{
|
||||
name: 'izinTarihi',
|
||||
title: 'İzin Tarihi'
|
||||
},
|
||||
{
|
||||
name: 'izinAciklamasi',
|
||||
title: 'İzin Açıklaması'
|
||||
},
|
||||
])
|
||||
|
||||
const EditOnay = (d: Record<string, any>) => {
|
||||
|
||||
@ -1,19 +1,33 @@
|
||||
import * as signalR from '@microsoft/signalr'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
|
||||
let connection: signalR.HubConnection
|
||||
let connectionId = ''
|
||||
|
||||
export const connectToHub = async () => {
|
||||
console.log('Connecting to SignalR Hub...')
|
||||
// Mevcut bağlantı varsa kapat
|
||||
if (connection && connection.state === signalR.HubConnectionState.Connected) {
|
||||
await connection.stop()
|
||||
}
|
||||
|
||||
connection = new signalR.HubConnectionBuilder()
|
||||
.withUrl(import.meta.env.VITE_SOCKET_URL, {
|
||||
withCredentials: false // Bu zorunlu, yoksa cookie vs gönderilmez
|
||||
}) // backend adresine göre düzenle
|
||||
withCredentials: true,
|
||||
skipNegotiation: true, // WebSocket kullanırken negotiation atlanabilir
|
||||
transport: signalR.HttpTransportType.WebSockets
|
||||
})
|
||||
.withAutomaticReconnect()
|
||||
.build()
|
||||
|
||||
// Eventleri ekle
|
||||
onProgress((data) => console.log('progress', data))
|
||||
onInsertProgress((data) => console.log('insert progress', data))
|
||||
onCompleted((data) => console.log('completed', data))
|
||||
onError((data) => console.log('error', data))
|
||||
|
||||
await connection.start()
|
||||
connectionId = connection.connectionId || uuidv4() // SignalR id'si ya da frontend'de de guid üretilebilir
|
||||
connectionId = await connection.invoke<string>('GetConnectionId')
|
||||
console.log('Connected to SignalR Hub with Connection ID:', connectionId)
|
||||
return connectionId
|
||||
}
|
||||
|
||||
|
||||
@ -23,7 +23,8 @@
|
||||
</AdminLayout>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onBeforeMount } from 'vue'
|
||||
import { ref, computed, onBeforeMount, onMounted } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
|
||||
import AdminLayout from '@/layouts/AdminLayout.vue'
|
||||
import { useDateStore } from '@/stores/dateStore'
|
||||
@ -39,6 +40,7 @@
|
||||
const piyangoServices = usePiyangoServices()
|
||||
|
||||
import router from '@/router'
|
||||
const route = useRoute()
|
||||
|
||||
const loaded = ref<boolean>(false)
|
||||
const apiList = ref<string>('')
|
||||
@ -241,4 +243,13 @@
|
||||
|
||||
loaded.value = true
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
// URL query parametrelerini kontrol et ve filtreleri uygula
|
||||
if (route.query.durumId) {
|
||||
// Filtre parametresini ListTableContent bileşenine iletmek için
|
||||
// Bu parametre otomatik olarak ListTableContent tarafından işlenecek
|
||||
console.log('Durum filtresi uygulanıyor:', route.query.durumId)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@ -215,18 +215,13 @@
|
||||
}
|
||||
const GetIkramiyeTotalValues = async () => {
|
||||
console.log(piyangoStore, 'piyangoStore')
|
||||
let data = await dataStore.dataGet('Ikramiye/Cekilis/' + piyangoStore.selectedLottery)
|
||||
let data = await dataStore.dataGet('Ikramiye/Cekilis/' + piyangoStore.selectedLottery +'?pageNumber=0')
|
||||
//todo:page 0
|
||||
if (data !== 'errorfalse') {
|
||||
piyangoIkramiyeStore.totalIkramiyeValue = data.toplamdeger
|
||||
}
|
||||
}
|
||||
const BasvuruBedeliDialog = () => {
|
||||
console.log(muhasebeSettingsStore.muhasebeSettingsForm.basvuruBedeli)
|
||||
console.log(calculatedBasvuruKdv.value)
|
||||
console.log(
|
||||
Number(muhasebeSettingsStore.muhasebeSettingsForm.basvuruBedeli) +
|
||||
calculatedBasvuruKdv.value
|
||||
)
|
||||
dialogStore.CreateDialog({
|
||||
title: 'Başvuru Bedelini Muhasebeleştir',
|
||||
id: 'basvurubedelimuhasebelestir',
|
||||
@ -268,6 +263,7 @@
|
||||
})
|
||||
}
|
||||
const BasvuruBedeliMuhasebelestir = async () => {
|
||||
console.log('basvuru bedeli muhasebelestir')
|
||||
let data = await dataStore.dataGet(
|
||||
'MuhasebeSettings/BasvuruBedeli/' + piyangoStore.selectedLottery
|
||||
)
|
||||
|
||||
@ -10,7 +10,8 @@
|
||||
iconBack="waiting"
|
||||
:tableData="onayBekleyenPiyango"
|
||||
lineRoute="piyangolar/detay/"
|
||||
lineRouteKey="id" />
|
||||
lineRouteKey="id"
|
||||
:filterParams="{ durumId: 0 }" />
|
||||
<dash-piyango-liste
|
||||
v-if="loaded"
|
||||
title="İtiraz/Şikayet Edilen Piyangolar"
|
||||
@ -21,7 +22,8 @@
|
||||
iconBack="alert"
|
||||
:tableData="itirazEdilenPiyango"
|
||||
lineRoute="piyangolar/detay/"
|
||||
lineRouteKey="id" />
|
||||
lineRouteKey="id"
|
||||
:filterParams="{ durumId: 1 }" />
|
||||
|
||||
<dash-piyango-liste
|
||||
v-if="loaded"
|
||||
@ -33,7 +35,8 @@
|
||||
iconBack="next"
|
||||
:tableData="yaklasanPiyango"
|
||||
lineRoute="piyangolar/detay/"
|
||||
lineRouteKey="id" />
|
||||
lineRouteKey="id"
|
||||
:filterParams="{ baslangicTarihi: '>' + new Date().toISOString().split('T')[0] }"/>
|
||||
|
||||
<dash-piyango-liste
|
||||
v-if="loaded"
|
||||
@ -45,7 +48,8 @@
|
||||
iconBack="ok"
|
||||
:tableData="bitenPiyango"
|
||||
lineRoute="piyangolar/detay/"
|
||||
lineRouteKey="id" />
|
||||
lineRouteKey="id"
|
||||
:filterParams="{ bitisTarihi: '<' + new Date().toISOString().split('T')[0] }" />
|
||||
</AdminLayout>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
|
||||
Reference in New Issue
Block a user