NEZ-311 fix:alert list图表 调整大小接口参数错误bug修复 & 项目其他图表调整线的width

This commit is contained in:
wangwenrui
2020-06-04 16:42:27 +08:00
parent 63a66268a2
commit 06d33dbf80
10 changed files with 71 additions and 16 deletions

View File

@@ -7,7 +7,7 @@
<div class="resize-box resize-box-alert" ref="resizeBox"> <div class="resize-box resize-box-alert" ref="resizeBox">
<div class="chart-alert-info" :id="'chartTableDiv'+chartIndex" v-show="divFirstShow" @mouseenter="caretShow=true" @mouseleave="caretShow=false"> <div class="chart-alert-info" :id="'chartTableDiv'+chartIndex" v-show="divFirstShow" @mouseenter="caretShow=true" @mouseleave="caretShow=false">
<loading :ref="'localLoading'+chartIndex"></loading> <loading :ref="'localLoading'+chartIndex"></loading>
<div class="clearfix chartTitle" :class="{'dragTitle':dragTitleShow}" :id="'chartTitle'+chartIndex"> <div class="clearfix chartTitle" :class="{'dragTitle':dragTitleShow}" :id="'chartTitle'+chartIndex" v-show="!isPreview">
<el-popover <el-popover
v-if="isError" v-if="isError"
:close-delay=10 :close-delay=10
@@ -482,6 +482,12 @@ export default {
handler(n,o){ handler(n,o){
this.data=Object.assign({},n) this.data=Object.assign({},n)
} }
},
panelId:{
immediate:true,
handler(n,o){
this.panelIdInner=n
}
} }
}, },
methods: { methods: {
@@ -584,7 +590,11 @@ export default {
type: "line", type: "line",
symbol: 'none', //去掉点 symbol: 'none', //去掉点
smooth: 0.2, //曲线变平滑 smooth: 0.2, //曲线变平滑
name: '' name: '',
lineStyle: {
width: 1,
opacity: 0.9
},
}; };
chartData.name += "{"; chartData.name += "{";
alias += "{"; alias += "{";
@@ -626,15 +636,21 @@ export default {
}) })
} }
}, },
getAlertList: function (filterType,isPreview=false) { getAlertList: function (filterType,isPreview=false,chartInfo) {
this.resize(); this.resize();
this.isPreview = isPreview; this.isPreview = isPreview;
let queryParam={ let queryParam={
pageSize:this.pageObj.pageSize, pageSize:this.pageObj.pageSize,
pageNo:this.pageObj.pageNo, pageNo:this.pageObj.pageNo,
} }
if(this.chartInfo&&this.chartInfo.param){ //按照粒度project>module>endpoint 查询只传最细粒度 let chart=null;
let param=this.chartInfo.param; if(chartInfo){
chart=Object.assign({},chartInfo)
}else{
chart=Object.assign({},this.chartInfo)
}
if(chart&&chart.param){ //按照粒度project>module>endpoint 查询只传最细粒度
let param=chart.param;
if(param.endpointId&&param.endpointId != ''){ if(param.endpointId&&param.endpointId != ''){
queryParam.endpointId=param.endpointId; queryParam.endpointId=param.endpointId;
}else{ }else{
@@ -887,7 +903,8 @@ export default {
next:parseInt(_this.data.next), next:parseInt(_this.data.next),
} }
targetDiv.style.height = (Math.round((containerHeight+_this.chartSpaceHeight)/10)*10-_this.chartSpaceHeight)+'px';//图表实际渲染高度,采用个位数字四舍五入 targetDiv.style.height = (Math.round((containerHeight+_this.chartSpaceHeight)/10)*10-_this.chartSpaceHeight)+'px';//图表实际渲染高度,采用个位数字四舍五入
_this.$put('panel/'+ _this.panelIdInner+'/charts/modify',modifyParams).then(response => { console.log('chart-alert-panel-id='+this.panelId)
_this.$put('panel/'+this.panelId+'/charts/modify',modifyParams).then(response => {
if (response.code === 200) { if (response.code === 200) {
//更新当前图表数据 //更新当前图表数据
_this.data.span= span; _this.data.span= span;

View File

@@ -57,7 +57,7 @@
</el-popover> </el-popover>
<div slot="title" class="chart-title"> <div slot="title" class="chart-title">
<span class="nz-dialog-title chart-title-text">{{chart.title}}</span> <span class="nz-dialog-title chart-title-text">{{chart.title}}</span>
<div class="float-right panel-calendar dialog-tool" v-if="chart.type!=='url'"> <div class="float-right panel-calendar dialog-tool" v-if="chart.type!=='url' && chart.type !=='alertList'">
<time-picker ref="calendarPanel" class="nz-dashboard-picker" style="margin-top: -12px;" @change="dateChange"></time-picker> <time-picker ref="calendarPanel" class="nz-dashboard-picker" style="margin-top: -12px;" @change="dateChange"></time-picker>
<!-- <!--
@@ -129,7 +129,7 @@
</template> </template>
<template v-if="chart.type === 'alertList'"> <template v-if="chart.type === 'alertList'">
<chart-alert-list ref="alertListChart"></chart-alert-list> <chart-alert-list ref="alertListChart" id="chartAlertListPreview"></chart-alert-list>
</template> </template>
<loading ref="loadingPreview"></loading> <loading ref="loadingPreview"></loading>
@@ -236,6 +236,8 @@
chartContainerId = 'chartUrlPreview'; chartContainerId = 'chartUrlPreview';
}else if (chartType === 'singleStat') { }else if (chartType === 'singleStat') {
chartContainerId = 'chartSingleStatPreview'; chartContainerId = 'chartSingleStatPreview';
}else if(chartType === 'alertList'){
chartContainerId = 'chartAlertListPreview';
} }
//设置高度 chart-table //设置高度 chart-table
@@ -327,7 +329,7 @@
}); });
}, },
getAlertListChartData:function(chartInfo,filterType){ getAlertListChartData:function(chartInfo,filterType){
this.$refs.alertListChart.getAlertList(filterType,true); this.$refs.alertListChart.getAlertList(filterType,true,this.chart);
this.$refs.loadingPreview.endLoading(); this.$refs.loadingPreview.endLoading();
}, },
// 获取一个图表具体数据 // 获取一个图表具体数据
@@ -406,6 +408,10 @@
showSymbol: false, showSymbol: false,
data: [], data: [],
type: chartItem.type, type: chartItem.type,
lineStyle: {
width: 1,
opacity: 0.9
},
}, },
metric_name: '', metric_name: '',
}; };
@@ -1112,6 +1118,10 @@
showSymbol:false, showSymbol:false,
data: [], data: [],
type:this.chart.type, type:this.chart.type,
lineStyle: {
width: 1,
opacity: 0.9
},
//visible: true, //visible: true,
//threshold: null, //threshold: null,
}, },

