预算选择默认年份规则调整

master
weizong song 1 month ago
parent ee148d3c45
commit 851f7b5e7a

@ -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 () => {

Loading…
Cancel
Save