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; },