From 7d7eee19af2f1aec0424d357fe79e6c45f949772 Mon Sep 17 00:00:00 2001 From: zty Date: Fri, 1 Nov 2024 17:11:11 +0800 Subject: [PATCH] =?UTF-8?q?feat=20:=20index=5Fenm=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=A4=A7=E5=B1=8F=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/bigScreen/index_enm.vue | 2 +- src/views/em/mpoint_form.vue | 21 +++++++++--------- src/views/fac_cal/mpointstat.vue | 36 ++++++++++++++++++++++++------- 3 files changed, 40 insertions(+), 19 deletions(-) diff --git a/src/views/bigScreen/index_enm.vue b/src/views/bigScreen/index_enm.vue index fda451ec..53e985d5 100644 --- a/src/views/bigScreen/index_enm.vue +++ b/src/views/bigScreen/index_enm.vue @@ -109,7 +109,7 @@
-
压缩空气、用水量
+
车间用水量
diff --git a/src/views/em/mpoint_form.vue b/src/views/em/mpoint_form.vue index ea23d0b3..ee5c7c30 100644 --- a/src/views/em/mpoint_form.vue +++ b/src/views/em/mpoint_form.vue @@ -220,6 +220,16 @@ + + + + + - - - - - + (index+1).toString()); - + // 获取 x 轴的数据,如果query.type为小时,则显示小时,如果为天则显示天,如果为月则显示月 + if (that.query.type == "hour") { + option.title.text = "小时统计"; + option.xAxis.data = tableData.reverse().map((item) => item.year.toString() + "-" + item.month.toString() + "-" + item.day.toString() + " " + item.hour.toString()); + }else if (that.query.type == "day") { + option.title.text = "天统计"; + option.xAxis.data = tableData.reverse().map((item, index) => item.year.toString() + "-" + item.month.toString() + "-" + item.day.toString()); + }else if (that.query.type == "month") { + option.title.text = "月统计"; + option.xAxis.data = tableData.reverse().map((item, index) => item.year.toString() + "-" + item.month.toString()); + }else if (that.query.type == "day_s") { + option.title.text = "班天统计"; + option.xAxis.data = tableData.length > 0 ? tableData.reverse().map((item, index) => item.day_s.toString()) : []; + }else if (that.query.type == "month_s") { + option.title.text = "班月统计"; + option.xAxis.data = tableData.length > 0 ? tableData.reverse().map((item, index) => item.month_s.toString()) : []; + } // 获取 y 轴的数据 - option.series = [ { - name: tableData[0].mpoint_name, + name: tableData.length > 0 ? tableData[0].mpoint_name : "", type: 'line', // 折线图类型 - data: tableData.map((item) => parseFloat(item.val)), // 将字符串转为数字 + data: tableData.length > 0 ? tableData.reverse().map((item) => parseFloat(item.val)) : [], // 将字符串转为数字 smooth: true, // 平滑曲线 } ]; - option.legend.data = [tableData[0].mpoint_name]; + option.legend.data = [tableData.length > 0 ? tableData[0].mpoint_name : ""]; // 更新图表选项 that.chartOption = option; },