fix : 페이지네이션 row 설정 에러 발생

This commit is contained in:
Yesol Choi
2025-05-28 11:03:14 +09:00
parent 7f8638d0fb
commit bd63114c80

View File

@@ -12,14 +12,17 @@ onBeforeMount(async () => {
const masks = ref({
modelValue: 'YYYY-MM-DD',
})
const totalItems = ref(0) // 전체 아이템 수
const currentPage = ref(0) // 현재 페이지
const itemsPerPage = 8
const searchParamsList = reactive({
cateCd : '', //분야코드
stCd : '', //등록상태
regNm : '', //담당자
regSdt: '',//등록시작일
regEdt: '',//등록종료일
page: 1,//페이지
row: 5 //아이템갯수
})
const params = reactive({
sessionUser:'',
@@ -40,20 +43,27 @@ async function getPriceListData(){
before30.setDate(today.getDate() - 30)
const after30 = new Date()
after30.setDate(today.getDate() + 30)
after30.setDate(today.getDate())
const priceBase = {
params:{
regSdt: formatDatefromObject(before30),
regEdt: formatDatefromObject(after30),
page: searchParamsList.page,
row: searchParamsList.row
page: Number.parseInt(route.query.page as string) || 1,
row: 10
}
}
const result = await getPriceList(priceBase)
params.priceData = result.content
//페이지 관련 값 설정
currentPage.value = result.pageable.pageNumber + 1
totalItems.value = result.totalElements
console.log("currentPage.value",currentPage.value)
console.log("totalItems.value",totalItems.value)
}
const route = useRoute()
const searchPrice = async () => {
const searchParams = {
params: {
cateCd : searchParamsList.cateCd, //분야코드
@@ -61,12 +71,20 @@ const searchPrice = async () => {
regNm : searchParamsList.regNm, //담당자
regSdt: formatDatefromString(searchParamsList.regSdt),//등록시작일
regEdt: formatDatefromString(searchParamsList.regEdt),//등록종료일
page: 1,//페이지
row: 3 //아이템갯수
page: Number.parseInt(route.query.page as string) || 1,//페이지
row: 10 //아이템갯수
}
}
console.log("searchParams", Number.parseInt(route.query.page as string))
const result = await getPriceList(searchParams)
params.priceData = result.content
currentPage.value = null
totalItems.value = null
//페이지 관련 값 설정
currentPage.value = result.pageable.pageNumber + 1
totalItems.value = result.totalElements
console.log("currentPage.value",currentPage.value)
console.log("totalItems.value",totalItems.value)
}
function getPriceDetail(){
@@ -77,6 +95,10 @@ function getPriceDetail(){
router.push({ path: '/app/priceDetail', state: { key: arguments[0].prcsNo }})
}
}
watch(() => route.query.page, (newPage) => {
searchPrice()
})
</script>
<template>
@@ -115,6 +137,7 @@ function getPriceDetail(){
v-model="searchParamsList.regNm"
class="input custom-text-filter"
placeholder="담당자"
@keydown.enter="searchPrice"
>
</VControl>
</VField>
@@ -211,7 +234,14 @@ function getPriceDetail(){
등록
</VButton>
</VButtons>
<VFlexPagination
:item-per-page="itemsPerPage"
:total-items="totalItems"
:current-page="currentPage"
:max-links-displayed="5"
/>
</div>
</template>
<style scoped lang="scss">