Commit 4fed56f6dfe3cee5eb36c74885a996268919d774
1 parent
30901683
fix: 报表默认当前月
Showing
2 changed files
with
7 additions
and
3 deletions
src/pages/OrderReport/components/OrderDualAxes.tsx
@@ -52,7 +52,6 @@ const OrderDualAxes = ({ data, statisticMethod, onXValueClick }) => { | @@ -52,7 +52,6 @@ const OrderDualAxes = ({ data, statisticMethod, onXValueClick }) => { | ||
52 | if (!yearFromXValue) { | 52 | if (!yearFromXValue) { |
53 | return; | 53 | return; |
54 | } | 54 | } |
55 | - console.log(pointData, '5656pointData'); | ||
56 | // // 减 1 获得目标年份 | 55 | // // 减 1 获得目标年份 |
57 | // const targetYear = String(Number(yearFromXValue) - 1); // "2024" | 56 | // const targetYear = String(Number(yearFromXValue) - 1); // "2024" |
58 | 57 |
src/pages/OrderReport/index.tsx
@@ -21,8 +21,13 @@ import OrderStatisticCard from './components/OrderStatisticCard'; | @@ -21,8 +21,13 @@ import OrderStatisticCard from './components/OrderStatisticCard'; | ||
21 | import './index.less'; | 21 | import './index.less'; |
22 | const OrderReportPage = () => { | 22 | const OrderReportPage = () => { |
23 | const [salesCodeOptions, setSalesCodeOptions] = useState([]); | 23 | const [salesCodeOptions, setSalesCodeOptions] = useState([]); |
24 | + const getCurrentMonth = () => { | ||
25 | + const month = new Date().getMonth(); // Returns a 0-based month (0-11) | ||
26 | + return month + 1; // To make it 1-based (1-12) | ||
27 | + }; | ||
28 | + const month = getCurrentMonth(); | ||
24 | const [selectedYear, setSelectedYear] = useState('2025'); | 29 | const [selectedYear, setSelectedYear] = useState('2025'); |
25 | - const [selectedMonth, setSelectedMonth] = useState('0'); | 30 | + const [selectedMonth, setSelectedMonth] = useState(month); |
26 | /** | 31 | /** |
27 | * 获取销售代码枚举,在复制和编辑的时候判断是否为旧的代码 | 32 | * 获取销售代码枚举,在复制和编辑的时候判断是否为旧的代码 |
28 | */ | 33 | */ |
@@ -45,7 +50,7 @@ const OrderReportPage = () => { | @@ -45,7 +50,7 @@ const OrderReportPage = () => { | ||
45 | }>(); | 50 | }>(); |
46 | const [statisticData, setStatisticData] = useState([]); | 51 | const [statisticData, setStatisticData] = useState([]); |
47 | const [loading, setLoading] = useState(false); | 52 | const [loading, setLoading] = useState(false); |
48 | - const [statisticsMethod, setStatisticsMethod] = useState('YEAR_STATISTICS'); | 53 | + const [statisticsMethod, setStatisticsMethod] = useState('MONTH_STATISTICS'); |
49 | // const onChange = (key: string) => { | 54 | // const onChange = (key: string) => { |
50 | // if (key === '本月') { | 55 | // if (key === '本月') { |
51 | // setStatisticsMethod('MONTH_STATISTICS'); | 56 | // setStatisticsMethod('MONTH_STATISTICS'); |