提交 | 用户 | 时间
|
850106
|
1 |
<template> |
H |
2 |
<el-dialog :visible.sync="visible" title="报告详情" :close-on-click-modal="false" |
|
3 |
:close-on-press-escape="false" width="60%"> |
|
4 |
<div style="padding: 5px;" v-loading="loading"> |
|
5 |
<h1 style="text-align: center">{{dataForm.reportName}}</h1> |
|
6 |
<el-divider content-position="left">诊断时间</el-divider> |
|
7 |
<el-row> |
|
8 |
<el-col :span="12">{{dataForm.reportDate}}</el-col> |
|
9 |
</el-row> |
|
10 |
<el-divider content-position="left">诊断结论</el-divider> |
|
11 |
<el-row> |
|
12 |
<el-col :span="24"> |
|
13 |
<p>{{dataForm.content}}</p> |
|
14 |
</el-col> |
|
15 |
</el-row> |
|
16 |
<el-divider content-position="left">参数分析</el-divider> |
|
17 |
<div v-for="(item, index) in dataForm.chartList" :key="index" class="Border" style="margin-top: 5px; padding: 10px"> |
|
18 |
<div :id="'reportView_' + dataForm.procCode + index" style="height: 200px; width: 100%;"></div> |
|
19 |
</div> |
|
20 |
</div> |
|
21 |
</el-dialog> |
|
22 |
</template> |
|
23 |
<script> |
|
24 |
export default { |
|
25 |
data() { |
|
26 |
return { |
|
27 |
visible: false, |
|
28 |
loading: false, |
|
29 |
dataForm: { |
|
30 |
id: '', |
|
31 |
procCode: '', |
|
32 |
procName: '', |
|
33 |
reportName: '', |
|
34 |
reportDate: '', |
|
35 |
content: '', |
|
36 |
createDate: '', |
|
37 |
chartList: [] |
|
38 |
} |
|
39 |
} |
|
40 |
}, |
|
41 |
methods: { |
|
42 |
init() { |
|
43 |
this.visible = true |
|
44 |
this.$nextTick(() => { |
|
45 |
this.resetFields(this.dataForm) |
|
46 |
this.dataForm['chartList'] = [] |
|
47 |
if (this.dataForm.id) { |
|
48 |
this.getInfo() |
|
49 |
} |
|
50 |
}) |
|
51 |
}, |
|
52 |
// 获取信息 |
|
53 |
getInfo() { |
|
54 |
let that = this |
|
55 |
that.loading = true |
|
56 |
this.$http.get(`/iailab-ntt-model/any/proc-report/${this.dataForm.id}`).then(({data: res}) => { |
|
57 |
that.loading = false |
|
58 |
if (res.code !== 0) { |
|
59 |
return this.$message.error(res.msg) |
|
60 |
} |
|
61 |
this.dataForm = res.data |
|
62 |
setTimeout(function () { |
|
63 |
that.dataForm.chartList.forEach(function (item, index) { |
|
64 |
that.getCharts('reportView_' + that.dataForm.procCode + index, item) |
|
65 |
}) |
|
66 |
}, 500) |
|
67 |
}).catch(() => { |
|
68 |
}) |
|
69 |
}, |
|
70 |
getCharts(id, chartData) { |
|
71 |
if (document.getElementById(id) == null) { |
|
72 |
return |
|
73 |
} |
|
74 |
this.$echarts.dispose(document.getElementById(id)) |
|
75 |
let myChart = this.$echarts.init(document.getElementById(id)); |
|
76 |
myChart.clear() |
|
77 |
let seriesData = [] |
|
78 |
if (chartData.series) { |
|
79 |
chartData.series.forEach(function (item, index) { |
|
80 |
seriesData.push( |
|
81 |
{ |
|
82 |
name: item.name, |
|
83 |
type: 'line', |
|
84 |
smooth: true, |
|
85 |
showSymbol: false, |
|
86 |
data: item.data |
|
87 |
} |
|
88 |
) |
|
89 |
}) |
|
90 |
} |
|
91 |
let option = { |
|
92 |
title: { |
|
93 |
text: chartData.valueName |
|
94 |
}, |
|
95 |
tooltip: { |
|
96 |
trigger: 'axis' |
|
97 |
}, |
|
98 |
legend: { |
|
99 |
data: chartData.legend, |
|
100 |
}, |
|
101 |
grid: { |
|
102 |
top: '20%', |
|
103 |
left: '3%', |
|
104 |
right: '4%', |
|
105 |
bottom: '3%', |
|
106 |
containLabel: true |
|
107 |
}, |
|
108 |
xAxis: { |
|
109 |
type: 'category', |
|
110 |
boundaryGap: false, |
|
111 |
data: chartData.categories, |
|
112 |
}, |
|
113 |
yAxis: { |
|
114 |
type: 'value', |
|
115 |
position: 'left', |
|
116 |
offset: 0, |
|
117 |
name: '', |
|
118 |
splitLine: { |
|
119 |
show: false |
|
120 |
}, |
|
121 |
axisLine: { |
|
122 |
show: true, |
|
123 |
onZero: false |
|
124 |
}, |
|
125 |
axisTick: {show: true}, |
|
126 |
axisLabel: { |
|
127 |
formatter: '{value}' |
|
128 |
} |
|
129 |
}, |
|
130 |
series: seriesData |
|
131 |
} |
|
132 |
myChart.setOption(option); |
|
133 |
}, |
|
134 |
resetFields (obj) { |
|
135 |
for (let key in obj) { |
|
136 |
if (key === 'id') { |
|
137 |
continue |
|
138 |
} |
|
139 |
if (obj[key] instanceof Array) { |
|
140 |
obj[key] = [] |
|
141 |
} else if (obj[key] instanceof Object) { |
|
142 |
this.resetFields(obj[key]) |
|
143 |
} else { |
|
144 |
obj[key] = '' |
|
145 |
} |
|
146 |
} |
|
147 |
} |
|
148 |
} |
|
149 |
} |
|
150 |
</script> |