houzhongjian
2024-07-23 8501060c4f921d1e744c477e4dc08eb47b52693c
提交 | 用户 | 时间
850106 1 <template>
H 2   <el-dialog :visible.sync="visible" title="报告详情" :close-on-click-modal="false"
3              :close-on-press-escape="false" :append-to-body="true" width="60%">
4     <div style="padding: 5px;" v-loading="loading">
5       <h1 style="text-align: center">{{dataForm.reportName}}</h1>
6       <div>
7         <span>报告编号:{{dataForm.reportNo}}</span>
8         <span style="float: right;">报告日期:{{dataForm.reportDate}}</span>
9       </div>
10       <el-divider content-position="left">基本信息</el-divider>
11       <div style="width: 80%;">
12         <el-descriptions class="margin-top" title="" :column="2" border>
13           <el-descriptions-item>
14             <template slot="label">
15               {{$t('healthReport.devNo')}}
16             </template>
17             {{dataForm.devNo}}
18           </el-descriptions-item>
19           <el-descriptions-item>
20             <template slot="label">
21               {{$t('healthReport.devName')}}
22             </template>
23             {{dataForm.devName}}
24           </el-descriptions-item>
25
26           <el-descriptions-item>
27             <template slot="label">
28               {{$t('healthReport.classNo')}}
29             </template>
30             {{dataForm.classNo}}
31           </el-descriptions-item>
32           <el-descriptions-item>
33             <template slot="label">
34               {{$t('healthReport.className')}}
35             </template>
36             {{dataForm.className}}
37           </el-descriptions-item>
38
39           <el-descriptions-item>
40             <template slot="label">
41               {{$t('healthReport.workshop')}}
42             </template>
43             {{dataForm.workshop}}
44           </el-descriptions-item>
45           <el-descriptions-item>
46             <template slot="label">
47               {{$t('healthReport.model')}}
48             </template>
49             {{dataForm.model}}
50           </el-descriptions-item>
51         </el-descriptions>
52       </div>
53       <el-divider content-position="left">数据分析</el-divider>
54       <div v-for="(item, index) in dataForm.chartList" :key="index" class="Border" style="margin-top: 5px; padding: 10px">
55         <div style="margin-top: -5px; border-bottom: 5px; text-align: center; background-color: #d9d9d9;">
56           <el-row>
57             <el-col :span="4"
58                     v-if="dataForm.detList[index] && dataForm.detList[index].dataMax != null && dataForm.detList[index].dataMax !== ''">
59               <span>
60                 最大值:{{dataForm.detList[index].dataMax}}
61               </span>
62             </el-col>
63             <el-col :span="4"
64                     v-if="dataForm.detList[index] && dataForm.detList[index].dataMin != null && dataForm.detList[index].dataMin !== ''">
65               <span>
66                 最小值:{{dataForm.detList[index].dataMin}}
67               </span>
68             </el-col>
69             <el-col :span="4"
70                     v-if="dataForm.detList[index] && dataForm.detList[index].dataAvg != null && dataForm.detList[index].dataAvg !== ''">
71               <span >
72                 平均值:{{dataForm.detList[index].dataAvg}}
73               </span>
74             </el-col>
75             <el-col :span="8"
76                     v-if="dataForm.detList[index] && dataForm.detList[index].gradeName != null && dataForm.detList[index].gradeName !== ''">
77               <span>
78                 分析结果:{{dataForm.detList[index].gradeName}}
79               </span>
80             </el-col>
81             <el-col :span="8"
82                     v-if="dataForm.detList[index] && dataForm.detList[index].remark != null && dataForm.detList[index].remark !== ''">
83               <span>
84                 {{dataForm.detList[index].remark}}
85               </span>
86             </el-col>
87           </el-row>
88         </div>
89         <div :id="'dhrData_' + dataForm.procCode  + index" style="height: 200px; width: 100%;"></div>
90       </div>
91
92       <el-divider content-position="left">评价结果及建议</el-divider>
93       <div>
94         <el-form :model="dataForm">
95           <el-row>
96             <el-col :span="8">
97               <el-form-item prop="healthLevel" :label="$t('healthReport.healthLevel')">
98                 <el-tag v-if="dataForm.healthLevel === '1'" type="success">健康</el-tag>
99                 <el-tag v-if="dataForm.healthLevel === '2'" type="warning">良好</el-tag>
100                 <el-tag v-if="dataForm.healthLevel === '3'" type="danger">不良</el-tag>
101               </el-form-item>
102             </el-col>
103             <el-col :span="8">
104               <el-form-item prop="healthScore" :label="$t('healthReport.healthScore')">
105                 {{dataForm.healthScore}}
106               </el-form-item>
107             </el-col>
108             <el-col :span="8">
109               <el-form-item prop="abnormalCount" :label="$t('healthReport.abnormalCount')">
110                 {{dataForm.abnormalCount}}
111               </el-form-item>
112             </el-col>
113           </el-row>
114           <el-row>
115             <span style="font-weight: 600;">总体评价:</span> {{dataForm.content}}
116           </el-row>
117           <el-row v-for="(item, index) in dataForm.detList" :key="index">
118             <span v-if="item.gradeName" style="font-weight: 600;">{{item.dataName}}分析:</span>
119             {{item.gradeName}}<span>;</span>
120             {{item.solution || ''}}
121           </el-row>
122         </el-form>
123       </div>
124     </div>
125   </el-dialog>
126 </template>
127 <script>
128   export default {
129     data() {
130       return {
131         visible: false,
132         loading: false,
133         dataForm: {
134           id: '',
135           devNo: '',
136           devName: '',
137           classNo: '',
138           className: '',
139           workshop: '',
140           model: '',
141           reportNo: '',
142           reportName: '',
143           reportDate: '',
144           healthLevel: '',
145           healthScore: '',
146           abnormalCount: '',
147           dataLength: '',
148           runTime: '',
149           content: '',
150           chartList: [],
151           detList: []
152         }
153       }
154     },
155     methods: {
156       init() {
157         this.visible = true
158         this.$nextTick(() => {
159           this.resetFields(this.dataForm)
160           this.dataForm['chartList'] = []
161           if (this.dataForm.id) {
162             this.getInfo()
163           }
164         })
165       },
166
167       // 获取信息
168       getInfo() {
169         let that = this
170         that.loading = true
171         this.$http.get(`/iailab-ntt-model/device/health-report/${this.dataForm.id}`).then(({data: res}) => {
172           that.loading = false
173           if (res.code !== 0) {
174             return this.$message.error(res.msg)
175           }
176           this.dataForm = res.data
177           setTimeout(function () {
178             that.dataForm.chartList.forEach(function (item, index) {
179               that.getCharts('dhrData_' + that.dataForm.procCode + index, item)
180             })
181           }, 500)
182         }).catch(() => {
183         })
184       },
185
186       getCharts(id, chartData) {
187         if (document.getElementById(id) == null) {
188           return
189         }
190         this.$echarts.dispose(document.getElementById(id))
191         let myChart = this.$echarts.init(document.getElementById(id));
192         myChart.clear()
193         let seriesData = []
194         if (chartData.series) {
195           chartData.series.forEach(function (item, index) {
196             seriesData.push(
197               {
198                 name: item.name,
199                 type: 'line',
200                 smooth: true,
201                 showSymbol: false,
202                 data: item.data
203               }
204             )
205           })
206         }
207         let option = {
208           title: {
209             text: chartData.valueName
210           },
211           tooltip: {
212             trigger: 'axis'
213           },
214           legend: {
215             data: chartData.legend,
216           },
217           grid: {
218             top: '20%',
219             left: '3%',
220             right: '4%',
221             bottom: '3%',
222             containLabel: true
223           },
224           xAxis: {
225             type: 'category',
226             boundaryGap: false,
227             data: chartData.categories,
228           },
229           yAxis: {
230             type: 'value',
231             position: 'left',
232             offset: 0,
233             name: '',
234             splitLine: {
235               show: false
236             },
237             axisLine: {
238               show: true,
239               onZero: false
240             },
241             axisTick: {show: true},
242             axisLabel: {
243               formatter: '{value}'
244             }
245           },
246           series: seriesData
247         }
248         myChart.setOption(option);
249       },
250
251       resetFields (obj) {
252         for (let key in obj) {
253           if (key === 'id') {
254             continue
255           }
256           if (obj[key] instanceof Array) {
257             obj[key] = []
258           } else if (obj[key] instanceof Object) {
259             this.resetFields(obj[key])
260           } else {
261             obj[key] = ''
262           }
263         }
264       }
265     }
266   }
267 </script>