Authored by 王涛

Merge branch 'master-ajreport-lushangqing' into 'master'

详情表格组件功能完善-文字超出悬浮提示



See merge request !13
... ... @@ -77,3 +77,9 @@
.el-table td {
padding: 6px 0;
}
.alarm-li{
.el-input .el-input__inner{
height: 50px;
}
}
... ...
... ... @@ -361,3 +361,17 @@ a:hover {
border-color: rgba(249, 32, 32, 0.2);
color: rgb(249, 32, 32);
}
/*列将内容转换成图标*/
.small-icon {
width: 22px;
height: 22px;
display: block;
}
.small-icon.small-icon-msg {
background: url('../images/monitor/icon-msg.png') no-repeat center;
background-size: contain;
}
.small-icon.small-icon-wechat {
background: url('../images/monitor/icon-wechat.png') no-repeat center;
background-size: contain;
}
... ...
... ... @@ -36,7 +36,7 @@
width="30%"
:before-close="handleClose"
>
<el-form :model="rowFormData" label-width="60px">
<el-form :model="rowFormData" label-width="70px">
<el-form-item label="名称:">
<el-input
v-model.trim="rowFormData['name']"
... ... @@ -76,6 +76,17 @@
controls-position="right"
/>
</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>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button size="mini" @click="editDialogVisible = false">取 消</el-button>
... ... @@ -160,12 +171,27 @@ export default {
width: "",
sort:false,
columnSort:0,
componentName:1
},
flag: true, // true 新增, false 编辑
indexEditor: -1, // 编辑第几个数据
tableData: [],
multipleSelection:[],
editDialogVisible:false,//编辑列
componentNameData:[
{
label:'正常内容',
value:1
},
{
label:'微信图标',
value:'textToImage'
},
{
label: '级别背景',
value:'textToBg'
}
],//关联组件
};
},
methods: {
... ... @@ -257,10 +283,9 @@ export default {
// this.formData.push(this.rowFormData);
let arr=[]
this.multipleSelection.map((item,index)=>{
arr.push({name:item.kpiName,key:item.kpiId,width:'50%',sort:false,columnSort:index})
arr.push({name:item.kpiName,key:item.kpiId,width:'50%',sort:false,columnSort:index,componentName:1})
})
this.formData=arr;
console.log("formadata",this.formData)
this.dialogVisible = false;
} else {
// 编辑
... ... @@ -287,7 +312,7 @@ export default {
}
})
this.multipleSelection.splice(indexId, 1);
console.log("*/*/*",this.multipleSelection)
this.tableData.map(item=>{
if(item.kpiId==kpiId){
setTimeout(()=>{
... ...
<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>
<div class="info-ul" style="width:140px;" >
<div class="basic-pressing-times" @click="pressingDialog(itemMenu,tableDataValue,flg)" v-for="itemMenu in detailMenubox">
<div class="basic-pressing-times" @click.stop="pressingDialog(itemMenu,tableDataValue,flg)" v-for="itemMenu in detailMenubox">
<i class="el-icon-link icon-div"></i>{{itemMenu.name}}
</div>
</div>
... ... @@ -17,7 +17,32 @@
>
<template v-slot>
<div v-if="dialogName=='alarm_setting'" class="txtScroll-top">
告警设置{{pressingValue}}
<!-- 告警设置{{pressingValue}}-->
<div class="alarm-li flex-center">
<div class="alarm-li-label">告警策略</div>
<el-select v-model="strategyValue" filterable class="m-2 alarm-li-select" placeholder="选择告警策略">
<el-option
v-for="item in strategyData"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</div>
<div class="alarm-li flex-center">
<div class="alarm-li-label">告警列表</div>
<el-select v-model="alarmListValue" multiple filterable class="m-2 alarm-li-select" placeholder="选择告警列表" >
<el-option
v-for="item in alarmListData"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</div>
</div>
<div v-if="dialogName=='filter_sheet_indicator'" class="txtScroll-top">
过滤单指标{{pressingValue}}
... ... @@ -112,6 +137,19 @@ export default {
// trendSrc:'',//性能走势图地址
// pressingVisible:'',
pressingValue:'',
strategyData: [{
label:'策略一',
value:'001'
}],//告警策略数据
strategyValue:'',//告警策略值
alarmListData:[{
label:'告警列表一',
value:'001'
},{
label:'告警列表二',
value:'002'
},],//告警列表数据
alarmListValue:[],//告警列表值
}
},
... ... @@ -122,6 +160,12 @@ export default {
},
deep: true
},
tableName:{
handler(val){
console.log("titlename",val)
},
deep:true
}
},
mounted() {
... ... @@ -165,8 +209,14 @@ export default {
this.setDialog(itemMenu.type,flg);
this.closePopoverMenu();
this.$emit("closeProbeDown",'')
// this.$refs.popoverMenu.showPopper = false;
},
closePopoverMenu(){
let key=this.$refs.popoverMenu;
console.log("key",key)
if(key && key.length>0){
key.map(item=>{
item.showPopper=false
... ... @@ -175,10 +225,6 @@ export default {
key.showPopper=false
}
this.$emit("closeProbeDown",'')
// this.$refs.popoverMenu.showPopper = false;
},
//打开弹框
setDialog(name,flg){
... ... @@ -235,4 +281,29 @@ export default {
}
}
.alarm-li{
width:100%;
padding:0 10px;
margin-bottom: 30px;
.alarm-li-label{
height:50px;
line-height: 50px;
background: #fbfbfb;
padding:10px;
display: flex;
align-items: center;
border:1px solid #e6e6e6;
}
.alarm-li-select{
flex:1;
}
}
.el-input .el-input__inner{
height: 40px;
}
.flex-center{
display: flex;
justify-content: center;
}
</style>
... ...
<template>
<div class="text-bg-div">
<div :class="['table-level-normal',{'table-level-worse':alarmLevel=='2','table-level-worst':alarmLevel=='3'}]">
{{levelName}}
</div>
</div>
</template>
<script>
export default {
name: "textToBg",
data() {
return {
levelName:'一般'
}
},
components: {},
props: {
alarmLevel: String,
},
computed: {},
mounted() {
this.getLeveName();
},
methods: {
getLeveName(){
if(this.alarmLevel=='1'){
this.levelName='一般'
}else if(this.alarmLevel=='2'){
this.levelName='重要'
}else if(this.alarmLevel=='3'){
this.levelName='严重'
}else{
this.levelName='一般'
}
}
}
}
</script>
<style lang="scss" scoped>
.text-bg-div{
width:80%;
}
.table-level-normal {
min-width: 28px;
line-height: 28px;
width:100%;
display: inline-block;
padding: 0 3px;
color: #fff;
background-color: #1e9fff
}
.table-level-worse {
background-color: #FF7E00;
}
.table-level-worst {
background-color: #D81E06;
}
</style>
... ...
<template>
<div>
<div :class="['small-icon',{'small-icon-wechat':way=='','small-icon-msg':way=='message'}]"></div>
</div>
</template>
<script>
export default {
name: "textToImage",
data() {
return {
}
},
components: {},
props: {
way: String,
},
computed: {},
mounted() {},
methods: {}
}
</script>
<style lang="scss" scoped>
</style>
... ...
... ... @@ -134,56 +134,119 @@ export const monitorDetailTable = {
placeholder: '',
value: '#e6e6e6'
},
[
{
name:'下探列表设置',
list:[
{
type: 'el-switch',
label: '告警设置',
name: 'alarm_setting',
required: false,
placeholder: '',
value: true
},
{
type: 'el-switch',
label: '过滤单指标',
name: 'filter_sheet_indicator',
required: false,
placeholder: '',
value: true
},
{
type: 'el-switch',
label: '过滤多指标',
name: 'filter_multiple_indicators',
required: false,
placeholder: '',
value: true
},
{
type: 'el-switch',
label: '性能趋势',
name: 'performance_trends',
required: false,
placeholder: '',
value: true
},
{
type: 'el-switch',
label: '压制次数',
name: 'pressing_times',
required: false,
placeholder: '',
value: true
},
{
type: 'el-switch',
label: '纳入容量预测',
name: 'include_capacity_forecast',
required: false,
placeholder: '',
value: true
}
]
}
],
{
type: 'el-switch',
label: '告警设置',
name: 'alarm_setting',
required: false,
placeholder: '',
value: true
},
{
type: 'el-switch',
label: '过滤单指标',
name: 'filter_sheet_indicator',
required: false,
placeholder: '',
value: true
},
{
type: 'el-switch',
label: '过滤多指标',
name: 'filter_multiple_indicators',
required: false,
placeholder: '',
value: true
},
{
type: 'el-switch',
label: '性能趋势',
name: 'performance_trends',
required: false,
placeholder: '',
value: true
},
{
type: 'el-switch',
label: '压制次数',
name: 'pressing_times',
required: false,
placeholder: '',
value: true
},
{
type: 'el-switch',
label: '纳入容量预测',
name: 'include_capacity_forecast',
label: '弹框默认名称',
name: 'nameDefault',
required: false,
placeholder: '',
value: true
},
[
{
name: '弹框名称设置',
list: [
{
type: 'el-switch',
label: '资源类型',
name: 'nameResType',
required: false,
placeholder: '',
value: false
},
{
type: 'el-switch',
label: 'IP地址',
name: 'nameIPAddress',
required: false,
placeholder: '',
value: false
},
{
type: 'el-switch',
label: '资源名称',
name: 'nameResName',
required: false,
placeholder: '',
value: false
},
{
type: 'el-switch',
label: '指标名称',
name: 'nameKpiName',
required: false,
placeholder: '',
value: false
},
{
type: 'el-switch',
label: '指标标识',
name: 'nameKpiFlg',
required: false,
placeholder: '',
value: false
}
],
}
],
[
{
name: '状态范围设置',
list: [
{
... ... @@ -336,11 +399,11 @@ export const monitorDetailTable = {
chartType:'detail-table',
placeholder: '',
value: [
{name: '文件系统挂载', key: 'KPI7AC1664E', width: '50%',isStatic:true,columnSort:0},
{name: '文件系统使用率', key: 'KPI449F5365', width: '50%',isStatic:true,columnSort:1},
{name: '文件系统总大小', key: 'KPIA91F44E7', width: '50%',isStatic:true,columnSort:2},
{name: '文件系统已使用大小', key: 'KPI98306224', width: '50%',isStatic:true,columnSort:3},
{name: '卷名称', key: 'KPI77C28BBA', width: '50%',isStatic:true,columnSort:4},
{name: '文件系统挂载', key: 'KPI7AC1664E', width: '50%',isStatic:true,columnSort:0,componentName:1},
{name: '文件系统使用率', key: 'KPI449F5365', width: '50%',isStatic:true,columnSort:1,componentName:1},
{name: '文件系统总大小', key: 'KPIA91F44E7', width: '50%',isStatic:true,columnSort:2,componentName:1},
{name: '文件系统已使用大小', key: 'KPI98306224', width: '50%',isStatic:true,columnSort:3,componentName:1},
{name: '卷名称', key: 'KPI77C28BBA', width: '50%',isStatic:true,columnSort:4,componentName:1},
]
}
],
... ...
<template>
<div :style="styleObj" @click="closePressingDialog" ref="detailTable">
<div :style="styleObj" @mouseleave.stop="closePressingDialog" ref="detailTable">
<div class="detail-table-title title-flex-between">
<div class="title-left">{{tableStyle.tableName}}</div>
<div class="title-right">
<span class="title-link" @click="handlerDetailDataNoPage()">更多</span>
<span class="title-link">下载</span>
<span class="title-link" @click="downloadTableList">下载</span>
</div>
</div>
<superslide v-if="hackReset" :options="options" class="txtScroll-top" :style="borderStyle">
... ... @@ -15,7 +15,7 @@
v-for="(item, index) in header"
:style="[headerTableStlye,tableFiledWidth(index),tableRowHeight()]"
:key="index"
:class="{'ascending':(sortBy==item.key && sortCaret=='ascending'),'descending':(sortBy==item.key && sortCaret=='descending')}"
:class="['padding-10',{'ascending':(sortBy==item.key && sortCaret=='ascending'),'descending':(sortBy==item.key && sortCaret=='descending')}]"
>
{{ item.name }}
<!-- <i v-if="tableFiledSort(index)" :class="['cursorClass',{'el-icon-caret-bottom':(sortBy==item.key && sortVal=='bottom'),'el-icon-caret-top':(sortBy==item.key && sortVal=='top')}]" @click="changeSort(item)"></i>-->
... ... @@ -31,34 +31,31 @@
<li v-for="(item, index) in list" :key="index" :style="tableRowHeight()" @mouseenter="isHover=true" @mouseleave="isHover=false" >
<div class="infoList-flex" :style="[bodyTableStyle, bodyTable(index),tableFiledWidth(index),tableRowHeight(),serialNumber]">
{{ index+1 }}</div>
<div class="infoList-flex"
<div class="infoList-flex text-overflow padding-10"
v-for="(itemChild, idx) in header"
:key="idx"
:style="[bodyTableStyle, bodyTable(index),tableFiledWidth(idx),tableRowHeight()]"
@mouseenter="pressingTimes(index,idx)"
:ref="'headerRef'+index+'-'+idx"
:data-tip="tableFiledMaxWidth('isOverflow'+index+'-'+idx,index,idx)"
>
<span @click="clickListName(item[itemChild.key])" :style="colorStyle(item[itemChild.key].kpiValue)"
:class="['listName',{'listName-link':item[itemChild.key] && (item[itemChild.key].kpiIdent==1 || item[itemChild.key].isWarning==1)}]">
{{ item[itemChild.key].kpiValue}} </span>
<!-- <div class="basic-img" v-if="item[itemChild.key] && (item[itemChild.key].kpiIdent==1 || item[itemChild.key].isWarning==1)">
<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(index,idx)">
</template>-->
<!-- <div class="info-ul" v-if="pressingVisible==index+'-'+idx">-->
<customMenuBox v-if="pressingVisible==index+'-'+idx && item[itemChild.key] && (item[itemChild.key].kpiIdent==1 || item[itemChild.key].isWarning==1)"
:detailMenubox="calcDetailMenubox"
:tableDataValue="item[itemChild.key].kpiValue" :flg="''" :trendSrc="trendSrc"
:heightStyle="heightStyle" :marginStyle="marginStyle" :tableName="dialogNameStyle(item[itemChild.key])"
<el-tooltip v-if="!itemChild.componentName || itemChild.componentName==1" :disabled="isEllipsis[index+'-'+idx]" ref="elTooltip" trigger="hover" >
<template #content>
<span>{{ item[itemChild.key].kpiValue}}</span>
</template>
<span @mouseleave="" :ref="'isOverflow'+index+'-'+idx" :data-num="index+'-'+idx" @click="clickListName(item[itemChild.key])" :style="colorStyle(item[itemChild.key].kpiValue)"
:class="['listName','width-80','text-overflow',{'listName-link':item[itemChild.key] && (item[itemChild.key].kpiIdent==1 || item[itemChild.key].isWarning==1)}]">
{{ item[itemChild.key].kpiValue}}
</span>
</el-tooltip>
<component v-if="itemChild.componentName && itemChild.componentName!=1" :is="itemChild.componentName" :alarmLevel="item[itemChild.key].alarmLevel?item[itemChild.key].alarmLevel:'2'" :way="item[itemChild.key].way?item[itemChild.key].way:'message'" />
></customMenuBox>
<!-- <div class="info-ul" style="width:140px;" >
<div class="basic-pressing-times" @click="pressingDialog(itemMenu,item[itemChild.key].kpiValue,'')" v-for="itemMenu in calcDetailMenubox">
<i class="el-icon-link icon-div"></i>{{itemMenu.name}}
</div>
</div>-->
<!-- </el-popover>
</div>-->
<customMenuBox ref="customMenu" v-if="pressingVisible==index+'-'+idx && item[itemChild.key] && (item[itemChild.key].kpiIdent==1 || item[itemChild.key].isWarning==1)"
:detailMenubox="calcDetailMenubox"
:tableDataValue="item[itemChild.key].kpiValue" :flg="''" :trendSrc="trendSrc"
:heightStyle="heightStyle" :marginStyle="marginStyle" :tableName="dialogNameStyle(item[itemChild.key])"
></customMenuBox>
</div>
</li>
</ul>
... ... @@ -180,6 +177,8 @@ import VueSuperSlide from "vue-superslide";
import {getDetailTableData,getDetailTableDataNoPage} from "@/api/platform";
import customDialog from "../../designerComponents/customDialog";
import customMenuBox from "../../designerComponents/customMenuBox";//下探组件
import textToImage from "../../designerComponents/textToImage";//文字转图片
import textToBg from "../../designerComponents/textToBg";//文字转背景
vue.use(VueSuperSlide);
export default {
... ... @@ -188,7 +187,7 @@ export default {
ispreview: Boolean
},
components:{
customDialog,customMenuBox
customDialog,customMenuBox,textToImage,textToBg
},
data() {
return {
... ... @@ -261,11 +260,12 @@ export default {
sortVal:'bottom',//排序方式
sortBy:'',//排序参数
sortCaret:'',//正序倒序
isEllipsis:[],//是否文字超出
componentName:'',//组件名称
};
},
computed: {
styleObj() {
// console.log(this.optionsSetUp);
const allStyle = this.optionsPosition;
return {
position: this.ispreview ? "absolute" : "static",
... ... @@ -469,7 +469,6 @@ export default {
this.marginStyle+="margin-top:"+(230)+'px;';
}
console.log("123",documentHeight,scroll)
}else{
//ajreport中弹框位置样式
this.heightStyle="height:"+(documentHeight+scroll)+'px;';
... ... @@ -652,6 +651,19 @@ export default {
}
return styleJson
},
//列最大宽
tableFiledMaxWidth(obj,index,idx){
let that=this;
this.$nextTick(() => {
let isOverflow=that.$refs[obj];
if(isOverflow && isOverflow[0]){
let cWidth = isOverflow[0].parentElement.scrollWidth;
let sWidth = isOverflow[0].scrollWidth;
that.isEllipsis[index+'-'+idx]=!((sWidth+10) > cWidth);
}
})
},
//列是否排序
tableFiledSort(index){
let isSort=false;
... ... @@ -667,12 +679,16 @@ export default {
this.header.map(v=>{
if(item.key==v.key){
v.columnSort=item.columnSort;
v.sort=item.sort?item.sort:false;
v.componentName=item.componentName?item.componentName:1;
}
})
if(this.headerAll && this.headerAll.length>0){
this.headerAll.map(v=>{
if(item.key==v.key){
v.columnSort=item.columnSort;
v.sort=item.sort?item.sort:false;
v.componentName=item.componentName?item.componentName:1;
}
})
}
... ... @@ -680,7 +696,6 @@ export default {
})
this.header.sort(this.compare('columnSort'))
this.headerAll.sort(this.compare('columnSort'))
console.log("&&&",this.header)
},
compare(property){
return function(a,b){
... ... @@ -728,7 +743,7 @@ export default {
this.pressingVisible=index+'-'+idx;
},
closePressingDialog(){
this.pressingVisible=false;
// this.pressingVisible=false;
},
//弹框关闭确定
hideDialog(){
... ... @@ -761,7 +776,6 @@ export default {
}else{
//不排序
}
console.log('sort',item.key)
// this.handlerDetailData('',item.key)
// this.handlerDetailDataNoPage();
},
... ... @@ -769,7 +783,6 @@ export default {
handleSizeChange(val){
// 切换页码重置初始页
this.currentPage = 1
// console.log(`每页 ${val} 条`)
//props.pageSize = val;
this.pageSize = val;
this.handlerDetailDataNoPage();
... ... @@ -777,14 +790,12 @@ export default {
// 切换页码
handleCurrentChange(val){
// console.log(`当前页: ${val}`)
//props.currentPage = val;
this.currentPage = val;
this.handlerDetailDataNoPage();
},
// 切换页码
prePage(val) {
// console.log(`当前页: ${val}`)
// props.currentPage = val - 1;
this.currentPage = val-1;
this.handlerDetailDataNoPage();
... ... @@ -792,20 +803,43 @@ export default {
// 切换页码
nextPage(val){
// console.log(`当前页: ${val}`)
// props.currentPage = val + 1;
this.currentPage = val+1;
this.handlerDetailDataNoPage();
},
//计算弹框名称
dialogNameStyle(obj){
const tableStyleSetup=this.optionsSetUp;
let kpiName=obj.kpiName?'+'+obj.kpiName:'';
let dialogName=tableStyleSetup.tableName+kpiName;
this.dialogName=dialogName;
return dialogName;
dialogNameStyle(obj) {
const tableStyleSetup = this.optionsSetUp;
let kpiName = obj.kpiName ? '+' + obj.kpiName : '';
let dialogName = tableStyleSetup.tableName + kpiName;
if (tableStyleSetup.nameDefault) {
dialogName = tableStyleSetup.tableName + kpiName;
} else {
let nameResType = tableStyleSetup.nameResType ? obj.resType ? obj.resType + '|' : '' : '';
let nameIPAddress = tableStyleSetup.nameIPAddress ? obj.ipAddr ? obj.ipAddr + '|' : '' : '';
let nameResName = tableStyleSetup.nameResName ? obj.resName ? obj.resName + '|' : '' : '';
let nameKpiName = tableStyleSetup.nameKpiName ? obj.kpiName ? obj.kpiName + '|' : '' : '';
let nameKpiFlg = tableStyleSetup.nameKpiFlg ? obj.flag ? obj.flag + '|' : '' : '';
let name = nameResType + nameIPAddress + nameIPAddress + nameResName + nameKpiName + nameKpiFlg;
dialogName = name.substring(0, name.length - 1);
}
this.dialogName = dialogName;
return dialogName;
},
//下载
downloadTableList(title, resId, kpiId, flagPrifix, sortBy, order){
let kpiIdArr=[];
let param={
sortBy:this.sortBy
}
this.header.map(item=>{
if(item.sort){
kpiIdArr.push(item.key)
}
})
console.log("kpiIdArr",kpiIdArr)
}
}
};
</script>
... ... @@ -997,7 +1031,7 @@ export default {
flex-direction: column;
align-items: center;
height: 14px;
width: 24px;
width: 14px;
vertical-align: middle;
cursor: pointer;
overflow: initial;
... ... @@ -1008,7 +1042,7 @@ export default {
height: 0;
border: solid 5px transparent;
position: absolute;
left: 7px;
left: 1px;
}
.title .sort-caret.ascending {
border-bottom-color: #c0c4cc;
... ... @@ -1024,4 +1058,22 @@ export default {
.title .descending .sort-caret.descending {
border-top-color: #409eff;
}
.text-overflow{
white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;
/*word-break: break-all;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;*/
}
.width-80{
max-width:80%;
}
.padding-10{
padding:5px;
}
</style>
... ...