View File

@@ -1120,6 +1120,10 @@
showSymbol:false, showSymbol:false,
data: [], data: [],
type:this.data.type, type:this.data.type,
lineStyle: {
width: 1,
opacity: 0.9
},
//visible: true, //visible: true,
//threshold: null, //threshold: null,
}, },

View File

@@ -513,7 +513,11 @@
type: "line", type: "line",
symbol: 'none', //去掉点 symbol: 'none', //去掉点
smooth: 0.2, //曲线变平滑 smooth: 0.2, //曲线变平滑
name: '' name: '',
lineStyle: {
width: 1,
opacity: 0.9
},
}; };
chartData.name += "{"; chartData.name += "{";
alias += "{"; alias += "{";

View File

@@ -418,7 +418,11 @@
let chartData={ let chartData={
type:"line", type:"line",
symbol:'none', //去掉点 symbol:'none', //去掉点
smooth:0.2, //曲线变平滑 smooth:0.2,
lineStyle: {
width: 1,
opacity: 0.9
},
}; };
chartData.name=queryData.metric.__name__; chartData.name=queryData.metric.__name__;
let alias=queryData.metric.__name__; let alias=queryData.metric.__name__;

View File

@@ -514,7 +514,11 @@
type: "line", type: "line",
symbol: 'none', //去掉点 symbol: 'none', //去掉点
smooth: 0.2, //曲线变平滑 smooth: 0.2, //曲线变平滑
name: '' name: '',
lineStyle: {
width: 1,
opacity: 0.9
},
}; };
chartData.name += "{"; chartData.name += "{";
alias += "{"; alias += "{";

View File

@@ -73,7 +73,7 @@
<!-- begin--表单--> <!-- begin--表单-->
<el-scrollbar class="right-box-form-box" ref="scrollbar"> <el-scrollbar class="right-box-form-box" ref="scrollbar">
<el-form class="right-box-form" :model="chart" :rules="rules" ref="chartForm"> <el-form class="right-box-form right-box-form-left" :model="chart" label-width="120px" label-position="right" :rules="rules" ref="chartForm">
<el-form-item :label="$t('dashboard.panel.title')" prop="panel" v-if="!showPanel.type"> <el-form-item :label="$t('dashboard.panel.title')" prop="panel" v-if="!showPanel.type">
<el-autocomplete <el-autocomplete
:fetch-suggestions="panelSuggestion" :fetch-suggestions="panelSuggestion"

View File

@@ -313,7 +313,11 @@ export default {
type:chartItem.type ? chartItem.type : 'line', type:chartItem.type ? chartItem.type : 'line',
//visible: true, //visible: true,
//threshold: null, //threshold: null,
chartTitle:'' chartTitle:'',
lineStyle: {
width: 1,
opacity: 0.9
},
}, },
metric_name: '', metric_name: '',
}; };

View File

@@ -513,6 +513,10 @@
smooth:0.2, //曲线变平滑 smooth:0.2, //曲线变平滑
data: [], data: [],
type:'line', type:'line',
lineStyle: {
width: 1,
opacity: 0.9
},
}; };
if (response.data.result.length > 0) { if (response.data.result.length > 0) {
series.data=response.data.result[0].values.map((item)=>{ series.data=response.data.result[0].values.map((item)=>{
@@ -545,6 +549,10 @@
smooth:0.2, //曲线变平滑 smooth:0.2, //曲线变平滑
data: [], data: [],
type:'line', type:'line',
lineStyle: {
width: 1,
opacity: 0.9
},
}; };
if (response.data.result.length > 0) { if (response.data.result.length > 0) {
series.data=response.data.result[0].values.map((item)=>{ series.data=response.data.result[0].values.map((item)=>{

View File

@@ -593,7 +593,7 @@
margin-top: 3px; margin-top: 3px;
text-align:left; text-align:left;
border-radius:4px; border-radius:4px;
width:120px; width:260px;
height:24px; height:24px;
border:solid 1px #d8dce1; border:solid 1px #d8dce1;
white-space: nowrap; white-space: nowrap;
@@ -602,7 +602,7 @@
} }
.panel-list-title { .panel-list-title {
min-height:24px; min-height:24px;
width:100px; width:236px;
white-space: nowrap; white-space: nowrap;
overflow-x: hidden; overflow-x: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;