|
@@ -8,13 +8,12 @@
|
|
|
title="扫描节点与位置分析"
|
|
|
:items="formItems"
|
|
|
:data="formData"
|
|
|
- button-text="开始分析"
|
|
|
@getFormData="getFormData"
|
|
|
/>
|
|
|
</div>
|
|
|
<div class="statstics-content">
|
|
|
<div
|
|
|
- id="chart"
|
|
|
+ ref="myChart"
|
|
|
class="node-statistics-chart"
|
|
|
:style="{ height: chartHeight }"
|
|
|
/>
|
|
@@ -181,6 +180,7 @@ export default {
|
|
|
fontFamily: 'Helvetica, "Microsoft YaHei"'
|
|
|
}
|
|
|
},
|
|
|
+ triggerEvent: true,
|
|
|
series: [
|
|
|
{
|
|
|
name: 'nodeRadar',
|
|
@@ -230,7 +230,8 @@ export default {
|
|
|
label: '到达',
|
|
|
ratio: '0%'
|
|
|
}
|
|
|
- ]
|
|
|
+ ],
|
|
|
+ descriptions: {}
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -249,16 +250,30 @@ export default {
|
|
|
this.resizeHandler()
|
|
|
}
|
|
|
},
|
|
|
+ created() {
|
|
|
+ this.getTips()
|
|
|
+ },
|
|
|
mounted() {
|
|
|
+ const that = this
|
|
|
+
|
|
|
this.setChartHeight()
|
|
|
- this.myChart = this.$echarts.init(document.getElementById('chart'))
|
|
|
+ this.myChart = this.$echarts.init(this.$refs['myChart'])
|
|
|
this.myChart.setOption(this.options)
|
|
|
+
|
|
|
// 监听页面缩放
|
|
|
window.addEventListener('resize', this.setChartHeight)
|
|
|
window.addEventListener('resize', this._.debounce(this.resizeHandler, this.debounceTime))
|
|
|
this.$nextTick(() => {
|
|
|
this.resizeHandler()
|
|
|
})
|
|
|
+
|
|
|
+ // 防止修改标签造成的闪烁
|
|
|
+ this.myChart.on('mousedown', this.hideTips)
|
|
|
+ // 修改雷达图标签说明
|
|
|
+ this.myChart.on('mousemove', this.changeTips)
|
|
|
+ this.myChart.on('mouseup', params => {
|
|
|
+ setTimeout(that.changeTips.bind(that, params), 0)
|
|
|
+ })
|
|
|
},
|
|
|
beforeDestroy() {
|
|
|
// 销毁实例和移除监听
|
|
@@ -270,6 +285,17 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ hideTips(params) {
|
|
|
+ if (params.componentType === 'radar') {
|
|
|
+ this.myChart._dom.children[1].style.opacity = 0
|
|
|
+ }
|
|
|
+ },
|
|
|
+ changeTips(params) {
|
|
|
+ const tip = this.myChart._dom.children[1]
|
|
|
+ if (params.componentType === 'radar' && this.descriptions[params.name]) {
|
|
|
+ tip.innerHTML = tip.textContent = this.descriptions[params.name]
|
|
|
+ }
|
|
|
+ },
|
|
|
getFormData(data) {
|
|
|
this.getData(data)
|
|
|
},
|
|
@@ -306,6 +332,25 @@ export default {
|
|
|
break
|
|
|
}
|
|
|
},
|
|
|
+ async getTips() {
|
|
|
+ try {
|
|
|
+ const {
|
|
|
+ code,
|
|
|
+ returnData: { listValues },
|
|
|
+ message
|
|
|
+ } = await Query({
|
|
|
+ id: DATACONTENT_ID.nodeAxisNameId,
|
|
|
+ dataContent: []
|
|
|
+ })
|
|
|
+ if (Number(code) === 0 && listValues?.length) {
|
|
|
+ this.descriptions = JSON.parse(listValues[0].jieshi)
|
|
|
+ } else {
|
|
|
+ this.$message.error(message ?? '失败')
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log('错误', error)
|
|
|
+ }
|
|
|
+ },
|
|
|
async getData(data) {
|
|
|
const params = []
|
|
|
let queryId
|
|
@@ -379,7 +424,7 @@ export default {
|
|
|
...pre,
|
|
|
{
|
|
|
label: curr.slice(0, 2),
|
|
|
- ratio: (datas[index] / max * 100).toFixed(2) + '%'
|
|
|
+ ratio: ((datas[index] / max) * 100).toFixed(2) + '%'
|
|
|
}
|
|
|
]
|
|
|
} else {
|