From 9b9b9df1d2e6a9c1691a0d8291cdba1cc298a3df Mon Sep 17 00:00:00 2001 From: gaoshp <291585735@qq.com> Date: 星期四, 20 六月 2024 22:56:35 +0800 Subject: [PATCH] update --- src/views/mdc/components/Time.vue | 29 +++++++++++++++++++++-------- 1 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/views/mdc/components/Time.vue b/src/views/mdc/components/Time.vue index cd12ccb..6442645 100644 --- a/src/views/mdc/components/Time.vue +++ b/src/views/mdc/components/Time.vue @@ -1,7 +1,7 @@ <!-- * @Date: 2024-04-18 21:52:18 * @LastEditors: Sneed - * @LastEditTime: 2024-06-18 20:09:02 + * @LastEditTime: 2024-06-20 22:54:35 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/mdc/components/Time.vue --> <template> @@ -117,8 +117,10 @@ startDate: params.startDate, statisticalMethod: this.statisticalMethod }).then(res => { - let startDate = Math.min(...res.data.map(v => new Date(v.startDate).getTime())) - let endDate = Math.max(...res.data.map(v => new Date(v.startDate).getTime())) + if (!res?.length) return + let startDate = Math.min(...res?.map(v => new Date(v.startDate).getTime())) + let endDate = Math.max(...res?.map(v => new Date(v.endDate).getTime())) + console.log('------') let data = { ...params, statisticalMethod: this.statisticalMethod @@ -126,6 +128,7 @@ if (this.statisticalMethod !== 'Day') { data = { ...data, + startDate: moment(startDate).format('YYYY-MM-DD'), endDate: moment(endDate).format('YYYY-MM-DD'), statisticalMethod: this.statisticalMethod } @@ -135,8 +138,8 @@ ...data }) this.queryChart({ - ...params, - statisticalMethod: this.statisticalMethod + ...data, + // statisticalMethod: this.statisticalMethod }) }) @@ -148,7 +151,17 @@ }).then(res => { if (res.code === 200) { this.btnListNew = res.data - return res + if (data.statisticalMethod === 'MONTH') { + return res?.data?.map(v => { + return { + ...v, + startDate: moment(v.id).startOf('month').format('YYYY-MM-DD'), + endDate: moment(v.id).endOf('month').format('YYYY-MM-DD') + } + }) + } else { + return res.data + } } }) }, @@ -222,7 +235,7 @@ console.log(option2) }) }, - query() { + query(res) { this.apiObj = { get: async (data) => { let params = { @@ -230,7 +243,7 @@ size: data.size } let dataSend = { - ...data, + ...res, queryType: 1, statisticalMethod: this.statisticalMethod } -- Gitblit v1.9.3