From 2b98daca58a12360f7ab4686c5f58e8c2be6b878 Mon Sep 17 00:00:00 2001 From: shijing Date: Mon, 28 Aug 2023 13:35:41 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E5=8D=95=E4=BD=8D=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E7=94=B5=E8=80=97=E8=B6=8B=E5=8A=BF=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 8 +-- public/index.html | 2 +- src/components/scEnm/empchartsdialog.vue | 74 +++++++++++++++---- src/views/enm_coal/power.vue | 90 +++--------------------- src/views/enm_kiln/power.vue | 90 +++--------------------- src/views/enm_mill/power.vue | 90 +++--------------------- src/views/enm_rm/power.vue | 90 +++--------------------- src/views/enm_slag/power.vue | 80 ++------------------- 8 files changed, 113 insertions(+), 411 deletions(-) diff --git a/.env.development b/.env.development index 7f6f0c13..d9600b6e 100644 --- a/.env.development +++ b/.env.development @@ -2,15 +2,15 @@ NODE_ENV = development # 标题 -# VUE_APP_TITLE = '曲阳金隅安全智能管控平台' -VUE_APP_TITLE = '托克逊能源管理平台' +VUE_APP_TITLE = '曲阳金隅安全智能管控平台' +# VUE_APP_TITLE = '托克逊能源管理平台' # 接口地址 #VUE_APP_API_BASEURL = http://1.203.161.103:2800/api #VUE_APP_WS_API = 'ws://localhost:8000' -# VUE_APP_API_BASEURL = http://222.222.144.147:6013/api +VUE_APP_API_BASEURL = http://222.222.144.147:6013/api #VUE_APP_API_BASEURL = http://10.99.5.79:20309/api -VUE_APP_API_BASEURL = http://49.232.14.174:2226/api +# VUE_APP_API_BASEURL = http://49.232.14.174:2226/api # VUE_APP_API_BASEURL = http://127.0.0.1:2226/api VUE_APP_BASEURL = http://49.232.14.174:2226 diff --git a/public/index.html b/public/index.html index 881a32cb..8fdc5259 100644 --- a/public/index.html +++ b/public/index.html @@ -32,7 +32,7 @@
<%= VUE_APP_TITLE %>
diff --git a/src/components/scEnm/empchartsdialog.vue b/src/components/scEnm/empchartsdialog.vue index ca80d1aa..bf339ac3 100644 --- a/src/components/scEnm/empchartsdialog.vue +++ b/src/components/scEnm/empchartsdialog.vue @@ -105,8 +105,10 @@ import * as echarts from 'echarts'; export default { props: { + cate:{ type: String, default: ""}, type: { type: String, default: "hours" }, title: { type: String, default: "" }, + mgroup: { type: String, default: "" }, apiObj: { type: Object, default: () => { } }, showClose: { type: Boolean, default: true }, echartType: { type: String, default: 'bar' }, @@ -124,8 +126,7 @@ myChart:null, option: { title: { - text: '折线图', - subtext: '小标题', + text: '设备单位产品电耗', x: 'center' }, grid: { // 图表距离边框的距离,可用百分比和数字(px)配置 @@ -230,23 +231,68 @@ } }, mounted() { - console.log(this.type); - console.log(this.title); - console.log(this.echartType); - this.visible = this.modelValue; - this.$nextTick(res=>{ - this.getChartsData(); + let that = this; + var myDate = new Date(); + that.year = myDate.getFullYear(); + that.month = myDate.getMonth()+1; + that.days = myDate.getDate(); + that.visible = that.modelValue; + that.option.legend.data.push(that.cate); + that.option.series[0].name=that.cate; + that.visible = that.modelValue; + that.$nextTick(res=>{ + that.getChartsData(); }) - }, methods: { async getChartsData(){ let that = this; - // var res = await this.apiObj.req(this.query); - let chartDom = document.getElementById('myChart'); - that.myChart = echarts.init(chartDom); - // var option = {}; - that.myChart.setOption(that.option); + let params = {}; + params.page = 0; + params.type = that.type; + params.mgroup = that.mgroup; + let type = that.type,unit='时'; + if(this.type=='hour_s'){ + type = 'hour';//key + params.year = that.year; + params.month = that.month; + params.day = that.day; + }else if(this.type=='day_s'){ + unit='日'; + params.year_s = that.year; + params.month_s = that.month; + }else if(this.type=='month_s'){ + unit='月'; + params.year_s = that.year; + } + that.apiObj.req(params).then(res=>{ + function compare(property) { + return function (a, b) { + return a[property]-b[property]; + } + } + let xAxisData = [],lineData = [],filterList=[]; + res.forEach(item=>{ + if(item.ep_monitored_name==that.cate){ + filterList.push(item); + } + }) + let arr = filterList.sort(compare(type)); + //that.cate设备名称 + arr.forEach(item=>{ + lineData.push(item.elec_consume_unit) + let xAxis = item[type]+unit; + xAxisData.push(xAxis) + }) + this.$nextTick(()=>{ + let chartDom = document.getElementById('myChart'); + that.myChart = echarts.init(chartDom); + that.option.xAxis.data = xAxisData; + that.option.series[0].data = lineData; + that.myChart.setOption(that.option); + }) + + }) }, //关闭 closeDialog(){ diff --git a/src/views/enm_coal/power.vue b/src/views/enm_coal/power.vue index 80688bec..8cef04bc 100644 --- a/src/views/enm_coal/power.vue +++ b/src/views/enm_coal/power.vue @@ -36,9 +36,9 @@ @@ -57,72 +57,13 @@
- - -
- - - - 查询 -
-
- - - 查询 -
-
- - - 查询 -
- -
{ - this.myOption = JSON.parse(res.echart_options); - debugger; - console.log(this.myOption) - this.chartShow = true; - }); - }, handlePrint() { this.$PRINT('#myReport'); }, diff --git a/src/views/enm_kiln/power.vue b/src/views/enm_kiln/power.vue index 9c6666bd..2ef3a2fe 100644 --- a/src/views/enm_kiln/power.vue +++ b/src/views/enm_kiln/power.vue @@ -36,9 +36,9 @@ @@ -57,72 +57,13 @@ - - -
- - - - 查询 -
-
- - - 查询 -
-
- - - 查询 -
- -
{ - this.myOption = JSON.parse(res.echart_options); - debugger; - console.log(this.myOption) - this.chartShow = true; - }); - }, handlePrint() { this.$PRINT('#myReport'); }, diff --git a/src/views/enm_mill/power.vue b/src/views/enm_mill/power.vue index 1eed7ead..cdd2e348 100644 --- a/src/views/enm_mill/power.vue +++ b/src/views/enm_mill/power.vue @@ -36,9 +36,9 @@ @@ -57,72 +57,13 @@ - - -
- - - - 查询 -
-
- - - 查询 -
-
- - - 查询 -
- -
{ - this.myOption = JSON.parse(res.echart_options); - debugger; - console.log(this.myOption) - this.chartShow = true; - }); - }, handlePrint() { this.$PRINT('#myReport'); }, diff --git a/src/views/enm_rm/power.vue b/src/views/enm_rm/power.vue index 5af99077..91853d49 100644 --- a/src/views/enm_rm/power.vue +++ b/src/views/enm_rm/power.vue @@ -36,9 +36,9 @@ @@ -57,72 +57,13 @@ - - -
- - - - 查询 -
-
- - - 查询 -
-
- - - 查询 -
- -
{ - this.myOption = JSON.parse(res.echart_options); - debugger; - console.log(this.myOption) - this.chartShow = true; - }); - }, handlePrint() { this.$PRINT('#myReport'); }, diff --git a/src/views/enm_slag/power.vue b/src/views/enm_slag/power.vue index 636ce0f0..90c82ac3 100644 --- a/src/views/enm_slag/power.vue +++ b/src/views/enm_slag/power.vue @@ -35,8 +35,8 @@ @@ -51,68 +51,6 @@ - - -
- - - - 查询 -
-
- - - 查询 -
-
- - - 查询 -
- -
{ - this.myOption = JSON.parse(res.echart_options); - debugger; - console.log(this.myOption) - this.chartShow = true; - }); - }, handlePrint() { this.$PRINT('#myReport'); },