This commit is contained in:
burakovec
2025-10-03 10:00:04 +03:00
parent 0e3c6e658f
commit 2b3b09c88b
8 changed files with 105 additions and 24 deletions

View File

@ -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>

View File

@ -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)