perf: 优化endpoint-info小图

This commit is contained in:
chenjinsong
2020-06-29 15:54:10 +08:00
parent 587034abdb
commit 7c81f75da3
3 changed files with 30 additions and 21 deletions

View File

@@ -481,8 +481,6 @@ export default {
immediate:true, immediate:true,
handler(n,o){ handler(n,o){
this.data=Object.assign({},n) this.data=Object.assign({},n)
this.data.resizable=true;
this.data.editable=true;
} }
}, },
panelId:{ panelId:{

View File

@@ -163,7 +163,7 @@
<div class="item-tip-hide item-tip-key el-popover" :class="itemTip(`key-${index}`, key, i, ready)">{{endpointKey[key]}}</div> <div class="item-tip-hide item-tip-key el-popover" :class="itemTip(`key-${index}`, key, i, ready)">{{endpointKey[key]}}</div>
</div> </div>
<div class="content-item-value item-tip" :id="`value-${index}-${i}`"> <div class="content-item-value item-tip" :id="`value-${index}-${i}`">
<template v-if="key == 'state'"><div id="littleChart" style="cursor: pointer; height: 80px;" @click="preview"></div></template> <template v-if="key == 'state'"><div id="littleChart" style="cursor: pointer; height: 26px; width: 60px;" @click="preview"></div></template>
<template v-else-if="endpointKey[key]"> <template v-else-if="endpointKey[key]">
<span class="content-text">{{value ? value : "&nbsp;"}}</span> <span class="content-text">{{value ? value : "&nbsp;"}}</span>
<div class="item-tip-hide item-tip-value el-popover" :class="itemTip(`value-${index}`, key, i, ready)">{{value}}</div> <div class="item-tip-hide item-tip-value el-popover" :class="itemTip(`value-${index}`, key, i, ready)">{{value}}</div>
@@ -432,12 +432,16 @@
initChart(series) { initChart(series) {
let option = { let option = {
title: {show: false}, title: {show: false},
grid: {left: 40}, grid: {top: 20, bottom: 20},
tooltip: { tooltip: {
show: true, show: true,
trigger: "axis", trigger: "axis",
extraCssText: 'z-index:3100;', extraCssText: 'z-index:3100;',
position: [0, '50%'], position: [100, 1],
textStyle: {
fontSize: 12,
},
padding: 3,
formatter: function(param) { formatter: function(param) {
let time = param[0].data[0]; let time = param[0].data[0];
time = bus.computeTimezone(time); time = bus.computeTimezone(time);
@@ -461,19 +465,23 @@
show: false, show: false,
type: 'time' type: 'time'
}, },
/*visualMap: {
show: false,
dimension: 1,
pieces: [],
outOfRange: {
color: 'green'
}
},*/
yAxis: { yAxis: {
type: 'value', type: 'value',
show: false show: false
}, },
useUTC: false,//使用本地时间 useUTC: false,//使用本地时间
visualMap: {
show: false,
pieces: [{
gt: -0.5,
lt: 0.5,
color: '#d64f40'
}, {
gt: 0.6,
lt: 1.5,
color: '#50d050'
}]
},
series: series series: series
}; };
let chart = echarts.init(document.querySelector("#littleChart")); let chart = echarts.init(document.querySelector("#littleChart"));

View File

@@ -554,8 +554,8 @@
id: -8, id: -8,
panelId: 0, panelId: 0,
title: this.$t("alert.alertList"), title: this.$t("alert.alertList"),
span: 12, span: 8,
height: 350, height: 700,
type: "alertList", type: "alertList",
prev: -9, prev: -9,
next: -1, next: -1,
@@ -606,7 +606,6 @@
}); });
return; return;
} }
if (!param.query) delete param.query; if (!param.query) delete param.query;
//根据panelId获得panel下的所有图表 //根据panelId获得panel下的所有图表
this.$get('panel/'+ params.panelId+'/charts').then(response => { this.$get('panel/'+ params.panelId+'/charts').then(response => {
@@ -650,6 +649,10 @@
this.$set(item, "draggable", true); this.$set(item, "draggable", true);
this.$set(item, "resizable", true); this.$set(item, "resizable", true);
} }
} else if (!param.from) {
this.$set(item, "draggable", true);
this.$set(item, "resizable", true);
this.$set(item, "editable", true);
} }
if(!item.isLoaded){ if(!item.isLoaded){
//获得当前显示在浏览器的图表,从后台获取数据 //获得当前显示在浏览器的图表,从后台获取数据
@@ -1210,16 +1213,15 @@
let series = { let series = {
name: '', name: '',
symbol: 'emptyCircle', //去掉点 symbol: 'emptyCircle', //去掉点
symbolSize: 6, symbolSize: 4,
smooth: 0.2, //曲线变平滑 smooth: 0.2, //曲线变平滑
showSymbol: true, showSymbol: false,
data: [], data: [],
type: "line", type: "line",
lineStyle: { lineStyle: {
width: 1, width: 1,
opacity: 0.9 opacity: 0.9
}, },
label: {show: true},
itemStyle: { itemStyle: {
color: function(params) { color: function(params) {
if (params.data[1] == "1") { if (params.data[1] == "1") {
@@ -1420,12 +1422,12 @@
if (response.data.project && response.data.project.length > 0) { if (response.data.project && response.data.project.length > 0) {
detail.push({title: vm.$t("project.project.project"), data: convert(response.data.project)}); detail.push({title: vm.$t("project.project.project"), data: convert(response.data.project)});
} }
if (response.data.module && response.data.module.length > 0) { /*if (response.data.module && response.data.module.length > 0) {
detail.push({title: vm.$t("project.module.module"), data: convert(response.data.module)}); detail.push({title: vm.$t("project.module.module"), data: convert(response.data.module)});
} }
if (response.data.endpoint && response.data.endpoint.length > 0) { if (response.data.endpoint && response.data.endpoint.length > 0) {
detail.push({title: vm.$t("project.endpoint.endpoint"), data: convert(response.data.endpoint)}); detail.push({title: vm.$t("project.endpoint.endpoint"), data: convert(response.data.endpoint)});
} }*/
if (response.data.asset && response.data.asset.length > 0) { if (response.data.asset && response.data.asset.length > 0) {
detail.push({title: vm.$t("asset.asset"), data: convert(response.data.asset)}); detail.push({title: vm.$t("asset.asset"), data: convert(response.data.asset)});
} }
@@ -1435,6 +1437,7 @@
}); });
}); });
req.then(result => { req.then(result => {
console.info(detail);
this.$refs['editChart'+chartInfo.id][0].setData(chartInfo, detail); this.$refs['editChart'+chartInfo.id][0].setData(chartInfo, detail);
}, err => {}); }, err => {});