| | |
| | | tableLoading.value = true; |
| | | const params = { |
| | | type: "", |
| | | state: |
| | | statisticsType.value === "day" |
| | | ? "æ¥" |
| | | : statisticsType.value === "month" |
| | | ? "æ" |
| | | : "å¹´", |
| | | }; |
| | | |
| | | // æé 请æ±åæ° |
| | |
| | | } else if (statisticsType.value === "month") { |
| | | if (searchForm.monthRange && searchForm.monthRange.length === 2) { |
| | | params.startDate = searchForm.monthRange[0] + "-01"; |
| | | params.endDate = searchForm.monthRange[1] + "-01"; |
| | | // è®¡ç®ææ° |
| | | const start = new Date(searchForm.monthRange[0] + "-01"); |
| | | const end = new Date(searchForm.monthRange[1] + "-01"); |
| | | params.days = |
| | | (end.getFullYear() - start.getFullYear()) * 12 + |
| | | (end.getMonth() - start.getMonth()) + |
| | | 1; |
| | | const [endYearStr, endMonthStr] = String(searchForm.monthRange[1]).split( |
| | | "-" |
| | | ); |
| | | const endYear = Number(endYearStr); |
| | | const endMonth = Number(endMonthStr); |
| | | const lastDay = new Date(endYear, endMonth, 0).getDate(); |
| | | params.endDate = `${endYearStr}-${endMonthStr}-${String(lastDay).padStart( |
| | | 2, |
| | | "0" |
| | | )}`; |
| | | // 计ç®å¤©æ° |
| | | const start = new Date(params.startDate); |
| | | const end = new Date(params.endDate); |
| | | params.days = Math.ceil((end - start) / (1000 * 60 * 60 * 24)) + 1; |
| | | } |
| | | } else if (statisticsType.value === "year") { |
| | | params.startDate = searchForm.year + "-01-01"; |