houzhongjian
2024-07-23 8501060c4f921d1e744c477e4dc08eb47b52693c
提交 | 用户 | 时间
850106 1 <template>
H 2   <el-card shadow="never" class="aui-card--fill" v-loading="loading">
3     <div v-for="(data, index) in dataList" :key="index" class="Border">
4       <el-card shadow="never" class="aui-card--fill" style="margin-top: 5px">
5           <el-row type="flex" justify="space-around">
6             <el-col :span="4" style="margin-top: 40px" class="Border_l">
7               <el-row>
8                 <el-col :span="12">
9                   <div style="width: 100%; text-align: left; font-size: 18px">
10                     当前值
11                   </div>
12                   <div
13                     style="
14                       width: 100%;
15                       height: 30px;
16                       margin-top: 10px;
17                       margin-bottom: 10px;
18                       color: #000000;
19                       font-size: 24px;
20                     "
21                   >
22                     <span>{{ data.currentValue }}</span>
23                     <span style="font-size: 14px">{{data.unit}}</span>
24                   </div>
25                 </el-col>
26                 <el-col :span="12">
27                   <div style="width: 100%; text-align: left; font-size: 18px">
28                     分析长度
29                   </div>
30                   <div
31                     style="
32                       width: 100%;
33                       height: 30px;
34                       margin-top: 10px;
35                       margin-bottom: 10px;
36                       color: #000000;
37                       font-size: 24px;
38                     "
39                   >
40                     <span>{{ data.length }}</span
41                     ><span style="font-size: 14px">天</span>
42                   </div>
43                 </el-col>
44               </el-row>
45     <!--          <el-button type="default" @onclick="viewHistoryData(bfg1Data)">-->
46     <!--          查看历史</el-button>-->
47             </el-col>
48             <el-col :span="19">
49               <div>
50                 <div :id="data.chartCode" style="margin-top: 20px" class="ecbox"></div>
51               </div>
52             </el-col>
53           </el-row>
54               <el-row>
55             <el-col :span="12" class="Border_down" align="left">
56               <el-row
57                 type="flex"
58                 justify="center"
59                 align="middle"
60                 style="height: 5vh"
61               >
62                 <el-col :span="5" style="padding-top:5vh">
63                   <span style="font-size: 16px; font-weight: 600">
64                     整体趋势{{data.trend}}
65                     <i :class="data.iconClass"></i>
66                   </span>
67                 </el-col>
68                 <el-col :span="5" style="padding-top:5vh">
69                   <el-row style="font-size: 14px">
70                     <span>平均值</span>
71                   </el-row>
72                   <el-row style="font-size: 14px">
73                     <span>{{data.trendValue.mean_value}}</span>
74                   </el-row>
75                 </el-col>
76                 <el-col :span="5" style="padding-top:5vh">
77                   <el-row style="font-size: 14px">
78                     <span>最大值</span>
79                   </el-row>
80                   <el-row style="font-size: 14px">
81                     <span>{{data.trendValue.max_value}}</span>
82                   </el-row>
83                 </el-col>
84                 <el-col :span="5" style="padding-top:5vh">
85                   <el-row style="font-size: 14px">
86                     <span>最小值</span>
87                   </el-row>
88                   <el-row style="font-size: 14px">
89                     <span>{{data.trendValue.min_value}}</span>
90                   </el-row>
91                 </el-col>
92               </el-row>
93             </el-col>
94             <el-col :span="12" class="Border_down" align="left">
95               <el-row style="margin-left: 2vh; margin-top: 1vh">
96                 <span style="font-size: 14px; font-weight: 600">调度建议</span>
97               </el-row>
98               <el-row>
99                 <el-col
100                   :span="23"
101                   class="Border_text"
102                   style="margin-left: 2vh; margin-top: 1vh; padding-top: 10px"
103                   ><span
104                     style="
105                       margin-left: 2vh;
106                       font-size: 18px;
107                       font-family: '楷体';
108                       font-weight: 600;
109                       color: red;
110                     "
111                     >{{data.dispatchSug}}</span>
112                 </el-col>
113               </el-row>
114             </el-col>
115           </el-row>
116       </el-card>
117     </div>
118   </el-card>
119 </template>
120
121 <script>
122 import * as echarts from "echarts";
123 import {getSeriesData} from '@/utils/mathUtils'
124
125 export default {
126   data() {
127     return {
128       radio: '产率',
129       loading: false,
130       dataList:[],
131       prepareDataList:{},
132       page:"wash",
133       bfg1Data: {
134         alarmList: {},
135       },
136       chartsName:{
137         'A010040':'混煤产量',
138         'A010041':'洗小块产量',
139         'A010042':'洗中块产量',
140         'A010019':'混煤灰分',
141         'A010043':'混煤水分',
142         'A010044':'混煤硫分',
143         'A010020':'混煤热值'
144       },
145       defaultDispatchSug:{
146         'A010040;1':'建议近期多加关注洗选环节与混煤环节,防止问题累积',
147         'A010040;2':'建议检查末煤洗选与小块煤洗选环节的设备情况,减少给煤机开启率',
148         'A010040;-1':'建议近期多加关注洗选环节与混煤环节,防止问题累积',
149         'A010040;-2':'建议检查末煤洗选与小块煤洗选环节的设备情况,增加给煤机开启率',
150         'A010041;1':'建议近期多加关注浅槽洗选环节,防止问题累积',
151         'A010041;2':'建议检查浅槽洗选环节的设备情况,减少洗小块产量',
152         'A010041;-1':'建议近期多加关注浅槽洗选环节,防止问题累积',
153         'A010041;-2':'建议检查浅槽洗选环节的设备情况,增加洗小块产量',
154         'A010042;1':'建议近期多加关注浅槽洗选环节,防止问题累积',
155         'A010042;2':'建议检查浅槽洗选环节的设备情况,减少洗中块产量',
156         'A010042;-1':'建议近期多加关注浅槽洗选环节,防止问题累积',
157         'A010042;-2':'建议检查浅槽洗选环节的设备情况,增加洗中块产量',
158         'A010019;1':'建议近期多加关注混煤配比环节,防止问题累积',
159         'A010019;2':'建议检查灰分传感器设备与混煤过程,同时注意外运混煤质量调整',
160         'A010019;-1':'煤质变好,注意外运混煤质量调整',
161         'A010019;-2':'建议检查灰分传感器设备与混煤过程,同时注意外运混煤质量调整',
162         'A010043;1':'建议近期多加关注混煤水分情况,同时注意外运混煤质量调整',
163         'A010043;2':'建议检查水分传感器设备与混煤过程,同时注意外运混煤质量调整',
164         'A010043;-1':'建议近期多加关注混煤水分情况,同时注意外运混煤质量调整',
165         'A010043;-2':'建议检查水分传感器设备与混煤过程,同时注意外运混煤质量调整',
166         'A010044;1':'建议近期多加关注混煤配比环节,防止问题累积',
167         'A010044;2':'建议检查硫分传感器设备与混煤过程,同时注意外运混煤质量调整',
168         'A010044;-1':'煤质变好,注意外运混煤质量调整',
169         'A010044;-2':'建议检查硫分传感器设备与混煤过程,同时注意外运混煤质量调整',
170         'A010020;1':'煤质变好,注意外运混煤质量调整',
171         'A010020;2':'建议检查热值传感器设备与混煤过程,同时注意外运混煤质量调整',
172         'A010020;-1':'建议近期多加关注混煤配比环节,防止问题累积',
173         'A010020;-2':'建议检查热值传感器设备与混煤过程,同时注意外运混煤质量调整',
174       }
175     };
176   },
177   mounted() {
178     this.init()
179   },
180   methods: {
181     init() {
182       window.addEventListener("resize", this.handleResize);
183       Promise.all([
184         this.getPageParamDataList()
185       ]).then(() => {
186         if (this.prepareDataList.length !== 0) {
187           this.getDataList();
188         }
189       })
190     },
191     getPageParamDataList(){
192       return this.$http.get(`/iailab-ntt-model/param/page/${this.page}`).then(({data: res}) => {
193         if (res.code !== 0) {
194           return this.$message.error(res.msg)
195         }
196         this.prepareDataList = res.data
197       })
198     },
199     getDataList() {
200       this.loading = true
201       let that = this
202       let params = []
203       this.prepareDataList.forEach((data) => {
204         params.push(data.chartCode)
205       })
206       this.$http.post(`/iailab-ntt-data/api/data/ind-item/values-trend`, params).then(({data: res}) => {
207         this.loading = false
208         if (res.code !== 0) {
209           console.log(res.msg)
210           return
211         }
212         this.prepareDataList.forEach((data) => {
213           data.dataValue = res.data['values'][data.chartCode]
214           //获取当前值数据,获取最后一个有值的数据
215           for (let i = data.dataValue.length - 1; i >= 0; i--) {
216             if (data.dataValue[i].dataValue) {
217               data.currentValue = data.dataValue[i].dataValue
218               break
219             }
220           }
221           data.trendValue = res.data['trend'][data.chartCode]
222           let slopeFlag = data.trendValue.slope_flag
223           //判断整体趋势,根据趋势值修改趋势后面的图标,生成建议值
224           let scopeValue = ''
225           switch (slopeFlag) {
226             case 1:
227               data.trend = '上升'
228               data.iconClass = 'el-icon-top'
229               scopeValue = '略有上升趋势,'
230               break
231             case 2:
232               data.trend = '上升'
233               data.iconClass = 'el-icon-top'
234               scopeValue = '上升趋势过大,'
235               break
236             case -1:
237               data.trend = '下降'
238               data.iconClass = 'el-icon-bottom'
239               scopeValue = '略有下降趋势,'
240               break
241             case -2:
242               data.trend = '下降'
243               data.iconClass = 'el-icon-bottom'
244               scopeValue = '下降趋势过大,'
245               break
246           }
247           //生成调度建议
248           let defaultSug = this.defaultDispatchSug[data.chartCode+';'+slopeFlag]
249           //生成调度建议
250           if(slopeFlag === 0 ){
251             data.trend = '平稳'
252             data.dispatchSug = '生产正常,暂无建议'
253           }else {
254             data.dispatchSug = this.chartsName[data.chartCode] + scopeValue + defaultSug
255           }
256           this.dataList.push(data)
257           setTimeout(function () {
258             that.getCharts(data);
259           }, 1000)
260         })
261       })
262     },
263     // getCharts() {
264     //   let that = this
265     //     this.$http.get(`/iailab-ntt-model/analysis/raw/${this.page}`).then(({data: res}) => {
266     //       if (res.code !== 0) {
267     //         return this.$message.error(res.msg)
268     //       }
269     //       this.dataList=res.data
270     //       this.dataList.forEach((data, index) => {
271     //         setTimeout(function() {
272     //           that.getLines(data,index);
273     //         }, 1000)
274     //         });
275     //     }).catch(() => {
276     //     })
277     //   },
278     getCharts(data) {
279       let myChart = this.$echarts.init(document.getElementById(data.chartCode));
280       let valueData = data.dataValue
281       let chartData = []
282       let xAxis = []
283       valueData.forEach((item) =>{
284         xAxis.push(item.dataTime)
285         if (item.dataValue && item.dataValue >= 0) {
286           chartData.push([item.dataTime, item.dataValue])
287         }
288       })
289       let chartTitle = this.chartsName[data.chartCode]
290       let trendS = getSeriesData(data.trendValue.slope, data.trendValue.bias, xAxis.length)
291       var option = {
292         title: {
293           text: chartTitle,
294         },
295         tooltip: {
296           trigger: "axis",
297         },
298         grid: {
299           left: "3%",
300           right: "4%",
301           bottom: "3%",
302           containLabel: true,
303         },
304         xAxis: {
305           type: "category",
306           boundaryGap: false,
307           data: xAxis,
308         },
309         yAxis: {
310           type: "value",
311         },
312         series: [
313           {
314             name: chartTitle,
315             type: "line",
316             smooth: true,
317             stack: "Total",
318             data: chartData,
319           },
320           {
321             name: '趋势',
322             data: trendS,
323             type: 'line',
324             smooth: true,
325             showSymbol: false,
326             color: '#FFAA5D'
327           }
328         ],
329       };
330       if (option && typeof option === "object") {
331         myChart.setOption(option);
332       }
333     },
334     handleResize() {
335       this.dataList.forEach((data, index) => {
336         var myChart = echarts.getInstanceByDom(
337           document.getElementById("wash" + index)
338         );
339         myChart.resize();
340       });
341     },
342   },
343   beforeDestroy() {
344     window.removeEventListener("resize", this.handleResize);
345   },
346 };
347 </script>
348
349 <style scoped>
350 .ecbox {
351   width: 100%;
352   height: 30vh;
353 }
354 .Border {
355   height: 42vh+40px;
356 }
357 .Border_l {
358   height: 20vh;
359 }
360 .Border_down {
361   border: 1px solid    #F2F3F5;
362   height: 12vh;
363 }
364 .Border_text {
365   background-color:     #F2F3F5;
366   border: 1px solid    #F2F3F5;
367   height: 7vh;
368 }
369 </style>