From 5badbfe212c1a23cafc87aecc699d1e324ca370b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E4=BA=91=E9=B9=8F?= Date: Thu, 5 Dec 2024 11:21:09 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8F=E6=B5=8B=EF=BC=9Aads=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=8F=82=E6=95=B0=20=E5=8D=95=E9=A3=8E=E6=9C=BA?= =?UTF-8?q?=EF=BC=9A=E4=BF=AE=E6=94=B9=E9=A3=8E=E9=80=9F=E5=AF=B9=E5=BA=94?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/backend/WindBlower/index.vue | 31 ++++++------------- ui/dasadmin/src/views/backend/node/utils.ts | 12 +++++++ 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/ui/dasadmin/src/views/backend/WindBlower/index.vue b/ui/dasadmin/src/views/backend/WindBlower/index.vue index 46c31029..e4e92d28 100644 --- a/ui/dasadmin/src/views/backend/WindBlower/index.vue +++ b/ui/dasadmin/src/views/backend/WindBlower/index.vue @@ -609,13 +609,14 @@ const initTrendChart = (type: 'day' | 'month') => { const samePeriod: number[] = type === 'day' ? TrendDataForDay.samePeriod.value : TrendDataForMonth.map((item) => item.samePeriod) const xAxisdata: string[] = type === 'day' ? TrendDataForDay.currentPeriod.time : TrendDataForMonth.map((item) => item.generationTime) const trendChart = state.charts?.trendChart ?? echarts.init(trendChartRef.value as unknown as HTMLElement) + const legend = type === 'day' ? ['当天', '环比'] : ['本月', '环比'] const option = { grid: { top: 30, right: 10, bottom: 20, - left: 100, + left: 70, borderColor: '#dadada', }, tooltip: { @@ -679,14 +680,14 @@ const initTrendChart = (type: 'day' | 'month') => { }, ], legend: { - data: ['本期', '同期'], + data: legend, textStyle: { color: '#73767a', }, }, series: [ { - name: '本期', + name: legend[0], data: currentPeriod, type: 'bar', smooth: true, @@ -695,7 +696,7 @@ const initTrendChart = (type: 'day' | 'month') => { }, }, { - name: '同期', + name: legend[1], data: samePeriod, type: 'bar', smooth: true, @@ -1021,9 +1022,6 @@ const createRealTimeData = async () => { temperatureChartsData[1].value = getCutDecimalsValue(realData.itempnacelle_1sec) temperatureChartsData[2].value = getCutDecimalsValue(realData.itempoutdoor_1sec) - const ipitchangle = Math.min(realData.ipitchangle1, realData.ipitchangle2, realData.ipitchangle3) - realTimeDataForSingle.value.ipitchangle = ipitchangle / 1 === 0 ? ipitchangle : Math.floor(ipitchangle * 1000) / 1000 - const overviewDatakeys: any = Object.keys(overviewData) const sigleDataKeys: any = Object.keys(realTimeDataForSingle.value) @@ -1201,22 +1199,13 @@ const getThisDayChartData = () => { }) } -const getLastYearTodayTimestamp = () => { - const now = new Date() - const lastYear = now.getFullYear() - 1 - const lastYearToday = new Date(lastYear, now.getMonth(), now.getDate()) - return lastYearToday.getTime() -} - -const getLastYearChartData = () => { +const getLastMonthThisDayChartData = () => { return new Promise((resolve) => { - const start = getLastYearTodayTimestamp() - const end = new Date() - end.setFullYear(end.getFullYear() - 1) - + const start = dayjs().subtract(1, 'month').startOf('day').valueOf() + const end = dayjs().subtract(1, 'month').valueOf() getChartData<'iKWhThisDay'>({ startTime: start, - endTime: end.getTime(), + endTime: end, attr: ['iKWhThisDay'], interval: '1h', }).then(({ times, val }) => { @@ -1272,7 +1261,7 @@ const getAllChartData = (type: ('power' | 'trend' | 'frequency')[] = ['power', ' }) } if (type.includes('trend')) { - const trendDataForLastYear = getLastYearChartData() + const trendDataForLastYear = getLastMonthThisDayChartData() const trendDataForThisDay = getThisDayChartForHourData() Promise.all([trendDataForLastYear, trendDataForThisDay]).then(() => { initTrendChart(trendChartType.value) diff --git a/ui/dasadmin/src/views/backend/node/utils.ts b/ui/dasadmin/src/views/backend/node/utils.ts index 4eaaf2a1..00b10f9f 100644 --- a/ui/dasadmin/src/views/backend/node/utils.ts +++ b/ui/dasadmin/src/views/backend/node/utils.ts @@ -284,6 +284,14 @@ export const excelDefaultConfig: any = { label: '寄存器地址', code: 'registerAddr', }, + { + label: '启用变量', + code: 'variableEnable', + }, + { + label: '变量名称', + code: 'variableName', + }, { label: '上界', code: 'upBound', @@ -341,6 +349,10 @@ export const excelDefaultConfig: any = { "8. 16位BCD数据", "9. 8位归一化值" ], // 数据类型的提示 + R0C7:[ + "0. 不启用", + "1. 启用" + ] }, //遥控147 CONTROL 147: {