| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
 | | <!-- |  |  * @Author: daidai |  |  * @Date: 2022-02-28 16:16:42 |  |  * @LastEditors: Please set LastEditors |  |  * @LastEditTime: 2022-10-25 09:18:22 |  |  * @FilePath: \web-pc\src\pages\big-screen\view\indexs\left-center.vue |  | --> |  | <template> |  |     <Echart id="leftcenterright" :options="options" class="left_center_inner" v-if="pageflag" ref="charts" /> |  |     <Reacquire v-else @onclick="getData" style="line-height:200px"> |  |       重新获取 |  |     </Reacquire> |  |   </template> |  |    |  |   <script> |  |   import { currentPOST } from 'api/modules' |  |   import {Equipmentfault} from "@/api/http.js" |  |   export default { |  |     data() { |  |       return { |  |         options: {}, |  |         countUserNumData: { |  |           HoistNum: 0, |  |           decoderNum: 0, |  |           uncoderNum: 0, |  |           elevatorNum:0, |  |           TransmissionlineNum:0, |  |           totalNum: 0 |  |         }, |  |         pageflag: true, |  |         timer: null |  |       }; |  |     }, |  |     created() { |  |       this.getData() |  |     }, |  |     mounted() { |  |       this.changeTiming(); |  |     }, |  |     beforeDestroy() { |  |       // this.clearData() |  |    |  |     }, |  |     methods: { |  |       changeTiming() { |  |       setInterval(() => { |  |         this.getData(); |  |       }, 5000); |  |     }, |  |       // clearData() { |  |       //   if (this.timer) { |  |       //     clearInterval(this.timer) |  |       //     this.timer = null |  |       //   } |  |       // }, |  |        async getData() { |  |          this.pageflag = true |  |         // this.pageflag =false |  |    |  |         // currentPOST('big1').then(res => { |  |   |  |         //   //只打印一次 |  |         //   if (!this.timer) { |  |         //     console.log("设备总览", res); |  |         //   } |  |         //   if (res.success) { |  |         //     // this.countUserNumData = res.data |  |         //     this.$nextTick(() => { |  |         //       this.init() |  |         //     }) |  |    |  |         //   } else { |  |         //     this.pageflag = false |  |         //     this.$Message({ |  |         //       text: res.msg, |  |         //       type: 'warning' |  |         //     }) |  |         //   } |  |         // }) |  |   |  |   |  |         let rep = await Equipmentfault((a)=>{ |  |           console.log(a); |  |         }); |  |          |  |         this.countUserNumData = rep; |  |             this.$nextTick(() => { |  |               this.init() |  |             }) |  |       }, |  |       //轮询 |  |       switper() { |  |         if (this.timer) { |  |           return |  |         } |  |         let looper = (a) => { |  |           this.getData() |  |         }; |  |         this.timer = setInterval(looper, this.$store.state.setting.echartsAutoTime); |  |         let myChart = this.$refs.charts.chart |  |         myChart.on('mouseover', params => { |  |           this.clearData() |  |         }); |  |         myChart.on('mouseout', params => { |  |           this.timer = setInterval(looper, this.$store.state.setting.echartsAutoTime); |  |         }); |  |       }, |  |       init() { |  |         let total = this.countUserNumData.total; |  |         let colors = ["#ECA444", "#33A1DB", "#56B557","#ffb8c6","#FF21FA"]; |  |         let piedata = { |  |           name: "故障设备频率", |  |           type: "pie", |  |           radius: ["40%", "70%"], |  |           avoidLabelOverlap: false, |  |           itemStyle: { |  |             borderRadius: 4, |  |             borderColor: "rgba(0,0,0,0)", |  |             borderWidth: 2, |  |           }, |  |    |  |           color: colors, |  |           data: [ |  |             // { |  |             //   value: 0, |  |             //   name: "告警", |  |             //   label: { |  |             //     shadowColor: colors[0], |  |             //   }, |  |             // }, |  |             { |  |               value: this.countUserNumData.elevator, |  |               name: "提升机故障", |  |               label: { |  |                 shadowColor: colors[0], |  |               }, |  |             }, |  |             { |  |               value: this.countUserNumData.discremover, |  |               name: "拆码机故障", |  |               label: { |  |                 shadowColor: colors[2], |  |               }, |  |             }, |  |             { |  |               value: this.countUserNumData.rgVcCar, |  |               name: "四向车故障", |  |               label: { |  |                 shadowColor: colors[1], |  |               }, |  |             }, |  |             { |  |               value: this.countUserNumData.pipeline, |  |               name: "输送线故障", |  |               label: { |  |                 shadowColor: colors[4], |  |               }, |  |             } |  |           ], |  |         }; |  |         this.options = { |  |           title: { |  |             // zlevel: 0, |  |             text: ["{value|" + total + "}", "{name|总数}"].join("\n"), |  |             top: "center", |  |             left: "center", |  |             textStyle: { |  |               rich: { |  |                 value: { |  |                   color: "#ffffff", |  |                   fontSize: 24, |  |                   fontWeight: "bold", |  |                   lineHeight: 20, |  |                 }, |  |                 name: { |  |                   color: "#ffffff", |  |                   lineHeight: 20, |  |                 }, |  |               }, |  |             }, |  |           }, |  |           tooltip: { |  |             trigger: "item", |  |             backgroundColor: "rgba(0,0,0,.6)", |  |             borderColor: "rgba(147, 235, 248, .8)", |  |             textStyle: { |  |               color: "#FFF", |  |             }, |  |           }, |  |           legend: { |  |             show: false, |  |             top: "5%", |  |             left: "center", |  |           }, |  |           series: [ |  |             //展示圆点 |  |             { |  |               ...piedata, |  |               tooltip: { show: true }, |  |               label: { |  |                 formatter: " {b|{b}}", |  |                 // formatter: "   {b|{b}}   \n   {c|{c}个}   {per|{d}%}  ", |  |                 //   position: "outside", |  |                 rich: { |  |                   b: { |  |                     color: "#fff", |  |                     fontSize: 12, |  |                     lineHeight: 26, |  |                   }, |  |                   c: { |  |                     color: "#31ABE3", |  |                     fontSize: 14, |  |                   }, |  |                   per: { |  |                     color: "#31ABE3", |  |                     fontSize: 14, |  |                   }, |  |                 }, |  |               }, |  |               labelLine: { |  |                 length: 30, // 第一段线 长度 |  |                 length2: 46, // 第二段线 长度 |  |                 show: true, |  |                |  |               }, |  |                 emphasis: { |  |                   show: true, |  |                 }, |  |             }, |  |             { |  |               ...piedata, |  |               tooltip: { show: true }, |  |               itemStyle: {}, |  |               label: { |  |                 backgroundColor: "inherit", //圆点颜色,auto:映射的系列色 |  |                 height: 0, |  |                 width: 0, |  |                 lineHeight: 0, |  |                 borderRadius: 2.5, |  |                 shadowBlur: 8, |  |                 shadowColor: "auto", |  |                 padding: [2.5, -2.5, 2.5, -2.5], |  |               }, |  |               labelLine: { |  |                 length: 30, // 第一段线 长度 |  |                 length2: 46, // 第二段线 长度 |  |                 show: false, |  |               }, |  |             }, |  |           ], |  |         }; |  |       }, |  |     }, |  |   }; |  |   </script> |  |   <style lang='scss' scoped> |  |   </style> | 
 |