diff --git a/src/views/payment/PaymentQuery.vue b/src/views/payment/PaymentQuery.vue index fd00668..8e80876 100644 --- a/src/views/payment/PaymentQuery.vue +++ b/src/views/payment/PaymentQuery.vue @@ -1504,6 +1504,14 @@ const loadConfirmYearOptions = async () => { } } +const getCurrentYearOptionValue = () => { + const currentYear = new Date().getFullYear() + const matched = (confirmYearOptions.value || []).find( + (y) => String(y.year) === String(currentYear) + ) + return matched ? matched.value : null +} + const loadConfirmTree = async (yearId) => { if (!yearId) return confirmTreeLoading.value = true @@ -1734,7 +1742,11 @@ const initBudgetConfirmData = async () => { // 选择年度 if (!confirmYearId.value) { const resolved = await resolveYearIdByValue(parsed) - confirmYearId.value = resolved || (confirmYearOptions.value[0] && confirmYearOptions.value[0].value) || null + confirmYearId.value = + resolved || + getCurrentYearOptionValue() || + (confirmYearOptions.value[0] && confirmYearOptions.value[0].value) || + null } if (confirmYearId.value) { @@ -2134,4 +2146,3 @@ onMounted(async () => { -