temp: alert-rule临时提交,周末完成

This commit is contained in:
chenjinsong
2020-06-05 19:31:14 +08:00
parent 12581425ee
commit 5beb5b60e2
6 changed files with 52 additions and 42 deletions

View File

@@ -50,11 +50,12 @@
ghostClass:'chart-ghost', ghostClass:'chart-ghost',
chosenClass:'choose-class', chosenClass:'choose-class',
scroll:true, scroll:true,
filter: '.drag-disabled',
scrollFn:function(offsetX,offsetY,originalEvent,touchEvt,hoverTargetEI){}, scrollFn:function(offsetX,offsetY,originalEvent,touchEvt,hoverTargetEI){},
animation:150, animation:150,
handle:'.chartTitle', handle:'.chartTitle'
}" > }" >
<div class="chartBox" v-for="(item, index) in dataList" :key="item.id" :id="'chart-' + item.id" :name="item.title"> <div class="chartBox" v-for="(item, index) in dataList" :key="item.id" :id="'chart-' + item.id" :name="item.title" :class="{'drag-disabled': !draggable}">
<line-chart-block v-if="item.type === 'line' || item.type === 'bar' ||item.type == 'stackArea' || item.type === 4" :key="'inner' + item.id" <line-chart-block v-if="item.type === 'line' || item.type === 'bar' ||item.type == 'stackArea' || item.type === 4" :key="'inner' + item.id"
:ref="'editChart'+item.id" :ref="'editChart'+item.id"
@on-refresh-data="refreshChart" @on-refresh-data="refreshChart"
@@ -150,7 +151,8 @@
name: 'chartList', name: 'chartList',
props: { props: {
isModel: {type: Boolean, default: false}, isModel: {type: Boolean, default: false},
additionalInfo:{} additionalInfo:{},
draggable: {type: Boolean, default: true}
}, },
components: { components: {
chartAlertList, chartAlertList,
@@ -319,19 +321,14 @@
let chartTitle = item.querySelector('.chartTitle'); let chartTitle = item.querySelector('.chartTitle');
chartTitle.style.background = ''; chartTitle.style.background = '';
}, },
move (event, orgin) { move(event, orgin) {
//console.log('move', event, orgin);
let dragClass = document.querySelector('.drag-chart-class');//drag-chart-class:yellow chart-ghost:green fallback-class choose-class:purple let dragClass = document.querySelector('.drag-chart-class');//drag-chart-class:yellow chart-ghost:green fallback-class choose-class:purple
//console.log('move---class', dragClass);
//dragClass.style.opacity = 1;
//dragClass.style.pointerEvents = 'auto';//设置此属性end事件里newIndex为 列表长度
let chartTitle = dragClass.querySelector('.chartTitle'); let chartTitle = dragClass.querySelector('.chartTitle');
//console.log('move-title',chartTitle);
chartTitle.style.background = '#d8dce1'; chartTitle.style.background = '#d8dce1';
}, },
choose(event ){ choose(event){
console.log('choose', event); console.log('choose', event);
let chartTitle = event.item.querySelector('.chartTitle'); let chartTitle = event.item.querySelector('.chartTitle');
}, },
@@ -529,6 +526,7 @@
}, },
// 获取panel详情数据,获取panel下所有chart列表 // 获取panel详情数据,获取panel下所有chart列表
getData(params) { getData(params) {
console.info(params)
//param 目前没有用 //param 目前没有用
const param = { const param = {
panelId: params.panelId, panelId: params.panelId,

View File

@@ -164,6 +164,9 @@
border: 1px solid #b7d0f7; border: 1px solid #b7d0f7;
box-shadow: 1px 1px 1px #d3e1f8; box-shadow: 1px 1px 1px #d3e1f8;
} }
.drag-disabled .el-dropdown-link {
cursor: default !important;
}
.resize-box { .resize-box {
.pagination { .pagination {
padding-top: 0; padding-top: 0;

View File

@@ -39,7 +39,7 @@
</template> </template>
<!-- model-panel/asset-detail/project-overview的panel--> <!-- model-panel/asset-detail/project-overview的panel-->
<panel-tab v-if="(from == 'model' || from == 'asset' || from == 'project') && targetTab == 'panel'" v-show="subResizeShow" :from="from" :obj="obj" ref="panelTab" <panel-tab v-if="(from == 'model' || from == 'asset' || from == 'project' || from == 'alertRule') && targetTab == 'panel'" v-show="subResizeShow" :from="from" :obj="obj" ref="panelTab"
@changeTab="changeTab" :targetTab.sync="targetTab"></panel-tab> @changeTab="changeTab" :targetTab.sync="targetTab"></panel-tab>
</div> </div>

View File

@@ -6,7 +6,7 @@
<template v-if="from == 'asset'">{{obj.host}}</template> <template v-if="from == 'asset'">{{obj.host}}</template>
<template v-if="from == 'alertRule'">{{obj.alertName}}</template> <template v-if="from == 'alertRule'">{{obj.alertName}}</template>
</div><div </div><div
class="sub-list-tab" @click="changeTab(from == 'asset' ? 'panel' : 'detail')">{{$t("overall.detail")}}</div><div class="sub-list-tab" @click="changeTab(from == 'asset' || from == 'alertRule' ? 'panel' : 'detail')">{{$t("overall.detail")}}</div><div
class="sub-list-tab sub-list-tab-active">{{$t("asset.tableTitle.alerts")}}</div><div v-if="from == 'asset'" class="sub-list-tab sub-list-tab-active">{{$t("asset.tableTitle.alerts")}}</div><div v-if="from == 'asset'"
class="sub-list-tab" @click="changeTab('endpoint')">{{$t("asset.tableTitle.modules")}}</div> class="sub-list-tab" @click="changeTab('endpoint')">{{$t("asset.tableTitle.modules")}}</div>
</div> </div>

View File

@@ -6,22 +6,26 @@
<div class="sub-list-tab-title"> <div class="sub-list-tab-title">
<template v-if="from == 'model'">{{obj.name}}</template> <template v-if="from == 'model'">{{obj.name}}</template>
<template v-else-if="from == 'asset'">{{obj.host}}</template> <template v-else-if="from == 'asset'">{{obj.host}}</template>
<template v-else-if="from == 'alertRule'">{{obj.alertName}}</template>
</div><div class="sub-list-tab sub-list-tab-active" v-if="from == 'model'">{{$t("dashboard.panel.title")}}</div><template v-if="from == 'asset'"><div </div><div class="sub-list-tab sub-list-tab-active" v-if="from == 'model'">{{$t("dashboard.panel.title")}}</div><template v-if="from == 'asset'"><div
class="sub-list-tab sub-list-tab-active">{{$t("overall.detail")}}</div><div class="sub-list-tab sub-list-tab-active">{{$t("overall.detail")}}</div><div
class="sub-list-tab" @click="changeTab('alertMessage')">{{$t("asset.tableTitle.alerts")}}</div><div class="sub-list-tab" @click="changeTab('alertMessage')">{{$t("asset.tableTitle.alerts")}}</div><div
class="sub-list-tab" @click="changeTab('endpoint')">{{$t("asset.tableTitle.modules")}}</div> class="sub-list-tab" @click="changeTab('endpoint')">{{$t("asset.tableTitle.modules")}}</div>
</template><template v-if="from == 'alertRule'"><div
class="sub-list-tab sub-list-tab-active">{{$t("overall.detail")}}</div><div
class="sub-list-tab" @click="changeTab('alertMessage')">{{$t("asset.tableTitle.alerts")}}</div>
</template> </template>
</div> </div>
<div class="top-tool-right"> <div class="top-tool-right">
<div class="top-tool-search margin-r-20"> <div class="top-tool-search margin-r-20" v-if="from != 'alertRule'">
<el-input ref="queryPanel" @clear="clearInput" id="queryPanel" @focus="focusInput" @blur="blurInput" v-model="filter.searchName" class="query-input-inactive" size="mini" clearable > <el-input ref="queryPanel" @clear="clearInput" id="queryPanel" @focus="focusInput" @blur="blurInput" v-model="filter.searchName" class="query-input-inactive" size="mini" clearable >
<i slot="suffix" class="el-input__icon el-icon-search" @click="focusInput" style="float: right"></i> <i slot="suffix" class="el-input__icon el-icon-search" @click="focusInput" style="float: right"></i>
</el-input> </el-input>
</div> </div>
<div class="panel-calendar margin-r-20" v-if="from != 'model'"> <div class="panel-calendar margin-r-20" v-if="from == 'asset'">
<time-picker ref="calendarPanel" class="nz-dashboard-picker" @change="dateChange" style="height: 26px; margin-top: -1px;"></time-picker> <time-picker ref="calendarPanel" class="nz-dashboard-picker" @change="dateChange" style="height: 26px; margin-top: -1px;"></time-picker>
</div> </div>
<div class="nz-btn-group nz-btn-group-size-small nz-btn-group-light margin-r-20" style="height: 24px;" v-if="from != 'model'"> <div class="nz-btn-group nz-btn-group-size-small nz-btn-group-light margin-r-20" style="height: 24px;" v-if="from == 'asset'">
<button style="border-right: 1px solid rgba(162,162,162,0.50);" type="button" <button style="border-right: 1px solid rgba(162,162,162,0.50);" type="button"
class="nz-btn nz-btn-size-normal nz-btn-style-light" @click="Refresh()"> class="nz-btn nz-btn-size-normal nz-btn-style-light" @click="Refresh()">
<i style="font-size: 12px" class="global-active-color nz-icon nz-icon-refresh"></i> <i style="font-size: 12px" class="global-active-color nz-icon nz-icon-refresh"></i>
@@ -39,7 +43,7 @@
</button> </button>
</el-popover> </el-popover>
</div> </div>
<button @click="toAddChart" :title="$t('overall.createChart')" <button @click="toAddChart" :title="$t('overall.createChart')" v-if="from != 'alertRule'"
class="nz-btn nz-btn-size-normal nz-btn-style-light "> class="nz-btn nz-btn-size-normal nz-btn-style-light ">
<i class="nz-icon-create-square nz-icon"></i> <i class="nz-icon-create-square nz-icon"></i>
</button> </button>
@@ -95,7 +99,7 @@
<div class="table-list" id="tableList"> <div class="table-list" id="tableList">
<el-scrollbar class="el-scrollbar-large" style="height: 100%" ref="dashboardScrollbar"> <el-scrollbar class="el-scrollbar-large" style="height: 100%" ref="dashboardScrollbar">
<div class="box-content"> <div class="box-content">
<chart-list @on-edit-chart="editData" @on-refresh-time="refreshTime" @on-remove-chart="removeData" <chart-list @on-edit-chart="editData" @on-refresh-time="refreshTime" @on-remove-chart="removeData" :draggable="draggable"
ref="chartList" :is-model="from == 'model'" :additional-info="obj"></chart-list> ref="chartList" :is-model="from == 'model'" :additional-info="obj"></chart-list>
</div> </div>
</el-scrollbar> </el-scrollbar>
@@ -116,7 +120,8 @@
name: "panel", name: "panel",
props: { props: {
from: String, from: String,
obj: Object obj: Object,
draggable: {type: Boolean, default: true}
}, },
data() { data() {
return { return {
@@ -316,31 +321,35 @@
/*时间条件查询--end*/ /*时间条件查询--end*/
//公用操作 //公用操作
getTableData(linkId) { getTableData(linkId) {
this.$get('panel', {type: this.from, link: linkId}).then(response => { if (this.from == "alertRule") {
if (response.code === 200) {
this.panelData = response.data.list; } else {
if (this.panelData.length > 0) { this.$get('panel', {type: this.from, link: linkId}).then(response => {
this.panelId = this.filter.panelId = this.panelData[0].id; if (response.code === 200) {
this.getData(this.filter); this.panelData = response.data.list;
} if (this.panelData.length > 0) {
}else { this.panelId = this.filter.panelId = this.panelData[0].id;
if(response.msg){ this.getData(this.filter);
console.error(response.msg); }
this.$message.error(response.msg);
}else if(response.error){
console.error(response.error);
this.$message.error(response.error);
}else { }else {
console.error(response); if(response.msg){
this.$message.error(response); console.error(response.msg);
this.$message.error(response.msg);
}else if(response.error){
console.error(response.error);
this.$message.error(response.error);
}else {
console.error(response);
this.$message.error(response);
}
} }
} }).catch((error) => {
}).catch((error) => { if (error) {
if (error) { console.error(error);
console.error(error); this.$message.error(error.toString());
this.$message.error(error.toString()); }
} });
}); }
}, },
//定期刷新 //定期刷新
selectInterval(val) { selectInterval(val) {

View File

@@ -374,7 +374,7 @@
}, },
detail: function (u) { detail: function (u) {
this.alertRuleForMessage = Object.assign({}, u); this.alertRuleForMessage = Object.assign({}, u);
this.targetTab = "detail"; this.targetTab = "panel";
this.showSubList = true; this.showSubList = true;
}, },
messageStyle(e) { messageStyle(e) {