From 37ae80471edf729c3b09873a01af00a8722ffda4 Mon Sep 17 00:00:00 2001 From: zmj <1493694146@qq.com> Date: Sat, 6 Jul 2024 10:07:57 +0800 Subject: [PATCH] add --- src/api/statistics.ts | 8 ++++++ src/views/statistic_cw/index.vue | 36 ++++++++++++++++++++++--- src/views/statistic_gc/index.vue | 28 ++++++++++++++++++- src/views/statistic_sc/index.vue | 30 ++++++++++++++++++--- src/views/statistic_xm/index.vue | 30 ++++++++++++++++++--- src/views/statistic_zj/index.vue | 28 ++++++++++++++++--- src/views/statistic_zx/index.vue | 46 +++++++++++++++++--------------- 7 files changed, 171 insertions(+), 35 deletions(-) diff --git a/src/api/statistics.ts b/src/api/statistics.ts index dcdc34c..c56d752 100644 --- a/src/api/statistics.ts +++ b/src/api/statistics.ts @@ -136,3 +136,11 @@ export function apistatisSupervisionStatistics(params: any) { export function apistatiscost_statistics(params: any) { return request.get({ url: '/cost_project.cost_statistics/index', params }) } + +export function apiManageStatistics(params: any) { + return request.get({ url: '/manage_basic.ManageStatistics/index', params }) +} + +export function apimarketingStatistics(params: any) { + return request.get({ url: '/marketing.marketing_statistics/index', params }) +} diff --git a/src/views/statistic_cw/index.vue b/src/views/statistic_cw/index.vue index d62dab7..7f2a094 100644 --- a/src/views/statistic_cw/index.vue +++ b/src/views/statistic_cw/index.vue @@ -26,9 +26,9 @@ import ProjectFund from "./components/ProjectFund.vue" 概况
时间筛选: - - 查询 + + 查询
@@ -201,8 +201,36 @@ const basicList = reactive([ // percent: 0 // } ]) + + + + +function getLastMonthRange() { + // 获取今天的日期 + let today = new Date(); + + // 获取上个月的日期 + let lastMonth = new Date(today.getFullYear(), today.getMonth() - 1, today.getDate()); + + // 格式化日期为 "年-月-日" + let formatDateString = (date) => { + let year = date.getFullYear(); + let month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,需要+1,并且补0 + let day = String(date.getDate()).padStart(2, '0'); // 补0 + return `${year}-${month}-${day}`; + }; + + // 格式化上个月和今天的日期 + let lastMonthFormatted = formatDateString(lastMonth); + let todayFormatted = formatDateString(today); + + // 返回结果数组 + return [lastMonthFormatted, todayFormatted]; +} + + const startEndTime = ref([new Date(), new Date()]); -const startEndTime2 = ref([]); +const startEndTime2 = ref(getLastMonthRange()); const getData2 = () => { diff --git a/src/views/statistic_gc/index.vue b/src/views/statistic_gc/index.vue index 080bea4..4a88f1d 100644 --- a/src/views/statistic_gc/index.vue +++ b/src/views/statistic_gc/index.vue @@ -194,8 +194,34 @@ const basicList = reactive([ // percent: 0 // } ]) + + +function getLastMonthRange() { + // 获取今天的日期 + let today = new Date(); + + // 获取上个月的日期 + let lastMonth = new Date(today.getFullYear(), today.getMonth() - 1, today.getDate()); + + // 格式化日期为 "年-月-日" + let formatDateString = (date) => { + let year = date.getFullYear(); + let month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,需要+1,并且补0 + let day = String(date.getDate()).padStart(2, '0'); // 补0 + return `${year}-${month}-${day}`; + }; + + // 格式化上个月和今天的日期 + let lastMonthFormatted = formatDateString(lastMonth); + let todayFormatted = formatDateString(today); + + // 返回结果数组 + return [lastMonthFormatted, todayFormatted]; +} + + const startEndTime = ref([new Date(), new Date()]); -const startEndTime2 = ref([]); +const startEndTime2 = ref(getLastMonthRange()); const getData2 = () => { diff --git a/src/views/statistic_sc/index.vue b/src/views/statistic_sc/index.vue index 102f758..6e4a029 100644 --- a/src/views/statistic_sc/index.vue +++ b/src/views/statistic_sc/index.vue @@ -39,7 +39,7 @@