Authored by 鲁尚清

Merge branch 'master-500-dev' of http://192.168.1.136:82/monitor_v3/anji-plus-re…

…port into master-500-dev-lushangqing
/*
* 基本信息二json
* author LH
* 2022/02/24
* */
export const monitorBasicInformationTwo = {
code: 'monitor-basic-information-two',
type: 'html',
label: '基本信息(二)',
icon: 'iconbiaoge',
options: {
setup: [
{
type: 'el-input-text',
label: '图层名称',
name: 'layerName',
required: false,
placeholder: '',
value: '基本信息',
},
{
type: 'el-input-text',
label: '标题名称',
name: 'titleName',
required: false,
placeholder: '',
value: '基本信息',
},
{
type: 'el-input-number',
label: '显示数据数',
name: 'dataNum',
required: false,
placeholder: '',
value: '6'
},
{
type: 'custom-upload',
label: '背景图片',
name: 'imageAdressBg',
required: false,
placeholder: '',
value: '',
},
{
type: 'el-select',
label: '标题位置',
name: 'textAlign',
required: false,
placeholder: '',
selectOptions: [
{code: 'center', name: '居中'},
{code: 'left', name: '左对齐'},
{code: 'right', name: '右对齐'},
],
value: 'left'
},
//logo配置
{
type: 'custom-upload',
label: '虚拟图片logo',
name: 'logoAdressBg',
required: false,
placeholder: '',
value: '',
},
{
type: 'el-input-number',
label: '字体大小',
name: 'fontSize',
required: false,
placeholder: '',
value: '14'
},
{
type: 'el-input-number',
label: '图片大小',
name: 'pictureSize',
required: false,
placeholder: '',
value: '140'
},
{
type: 'el-input-text',
label: '属性key',
name: 'attKey',
required: false,
placeholder: '请输入Key值,以逗号分割',
value: 'vmware,ipAddress,resPool,host,vMachine'
},
],
data: [
{
type: 'el-radio-group',
label: '数据类型',
name: 'dataType',
require: false,
placeholder: '',
selectValue: true,
selectOptions: [
{
code: 'staticData',
name: '静态数据',
},
{
code: 'dynamicData',
name: '动态数据',
},
],
value: 'staticData',
},
{
type: 'el-input-number',
label: '刷新时间(毫秒)',
name: 'refreshTime',
relactiveDom: 'dataType',
relactiveDomValue: 'dynamicData',
value: 30000
},
{
type: 'el-button',
label: '静态数据',
name: 'staticData',
required: false,
placeholder: '',
relactiveDom: 'dataType',
relactiveDomValue: 'staticData',
value: [
{
name:'vmware-80.12.89.77',
value : 'vmware-80.12.89.77',
code : 'vmware',
state: "2"
},
{
name:'IP地址',
value:'80.12.89.77',
code:'ipAddress',
state: "2"
},
{
name:'资源池',
value:'3',
code:'resPool',
state: "2"
},
{
name:'宿主机',
value:'2',
code:'host',
state: "2"
},
{
name:'虚拟机',
value:'10',
code:'vMachine',
state: "2"
},
],
},
{
type: 'dycustComponents',
label: '',
name: 'dynamicData',
required: false,
placeholder: '',
relactiveDom: 'dataType',
relactiveDomValue: 'dynamicData',
chartType: 'widget-table',
dictKey: 'TEXT_PROPERTIES', //表格的暂不起作用
value: '',
},
],
position: [
{
type: 'el-input-number',
label: '左边距',
name: 'left',
required: false,
placeholder: '',
value: 0,
},
{
type: 'el-input-number',
label: '上边距',
name: 'top',
required: false,
placeholder: '',
value: 0,
},
{
type: 'el-input-number',
label: '宽度',
name: 'width',
required: false,
placeholder: '该容器在1920px大屏中的宽度',
value: 416,
},
{
type: 'el-input-number',
label: '高度',
name: 'height',
required: false,
placeholder: '该容器在1080px大屏中的高度',
value: 220,
},
],
}
}
... ...
... ... @@ -42,6 +42,7 @@ import {monitorBgBorder} from "./echartsConfigJson/monitorConfigJson/monitor-bg-
import {monitorGaugeRate} from "./echartsConfigJson/monitorConfigJson/monitor-gauge-rate";
import {monitorCustomLineChart} from "./echartsConfigJson/monitorConfigJson/monitor-custom-line-chart";
import {monitorCustomBarStack} from "./echartsConfigJson/monitorConfigJson/monitor-custom-bar-stack";
import {monitorBasicInformationTwo} from "./echartsConfigJson/monitorConfigJson/monitor-basic-information-two";
import {monitorCustomLineStack} from "./echartsConfigJson/monitorConfigJson/monitor-custom-line-stack";
... ... @@ -84,6 +85,7 @@ export const {widgetTool,monitor} = {
monitorGaugeRate,
monitorCustomLineChart,
monitorCustomBarStack,
monitorBasicInformationTwo,
monitorCustomLineStack
]
}
... ...
<template>
<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}}
</div>
</div>
<div class="basic-ul">
<div class="basic-ul-left ">
<img :style="imgSizeStyle" :src="imgStyle.logoAdressBg"/>
</div>
<!-- <dynamicTableComponents :formData="dtInformationData"></dynamicTableComponents>-->
<div class="basic-ul-right" >
<div @mouseenter="mouseFun" @mouseleave="leaveFun">
<el-row :style="fontStyle">
<el-col aria-colspan="2">
<a class="link-type" :href="resUrl" target="_blank">{{informationData[0].name}}</a>
<i class="el-icon-info" v-if="visible" @click="resTopo"/>
</el-col>
</el-row>
</div>
<el-row class="basic-item" :style="fontStyle" v-for="(item,index) in informationData" :key="index">
<el-col v-if="attrKey.attrKeyVal.indexOf(item.code)>0 && index>0" class="basic-border basic-item-title basic-flex" :span="10">
{{ item.name }}
</el-col>
<el-col v-if="attrKey.attrKeyVal.indexOf(item.code)>0 && index>0 " class="basic-border basic-item-content" :span="14"><span>{{ item.value }}</span>
</el-col>
<!-- && attrKey.attrKeyVal.includes(item.code)-->
</el-row>
</div>
</div>
<!-- 直接点击表格数据展示 -->
<customDialog :dialogVisible="topoVisible" :heightStyle="heightStyle" :marginStyle="marginStyle"
:widthStyle="widthStyle" :title-name="dialogName"
:showFooter="true" :showCancelBtn="true" :showOkBtn="true" @hideDialog="hideDialog" @okFunc="okFunc"
>
<template v-slot>
<div class="txtScroll-top">
<iframe :src="topoSrc" class="layadmin-iframe" style="height: 99.5%!important;width: 100%;"/>
</div>
</template>
</customDialog>
</div>
</template>
<script>
// import customMenuBox from "../../designerComponents/customMenuBox";//下探组件
import customDialog from "../../designerComponents/customDialog";
// import dynamicTableComponents from "../../designerComponents/dynamicTableComponents";
export default {
name: "basicInformationTwo",
data() {
return {
options: {},
optionsSetUp: {},
optionsPosition: {},
optionsData: {},
informationData: [],
informationDataAll: [],
tableDate: [],
pressingVisible: false,
pressingVisibleTip: false,
visible: false,
hackReset: true,
tableDataValue: {kpiId: ''},
tableDataValueHead: {},
resType: '',
marginStyle: '',//弹框距离顶部距离
heightStyle: '',//弹框遮罩层高度
widthStyle: ';',//弹框宽度样式
topoSrc: '',
resUrl: 'http://www.baidu.com', //跳转详情页面
topoVisible: false, //资源topo弹框
dialogName: "" //弹框标题
}
},
components: {customDialog},//customMenuBox
props: {
value: Object,
ispreview: Boolean,
},
computed: {
transStyle() {
return this.objToOne(this.options);
},
styleObj() {
const allStyle = this.optionsPosition;
return {
position: this.ispreview ? "absolute" : "static",
width: allStyle.width + "px",
height: allStyle.height + "px",
left: allStyle.left + "px",
top: allStyle.top + "px",
'background-image': 'url(' + this.transStyle.imageAdressBg + ')',
// 'background-position':'center',
'background-repeat': 'no-repeat',
'background-size': 'contain'
};
},
styleColor() {
return {
"text-align": this.transStyle.textAlign,
};
},
fontStyle() {
return {
"font-size": this.transStyle.fontSize + "px",
}
},
imgStyle() {
return {
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',
probeDown: this.transStyle.probeDown,
logoAdressBg: this.transStyle.logoAdressBg ? this.transStyle.logoAdressBg : require("../../../../../../assets/images/healthStatus/title-asset.png"),
};
},
//动态基础表格信息
attrKey(){
return {
attrKeyVal: this.transStyle.attKey,
}
},
//图片大小
imgSizeStyle() {
return {
"width": this.transStyle.pictureSize + "px",
}
},
},
watch: {
value: {
handler(val) {
this.options = val;
this.optionsSetUp = val.setup;
this.optionsPosition = val.position;
this.optionsData = val.data;
this.handlerData();
},
deep: true
}
},
mounted() {
// this.initImageUrl();
this.options = this.value;
this.optionsSetUp = this.value.setup;
this.optionsPosition = this.value.position;
this.optionsData = this.value.data;
this.handlerData();
},
methods: {
handlerData() {
const resData = this.optionsData;
resData.dataType == "staticData"
? this.handlerStaticData(resData.staticData)
: this.handlerDynamicData(resData.dynamicData, resData.refreshTime);
},
handlerStaticData(data) {
this.informationDataAll = data;
if (this.imgStyle.dataNum) {
this.informationData = this.informationDataAll.slice(0, this.imgStyle.dataNum);
}
},
handlerDynamicData(data, refreshTime) {
if (!data) return;
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() {
},
pressingTimes() {
this.pressingVisible = true;
},
closePressingDialog() {
this.pressingVisible = false;
this.pressingVisibleTip = false;
},
//鼠标悬浮事件
mouseFun() {
this.visible = true;
// $(".el-icon-info").attr("src","http://www.qq.com");
// $("#resTopo").on("click",function(index){
// alert("asasas");
// });
},
//鼠标悬浮离开事件
leaveFun() {
this.visible = false;
},
//
resTopo() {
this.topoSrc = "http://www.baidu.com";
this.topoVisible = true;
},
//弹框关闭确定
hideDialog() {
this.topoVisible = false;
},
okFunc() {
this.topoVisible = false;
}
},
}
</script>
<style scoped lang="scss">
.basicInformation-container {
/*border:1px solid #f6f6f6;
border-bottom: none;*/
}
.basic-flex {
display: flex;
align-items: center;
}
.title-div {
text-align: left;
padding: 8px 10px;
}
.basic-ul-left {
/*border: 0;*/
width: 100%;
height: 100%;
/*padding-left: 10px;*/
/*float: left;*/
display: flex;
/*flex-wrap: nowrap*/
}
.basic-ul-left img {
width: 140px;
height: 140px;
margin-bottom: 20px;
}
.basic-ul-right {
width: 100%;
height: 100%;
/*display: flex;*/
/*flex-wrap: nowrap*/
/*width: 50%;*/
/*height:50%;*/
/*float: left;*/
/*margin-left: 45%;*/
/*margin-bottom: 100px;*/
}
/**
资源名称不换行
*/
.link-type {
white-space: nowrap;
color: #0d82e9;
}
.title-name {
color: rgb(30, 159, 255);
font-size: 16px;
/*padding:10px;*/
font-weight: bold;
}
.basic-ul {
display: flex;
.basic-item:nth-child(even) {
background-color: #f8f8f8;
}
.basic-item {
border-top: 1px solid #f6f6f6;
}
.basic-item:last-child {
border-bottom: 1px solid #f6f6f6;
}
}
.basic-ul-all {
.basic-item:nth-child(even) {
background-color: #262323 !important;
}
}
.basic-item {
text-align: left;
font-size: 14px;
/* border-top:1px solid #f6f6f6;*/
}
.basic-border {
padding: 7px 10px;
border-left: 1px solid rgba(151, 151, 151, 0.13);
}
.basic-border:first-child {
border-left: 0;
}
.basic-img {
width: 16px;
height: 16px;
display: inline-block;
/*display: none;*/
cursor: pointer;
img {
width: 100%;
}
}
/*.basic-item-title:hover{
.basic-img{
display: inline-block;
}
}*/
.basic-ul-all {
.basic-item-content {
text-align: center;
}
}
.basic-pressing-times {
position: absolute;
border: 1px solid #d2d2d2;
padding: 16px 20px;
z-index: 1;
background: #ffffff;
color: #666666;
&:hover {
background: #0d82e9;
color: #f6f6f6;
}
}
.span-green {
color: #0BAC33;
}
</style>
... ...
... ... @@ -45,6 +45,7 @@ import monitorBgBorder from "./monitor/bgBorder";
import monitorGaugeRate from "./monitor/gaugeRate";
import monitorCustomLineChart from "./monitor/customLineChart";
import monitorCustomBarStack from "./monitor/customBarStack";
import monitorBasicInformationTwo from "./monitor/basicInformationTwo";
import monitorCustomLineStack from "./monitor/customLineStack";
export default {
... ... @@ -84,6 +85,7 @@ export default {
monitorGaugeRate,
monitorCustomLineChart,
monitorCustomBarStack,
monitorBasicInformationTwo,
monitorCustomLineStack
},
model: {
... ...
... ... @@ -56,6 +56,7 @@ import monitorBgBorder from "./monitor/bgBorder";
import monitorGaugeRate from "./monitor/gaugeRate";
import monitorCustomLineChart from "./monitor/customLineChart";
import monitorCustomBarStack from "./monitor/customBarStack";
import monitorBasicInformationTwo from "./monitor/basicInformationTwo";
import monitorCustomLineStack from "./monitor/customLineStack";
... ... @@ -95,6 +96,7 @@ export default {
monitorGaugeRate,
monitorCustomLineChart,
monitorCustomBarStack,
monitorBasicInformationTwo,
monitorCustomLineStack
},
model: {
... ...