From b9fef6cde056cc800eb29883b8b274f869a2308c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=B2=E4=B9=88=E4=BA=86?= Date: Wed, 28 Feb 2024 18:47:52 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A8=B3=E6=80=81=E6=8C=87=E6=A0=87=E5=90=88?= =?UTF-8?q?=E6=A0=BC=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/harmonic-boot/pollution.ts | 9 + src/components/form/datePicker/index.vue | 34 +- src/components/table/index.vue | 7 +- .../online/wentaizhibiaohegelv/index.vue | 399 ++++++++++++------ .../online/wentaizonghepinggu/index.vue | 5 +- 5 files changed, 311 insertions(+), 143 deletions(-) create mode 100644 src/api/harmonic-boot/pollution.ts diff --git a/src/api/harmonic-boot/pollution.ts b/src/api/harmonic-boot/pollution.ts new file mode 100644 index 00000000..ed637c2b --- /dev/null +++ b/src/api/harmonic-boot/pollution.ts @@ -0,0 +1,9 @@ +import request from '@/utils/request' + +export function getSteadyData(data: any) { + return request({ + url: '/harmonic-boot/pollution/getSteadyData', + method: 'post', + data: data + }) +} diff --git a/src/components/form/datePicker/index.vue b/src/components/form/datePicker/index.vue index 4ceaf558..207ac964 100644 --- a/src/components/form/datePicker/index.vue +++ b/src/components/form/datePicker/index.vue @@ -451,7 +451,39 @@ const setTimeOptions = (list: any) => { timeOptions.value = list } -defineExpose({ timeValue, interval, timeFlag, setTimeOptions }) +// 获取时间范围的同比 +function getYearOnYear(startDate: string, endDate: string): [string, string] { + const startYearAgo = new Date(startDate) + startYearAgo.setFullYear(startYearAgo.getFullYear() - 1) + + const endYearAgo = new Date(endDate) + endYearAgo.setFullYear(endYearAgo.getFullYear() - 1) + + return [formatDate(startYearAgo), formatDate(endYearAgo)] +} + +// 获取时间范围的环比 +function getMonthOnMonth(startDate: string, endDate: string): [string, string] { + const start = new Date(startDate) + const end = new Date(endDate) + + const diffTime = end.getTime() - start.getTime() + 60 * 60 * 24 * 1000 // 计算时间差 + const startMonthAgo = new Date(start) + startMonthAgo.setTime(startMonthAgo.getTime() - diffTime) // 将开始时间向前推移相同的时间差 + + const endMonthAgo = new Date(start) + endMonthAgo.setDate(start.getDate() - 1) // 结束时间是开始时间的前一天 + + return [formatDate(startMonthAgo), formatDate(endMonthAgo)] +} +// 格式化日期为 YYYY-MM-DD +function formatDate(date: Date): string { + const year = date.getFullYear() + const month = String(date.getMonth() + 1).padStart(2, '0') + const day = String(date.getDate()).padStart(2, '0') + return `${year}-${month}-${day}` +} +defineExpose({ timeValue, interval, timeFlag, setTimeOptions, getYearOnYear, getMonthOnMonth }) diff --git a/src/views/pqs/harmonicMonitoring/monitoringPoint/online/wentaizonghepinggu/index.vue b/src/views/pqs/harmonicMonitoring/monitoringPoint/online/wentaizonghepinggu/index.vue index 0d31ebfd..5049c901 100644 --- a/src/views/pqs/harmonicMonitoring/monitoringPoint/online/wentaizonghepinggu/index.vue +++ b/src/views/pqs/harmonicMonitoring/monitoringPoint/online/wentaizonghepinggu/index.vue @@ -93,6 +93,9 @@ const init = () => { } } }, + legend: { + show: false + }, xAxis: [ { name: '指标', @@ -113,7 +116,7 @@ const init = () => { name: '等级', type: 'value', min: 0, - max: 6, + max: 5, axisLabel: { show: true, // 这里重新定义就可以