fix(history): search year
This commit is contained in:
parent
c966e1d961
commit
d03c7f35fe
2 changed files with 23 additions and 26 deletions
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, watch } from 'vue'
|
||||
import { onMounted, ref, watch } from 'vue'
|
||||
|
||||
import { useCounterMixin } from '@/stores/mixin'
|
||||
import { useChekIn } from '@/stores/chekin'
|
||||
|
|
@ -27,14 +27,11 @@ const props = defineProps({
|
|||
})
|
||||
const emit = defineEmits(['update:year'])
|
||||
|
||||
const filterYear = ref<number>(
|
||||
stores.year ? stores.year : calculateFiscalYear(new Date())
|
||||
) //ปีงบประมาณ
|
||||
const filterYear = ref<number>(calculateFiscalYear(new Date())) //ปีงบประมาณ
|
||||
const titleName = ref<string>('เพิ่มรายการลงเวลากรณีพิเศษ') //หัว popup
|
||||
const dateMonth = ref<DataDateMonthObject>({
|
||||
month: new Date().getMonth(),
|
||||
year:
|
||||
stores.year && !isNaN(stores.year) ? stores.year : new Date().getFullYear(),
|
||||
year: new Date().getFullYear(),
|
||||
})
|
||||
const modalPopup = ref<boolean>(false) // modal เพิ่มรายการลงเวลากรณีพิเศษ
|
||||
|
||||
|
|
@ -46,6 +43,8 @@ function filterYearFn(type: string) {
|
|||
const year = type === 'year' ? filterYear.value : dateMonth.value.year
|
||||
const month = dateMonth.value.month
|
||||
|
||||
console.log(year, month)
|
||||
|
||||
// ตรวจสอบค่าก่อนส่ง
|
||||
if (isNaN(Number(year)) || isNaN(Number(month))) {
|
||||
console.warn('Invalid year or month value:', { year, month })
|
||||
|
|
@ -91,15 +90,19 @@ const monthYearThai = (val: DataDateMonthObject) => {
|
|||
return monthYear2Thai(month, year)
|
||||
}
|
||||
|
||||
/**
|
||||
* watch การเปลี่ยนแปลงของ stores.year
|
||||
*/
|
||||
watch(
|
||||
() => stores.year,
|
||||
(newYear) => {
|
||||
dateMonth.value.year = newYear
|
||||
}
|
||||
)
|
||||
onMounted(() => {
|
||||
filterYearFn(props.tab === 'history' ? 'year' : 'month')
|
||||
})
|
||||
|
||||
// /**
|
||||
// * watch การเปลี่ยนแปลงของ stores.year
|
||||
// */
|
||||
// watch(
|
||||
// () => stores.year,
|
||||
// (newYear) => {
|
||||
// dateMonth.value.year = newYear
|
||||
// }
|
||||
// )
|
||||
</script>
|
||||
<template>
|
||||
<div class="items-center col-12 row q-pb-sm">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue