2020-05-31 22:33:16 +08:00
|
|
|
|
<style lang="scss">
|
2020-06-01 20:47:36 +08:00
|
|
|
|
@import './chart.scss';
|
2020-05-28 17:32:23 +08:00
|
|
|
|
</style>
|
|
|
|
|
|
<template>
|
2020-08-06 16:37:35 +08:00
|
|
|
|
<div class="nz-chart-resize" :id="id">
|
2020-06-01 20:47:36 +08:00
|
|
|
|
<div class="resize-shadow" ref="resizeShadow"></div>
|
|
|
|
|
|
<div class="resize-box resize-box-alert" ref="resizeBox">
|
2020-06-05 17:09:27 +08:00
|
|
|
|
<div class="chart-alert-info" :id="'chartTableDiv'+chartIndex" @mouseenter="caretShow=true" @mouseleave="caretShow=false">
|
2020-06-01 20:47:36 +08:00
|
|
|
|
<loading :ref="'localLoading'+chartIndex"></loading>
|
2020-06-16 10:38:26 +08:00
|
|
|
|
<div class="clearfix chartTitle" :class="{'dragTitle':dragTitleShow, 'drag-disabled': !data.draggable}" :id="'chartTitle'+chartIndex" v-show="!isPreview">
|
2020-05-28 17:32:23 +08:00
|
|
|
|
<el-popover
|
|
|
|
|
|
v-if="isError"
|
|
|
|
|
|
:close-delay=10
|
|
|
|
|
|
placement="top-start"
|
|
|
|
|
|
trigger="hover"
|
|
|
|
|
|
popper-class="chart-error-popper">
|
|
|
|
|
|
<div >{{errorContent}}</div>
|
2020-06-01 20:47:36 +08:00
|
|
|
|
<span slot="reference" class="panel-info-corner panel-info-corner--error">
|
|
|
|
|
|
<i class="nz-icon nz-icon-warning fa"></i>
|
|
|
|
|
|
<span class="panel-info-corner-inner"></span>
|
2020-05-28 17:32:23 +08:00
|
|
|
|
</span>
|
|
|
|
|
|
</el-popover>
|
2020-06-05 17:09:27 +08:00
|
|
|
|
<el-dropdown trigger="click" v-show="!isPreview" class="nz-chart-top" :key="'chartDropdown'+chartIndex" v-clickoutside="clickos">
|
2020-05-28 17:32:23 +08:00
|
|
|
|
<el-dropdown-menu style="display: none"></el-dropdown-menu>
|
2020-09-14 15:27:26 +08:00
|
|
|
|
<span class="el-dropdown-link chart-title" @click.stop="dropdownMenuShow=!dropdownMenuShow">
|
2020-06-07 21:39:07 +08:00
|
|
|
|
<span class="chart-title-text">{{chartInfo.title}}</span>
|
2020-10-22 13:52:40 +08:00
|
|
|
|
<span class="chart-title-icon" v-if="data.editable"><i class="nz-icon nz-icon-xialaxuanze " :class="{'visible':caretShow,'hidden':!caretShow}"></i></span>
|
2020-05-28 17:32:23 +08:00
|
|
|
|
</span>
|
2020-06-16 10:38:26 +08:00
|
|
|
|
<ul slot="dropdown" v-show="dropdownMenuShow" v-if="data.editable" :id="'dropdownUl'+chartIndex" class="el-dropdown-menu nz-chart-dropdown" style="position: absolute; top: 30px; left: calc(50% - 79px); transform-origin: center top; z-index: 1000;" >
|
2020-05-28 17:32:23 +08:00
|
|
|
|
<li @click="refreshChart" class="el-dropdown-menu__item">
|
|
|
|
|
|
<i class="global-active-color el-icon-refresh-right" style="font-size: 16px;"></i><span>{{$t('dashboard.refresh')}}</span></li>
|
|
|
|
|
|
<li @click="editChart" class="el-dropdown-menu__item">
|
|
|
|
|
|
<i class="nz-icon nz-icon-edit" style="font-size: 14px; margin-right: 11px; margin-left: 1px;"></i>{{$t('dashboard.edit')}}</li>
|
|
|
|
|
|
<li @click="removeChart" class="el-dropdown-menu__item">
|
2020-09-10 17:00:32 +08:00
|
|
|
|
<i class="nz-icon nz-icon-delete" style="font-size: 16px;"></i>{{$t('dashboard.delete')}}</li>
|
2020-05-28 17:32:23 +08:00
|
|
|
|
<li @click="showAllScreen" class="el-dropdown-menu__item">
|
|
|
|
|
|
<i class="el-icon-full-screen" style="font-size: 16px;"></i>{{$t('dashboard.screen')}}</li>
|
|
|
|
|
|
<li @click="duplicate" class="el-dropdown-menu__item">
|
|
|
|
|
|
<i class="el-icon-copy-document" style="font-size: 16px;"></i>{{$t('dashboard.duplicate')}}</li>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
</el-dropdown>
|
|
|
|
|
|
</div>
|
2020-05-29 17:58:12 +08:00
|
|
|
|
<div class="mt-10 table-container" v-cloak v-show="firstShow || isPreview">
|
2020-07-31 10:55:25 +08:00
|
|
|
|
<alertMessageTable
|
2020-08-05 09:54:58 +08:00
|
|
|
|
:tableData="storedTableData"
|
2020-08-04 11:41:31 +08:00
|
|
|
|
:loading="loadingTable"
|
2020-07-31 10:55:25 +08:00
|
|
|
|
:tableHeight="tableHeight"
|
|
|
|
|
|
:tableId="''"
|
|
|
|
|
|
:projectAlertId="'tableContainer'+chartIndex"
|
|
|
|
|
|
@tableDataSort="tableDataSort"
|
|
|
|
|
|
@deleteMessage="deleteMessage"
|
2020-05-28 17:32:23 +08:00
|
|
|
|
ref="alertListTable"
|
2020-08-04 16:00:38 +08:00
|
|
|
|
:form="'chartList'"
|
2020-08-04 16:41:03 +08:00
|
|
|
|
:fromPath="'/alertList'"
|
2020-07-31 10:55:25 +08:00
|
|
|
|
></alertMessageTable>
|
2020-06-02 13:05:40 +08:00
|
|
|
|
<Pagination :pageObj="pageObj" @pageNo='pageNo' @pageSize='pageSize' ref="Pagination" :append-to-body="false" pop-class="out-popper-fix"></Pagination>
|
2020-05-28 17:32:23 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<!--全屏-->
|
2020-06-01 20:47:36 +08:00
|
|
|
|
<el-dialog class="nz-dialog table-chart-dialog" :title="$t('dashboard.panel.view')" :visible.sync="screenModal" width="96%" @close="screenDialogClose" >
|
|
|
|
|
|
<div slot="title">
|
|
|
|
|
|
<span class="nz-dialog-title">{{data.title}}</span>
|
|
|
|
|
|
<div class="float-right panel-calendar dialog-tool">
|
2020-05-28 17:32:23 +08:00
|
|
|
|
</div>
|
2020-06-01 20:47:36 +08:00
|
|
|
|
</div>
|
2020-07-31 10:55:25 +08:00
|
|
|
|
<alertMessageTable
|
|
|
|
|
|
:tableData="storedScreanTableData"
|
2020-08-04 09:30:32 +08:00
|
|
|
|
:loading="loadingTable"
|
2020-07-31 10:55:25 +08:00
|
|
|
|
:tableHeight="'95%'"
|
|
|
|
|
|
:tableId="''"
|
|
|
|
|
|
:projectAlertId="'tableContainer'+chartIndex"
|
|
|
|
|
|
@tableDataSort="tableDataSort"
|
|
|
|
|
|
@deleteMessage="deleteMessage"
|
2020-06-01 20:47:36 +08:00
|
|
|
|
ref="alertListScreenTable"
|
2020-07-31 10:55:25 +08:00
|
|
|
|
></alertMessageTable>
|
2020-06-01 20:47:36 +08:00
|
|
|
|
<Pagination :pageObj="screenPageObj" @pageNo='screenPageNo' @pageSize='screenPageSize' ref="Pagination" ></Pagination>
|
|
|
|
|
|
<loading :ref="'localLoadingScreen'+chartIndex"></loading>
|
2020-05-28 17:32:23 +08:00
|
|
|
|
</el-dialog>
|
2020-06-01 20:47:36 +08:00
|
|
|
|
<div class="export-xlsx">
|
|
|
|
|
|
<el-dialog :visible.sync="deleteBox.show" :title="$t('overall.delete')" :modal-append-to-body='false' :show-close="true" width="300px" @close="closeDialog" class="nz-message">
|
|
|
|
|
|
<div class="upload-body">
|
|
|
|
|
|
<el-input type="textarea" :placeholder="$t('alert.description')" v-model="deleteBox.remark"></el-input>
|
|
|
|
|
|
<div style="text-align: right; margin-top: 10px;">
|
|
|
|
|
|
<button @click="closeDialog" class="el-button el-button--default el-button--small">
|
|
|
|
|
|
<span>{{$t('tip.no')}}</span>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<button @click="deleteMessage" class="el-button el-button--default el-button--small el-button--primary">
|
|
|
|
|
|
<span>{{$t('tip.yes')}}</span>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<el-dialog class="line-chart-block-modal nz-dialog endpoint-dialog"
|
|
|
|
|
|
:title="$t('overall.detail')"
|
|
|
|
|
|
:visible.sync="graphShow"
|
|
|
|
|
|
width="90%"
|
|
|
|
|
|
:append-to-body="true"
|
|
|
|
|
|
id="viewGraphDialog"
|
|
|
|
|
|
@close="dialogClose">
|
|
|
|
|
|
<div slot="title">
|
|
|
|
|
|
{{$t("project.endpoint.dialogTitle")}}
|
|
|
|
|
|
<div class="float-right panel-calendar dialog-tool" style="display: flex">
|
2020-06-04 19:14:04 +08:00
|
|
|
|
<pick-time :refresh-data-func="queryChartDate" :use-refresh="false" :use-chart-unit="false" v-model="searchTime" style="height: 28px;" @unitChange="chartUnitChange"></pick-time>
|
2020-05-28 17:32:23 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2020-06-04 19:14:04 +08:00
|
|
|
|
<chart ref="messageChart" name="alertMessageChart" :unit="chartUnit" ></chart>
|
2020-05-28 17:32:23 +08:00
|
|
|
|
</el-dialog>
|
|
|
|
|
|
</div>
|
2020-06-16 10:38:26 +08:00
|
|
|
|
<span class="vue-resizable-handle" @mousedown="startResize" v-if="!isPreview && data.resizable"></span>
|
2020-05-28 17:32:23 +08:00
|
|
|
|
</div>
|
2020-06-01 20:47:36 +08:00
|
|
|
|
</div>
|
2020-05-28 17:32:23 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import bus from '../../libs/bus';
|
|
|
|
|
|
import {Loading} from 'element-ui';
|
|
|
|
|
|
import chartDataFormat from './chartDataFormat'
|
|
|
|
|
|
import loading from "../common/loading";
|
|
|
|
|
|
import timePicker from '../common/timePicker'
|
|
|
|
|
|
import nzAlertTag from "../page/alert/nzAlertTag";
|
|
|
|
|
|
import axios from "axios";
|
|
|
|
|
|
import pickTime from "../common/pickTime";
|
|
|
|
|
|
import chart from "../page/dashboard/overview/chart";
|
2020-07-31 10:55:25 +08:00
|
|
|
|
import alertMessageTable from '@/components/common/alert/alertMessageTable.vue'
|
2020-05-28 17:32:23 +08:00
|
|
|
|
export default {
|
2020-06-01 20:47:36 +08:00
|
|
|
|
name: 'chartTable',
|
2020-05-28 17:32:23 +08:00
|
|
|
|
components: {
|
|
|
|
|
|
'loading': loading,
|
|
|
|
|
|
'time-picker':timePicker,
|
|
|
|
|
|
'nz-alert-tag':nzAlertTag,
|
|
|
|
|
|
'chart':chart,
|
|
|
|
|
|
'pick-time':pickTime,
|
2020-07-31 10:55:25 +08:00
|
|
|
|
'alertMessageTable':alertMessageTable
|
2020-05-28 17:32:23 +08:00
|
|
|
|
},
|
2020-06-01 20:47:36 +08:00
|
|
|
|
props: {
|
|
|
|
|
|
// 看板id
|
|
|
|
|
|
panelId: {
|
|
|
|
|
|
type: Number,
|
|
|
|
|
|
default: 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
editChartId: {
|
|
|
|
|
|
type: String,
|
|
|
|
|
|
default: 'editChartId',
|
|
|
|
|
|
},
|
|
|
|
|
|
chartIndex:{
|
|
|
|
|
|
type: Number,
|
|
|
|
|
|
default: 0,
|
|
|
|
|
|
},
|
2020-08-06 16:37:35 +08:00
|
|
|
|
chartInfo:{},
|
|
|
|
|
|
id:''
|
2020-06-01 20:47:36 +08:00
|
|
|
|
},
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
tableHeight: 0,
|
|
|
|
|
|
data: {}, // 该图表信息,chartItem
|
|
|
|
|
|
unit:{},
|
|
|
|
|
|
isError:false,
|
|
|
|
|
|
errorContent:'',
|
|
|
|
|
|
pageObj: {
|
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
|
pageSize: 50,
|
|
|
|
|
|
total: 0
|
2020-05-28 17:32:23 +08:00
|
|
|
|
},
|
2020-08-04 09:30:32 +08:00
|
|
|
|
loadingTable:false,// 表格数据加载loading
|
2020-06-01 20:47:36 +08:00
|
|
|
|
screenPageObj:{
|
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
|
pageSize: 50,
|
|
|
|
|
|
total: 0
|
2020-05-28 17:32:23 +08:00
|
|
|
|
},
|
2020-06-01 20:47:36 +08:00
|
|
|
|
storedTableData:[],
|
2020-08-03 10:47:04 +08:00
|
|
|
|
requestIndex:0,
|
2020-06-01 20:47:36 +08:00
|
|
|
|
storedScreanTableData:[],
|
|
|
|
|
|
images: '',
|
|
|
|
|
|
//toolbox: false,
|
|
|
|
|
|
loading:Object,
|
|
|
|
|
|
panelIdInner: '', // 看板id=panelId,原写作chart,由set_data获取
|
|
|
|
|
|
firstLoad: false, // 是否第一次加载
|
|
|
|
|
|
//showLoading:true,
|
|
|
|
|
|
//showLoadingScreen:false,
|
|
|
|
|
|
//showTable:true,
|
|
|
|
|
|
chartType: 'alertLIst', // 图表类型
|
|
|
|
|
|
screenModal: false,
|
|
|
|
|
|
// 查询数据使用
|
|
|
|
|
|
filter: {
|
|
|
|
|
|
start_time: '',
|
|
|
|
|
|
end_time: '',
|
2020-05-28 17:32:23 +08:00
|
|
|
|
},
|
2020-06-01 20:47:36 +08:00
|
|
|
|
stableFilter: {}, // 保存数据使用,初始化起止时间,单图or多图等
|
|
|
|
|
|
firstShow: false, // 默认不显示操作按钮,
|
|
|
|
|
|
caretShow:false,
|
|
|
|
|
|
dragTitleShow:false,
|
|
|
|
|
|
dropdownMenuShow:false,
|
|
|
|
|
|
minHeight:200,
|
|
|
|
|
|
chartSpaceHeight:5,//top-border: 1,bottom-border: 1,padding-bottome:3
|
|
|
|
|
|
titleHeight:38,//title-height:28,magrin-bottom:10
|
|
|
|
|
|
pageHeight:40,
|
|
|
|
|
|
divFirstShow:false,
|
|
|
|
|
|
searchTime: [new Date().setHours(new Date().getHours() - 1), new Date()],//全屏显示的时间
|
|
|
|
|
|
oldSearchTime: [],
|
2020-07-21 10:03:31 +08:00
|
|
|
|
searchLabel:{},
|
2020-06-01 20:47:36 +08:00
|
|
|
|
tableTitle: [
|
|
|
|
|
|
{
|
|
|
|
|
|
label: 'ID',
|
|
|
|
|
|
prop: 'id',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
width: 80
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t("alert.alertName"),
|
|
|
|
|
|
prop: 'alertRule',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
width: 180
|
|
|
|
|
|
}, /*{
|
|
|
|
|
|
label: this.$t("alert.list.type"),
|
|
|
|
|
|
prop: 'type',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
width: 100
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t("alert.list.linked"),
|
|
|
|
|
|
prop: 'linkObject',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
width: 140
|
|
|
|
|
|
}, */{
|
|
|
|
|
|
label: this.$t("alert.list.labels"),
|
|
|
|
|
|
prop: 'labels',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
width: 200
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t("alert.severity"),
|
|
|
|
|
|
prop: 'severity',
|
2020-05-28 17:32:23 +08:00
|
|
|
|
show: true,
|
|
|
|
|
|
width: 100
|
|
|
|
|
|
}, {
|
2020-06-01 20:47:36 +08:00
|
|
|
|
label: this.$t('alert.summary'),
|
|
|
|
|
|
prop: 'summary',
|
|
|
|
|
|
show: true
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('alert.description'),
|
|
|
|
|
|
prop: 'description',
|
|
|
|
|
|
show: true
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('alert.list.state'),
|
|
|
|
|
|
prop: 'state',
|
2020-05-28 17:32:23 +08:00
|
|
|
|
show: true,
|
2020-06-01 20:47:36 +08:00
|
|
|
|
width: 100
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t("alert.startAt"),
|
|
|
|
|
|
prop: 'startAt',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('alert.endAt'),
|
|
|
|
|
|
prop: 'endAt',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('alert.list.current'),
|
|
|
|
|
|
prop: 'current',
|
|
|
|
|
|
show: true
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('overall.option'),
|
|
|
|
|
|
prop: 'option',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
width: 90
|
|
|
|
|
|
}
|
|
|
|
|
|
],
|
|
|
|
|
|
tablelable:[],
|
|
|
|
|
|
dropCol: [],
|
|
|
|
|
|
toTopBtnTop: this.$tableHeight.toTopBtnTop, //to-top按钮的top属性
|
|
|
|
|
|
tableHover: false, //控制滚动条和top按钮同时出现
|
|
|
|
|
|
showTopBtn: false,
|
|
|
|
|
|
graphShow: false,
|
|
|
|
|
|
chartDatas: [],
|
|
|
|
|
|
chartUnit:5,
|
|
|
|
|
|
deleteBox: {show: false, ids: "", remark: '', state: 2},
|
|
|
|
|
|
isPreview:false,
|
2020-11-20 13:57:46 +08:00
|
|
|
|
ps: null
|
2020-06-01 20:47:36 +08:00
|
|
|
|
};
|
|
|
|
|
|
},
|
2020-05-28 17:32:23 +08:00
|
|
|
|
computed: {
|
|
|
|
|
|
tagType() {
|
|
|
|
|
|
return (key) => {
|
|
|
|
|
|
if (key == 'asset' || key == 'module' || key == 'project' || key == 'datacenter' || key == 'endpoint') {
|
|
|
|
|
|
return "normal";
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return "info";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
tagValue() {
|
|
|
|
|
|
return (key, value) => {
|
|
|
|
|
|
if (key == 'type') {
|
|
|
|
|
|
if (value == 1) {
|
|
|
|
|
|
value = this.$t("project.project.project");
|
|
|
|
|
|
} else if (value == 2) {
|
|
|
|
|
|
value = this.$t("module.module.module");
|
|
|
|
|
|
} else if (value == 3) {
|
|
|
|
|
|
value = this.$t("asset.asset");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return key + ":" + value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
watch: {
|
|
|
|
|
|
chartInfo:{
|
|
|
|
|
|
deep:true,
|
|
|
|
|
|
immediate:true,
|
|
|
|
|
|
handler(n,o){
|
|
|
|
|
|
this.data=Object.assign({},n)
|
|
|
|
|
|
}
|
2020-06-04 16:42:27 +08:00
|
|
|
|
},
|
|
|
|
|
|
panelId:{
|
|
|
|
|
|
immediate:true,
|
|
|
|
|
|
handler(n,o){
|
|
|
|
|
|
this.panelIdInner=n
|
|
|
|
|
|
}
|
2020-05-28 17:32:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
2020-06-01 20:47:36 +08:00
|
|
|
|
startResize(e) {
|
|
|
|
|
|
let vm = this;
|
|
|
|
|
|
this.$chartResizeTool.start(vm, this.data, e);
|
2020-07-22 19:04:30 +08:00
|
|
|
|
},
|
2020-06-04 19:14:04 +08:00
|
|
|
|
formatThreshold:function(value,unit){
|
|
|
|
|
|
let unitMethod=chartDataFormat.getUnit(unit)
|
2020-06-04 19:19:50 +08:00
|
|
|
|
if(unitMethod&&value){
|
2020-06-04 19:14:04 +08:00
|
|
|
|
return unitMethod.compute(value,null,2);
|
|
|
|
|
|
}else{
|
|
|
|
|
|
return value
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2020-06-05 17:45:31 +08:00
|
|
|
|
computeDistance:function(str){
|
|
|
|
|
|
var width = 0;
|
|
|
|
|
|
var html = document.createElement('span');
|
|
|
|
|
|
html.innerText = str;
|
|
|
|
|
|
html.className = 'getTextWidth';
|
|
|
|
|
|
document.querySelector('body').appendChild(html);
|
|
|
|
|
|
width = document.querySelector('.getTextWidth').offsetWidth;
|
|
|
|
|
|
document.querySelector('.getTextWidth').remove();
|
|
|
|
|
|
return Number('-'+(width+5));
|
|
|
|
|
|
},
|
2020-06-05 19:16:01 +08:00
|
|
|
|
returnMarkArea:function(){
|
|
|
|
|
|
if(this.currentMsg){
|
|
|
|
|
|
if(this.currentMsg.alertRule.operator=='>'||this.currentMsg.alertRule.operator=='>='){
|
|
|
|
|
|
return[{yAxis:this.currentMsg.alertRule.threshold},{}]
|
|
|
|
|
|
}else{
|
|
|
|
|
|
return[{},{yAxis:this.currentMsg.alertRule.threshold}]
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2020-05-28 17:32:23 +08:00
|
|
|
|
detail(obj) {
|
|
|
|
|
|
this.chartDatas = [];
|
|
|
|
|
|
this.legend = [];
|
|
|
|
|
|
this.graphShow = true;
|
|
|
|
|
|
this.currentMsg = obj;
|
2020-06-04 19:14:04 +08:00
|
|
|
|
this.chartUnit=obj.alertRule.unit?obj.alertRule.unit:5;
|
2020-05-28 17:32:23 +08:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.queryChartDate();
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
dialogClose() {
|
|
|
|
|
|
this.graphShow = false;
|
|
|
|
|
|
},
|
|
|
|
|
|
closeDialog() {
|
|
|
|
|
|
this.importBox.show = false;
|
|
|
|
|
|
this.deleteBox.show = false;
|
|
|
|
|
|
},
|
|
|
|
|
|
screenDialogClose:function(){
|
|
|
|
|
|
this.screenModal = false
|
|
|
|
|
|
this.deleteBox.ids=[];
|
2020-07-31 10:55:25 +08:00
|
|
|
|
this.$refs.alertListScreenTable.$refs.alertListTable.clearSelection();
|
2020-05-28 17:32:23 +08:00
|
|
|
|
},
|
|
|
|
|
|
selectChange(s) {
|
|
|
|
|
|
let ids = [];
|
|
|
|
|
|
this.deleteBox.ids = "";
|
|
|
|
|
|
s.forEach(item => {
|
|
|
|
|
|
ids.push(item.id);
|
|
|
|
|
|
});
|
|
|
|
|
|
this.deleteBox.ids = ids.join(",");
|
|
|
|
|
|
},
|
2020-08-06 10:10:49 +08:00
|
|
|
|
deleteMessage(deleltebox,cb) {
|
2020-07-31 10:55:25 +08:00
|
|
|
|
this.$put("alert/message", deleltebox).then(res => {
|
2020-05-28 17:32:23 +08:00
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
|
this.$message({duration: 2000, type: 'success', message: this.$t("tip.deleteSuccess")});
|
|
|
|
|
|
this.deleteBox.show = false;
|
|
|
|
|
|
this.deleteBox.ids="";
|
|
|
|
|
|
this.getAlertList();
|
2020-08-06 10:10:49 +08:00
|
|
|
|
cb();
|
2020-05-28 17:32:23 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(res.msg);
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
chartUnitChange:function(unit){
|
|
|
|
|
|
this.chartUnit=unit;
|
|
|
|
|
|
this.$nextTick(()=>{
|
|
|
|
|
|
this.queryChartDate()
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
queryChartDate() {
|
2020-06-05 17:45:31 +08:00
|
|
|
|
let $temp=this;
|
2020-05-28 17:32:23 +08:00
|
|
|
|
let start = this.searchTime[0]?this.searchTime[0]:this.getTime(-1, 'h');
|
|
|
|
|
|
let end = this.searchTime[1]?this.searchTime[1]:this.getTime(0, 'h')
|
|
|
|
|
|
this.searchTime = [start, end];
|
|
|
|
|
|
let timeDiff = (new Date(end).getTime()-new Date(start).getTime())/1000/(24*60*60);
|
|
|
|
|
|
let step = '15s';
|
|
|
|
|
|
if(timeDiff< 1){
|
|
|
|
|
|
step='15s';
|
|
|
|
|
|
}else if(timeDiff < 7){
|
|
|
|
|
|
step='5m';
|
|
|
|
|
|
}else if(timeDiff<30){
|
|
|
|
|
|
step='10m';
|
|
|
|
|
|
}else{
|
|
|
|
|
|
step='30m';
|
|
|
|
|
|
}
|
2020-05-28 18:13:11 +08:00
|
|
|
|
if(this.$refs.messageChart){
|
|
|
|
|
|
this.$refs.messageChart.startLoading();
|
|
|
|
|
|
}
|
2020-05-28 17:32:23 +08:00
|
|
|
|
let axiosArr=[];
|
|
|
|
|
|
let paramStr = JSON.stringify(this.promQueryParamConvert(this.currentMsg));
|
2020-05-28 18:29:15 +08:00
|
|
|
|
if(paramStr&¶mStr.trim()!='""'){
|
|
|
|
|
|
axiosArr.push(axios.get("/prom/api/v1/query_range?query="+paramStr.substring(1, paramStr.length-1).replace(/\+/g, "%2B").replace(/ /g, "%20").replace(/\\/g, "")+"&start="+this.$stringTimeParseToUnix(start)+"&end="+this.$stringTimeParseToUnix(end)+"&step="+step));
|
|
|
|
|
|
this.legend = [];
|
|
|
|
|
|
this.chartDatas = [];
|
|
|
|
|
|
axios.all(axiosArr).then(res =>{
|
|
|
|
|
|
try {
|
|
|
|
|
|
res.forEach((response, promIndex) => {
|
|
|
|
|
|
if (response.status == 200) {
|
|
|
|
|
|
if (response.data.status == 'success') {
|
|
|
|
|
|
let queryData = response.data.data.result[0];
|
|
|
|
|
|
if (queryData) {
|
|
|
|
|
|
let chartData = {
|
|
|
|
|
|
type: "line",
|
|
|
|
|
|
symbol: 'none', //去掉点
|
|
|
|
|
|
smooth: 0.2, //曲线变平滑
|
2020-06-04 16:42:27 +08:00
|
|
|
|
name: '',
|
|
|
|
|
|
lineStyle: {
|
|
|
|
|
|
width: 1,
|
|
|
|
|
|
opacity: 0.9
|
|
|
|
|
|
},
|
2020-06-05 17:45:31 +08:00
|
|
|
|
markLine: {
|
|
|
|
|
|
silent: true,
|
|
|
|
|
|
symbol: ['circle', 'circle'],
|
|
|
|
|
|
label: {
|
|
|
|
|
|
distance: this.computeDistance(chartDataFormat.getUnit(this.currentMsg.alertRule.unit ? this.currentMsg.alertRule.unit : 2).compute(this.currentMsg.alertRule.threshold)),
|
|
|
|
|
|
formatter: function (params) {
|
|
|
|
|
|
return chartDataFormat.getUnit($temp.currentMsg.alertRule.unit ? $temp.currentMsg.alertRule.unit : 2).compute(params.value)
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
lineStyle: {
|
|
|
|
|
|
color:'#d64f40',
|
|
|
|
|
|
width:2,
|
|
|
|
|
|
type:'dotted'
|
|
|
|
|
|
},
|
|
|
|
|
|
data: [{
|
|
|
|
|
|
yAxis: Number(this.currentMsg.alertRule.threshold)
|
|
|
|
|
|
}, ]
|
|
|
|
|
|
},
|
|
|
|
|
|
markArea:{
|
|
|
|
|
|
itemStyle:{
|
|
|
|
|
|
color:'#d64f40',
|
2020-06-05 19:23:29 +08:00
|
|
|
|
opacity:0.1
|
2020-06-05 17:45:31 +08:00
|
|
|
|
},
|
|
|
|
|
|
data:[
|
2020-06-05 19:16:01 +08:00
|
|
|
|
this.returnMarkArea()
|
2020-06-05 17:45:31 +08:00
|
|
|
|
]
|
|
|
|
|
|
}
|
2020-05-28 18:29:15 +08:00
|
|
|
|
};
|
|
|
|
|
|
chartData.name += "{";
|
|
|
|
|
|
alias += "{";
|
|
|
|
|
|
Object.keys(queryData.metric).forEach((item, index) => {
|
|
|
|
|
|
let label = item;
|
|
|
|
|
|
let value = queryData.metric[label];
|
|
|
|
|
|
chartData.name += label + "='" + value + "',";
|
|
|
|
|
|
});
|
|
|
|
|
|
chartData.name = chartData.name.charAt(chartData.name.length - 1) == "," ? chartData.name.substr(0, chartData.name.length - 1) : chartData.name;
|
|
|
|
|
|
chartData.name += "}";
|
|
|
|
|
|
let alias = chartData.name;
|
|
|
|
|
|
let legend = {
|
|
|
|
|
|
name: chartData.name,
|
|
|
|
|
|
alias: alias,
|
|
|
|
|
|
isGray: false
|
|
|
|
|
|
}
|
|
|
|
|
|
this.legend.push(legend);
|
|
|
|
|
|
chartData.data = queryData.values.map((dpsItem, dpsIndex) => {
|
|
|
|
|
|
return [bus.computeTimezone(dpsItem[0]) * 1000, parseFloat(dpsItem[1]).toFixed(2)];
|
|
|
|
|
|
});
|
|
|
|
|
|
this.chartDatas.push(chartData);
|
2020-05-28 17:32:23 +08:00
|
|
|
|
}
|
2020-05-28 18:29:15 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(response.data.error)
|
|
|
|
|
|
console.error(response.data)
|
2020-05-28 17:32:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-05-28 18:29:15 +08:00
|
|
|
|
});
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.$refs.messageChart.setRandomColors(this.chartDatas.length);
|
|
|
|
|
|
this.$refs.messageChart.setLegend(this.legend);
|
|
|
|
|
|
this.$refs.messageChart.setSeries(this.chartDatas);
|
|
|
|
|
|
this.$refs.messageChart.endLoading();
|
|
|
|
|
|
});
|
|
|
|
|
|
} catch(err) {
|
|
|
|
|
|
this.$message.error(err);
|
2020-05-28 17:32:23 +08:00
|
|
|
|
this.$refs.messageChart.endLoading();
|
2020-05-28 18:29:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2020-05-28 17:32:23 +08:00
|
|
|
|
},
|
2020-06-04 16:42:27 +08:00
|
|
|
|
getAlertList: function (filterType,isPreview=false,chartInfo) {
|
2020-06-01 20:47:36 +08:00
|
|
|
|
this.resize();
|
2020-08-04 09:30:32 +08:00
|
|
|
|
this.loadingTable=true;
|
2020-06-01 20:47:36 +08:00
|
|
|
|
this.isPreview = isPreview;
|
|
|
|
|
|
let queryParam={
|
|
|
|
|
|
pageSize:this.pageObj.pageSize,
|
|
|
|
|
|
pageNo:this.pageObj.pageNo,
|
|
|
|
|
|
}
|
2020-06-15 22:23:56 +08:00
|
|
|
|
let chart;
|
2020-06-04 16:42:27 +08:00
|
|
|
|
if(chartInfo){
|
|
|
|
|
|
chart=Object.assign({},chartInfo)
|
|
|
|
|
|
}else{
|
|
|
|
|
|
chart=Object.assign({},this.chartInfo)
|
|
|
|
|
|
}
|
2020-06-15 22:23:56 +08:00
|
|
|
|
if(chart && chart.param){ //按照粒度,project>module>endpoint 查询只传最细粒度
|
2020-06-04 16:42:27 +08:00
|
|
|
|
let param=chart.param;
|
2020-06-01 20:47:36 +08:00
|
|
|
|
if(param.endpointId&¶m.endpointId != ''){
|
|
|
|
|
|
queryParam.endpointId=param.endpointId;
|
|
|
|
|
|
}else{
|
|
|
|
|
|
if(param.moduleId&¶m.moduleId!=''){
|
|
|
|
|
|
queryParam.moduleId=param.moduleId;
|
2020-05-28 17:32:23 +08:00
|
|
|
|
}else{
|
2020-06-01 20:47:36 +08:00
|
|
|
|
if(param.projectId&¶m.projectId!=''){
|
|
|
|
|
|
queryParam.projectId=param.projectId;
|
2020-05-28 17:32:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-06-01 20:47:36 +08:00
|
|
|
|
if(param.ruleId&¶m.ruleId!=''){
|
|
|
|
|
|
queryParam.ruleId=param.ruleId;
|
|
|
|
|
|
}
|
|
|
|
|
|
if(param.severity&¶m.severity!=''){
|
|
|
|
|
|
queryParam.severity=param.severity;
|
|
|
|
|
|
}
|
|
|
|
|
|
if(param.state&¶m.state!=''){
|
|
|
|
|
|
queryParam.state=param.state;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-07-21 10:03:31 +08:00
|
|
|
|
if(this.searchLabel.orderBy){
|
|
|
|
|
|
queryParam.orderBy=this.searchLabel.orderBy;
|
|
|
|
|
|
}
|
2020-06-01 20:47:36 +08:00
|
|
|
|
this.startLoading(filterType);
|
|
|
|
|
|
this.$get('/alert/message', queryParam).then(response => {
|
|
|
|
|
|
if (response.code == 200) {
|
|
|
|
|
|
this.storedTableData = response.data.list;
|
|
|
|
|
|
this.storedScreanTableData=response.data.list;
|
|
|
|
|
|
this.storedTableData.forEach((item) => {
|
|
|
|
|
|
item.labels = JSON.parse(item.labels);
|
|
|
|
|
|
let paramStr = JSON.stringify(this.promQueryParamConvert(item));
|
|
|
|
|
|
if(paramStr&& paramStr !='""'){
|
|
|
|
|
|
this.$get('/prom/api/v1/query?query=' + paramStr.substring(1, paramStr.length-1).replace(/\+/g, "%2B").replace(/ /g, "%20").replace(/\\/g, "")).then(response2 => {
|
|
|
|
|
|
let current = [];
|
|
|
|
|
|
if (response2.data && response2.data.result && response2.data.result.length > 0) {
|
|
|
|
|
|
current = response2.data.result[0].value.map((item, i) => {
|
|
|
|
|
|
if (i == 0) {
|
|
|
|
|
|
return bus.computeTimezone(item);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return parseFloat(item).toFixed(2);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2020-08-03 10:47:04 +08:00
|
|
|
|
this.requestIndex+=1;
|
|
|
|
|
|
item.current=current;
|
2020-08-06 10:10:49 +08:00
|
|
|
|
if(this.requestIndex===this.storedTableData.length){
|
2020-08-03 10:47:04 +08:00
|
|
|
|
this.$set(item, "current", current);
|
|
|
|
|
|
this.requestIndex=0;
|
|
|
|
|
|
}
|
2020-06-01 20:47:36 +08:00
|
|
|
|
});
|
2020-05-28 17:32:23 +08:00
|
|
|
|
}
|
2020-06-01 20:47:36 +08:00
|
|
|
|
});
|
|
|
|
|
|
this.pageObj.total = response.data.total;
|
|
|
|
|
|
this.isError = false;
|
|
|
|
|
|
this.errorContent = '';
|
|
|
|
|
|
this.divFirstShow = true;
|
|
|
|
|
|
|
|
|
|
|
|
this.firstShow = true; // 展示操作按键
|
2020-08-04 09:30:32 +08:00
|
|
|
|
this.loadingTable=false;
|
2020-06-01 20:47:36 +08:00
|
|
|
|
this.endLoading(filterType);
|
|
|
|
|
|
}else{
|
|
|
|
|
|
this.isError = true;
|
|
|
|
|
|
this.errorContent = response.msg;
|
2020-05-28 18:13:11 +08:00
|
|
|
|
}
|
2020-06-01 20:47:36 +08:00
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
promQueryParamConvert(obj) {
|
|
|
|
|
|
if(obj){
|
|
|
|
|
|
return "(" + obj.alertRule.expr + ") and (" + function(){
|
|
|
|
|
|
let q = "{";
|
|
|
|
|
|
for (let k in obj.labels) {
|
|
|
|
|
|
if (k != 'alertname' && k != 'severity') {
|
|
|
|
|
|
q += k;
|
|
|
|
|
|
q += "=";
|
|
|
|
|
|
q += ("'" + obj.labels[k] + "',");
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
if (q.length > 1) {
|
|
|
|
|
|
q = q.substring(0, q.length-1);
|
|
|
|
|
|
}
|
|
|
|
|
|
q += "}";
|
|
|
|
|
|
return q;
|
|
|
|
|
|
}() + ")";
|
|
|
|
|
|
}
|
|
|
|
|
|
return '';
|
|
|
|
|
|
},
|
2020-05-28 17:32:23 +08:00
|
|
|
|
elementsetShow(s, e) {
|
|
|
|
|
|
var eventfixed = {
|
|
|
|
|
|
shezhi: 0,
|
|
|
|
|
|
screen: 0
|
|
|
|
|
|
};
|
|
|
|
|
|
eventfixed[s] = 1;
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
this.$store.commit('setHeaderTable', this.tablelable);
|
|
|
|
|
|
this.$store.commit('setEventfixed', eventfixed);
|
|
|
|
|
|
const h = document.documentElement.clientHeight;
|
|
|
|
|
|
const w = document.documentElement.clientWidth;
|
|
|
|
|
|
const dw = this.$refs.elementset.$el.offsetWidth;
|
|
|
|
|
|
const dh = this.$refs.elementset.$el.offsetHeight;
|
|
|
|
|
|
let positionx =
|
|
|
|
|
|
e.clientX + dw <= w - 10 ? e.clientX + 14 : e.clientX + 14 - dw;
|
|
|
|
|
|
let positiony =
|
|
|
|
|
|
e.clientY + dh <= h - 10
|
|
|
|
|
|
? e.clientY + 20
|
|
|
|
|
|
: e.clientY + 20 - (e.clientY + dh - h);
|
|
|
|
|
|
this.$store.commit('setPosition', {positionx, positiony});
|
|
|
|
|
|
},
|
|
|
|
|
|
elementsetHide() {
|
|
|
|
|
|
//悬浮点击空白隐藏
|
|
|
|
|
|
this.$refs.elementset.elementsetHide();
|
|
|
|
|
|
},
|
|
|
|
|
|
tablelabelEmit(data) {
|
|
|
|
|
|
//获取子组件传过来的参数
|
|
|
|
|
|
this.$store.commit('setHeaderTable', data);
|
|
|
|
|
|
this.tablelable = data;
|
|
|
|
|
|
},
|
|
|
|
|
|
pageNo(val) {
|
|
|
|
|
|
this.pageObj.pageNo = val;
|
|
|
|
|
|
this.getAlertList();
|
|
|
|
|
|
},
|
|
|
|
|
|
pageSize(val) {
|
|
|
|
|
|
this.pageObj.pageSize = val;
|
|
|
|
|
|
this.getAlertList();
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
screenPageNo(val) {
|
|
|
|
|
|
this.screenPageObj.pageNo = val;
|
|
|
|
|
|
this.getAlertList();
|
|
|
|
|
|
},
|
|
|
|
|
|
screenPageSize(val) {
|
|
|
|
|
|
this.screenPageObj.pageSize = val;
|
|
|
|
|
|
this.getAlertList();
|
|
|
|
|
|
},
|
|
|
|
|
|
startLoading(area){
|
|
|
|
|
|
if(area==='showFullScreen'){
|
|
|
|
|
|
//this.showLoadingScreen = true;
|
|
|
|
|
|
this.$refs['localLoadingScreen'+this.chartIndex].startLoading();
|
|
|
|
|
|
}else {
|
|
|
|
|
|
//this.showLoading = true;
|
|
|
|
|
|
this.$refs['localLoading'+this.chartIndex].startLoading();
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
endLoading(area){
|
|
|
|
|
|
if(area==='showFullScreen'){
|
|
|
|
|
|
//this.showLoadingScreen = false;
|
|
|
|
|
|
this.$refs['localLoadingScreen'+this.chartIndex].endLoading();
|
|
|
|
|
|
}else {
|
|
|
|
|
|
//this.showLoading = false;
|
|
|
|
|
|
this.$refs['localLoading'+this.chartIndex].endLoading();
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2020-06-01 20:47:36 +08:00
|
|
|
|
resize(chartItem) {
|
|
|
|
|
|
let deHeight = this.$chartResizeTool.titleHeight+this.$chartResizeTool.chartTableBlankHeight;
|
|
|
|
|
|
let container = document.querySelector('#chartTableDiv' + this.chartIndex + " .table-container");
|
|
|
|
|
|
container.style.height = `calc(100% - ${deHeight}px)`;
|
|
|
|
|
|
this.tableHeight = `calc(100% - 34px)`;
|
|
|
|
|
|
this.$nextTick(() => {
|
2020-11-20 13:57:46 +08:00
|
|
|
|
this.ps = container.querySelector(".el-table__body-wrapper")._ps_;
|
|
|
|
|
|
this.ps.update();
|
2020-06-01 20:47:36 +08:00
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
showLoad(chartItem) {
|
|
|
|
|
|
//设置高度 chart-table
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.resize(chartItem);
|
|
|
|
|
|
});
|
|
|
|
|
|
this.startLoading();
|
|
|
|
|
|
this.divFirstShow = true;
|
|
|
|
|
|
},
|
|
|
|
|
|
// 重新请求数据 刷新操作-local
|
|
|
|
|
|
refreshChart() {
|
|
|
|
|
|
this.dropdownMenuShow=false;
|
|
|
|
|
|
this.startLoading();
|
|
|
|
|
|
this.firstShow = false;
|
|
|
|
|
|
this.$emit('on-refresh-data', this.data.id);
|
|
|
|
|
|
},
|
|
|
|
|
|
// 编辑图表
|
|
|
|
|
|
editChart() {
|
|
|
|
|
|
this.dropdownMenuShow=false;
|
|
|
|
|
|
this.$emit('on-edit-chart-block', this.data.id);
|
|
|
|
|
|
},
|
|
|
|
|
|
// 删除该图表
|
|
|
|
|
|
removeChart() {
|
|
|
|
|
|
this.dropdownMenuShow=false;
|
|
|
|
|
|
this.$emit('on-remove-chart-block', this.data.id);
|
|
|
|
|
|
},
|
|
|
|
|
|
//全屏时间条件查询
|
|
|
|
|
|
dateChange(time) {
|
|
|
|
|
|
//this.filter.start_time = bus.timeFormate(this.searchTime[0], 'yyyy-MM-dd hh:mm:ss');
|
|
|
|
|
|
//this.filter.end_time = bus.timeFormate(this.searchTime[1], 'yyyy-MM-dd hh:mm:ss');
|
|
|
|
|
|
//this.showTable = false;
|
|
|
|
|
|
this.searchTime = [...time];
|
|
|
|
|
|
this.seriesItemScreen = [];
|
|
|
|
|
|
for(let i=0;i<8;i++){
|
|
|
|
|
|
this.seriesItemScreen.push({//表格数据
|
|
|
|
|
|
// label: '',//label
|
|
|
|
|
|
// metric: '',//metric列
|
|
|
|
|
|
element:'',
|
|
|
|
|
|
time: '',//采集时间
|
|
|
|
|
|
value: '',//数值
|
2020-05-28 17:32:23 +08:00
|
|
|
|
});
|
2020-06-01 20:47:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
this.startLoading('screen');
|
|
|
|
|
|
//this.tableLoading = true;
|
|
|
|
|
|
//this.firstShow = false;
|
|
|
|
|
|
this.$emit('on-search-data', this.data.id, this.searchTime);
|
|
|
|
|
|
},
|
|
|
|
|
|
clickos() {
|
|
|
|
|
|
this.dropdownMenuShow=false;
|
|
|
|
|
|
},
|
2020-05-28 17:32:23 +08:00
|
|
|
|
clearChart(){
|
|
|
|
|
|
this.data = {};
|
|
|
|
|
|
},
|
|
|
|
|
|
duplicate(){
|
|
|
|
|
|
this.dropdownMenuShow=false;
|
|
|
|
|
|
const param = {id:this.data.id};
|
|
|
|
|
|
this.$post('panel/'+ this.data.panelId+'/charts/duplicate',(param)).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.$message({
|
|
|
|
|
|
duration: 2000,
|
|
|
|
|
|
type: 'success',
|
|
|
|
|
|
message: this.$t("tip.duplicateSuccess")
|
|
|
|
|
|
});
|
|
|
|
|
|
this.$emit('on-duplicate-chart-block', this.data.id,response.data);
|
|
|
|
|
|
}else {
|
|
|
|
|
|
if(response.msg){
|
|
|
|
|
|
this.$message.error(response.msg);
|
|
|
|
|
|
}else if(response.error){
|
|
|
|
|
|
this.$message.error(response.error);
|
|
|
|
|
|
}else {
|
|
|
|
|
|
this.$message.error(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
// 全屏查看
|
|
|
|
|
|
showAllScreen() {
|
|
|
|
|
|
this.dropdownMenuShow=false;
|
|
|
|
|
|
this.storedScreanTableData = this.storedTableData
|
|
|
|
|
|
this.screenModal = true;
|
|
|
|
|
|
this.deleteBox.ids=[];
|
2020-07-31 10:55:25 +08:00
|
|
|
|
this.$refs.alertListTable.$refs.alertListTable.clearSelection();
|
2020-05-28 17:32:23 +08:00
|
|
|
|
},
|
|
|
|
|
|
// 设置数据, filter区分
|
|
|
|
|
|
setData(chartItem, seriesItem, panelId, filter,area,errorMsg) {
|
2020-10-30 16:26:36 +08:00
|
|
|
|
// console.info(chartItem,title)
|
2020-05-28 17:32:23 +08:00
|
|
|
|
},
|
2020-07-21 10:03:31 +08:00
|
|
|
|
// 数据排序
|
|
|
|
|
|
tableDataSort(item){
|
|
|
|
|
|
let orderBy='';
|
|
|
|
|
|
if(item.order==='ascending'){
|
|
|
|
|
|
orderBy=item.prop;
|
|
|
|
|
|
}
|
|
|
|
|
|
if(item.order==='descending'){
|
|
|
|
|
|
orderBy='-'+item.prop;
|
|
|
|
|
|
}
|
|
|
|
|
|
this.$set(this.searchLabel, "orderBy", orderBy);
|
|
|
|
|
|
this.getAlertList();
|
|
|
|
|
|
},
|
2020-05-28 17:32:23 +08:00
|
|
|
|
|
|
|
|
|
|
},
|
2020-11-21 12:21:27 +08:00
|
|
|
|
created(){
|
2020-05-28 17:32:23 +08:00
|
|
|
|
//是否存在分页缓存
|
|
|
|
|
|
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
|
|
|
|
|
|
if (pageSize != 'undefined' && pageSize != null) {
|
|
|
|
|
|
this.pageObj.pageSize = pageSize
|
|
|
|
|
|
}
|
2020-11-21 12:21:27 +08:00
|
|
|
|
},
|
|
|
|
|
|
mounted() {
|
|
|
|
|
|
this.firstLoad = false;
|
2020-05-28 17:32:23 +08:00
|
|
|
|
this.tablelable = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + '/alertList')
|
|
|
|
|
|
? JSON.parse(localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + '/alertList'))
|
|
|
|
|
|
: this.tableTitle;
|
|
|
|
|
|
this.dropCol = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + '/alertList')
|
|
|
|
|
|
? JSON.parse(localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + '/alertList'))
|
|
|
|
|
|
: this.tableTitle;
|
|
|
|
|
|
},
|
|
|
|
|
|
beforeDestroy() {
|
|
|
|
|
|
this.clearChart();
|
2020-11-20 13:57:46 +08:00
|
|
|
|
if (this.ps) {
|
|
|
|
|
|
this.ps.destroy();
|
|
|
|
|
|
}
|
2020-05-28 17:32:23 +08:00
|
|
|
|
},
|
|
|
|
|
|
};
|
|
|
|
|
|
</script>
|