Authored by 鲁尚清

仪表盘数据增加点击事件-自定义文本点击事件

... ... @@ -77,15 +77,23 @@
/>
</el-form-item>
<el-form-item label="关联组件:">
<el-select v-model.trim="rowFormData['componentName']" size="small">
<el-option
v-for="item in componentNameData"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
<div class="flex-start">
<el-select v-model.trim="rowFormData['componentName']" size="small">
<el-option
v-for="item in componentNameData"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
<div class="alt-text">
<span v-if="rowFormData['componentName']=='1'">显示正常内容</span>
<span v-if="rowFormData['componentName']=='textToImage'">值为'message',显示为信息图标,值为'',显示微信图标</span>
<span v-if="rowFormData['componentName']=='textToBg'">值为'1',显示为一般,值为'2',显示为重要,值为'3',显示为严重</span>
</div>
</div>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
... ... @@ -184,7 +192,7 @@ export default {
value:1
},
{
label:'微信图标',
label:'信息图标',
value:'textToImage'
},
{
... ... @@ -380,4 +388,15 @@ export default {
}
}
.flex-start{
display: flex;
align-items: center;
justify-content: start;
}
.alt-text{
margin-left:5px;
font-size: 12px;
color:#D81E06;
line-height: 12px;
}
</style>
... ...
<template>
<div>
<div class="basic-img">
<el-popover ref="popoverMenu" placement="right" trigger="click" auto-close="200" >
<el-popover ref="popoverMenu" placement="right" trigger="click" auto-close="200" >
<template #reference>
<img class="info-img" src="@/assets/images/healthStatus/icon_row_menu.png" alt="" @click.stop="pressingTimes()">
</template>
... ...
... ... @@ -80,7 +80,70 @@ export const monitorBasicInformation = {
required: false,
placeholder: '',
value: '14'
}
},
[
{
name: "下探设置",
list: [
{
type: 'el-switch',
label: '是否有下探',
name: 'probeDown',
required: false,
placeholder: '',
value: true,
},
{
type: 'el-switch',
label: '告警设置',
name: 'alarm_setting',
required: false,
placeholder: '',
value: false
},
{
type: 'el-switch',
label: '过滤单指标',
name: 'filter_sheet_indicator',
required: false,
placeholder: '',
value: false
},
{
type: 'el-switch',
label: '过滤多指标',
name: 'filter_multiple_indicators',
required: false,
placeholder: '',
value: false
},
{
type: 'el-switch',
label: '性能趋势',
name: 'performance_trends',
required: false,
placeholder: '',
value: false
},
{
type: 'el-switch',
label: '压制次数',
name: 'pressing_times',
required: false,
placeholder: '',
value: true
},
{
type: 'el-switch',
label: '纳入容量预测',
name: 'include_capacity_forecast',
required: false,
placeholder: '',
value: false
}
]
},
],
],
data: [
{
... ... @@ -120,9 +183,10 @@ export const monitorBasicInformation = {
relactiveDomValue: 'staticData',
value: [
{
name:'监控连接状态',
value:'连接成功',
code:'link'
name:'监控连接状态1',
value:'连接成功1',
code:'link',
id:'KPIE13DD9A3'
},
{
name:'最近采集时间',
... ...
... ... @@ -30,7 +30,7 @@ export const monitorGaugeRate = {
placeholder: '',
value: 'CPU使用率',
},
{
/*{
type: 'el-select',
label: '标题位置',
name: 'textAlign',
... ... @@ -50,13 +50,18 @@ export const monitorGaugeRate = {
required: false,
placeholder: '',
value: '',
},
},*/
{
type: 'el-input-text',
type: 'el-select',
label: 'kpiId',
name: 'kpiId',
required: false,
placeholder: '',
selectOptions: [
{code: 'KPI7054BC34', name: 'KPI7054BC34'},
{code: 'KPI31CB8D97', name: 'KPI31CB8D97'},
{code: 'KPI20352505', name: 'KPI20352505'},
],
value: 'KPI7054BC34',
},
{
... ... @@ -67,6 +72,14 @@ export const monitorGaugeRate = {
placeholder: '',
value: 'x86server_cpurate',
},
{
type: 'el-input-text',
label: 'flag',
name: 'flag',
required: false,
placeholder: '',
value: '',
},
[
{
name: "下探设置",
... ...
<template>
<div class="basicInformation-container" :style="styleObj" @click="closePressingDialog">
<div class="title-div" :style="styleColor">
<div class="basicInformation-container" :style="styleObj" @click="closePressingDialog" @click.stop="visible = false" >
<div class="title-div" :style="styleColor" v-if="hackReset">
<img v-if="!imgStyle.titleName" :src="imgStyle.imageAdress" :style="imgStyle" alt="">
<div v-if="imgStyle.titleName" class="title-name">
{{imgStyle.titleName}}
<el-tooltip v-model="visible">
<el-tooltip v-model="visible" :manual="true" placement="right-start">
<template #content>
<div class="basic-ul-all" style="width:720px;" @click="pressingVisibleTip=false">
<el-row class="basic-item" :style="fontStyle" v-for="(item,index) in informationDataAll" :key="index">
<el-col class="basic-border basic-item-title basic-flex" :span="10">
{{ item.name }}
<span class="basic-img" v-if="item.code=='link'">
<img src="@/assets/images/healthStatus/icon_row_menu.png" alt="" @click.stop="pressingVisibleTip=true">
<span class="basic-img" v-if="item.id=='KPIE13DD9A3'">
<!-- <img src="@/assets/images/healthStatus/icon_row_menu.png" alt="" @click.stop="pressingVisibleTip=true">
<span class="basic-pressing-times" @click="pressingDialog" v-if="pressingVisibleTip">
<i class="el-icon-link"></i>压制次数
</span>
</span>-->
<customMenuBox ref="customMenu" v-if="imgStyle.probeDown "
:detailMenubox="calcDetailMenubox"
:tableDataValue="tableDataValue" :flg="''"
:tableDataValueHead="tableDataValueHead"
:heightStyle="heightStyle" :marginStyle="marginStyle" :tableName="imgStyle.titleName"
:trendSrc="trendSrc"
:resType="resType"
></customMenuBox>
</span>
</el-col>
<el-col class="basic-border basic-item-content" :span="14">{{ item.value }}</el-col>
<el-col class="basic-border basic-item-content" :span="14"><span :class="{'span-green':index==0}">{{ item.value }}</span></el-col>
</el-row>
</div>
</template>
<i class="el-icon-info" @mouseenter="visible = true" @mouseleave="visible = false" />
<i class="el-icon-info" @mouseenter="visible = true"/>
</el-tooltip>
</div>
... ... @@ -30,14 +38,22 @@
<el-row class="basic-item" :style="fontStyle" v-for="(item,index) in informationData" :key="index">
<el-col class="basic-border basic-item-title basic-flex" :span="10">
{{ item.name }}
<span class="basic-img" v-if="item.code=='link'">
<img src="@/assets/images/healthStatus/icon_row_menu.png" alt="" @click.stop="pressingTimes">
<span class="basic-img" v-if="item.id=='KPIE13DD9A3'">
<!-- <img src="@/assets/images/healthStatus/icon_row_menu.png" alt="" @click.stop="pressingTimes">
<span class="basic-pressing-times" @click="pressingDialog" v-if="pressingVisible">
<i class="el-icon-link"></i>压制次数
</span>
</span>-->
<customMenuBox ref="customMenu" v-if="imgStyle.probeDown"
:detailMenubox="calcDetailMenubox"
:tableDataValue="tableDataValue" :flg="''"
:tableDataValueHead="tableDataValueHead"
:heightStyle="heightStyle" :marginStyle="marginStyle" :tableName="imgStyle.titleName"
:trendSrc="trendSrc"
:resType="resType"
></customMenuBox>
</span>
</el-col>
<el-col class="basic-border basic-item-content" :span="14">{{ item.value }}</el-col>
<el-col class="basic-border basic-item-content" :span="14"><span :class="{'span-green':index==0}">{{ item.value }}</span></el-col>
</el-row>
</div>
... ... @@ -45,6 +61,7 @@
</template>
<script>
import customMenuBox from "../../designerComponents/customMenuBox";//下探组件
export default {
name: "basicInformation",
... ... @@ -59,9 +76,17 @@ export default {
pressingVisible:false,
pressingVisibleTip:false,
visible:false,
hackReset:true,
tableDataValue: {kpiId:''},
tableDataValueHead: {},
resType:'',
marginStyle:'',//弹框距离顶部距离
heightStyle:'',//弹框遮罩层高度
widthStyle:';',//弹框宽度样式
trendSrc:'',
}
},
components: {},
components: {customMenuBox},
props: {
value: Object,
ispreview: Boolean
... ... @@ -102,9 +127,53 @@ export default {
imageAdress: this.transStyle.imageAdress?this.transStyle.imageAdress:require("../../../../../../assets/images/healthStatus/title-asset.png"),
titleName:this.transStyle.titleName,
isName:this.transStyle.isName,
dataNum:this.transStyle.dataNum?this.transStyle.dataNum:'6'
dataNum:this.transStyle.dataNum?this.transStyle.dataNum:'6',
probeDown:this.transStyle.probeDown
};
}
},
//表格下探列表
calcDetailMenubox(){
const menubox = this.transStyle;
let detailMenuBox=[];
if(menubox.alarm_setting){
detailMenuBox.push({
name:'告警设置',
type:'alarm_setting'
})
}
if(menubox.filter_sheet_indicator){
detailMenuBox.push({
name:'过滤单指标',
type:'filter_sheet_indicator'
})
}
if(menubox.filter_multiple_indicators){
detailMenuBox.push({
name:'过滤多指标',
type:'filter_multiple_indicators'
})
}
if(menubox.performance_trends){
detailMenuBox.push({
name:'性能趋势',
type:'performance_trends'
})
}
if(menubox.pressing_times){
detailMenuBox.push({
name:'压制次数',
type:'pressing_times'
})
}
if(menubox.include_capacity_forecast){
detailMenuBox.push({
name:'纳入容量预测',
type:'include_capacity_forecast'
})
}
return detailMenuBox;
},
},
watch: {
... ... @@ -133,28 +202,53 @@ export default {
handlerData() {
const resData = this.optionsData;
console.log("resdata",resData)
resData.dataType == "staticData"
? this.handlerStaticData(resData.staticData)
: this.handlerDynamicData(resData.dynamicData, resData.refreshTime);
},
handlerStaticData(data) {
this.informationData = data;
// this.informationData = data;
this.informationDataAll = data;
if(this.imgStyle.dataNum){
this.informationData=this.informationData.slice(0,this.imgStyle.dataNum);
this.informationData=this.informationDataAll.slice(0,this.imgStyle.dataNum);
}
},
handlerDynamicData(data, refreshTime) {
if (!data) return;
/* if (this.ispreview) {
if (this.ispreview) {
this.getEchartData(data);
this.flagInter = setInterval(() => {
this.getEchartData(data);
}, refreshTime);
} else {
this.getEchartData(data);
}*/
}
},
getEchartData(val) {
const data = this.queryEchartsData(val);
data.then(res => {
if(res && res[0].code==0)
this.informationDataAll = res[0].data;
if(this.informationDataAll && this.informationDataAll.length>0){
this.informationDataAll.map(item=>{
if(typeof (item.value)!='string'){
item.value=item.value[0].state
}
})
}
if(this.imgStyle.dataNum){
this.informationData=this.informationDataAll.slice(0,this.imgStyle.dataNum);
}
this.hackResetFun();
});
},
// vue hack 之强制刷新组件
hackResetFun() {
this.hackReset = false;
this.$nextTick(() => {
this.hackReset = true;
});
},
pressingDialog(){
},
... ... @@ -253,4 +347,7 @@ export default {
color:#f6f6f6;
}
}
.span-green{
color:#0BAC33;
}
</style>
... ...
<template>
<div :style="styleObj" >
<div :style="styleObj" @click.stop="isDisplay=false">
<div class="title-div flex-start" :style="styleColor" @mouseenter.stop="isDisplay=true;">
<img v-if="!imgStyle.titleName" :src="imgStyle.imageAdress" alt="">
<div v-if="imgStyle.titleName" class="title-name">{{imgStyle.titleName}}</div>
... ... @@ -13,24 +13,46 @@
></customMenuBox>
</div>
<v-chart :options="options" autoresize/>
<!-- <div class="chart-div" style="height: 100%;height: 100%">-->
<v-chart :options="options" autoresize/>
<div class="chart-value" :style="chartValueStyle"><span @click="goTrend()">{{dataValue}}</span></div>
<!-- </div>-->
<!-- 直接点击数据展示 性能趋势弹框-->
<customDialog :dialogVisible="trendVisible" :heightStyle="heightStyle" :marginStyle="marginStyle" :widthStyle="widthStyle" :title-name="imgStyle.titleName"
:showFooter="true" :showCancelBtn="true" :showOkBtn="true" @hideDialog="hideDialog" @okFunc="okFunc"
>
<template v-slot>
<div class="txtScroll-top">
<iframe :src="trendSrc" class="layadmin-iframe" style="height: 99.5%!important;width: 100%;"/>
</div>
</template>
</customDialog>
</div>
</template>
<script>
import echarts from "echarts";
import customMenuBox from "../../designerComponents/customMenuBox";//下探组件
import customDialog from "../../designerComponents/customDialog";
import {getTrendBaseUrl} from "@/api/platform";
export default {
name: "gaugeRate",
components: {customMenuBox},
components: {customMenuBox,customDialog},
props: {
value: Object,
ispreview: Boolean
},
data() {
/*this.myChart={
click:function(e){
console.log("111",e)
}
}*/
return {
trendVisible:false,//性能趋势弹框
dataValue:'',
trendSrc:'',//性能趋势图地址
marginStyle:'',//弹框距离顶部距离
heightStyle:'',//弹框遮罩层高度
... ... @@ -164,7 +186,7 @@ export default {
},
styleColor() {
return {
"text-align": this.optionsSetup.textAlign,
// "text-align": this.optionsSetup.textAlign,
};
},
... ... @@ -175,6 +197,13 @@ export default {
probeDown:this.optionsSetup.probeDown
};
},
chartValueStyle(){
return{
color: this.optionsSetup.labelColor,
'font-size': this.optionsSetup.labelFontSize+'px',
'font-weight': this.optionsSetup.labelFontWeight,
}
},
//表格下探列表
calcDetailMenubox(){
const menubox = this.optionsSetup;
... ... @@ -221,10 +250,10 @@ export default {
kpiIdStyle(){
this.$set(this.tableDataValue,'kpiId',this.optionsSetup.kpiId)
this.tableDataValue.kpiId=this.optionsSetup.kpiId;
console.log("111",this.tableDataValue)
let obj={
kpiId:this.optionsSetup.kpiId,
targetId:this.optionsSetup.targetId
targetId:this.optionsSetup.targetId,
flag:this.optionsSetup.flag
}
return obj;
},
... ... @@ -258,6 +287,7 @@ export default {
this.optionsCollapse = this.value.collapse;
this.optionsSetup = this.value.setup;
this.editorOptions();
},
methods: {
editorOptions() {
... ... @@ -367,6 +397,7 @@ export default {
}
]
const detail = {
show:false,
valueAnimation: true,
formatter: '{value} %',
color: optionsSetup.labelColor,
... ... @@ -375,7 +406,8 @@ export default {
}
series[0].data = data
series[0].detail = detail
console.log("val",val)
this.dataValue=(num?num:'0') +'%';
this.tableDataValue=val[0];
this.setTrend(val[0])
},
dynamicDataFn(val, refreshTime) {
... ... @@ -392,6 +424,7 @@ export default {
getEchartData(val) {
const data = this.queryEchartsData(val);
data.then(res => {
this.tableDataValue=res.map;
this.setTrend(res.map)
this.renderingFn(res);
});
... ... @@ -405,6 +438,7 @@ export default {
}
]
const detail = {
show:false,
valueAnimation: true,
formatter: '{value} %',
color: optionsSetup.labelColor,
... ... @@ -413,8 +447,8 @@ export default {
}
series[0].data = data
series[0].detail = detail
this.dataValue=(val[0].value?val[0].value:'0')+'%';
},
//设置性能趋势图
setTrend(data){
let urlParams='resId='+this.getUrlToken.resId+'&kpiId='+this.kpiIdStyle.kpiId+'&flag='+data.flag+'&warning='+data.isWarning
... ... @@ -425,6 +459,18 @@ export default {
this.resType=data.resType;
this.trendSrc=baseUrl+'/vue3/index.html#/vue3/pieDetailLine?'+urlParams+'&access_token='+this.getUrlToken.token;
},
goTrend(){
this.setTrend(this.tableDataValue);
this.trendVisible=true;
},
//弹框关闭确定
hideDialog(){
this.trendVisible=false;
},
okFunc(){
this.trendVisible=false;
},
handleScroll(e){
let serviceTop = 44;
... ... @@ -484,4 +530,17 @@ export default {
justify-content: start;
align-items: center;
}
.detail-value{
color: #ff0000;
}
.chart-value{
position: absolute;
left: 0;
right: 0;
bottom: 6%;
span{
cursor: pointer;
text-decoration:underline;
}
}
</style>
... ...