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" style="margin-top: 5px">
4       <el-card shadow="never" class="aui-card--fill" >
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
120 </template>
121
122 <script>
123 import * as echarts from "echarts";
124 import {getSeriesData} from '@/utils/mathUtils'
125
126 export default {
127   data() {
128     return {
129       radio: '产率',
130       loading: false,
131       dataList: [],
132       prepareDataList:{},
133       page:"rowCoal",
134       bfg1Data: {
135         alarmList: {},
136       },
137       chartsName:{
138         'A010039':'原煤入洗量',
139         'A010001':'原煤灰分',
140         'A010037':'原煤水分',
141         'A010038':'原煤硫分',
142         'A010018':'原煤热值'
143       },
144       defaultDispatchSug:{
145         'A010039;1':'建议近期多加关注洗选环节产量情况,防止问题累积',
146         'A010039;2':'建议检查原煤生产与洗选环节设备情况,减少原煤入洗量',
147         'A010039;-1':'建议近期多加关注洗选环节产量情况,防止问题累积',
148         'A010039;-2':'建议检查原煤生产与洗选环节设备情况,增加原煤入洗量',
149         'A010001;1':'建议近期多加关注原煤灰分情况,同时注意配煤质量',
150         'A010001;2':'建议检查灰分传感器设备,同时注意配煤质量',
151         'A010001;-1':'煤质变好,注意配煤质量',
152         'A010001;-2':'建议检查灰分传感器设备,同时注意配煤质量',
153         'A010038;1':'建议近期多加关注原煤硫分情况,同时注意配煤质量',
154         'A010038;2':'建议检查硫分传感器设备,同时注意配煤质量',
155         'A010038;-1':'煤质变好,注意配煤质量',
156         'A010038;-2':'建议检查硫分传感器设备,同时注意配煤质量',
157         'A010037;1':'建议近期多加关注原煤水分情况,同时注意配煤质量',
158         'A010037;2':'建议检查水分传感器设备,同时注意配煤质量',
159         'A010037;-1':'建议近期多加关注原煤水分情况,同时注意配煤质量',
160         'A010037;-2':'建议检查水分传感器设备,同时注意配煤质量',
161         'A010018;1':'建议近期多加关注原煤热值情况,同时注意配煤质量',
162         'A010018;2':'建议检查热值传感器设备,同时注意配煤质量',
163         'A010018;-1':'建议近期多加关注原煤热值情况,同时注意配煤质量',
164         'A010018;-2':'建议检查热值传感器设备,同时注意配煤质量',
165       }
166     };
167   },
168   mounted() {
169     this.init()
170   },
171   methods: {
172     init() {
173       window.addEventListener("resize", this.handleResize);
174       Promise.all([
175         this.getPageParamDataList()
176       ]).then(() => {
177         if (this.prepareDataList.length !== 0) {
178           this.getDataList();
179         }
180       })
181     },
182     getPageParamDataList(){
183       return this.$http.get(`/iailab-ntt-model/param/page/${this.page}`).then(({data: res}) => {
184         if (res.code !== 0) {
185           return this.$message.error(res.msg)
186         }
187         this.prepareDataList = res.data
188       })
189     },
190     getDataList() {
191       this.loading = true
192       let that = this
193       let params = []
194       this.prepareDataList.forEach((data) => {
195         params.push(data.chartCode)
196       })
197       this.$http.post(`/iailab-ntt-data/api/data/ind-item/values-trend`, params).then(({data: res}) => {
198         this.loading = false
199         if (res.code !== 0) {
200           console.log(res.msg)
201           return
202         }
203         this.prepareDataList.forEach((data) => {
204           data.dataValue = res.data['values'][data.chartCode]
205           //获取当前值数据,获取最后一个有值的数据
206           for (let i = data.dataValue.length - 1; i >= 0; i--) {
207             if (data.dataValue[i].dataValue) {
208               data.currentValue = data.dataValue[i].dataValue
209               break
210             }
211           }
212           data.trendValue = res.data['trend'][data.chartCode]
213           this.getDispatchSug(data)
214           this.dataList.push(data)
215           setTimeout(function () {
216             that.getCharts(data);
217           }, 1000)
218         })
219       })
220     },
221
222     getDispatchSug(data){
223       //判断整体趋势,根据趋势值修改趋势后面的图标,生成建议值
224       let scopeValue = ''
225       let slopeFlag = data.trendValue.slope_flag
226       switch (slopeFlag) {
227         case 1:
228           data.trend = '上升'
229           data.iconClass = 'el-icon-top'
230           scopeValue = '略有上升趋势,'
231           break
232         case 2:
233           data.trend = '上升'
234           data.iconClass = 'el-icon-top'
235           scopeValue = '上升趋势过大,'
236           break
237         case -1:
238           data.trend = '下降'
239           data.iconClass = 'el-icon-bottom'
240           scopeValue = '略有下降趋势,'
241           break
242         case -2:
243           data.trend = '下降'
244           data.iconClass = 'el-icon-bottom'
245           scopeValue = '下降趋势过大,'
246           break
247       }
248       //生成调度建议
249       let defaultSug = this.defaultDispatchSug[data.chartCode+';'+slopeFlag]
250       if(slopeFlag === 0 ){
251         data.trend = '平稳'
252         data.dispatchSug = '生产正常,暂无建议'
253       }else {
254         data.dispatchSug = this.chartsName[data.chartCode] + scopeValue + defaultSug
255       }
256     },
257     getCharts(data) {
258       let myChart = this.$echarts.init(document.getElementById(data.chartCode));
259       let chartTitle = this.chartsName[data.chartCode]
260       let valueData = data.dataValue
261       let chartData = []
262       let xAxis = []
263       valueData.forEach((item) =>{
264         xAxis.push(item.dataTime)
265         if (item.dataValue && item.dataValue >= 0) {
266           chartData.push([item.dataTime, item.dataValue])
267         }
268       })
269       let trendDate = getSeriesData(data.trendValue.slope, data.trendValue.bias, xAxis.length)
270       var option = {
271         title: {
272           text: chartTitle,
273         },
274         tooltip: {
275           trigger: "axis",
276         },
277         grid: {
278           left: "3%",
279           right: "4%",
280           bottom: "3%",
281           containLabel: true,
282         },
283         xAxis: {
284           type: "category",
285           boundaryGap: false,
286           data: xAxis,
287         },
288         yAxis: {
289           type: "value",
290         },
291         series: [
292           {
293             name: chartTitle,
294             type: "line",
295             smooth: true,
296             stack: "Total",
297             data: chartData,
298           },
299           {
300             name: '趋势',
301             data: trendDate,
302             type: 'line',
303             smooth: true,
304             showSymbol: false,
305             color: '#FFAA5D'
306           }
307         ],
308       };
309       if (option && typeof option === "object") {
310         myChart.setOption(option);
311       }
312       return option;
313     },
314     handleResize() {
315       this.dataList.forEach((data, index) => {
316         var myChart = echarts.getInstanceByDom(
317                 document.getElementById(index)
318         );
319         myChart.resize();
320       });
321     },
322   },
323   beforeDestroy() {
324     window.removeEventListener("resize", this.handleResize);
325   },
326 };
327 </script>
328
329 <style scoped>
330   .ecbox {
331     width: 100%;
332     height: 30vh;
333   }
334   .Border {
335     height: 42vh+40px;
336   }
337   .Border_l {
338     height: 20vh;
339   }
340   .Border_down {
341     border: 1px solid    #F2F3F5;
342     height: 12vh;
343   }
344   .Border_text {
345     background-color:     #F2F3F5;
346     border: 1px solid    #F2F3F5;
347     height: 7vh;
348   }
349 </style>