diff --git a/static/modules/finance.js b/static/modules/finance.js index 3b5f922..c4e5ce5 100644 --- a/static/modules/finance.js +++ b/static/modules/finance.js @@ -105,15 +105,12 @@ function renderFinance() { const defaultMonth2 = now2.getFullYear() + "-" + String(now2.getMonth()+1).padStart(2,"0"); if (!state.finMonth) state.finMonth = defaultMonth2; if (state.finQuarter === undefined) state.finQuarter = Math.floor(now2.getMonth() / 3); - const monthSet2 = new Set([defaultMonth2]); - pfs.forEach(pf => { let bd = []; try { bd = JSON.parse(pf.budget_data || "[]"); } catch(e) {} bd.forEach(b => { if (b.month) monthSet2.add(b.month); }); }); - const allMonths = [...monthSet2].sort().reverse(); - const qLabels2 = ["Q1 (1-3月)","Q2 (4-6月)","Q3 (7-9月)","Q4 (10-12月)"]; - const toolMonthSelect = allMonths.map(m => '').join(""); - const toolQuarterSelect = qLabels2.map((l,i) => '').join(""); - const toolDateSelect = state.finView==='monthly'?'月份:':state.finView==='quarterly'?'季度:':''; - - const finHeaderBase = `视图:${toolDateSelect}`; + const qLabels = ['Q1','Q2','Q3','Q4']; + const qMonths = [[1,2,3],[4,5,6],[7,8,9],[10,11,12]]; + const nowD = new Date(); + const activeQ = state.finQuarter !== undefined ? state.finQuarter : Math.floor(nowD.getMonth() / 3); + const activeMonths = qMonths[activeQ]; + const finHeaderBase = `
|按季度:${qLabels.map((q,i) => ``).join('')}|按月度:${activeMonths.map(m => { const ms = `2026-${String(m).padStart(2,'0')}`; return ``; }).join('')}
`; const finAddBtn = ``; const finFilterTabs = `
`; diff --git a/static/modules/plan.js b/static/modules/plan.js index 5375c60..f1104f8 100644 --- a/static/modules/plan.js +++ b/static/modules/plan.js @@ -103,25 +103,22 @@ function renderPlan() { const defaultMonth2 = now2.getFullYear() + "-" + String(now2.getMonth()+1).padStart(2,"0"); if (!state.planMonth) state.planMonth = defaultMonth2; if (state.planQuarter === undefined) state.planQuarter = Math.floor(now2.getMonth() / 3); - const monthSet2 = new Set([defaultMonth2]); - pfs.forEach(pf => { let bd = []; try { bd = JSON.parse(pf.budget_data || "[]"); } catch(e) {} bd.forEach(b => { if (b.month) monthSet2.add(b.month); }); }); - const allMonths = [...monthSet2].sort().reverse(); - const qLabels2 = ["Q1 (1-3月)","Q2 (4-6月)","Q3 (7-9月)","Q4 (10-12月)"]; - const toolMonthSelect = allMonths.map(m => '').join(""); - const toolQuarterSelect = qLabels2.map((l,i) => '').join(""); - const toolDateSelect = state.planView==='monthly'?'月份:':state.planView==='quarterly'?'季度:':''; - - const finHeaderBase = `视图:${toolDateSelect}`; + const qLabels = ['Q1','Q2','Q3','Q4']; + const qMonths = [[1,2,3],[4,5,6],[7,8,9],[10,11,12]]; + const nowD = new Date(); + const activeQ = state.planQuarter !== undefined ? state.planQuarter : Math.floor(nowD.getMonth() / 3); + const activeMonths = qMonths[activeQ]; + const finHeaderBase = `
|按季度:${qLabels.map((q,i) => ``).join('')}|按月度:${activeMonths.map(m => { const ms = `2026-${String(m).padStart(2,'0')}`; return ``; }).join('')}
`; const finAddBtn = ``; const planFilterTabs = `
`; document.querySelector("#plan").innerHTML = `
+ ${planFilterTabs}
计划提醒:计划也是预算,只有真正能够列出计划的预算,才有靠谱的落地可能性
- ${planFilterTabs} ${state.planFilter !== 'expense' && state.planFilter !== 'overview' ? card(`
${finHeaderBase}
${finAddBtn}
`, "p-4") : ''}