Merge branch 'codeCheck' of https://git.mesalab.cn/nezha/nezha-fronted into codeCheck

This commit is contained in:
wangwenrui
2020-01-08 18:02:48 +08:00
15 changed files with 194 additions and 247 deletions

View File

@@ -15,14 +15,14 @@
<line-chart-block v-if="item.type === 'line' || item.type === 'bar' || item.type === 4" :key="'inner' + item.id" <line-chart-block v-if="item.type === 'line' || item.type === 'bar' || item.type === 4" :key="'inner' + item.id"
ref="editChart" ref="editChart"
@on-refresh-data="" @on-refresh-data="refreshChart"
@on-remove-chart-block="removeChart" @on-remove-chart-block="removeChart"
@on-edit-chart-block="editData" @on-edit-chart-block="editData"
:panel-id="filter.panelId" :panel-id="filter.panelId"
:editChartId="'editChartId' + item.id"></line-chart-block> :editChartId="'editChartId' + item.id"></line-chart-block>
<chart-table v-if="item.type === 'table'" ref="editChart" :key="'inner' + item.id" <chart-table v-if="item.type === 'table'" ref="editChart" :key="'inner' + item.id"
@on-refresh-data="" @on-refresh-data="refreshChart"
@on-remove-chart-block="removeChart" @on-remove-chart-block="removeChart"
@on-edit-chart-block="editData" @on-edit-chart-block="editData"
:panel-id="filter.panelId" :panel-id="filter.panelId"
@@ -34,7 +34,7 @@
</template> </template>
<script> <script>
import axios from 'axios'; import axios from 'axios';
//import bus from '../../libs/bus'; import bus from '../../libs/bus';
import lineChartBlock from './line-chart-block'; import lineChartBlock from './line-chart-block';
import chartTable from './chart-table'; import chartTable from './chart-table';
@@ -81,7 +81,11 @@ export default {
}; };
if (!param.query) delete param.query; if (!param.query) delete param.query;
//根据panelId获得panel下的所有图表 //根据panelId获得panel下的所有图表
this.$get('panel/'+ params.panelId+'/charts').then(response => { let searchTitleStr = '';
if(this.filter.searchName&&this.filter.searchName!=''){
searchTitleStr = '?title='+this.filter.searchName;
}
this.$get('panel/'+ params.panelId+'/charts'+searchTitleStr).then(response => {
if (response.code === 200) { if (response.code === 200) {
if(response.data.list){ if(response.data.list){
this.dataList = response.data.list; this.dataList = response.data.list;
@@ -117,30 +121,25 @@ export default {
} else { } else {
let startTime = ''; let startTime = '';
let endTime = ''; let endTime = '';
if (filterType === 'refresh') {//刷新:需要根据刷新周期来??? if (filterType === 'refresh') {//刷新
const now = new Date(); const now = new Date();
const origin = new Date(this.filter.end_time); const origin = new Date(this.filter.end_time);
const numInterval = now.getTime() - origin.getTime(); const numInterval = now.getTime() - origin.getTime();
if (numInterval >= 6000) { if (numInterval >= 60000) {//大于1分钟则start、end均往后移numInterval否则时间不变
startTime = this.getNewTime(this.filter.start_time, numInterval); startTime = this.getNewTime(this.filter.start_time, numInterval);
endTime = bus.timeFormate(now, 'yyyy/MM/dd-hh:mm:ss'); endTime = bus.timeFormate(now, 'yyyy-MM-dd hh:mm:ss');
} else { } else {
startTime = this.filter.start_time; startTime = this.filter.start_time;
endTime = this.filter.end_time; endTime = this.filter.end_time;
} }
} else { } else {
startTime = this.filter.start_time; startTime = this.filter.start_time;
endTime = this.filter.end_time; endTime = this.filter.end_time;
} }
//测试数据----之后会要去掉
startTime='2020-01-02T10:10:30.781Z';
endTime = '2020-01-02T20:10:30.781Z';
this.$nextTick(() => { this.$nextTick(() => {
const axiosArr = chartItem.elements.map((ele) => { const axiosArr = chartItem.elements.map((ele) => {
const filterItem = ele; const filterItem = ele;
return this.$get('http://192.168.40.247:9090/api/v1/query_range?query='+filterItem.expression+"&start="+startTime+"&end="+endTime+'&step=3600s'); return this.$get('/prom/api/v1/query_range?query='+filterItem.expression+"&start="+startTime+"&end="+endTime+'&step=3600s');
}); });
// 一个图表的所有element单独获取数据 // 一个图表的所有element单独获取数据
axios.all(axiosArr).then((res) => { axios.all(axiosArr).then((res) => {
@@ -200,8 +199,7 @@ export default {
} }
*/ */
let t_date = new Date(dpsItem[0] * 1000); let t_date = new Date(dpsItem[0] * 1000);
let timeTmp = [t_date.getFullYear(), t_date.getMonth() + 1, t_date.getDate()].join('-') + "\n" let timeTmp = bus.timeFormate(t_date, 'yyyy-MM-dd hh:mm');
+ [t_date.getHours(), t_date.getMinutes()].join(':');
tableData.push({//表格数据 tableData.push({//表格数据
label: host.slice(host.indexOf('{') + 1,host.indexOf('}')),//label label: host.slice(host.indexOf('{') + 1,host.indexOf('}')),//label
metric: queryItem.metric.__name__,//metric列 metric: queryItem.metric.__name__,//metric列
@@ -272,7 +270,7 @@ export default {
getNewTime(time, num) { getNewTime(time, num) {
const date = new Date(time); const date = new Date(time);
const newDate = new Date(parseInt(date.getTime(), 10) + num); const newDate = new Date(parseInt(date.getTime(), 10) + num);
return bus.timeFormate(newDate, 'yyyy/MM/dd-hh:mm:ss'); return bus.timeFormate(newDate, 'yyyy-MM-dd hh:mm:ss');
}, },
// 删除图表 // 删除图表
removeChart(chartId) { removeChart(chartId) {
@@ -289,7 +287,6 @@ export default {
this.$emit('on-edit-chart', chart); this.$emit('on-edit-chart', chart);
} }
}, },
/*
// 刷新列表中的一个图表 // 刷新列表中的一个图表
refreshChart(chartId) { refreshChart(chartId) {
this.dataList.forEach((item, index) => { this.dataList.forEach((item, index) => {
@@ -298,6 +295,7 @@ export default {
} }
}); });
}, },
/*
// 刷新数据 // 刷新数据
refreshData() { refreshData() {
this.getData(this.filter); this.getData(this.filter);

View File

@@ -61,4 +61,8 @@
font-size: 24px; font-size: 24px;
font-weight: 600; font-weight: 600;
} }
.chart-table-col{
width: 100%;
}
} }

View File

@@ -11,13 +11,13 @@
<div class="edit"> <div class="edit">
<!-- v-if="firstShow" --> <!-- v-if="firstShow" -->
<div class="list-icon"> <div class="list-icon">
<span @click="refreshChart" :title="$t('dashboard.refresh')" class="set-icon" v-if="showSetting"> <span @click="refreshChart" :title="$t('dashboard.refresh')" class="set-icon" >
<i class="el-icon-refresh-right"></i> <i class="el-icon-refresh-right"></i>
</span> </span>
<span @click="editChart" :title="$t('dashboard.edit')" class="set-icon" v-if="showSetting"> <span @click="editChart" :title="$t('dashboard.edit')" class="set-icon">
<i class="el-icon-edit-outline"></i> <i class="el-icon-edit-outline"></i>
</span> </span>
<span @click="removeChart" :title="$t('dashboard.delete')" class="set-icon" v-if="showSetting"> <span @click="removeChart" :title="$t('dashboard.delete')" class="set-icon" >
<i class="el-icon-delete"></i> <i class="el-icon-delete"></i>
</span> </span>
<span @click="showAllScreen" :title="$t('dashboard.screen')" class="set-icon"> <span @click="showAllScreen" :title="$t('dashboard.screen')" class="set-icon">
@@ -30,10 +30,10 @@
<div class="mt-10"> <div class="mt-10">
<!-- <!--
<el-table size="small" :loading="tableLoading">--> <el-table size="small" :loading="tableLoading">-->
<el-table :data="seriesItem" height="350" border style="width: 100%"> <el-table :data="seriesItem" height="350" border class="chart-table-col" v-loading="tableLoading">
<el-table-column prop="metric" :label="$t('dashboard.panel.chartTableColumn.metric')" sortable></el-table-column> <el-table-column prop="metric" :label="$t('dashboard.panel.chartTableColumn.metric')" sortable></el-table-column>
<el-table-column prop="label" :label="$t('dashboard.panel.chartTableColumn.label')" sortable></el-table-column> <el-table-column prop="label" :label="$t('dashboard.panel.chartTableColumn.label')" sortable></el-table-column>
<el-table-column prop="time" :label="$t('dashboard.panel.chartTableColumn.time')" width="125" sortable></el-table-column> <el-table-column prop="time" :label="$t('dashboard.panel.chartTableColumn.time')" width="145" sortable></el-table-column>
<el-table-column prop="value" :label="$t('dashboard.panel.chartTableColumn.value')" sortable></el-table-column> <el-table-column prop="value" :label="$t('dashboard.panel.chartTableColumn.value')" sortable></el-table-column>
</el-table> </el-table>
</div> </div>
@@ -67,11 +67,6 @@ export default {
type: Number, type: Number,
default: 0, default: 0,
}, },
// 展示设置内容
showSetting: {
type: Boolean,
default: true,
},
}, },
data() { data() {
return { return {

View File

@@ -5,7 +5,7 @@
<div class="line-chart-block" > <div class="line-chart-block" >
<div class="edit"> <div class="edit">
<div class="list-icon" v-if="firstShow"> <div class="list-icon" >
<span @click="refreshChart" :title="$t('dashboard.refresh')" class="set-icon" v-if="showSetting"> <span @click="refreshChart" :title="$t('dashboard.refresh')" class="set-icon" v-if="showSetting">
<i class="el-icon-refresh-right"></i> <i class="el-icon-refresh-right"></i>
</span> </span>
@@ -103,7 +103,7 @@ export default {
end_time: '', end_time: '',
}, },
stableFilter: {}, // 保存数据使用,初始化起止时间,单图or多图等 stableFilter: {}, // 保存数据使用,初始化起止时间,单图or多图等
firstShow: false, // 默认不显示操作按钮, // firstShow: false, // 默认不显示操作按钮,
}; };
}, },
computed: { computed: {
@@ -120,19 +120,12 @@ export default {
methods: { methods: {
// chartSite用于区分是全屏显示还是局部显示 // chartSite用于区分是全屏显示还是局部显示
initChart(chartInfo, dataArg, ele, chartSite,legend) { initChart(chartInfo, dataArg, ele, chartSite,legend) {
this.firstShow = true; // 展示操作按键 //this.firstShow = true; // 展示操作按键
const self = this; const self = this;
this.chartType = ''; // 图表类型 this.chartType = ''; // 图表类型
if ( chartInfo.type === 4) {//line,bar if ( chartInfo.type === 4) {//line,bar
this.chartType = 'line'; this.chartType = 'line';
} }
//alert(ele.style.height);
// ele.style.height= chartInfo.height;
//alert(chartInfo.height);
//alert(ele.style.height);
//var myEchart = echarts.init(document.getElementById('lineChartArea'));
this.echartStore = echarts.init(ele); this.echartStore = echarts.init(ele);
var chartWidth = ele.clientWidth; var chartWidth = ele.clientWidth;
var option = { var option = {
@@ -324,6 +317,7 @@ export default {
}); });
*/ */
this.echartStore.setOption(option);//创建图表 this.echartStore.setOption(option);//创建图表
this.echartStore.hideLoading();
} else if (chartSite === 'screen') { // 全屏显示 } else if (chartSite === 'screen') { // 全屏显示
option.series = dataArg.map((item) => {// params.series = dataArg.map((item) => { option.series = dataArg.map((item) => {// params.series = dataArg.map((item) => {
const obj = Object.assign(item); const obj = Object.assign(item);
@@ -370,6 +364,7 @@ export default {
}); });
// eslint-disable-next-line // eslint-disable-next-line
this.echartStore.setOption(option);//显示全屏界面 this.echartStore.setOption(option);//显示全屏界面
this.echartStore.hideLoading();
} }
this.echartStore.resize({height:chartInfo.height});//,width:`${ele.clientWidth-100}`} this.echartStore.resize({height:chartInfo.height});//,width:`${ele.clientWidth-100}`}
}, },
@@ -397,7 +392,11 @@ export default {
editChart() { editChart() {
this.$emit('on-edit-chart-block', this.data.id); this.$emit('on-edit-chart-block', this.data.id);
}, },
// 重新请求数据 刷新操作
refreshChart() {
this.echartStore.showLoading();
this.$emit('on-refresh-data', this.data.id);
},
/* /*
handleClose(done) { handleClose(done) {
/* /*
@@ -422,11 +421,7 @@ export default {
}, },
}); });
}, },
// 重新请求数据 刷新操作-> console, create-board
refreshChart() {
this.highchartStore.showLoading();
this.$emit('on-refresh-data', this.data.id);
},
// 全屏查看 // 全屏查看
showAllScreen() { showAllScreen() {
// 初始化同步时间 // 初始化同步时间

View File

@@ -474,7 +474,7 @@
return this.$store.state.projectListChange; return this.$store.state.projectListChange;
}, },
getIdcData() { getIdcData() {
return this.$store.state.assetData.idcData return this.$store.state.assetDcList;
} }
}, },
watch: { watch: {

View File

@@ -20,6 +20,9 @@ const cn = {
title:'仪表盘', title:'仪表盘',
panel:{ panel:{
title:'看板', title:'看板',
searchItem:{
name:'标题'
},
//面板-侧滑框 //面板-侧滑框
createPanelTitle: "创建面板", createPanelTitle: "创建面板",
createPanelTitleSec:"创建新面板", createPanelTitleSec:"创建新面板",
@@ -67,7 +70,14 @@ const cn = {
recSevenDay:'近7日', recSevenDay:'近7日',
recOneMonth:'近一个月', recOneMonth:'近一个月',
curMonth:'本月', curMonth:'本月',
lastMonth:'上月' lastMonth:'上月',
refreshInterval:{
never:'从不',
oneMinute:'1分钟',
threeMinutes:'3分钟',
fiveMinutes:'5分钟',
tenMinutes:'10分钟',
}
}, },
metric:{ metric:{
name:"指标名称", name:"指标名称",

View File

@@ -25,6 +25,9 @@ const en = {
title:'Dashboard', title:'Dashboard',
panel:{ panel:{
title:'Panel', title:'Panel',
searchItem:{
name:'Title'
},
//面板-侧滑框 //面板-侧滑框
createPanelTitle: "Create Panel", createPanelTitle: "Create Panel",
createPanelTitleSec:"Create New Panel", createPanelTitleSec:"Create New Panel",
@@ -72,7 +75,14 @@ const en = {
recSevenDay:'recent week', recSevenDay:'recent week',
recOneMonth:'recent month', recOneMonth:'recent month',
curMonth:'this month', curMonth:'this month',
lastMonth:'last month' lastMonth:'last month',
refreshInterval:{
never:'never',
oneMinute:'1 min',
threeMinutes:'3 mins',
fiveMinutes:'5 mins',
tenMinutes:'10 mins',
}
}, },
metric:{ metric:{
name:"Metric", name:"Metric",
@@ -111,7 +121,6 @@ const en = {
}, },
tip: { tip: {
confirmDelete: "Confirm Delete?", confirmDelete: "Confirm Delete?",
assetConfirmDelete: 'Its associated Endpoints and Alert Rules will also be deleted, confirm delete?',
yes: "Yes", yes: "Yes",
no: "No", no: "No",
deleteSuccess: "Successfully Deleted", deleteSuccess: "Successfully Deleted",

View File

@@ -1,10 +1,10 @@
<style scoped> <style scoped>
.account { .config {
height: 100%; height: 100%;
} }
</style> </style>
<template> <template>
<div class="account"> <div class="config">
<div class="content-left"> <div class="content-left">
<div class="sidebar-title">{{$t('alert.alert')}}</div> <div class="sidebar-title">{{$t('alert.alert')}}</div>
<div class="sidebar-info"> <div class="sidebar-info">
@@ -34,7 +34,7 @@
show-overflow-tooltip show-overflow-tooltip
> >
<template slot-scope="scope" :column="item"> <template slot-scope="scope" :column="item">
<div v-if="item.prop == 'option'" class="account-list-options"> <div v-if="item.prop == 'option'" class="content-right-options">
<span @click="del(scope.row)" class="content-right-option"><i class="el-icon-delete"></i></span> <span @click="del(scope.row)" class="content-right-option"><i class="el-icon-delete"></i></span>
<span @click="detail(scope.row)" class="content-right-option"><i class="el-icon-view"></i></span> <span @click="detail(scope.row)" class="content-right-option"><i class="el-icon-view"></i></span>
<span @click="toEdit(scope.row)" class="content-right-option"><i class="el-icon-edit-outline"></i></span> <span @click="toEdit(scope.row)" class="content-right-option"><i class="el-icon-edit-outline"></i></span>
@@ -49,8 +49,8 @@
</span> </span>
<!-- <span v-else-if="item.prop == 'linkObject' && scope.row[item.prop]">{{scope.row.type != 3 && scope.row.linkObject ? scope.row[item.prop].name : scope.row[item.prop].host}}</span>--> <!-- <span v-else-if="item.prop == 'linkObject' && scope.row[item.prop]">{{scope.row.type != 3 && scope.row.linkObject ? scope.row[item.prop].name : scope.row[item.prop].host}}</span>-->
<div v-else-if="item.prop == 'linkObject'"> <div v-else-if="item.prop == 'linkObject'">
<span v-if="(scope.row['type'] == 1 || scope.row['type'] == 2) && scope.row[item.prop]" class="account-list-option" @click="viewAlertType(scope.row['type'],scope.row[item.prop])">{{scope.row[item.prop].name}}</span> <span v-if="(scope.row['type'] == 1 || scope.row['type'] == 2) && scope.row[item.prop]" class="content-right-option" @click="viewAlertType(scope.row['type'],scope.row[item.prop])">{{scope.row[item.prop].name}}</span>
<span v-if="scope.row['type'] == 3 && scope.row[item.prop]" class="account-list-option" @click="viewAlertType(scope.row['type'],scope.row[item.prop].id)">{{scope.row[item.prop].host}}</span> <span v-if="scope.row['type'] == 3 && scope.row[item.prop]" class="content-right-option" @click="viewAlertType(scope.row['type'],scope.row[item.prop].id)">{{scope.row[item.prop].host}}</span>
</div> </div>
<span v-else>{{scope.row[item.prop]}}</span> <span v-else>{{scope.row[item.prop]}}</span>
</template> </template>
@@ -61,7 +61,7 @@
<alert-config-box :parentAlertRule="alertRule" @reload="getTableData" ref="alertConfigBox"></alert-config-box> <alert-config-box :parentAlertRule="alertRule" @reload="getTableData" ref="alertConfigBox"></alert-config-box>
<project-box :project="viewProjectData" ref="projectBox" @reload="getTableData"></project-box> <project-box :project="viewProjectData" ref="projectBox" @reload="getTableData"></project-box>
<module-box :module="viewModuleData" @reload="getTableData" ref="moduleBox"></module-box> <module-box :module="viewModuleData" @reload="getTableData" ref="moduleBox"></module-box>
<asset-edit-unit :edit-unit-show='viewAsset' @refreshData="" @sendStateData="" ref="assetEditUnit"></asset-edit-unit> <asset-edit-unit :edit-unit-show='viewAsset' @refreshData="getTableData" @sendStateData="tabControl" ref="assetEditUnit"></asset-edit-unit>
</div> </div>
</template> </template>
@@ -219,6 +219,13 @@ export default {
}) })
}); });
}, },
//asset弹框控制
tabControl(data) {
if (data === 'close') {
this.viewAsset = false
this.$refs['assetEditUnit'].tabView = false
}
},
toAdd: function() { toAdd: function() {
this.cleanAlertRule(); this.cleanAlertRule();
this.$refs.alertConfigBox.show(true, true); this.$refs.alertConfigBox.show(true, true);

View File

@@ -1,165 +1,10 @@
<style scoped> <style scoped>
.account { .list {
height: 100%; height: 100%;
} }
.account-list-option {
cursor: pointer;
display: inline-block;
margin-right: 6px;
}
.account-list-option .el-icon-delete {
color: #F98D9A;
}
.account-list-option .el-icon-delete:hover {
color: #D96D7A;
}
.account-list-option .el-icon-view {
color: #60BEFF;
}
.account-list-option .el-icon-view:hover {
color: #409EFF;
}
/* begin--右侧弹框*/
.right-box {
position: fixed;
top: 80px;
right: 15px;
z-index: 1;
border-radius: 8px;
box-shadow: 0 0 15px #ccc;
background-color: white;
padding: 0 20px;
}
.right-box-account {
width: 550px;
height: calc(100% - 100px);
}
/* begin--右侧弹框--顶部按钮*/
.right-box-top-btns {
text-align: center;
}
.right-box-top-btn {
border-radius: 0 0 9px 9px;
float: right;
color: #656565;
height: 30px;
font-size: 12px;
padding: 3px 8px 1px 8px;
border: 1px solid #aaaaaa;
border-top: none;
cursor: pointer;
margin-left: 20px;
}
.right-box-top-btn-full {
background-color: #656565;
border: 1px solid #656565;
border-top: none;
color: white;
}
/* end--右侧弹框--顶部按钮*/
/* begin--右侧弹框--内容*/
.right-box-title {
height: 30px;
line-height: 40px;
text-align: left;
}
.right-box-form {
margin-top: 35px;
}
.right-box-form-row {
margin-top: 25px;
}
.right-box-form-label {
margin-bottom: 8px;
text-align: left;
}
.right-box-form-content {
line-height: 32px;
text-align: left;
width: 100%;
}
.right-box-form-content-txt {
padding-left: 11px;
}
.right-box-form-content .el-select {
width: calc(100% - 38px);
vertical-align: top;
}
.el-select-add-btn {
width: 33px;
height: 33px;
display: inline-block;
text-align: center;
border-radius: 5px;
border: 1px solid #DCDFE6;
box-sizing: border-box;
color: #C7C9CE;
transition: border-color .2s cubic-bezier(.645,.045,.355,1);
}
.el-select-add-btn:hover {
border: 1px solid #C0C4CC;
cursor: pointer;
}
/* end--右侧弹框--内容*/
/* begin--右侧弹框--底部按钮*/
.right-box-bottom-btns {
position: absolute;
bottom: 0;
width: 100%;
height: 40px;
left: 0;
text-align: center;
}
.right-box-bottom-btn:first-of-type {
border-bottom-left-radius: 8px;
}
.right-box-bottom-btn:last-of-type{
border-bottom-right-radius: 8px;
}
.right-box-bottom-btn {
display: inline-block;
background-color: #656565;
color: white;
height: 100%;
line-height: 40px;
cursor: pointer;
width: 100%;
}
.config-dropdown-label-input {
width: 50%;
display: inline-block;
}
.right-box-bottom-btn-cancel {
background-color: #DADADA;
color: #656565;
}
.right-box-bottom-btn-50 {
width: 50%;
}
/* end--右侧弹框--底部按钮*/
/* end--右侧弹框*/
/* begin--右弹框滑入滑出动画*/
@keyframes slide-in-from-right {
from {right: -800px}
to {right: 0}
}
@keyframes slide-out-to-right {
from {right: 0}
to {right: -800px}
}
.right-box-enter-active {
animation: slide-in-from-right 0.4s;
}
.right-box-leave-active {
animation: slide-out-to-right 0.4s;
}
/* end--右弹框滑入滑出动画*/
</style> </style>
<template> <template>
<div class="account"> <div class="list">
<div class="content-left"> <div class="content-left">
<div class="sidebar-title">{{$t('alert.alert')}}</div> <div class="sidebar-title">{{$t('alert.alert')}}</div>
<div class="sidebar-info"> <div class="sidebar-info">
@@ -185,10 +30,10 @@
:label="item.label" :label="item.label"
> >
<template slot-scope="scope" :column="item"> <template slot-scope="scope" :column="item">
<span v-if="item.prop == 'alertRule'" class="account-list-option" @click="viewRule(scope.row[item.prop].id)"> <span v-if="item.prop == 'alertRule'" class="content-right-option" @click="viewRule(scope.row[item.prop].id)">
{{scope.row[item.prop].alertName}} {{scope.row[item.prop].alertName}}
</span> </span>
<div v-else-if="item.prop == 'type'" class="account-list-options"> <div v-else-if="item.prop == 'type'" class="content-right-options">
<span v-if="scope.row[item.prop] == 1" >Project</span> <span v-if="scope.row[item.prop] == 1" >Project</span>
<span v-if="scope.row[item.prop] == 2" >Module</span> <span v-if="scope.row[item.prop] == 2" >Module</span>
<span v-if="scope.row[item.prop] == 3" >Device</span> <span v-if="scope.row[item.prop] == 3" >Device</span>
@@ -199,11 +44,11 @@
<span v-if="scope.row[item.prop] == 'low'"><i class="el-icon-arrow-down"></i>&nbsp;{{severityData[2].value}}</span> <span v-if="scope.row[item.prop] == 'low'"><i class="el-icon-arrow-down"></i>&nbsp;{{severityData[2].value}}</span>
</span> </span>
<div v-else-if="item.prop == 'linkObject'"> <div v-else-if="item.prop == 'linkObject'">
<span v-if="(scope.row['type'] == 1 || scope.row['type'] == 2) && scope.row[item.prop]" class="account-list-option" @click="viewAlertType(scope.row['type'],scope.row[item.prop])">{{scope.row[item.prop].name}}</span> <span v-if="(scope.row['type'] == 1 || scope.row['type'] == 2) && scope.row[item.prop]" class="content-right-option" @click="viewAlertType(scope.row['type'],scope.row[item.prop])">{{scope.row[item.prop].name}}</span>
<span v-if="scope.row['type'] == 3 && scope.row[item.prop]" class="account-list-option" @click="viewAlertType(scope.row['type'],scope.row[item.prop].id)">{{scope.row[item.prop].host}}</span> <span v-if="scope.row['type'] == 3 && scope.row[item.prop]" class="content-right-option" @click="viewAlertType(scope.row['type'],scope.row[item.prop].id)">{{scope.row[item.prop].host}}</span>
</div> </div>
<div v-else-if="item.prop == 'state'"> <div v-else-if="item.prop == 'state'">
<span class="account-list-option"> <span class="">
{{scope.row['state'] == 1 ? "Pending" : ""}} {{scope.row['state'] == 1 ? "Pending" : ""}}
{{scope.row['state'] == 2 ? "Expired" : ""}} {{scope.row['state'] == 2 ? "Expired" : ""}}
</span> </span>
@@ -217,7 +62,7 @@
<alert-config-box :parentAlertRule="viewRuleData" @reload="getAlertList" ref="alertConfigBox"></alert-config-box> <alert-config-box :parentAlertRule="viewRuleData" @reload="getAlertList" ref="alertConfigBox"></alert-config-box>
<project-box :project="viewProjectData" ref="projectBox" @reload="getAlertList"></project-box> <project-box :project="viewProjectData" ref="projectBox" @reload="getAlertList"></project-box>
<module-box :module="viewModuleData" @reload="getAlertList" ref="moduleBox"></module-box> <module-box :module="viewModuleData" @reload="getAlertList" ref="moduleBox"></module-box>
<asset-edit-unit :edit-unit-show='viewAssetState' @refreshData="getAlertList" @sendStateData="" ref="assetEditUnit"></asset-edit-unit> <asset-edit-unit :edit-unit-show='viewAssetState' @refreshData="getAlertList" @sendStateData="tabControl" ref="assetEditUnit"></asset-edit-unit>
</div> </div>
</template> </template>
@@ -344,6 +189,13 @@ export default {
} }
}) })
}, },
//asset弹框控制
tabControl(data) {
if (data === 'close') {
this.viewAssetState = false
this.$refs['assetEditUnit'].tabView = false
}
},
jumpTo(data,id) { jumpTo(data,id) {
this.$store.state.assetData.moduleData = data this.$store.state.assetData.moduleData = data
this.$store.state.assetData.selectedData = id this.$store.state.assetData.selectedData = id

View File

@@ -889,7 +889,7 @@
if (response.code === 200) { if (response.code === 200) {
this.IDCOptionData = response.data.list; this.IDCOptionData = response.data.list;
this.markOptionData(this.IDCOptionData) this.markOptionData(this.IDCOptionData)
//this.$store.state.assetData.idcData = this.IDCOptionData; this.$store.commit('assetDcListChange');
this.$emit('refreshData'); this.$emit('refreshData');
} }
}) })

View File

@@ -967,8 +967,8 @@
this.$get('idc').then(response => { this.$get('idc').then(response => {
if (response.code === 200) { if (response.code === 200) {
this.IDCOptionData = response.data.list; this.IDCOptionData = response.data.list;
this.markOptionData(this.IDCOptionData) this.markOptionData(this.IDCOptionData);
//this.$store.state.assetData.idcData = this.IDCOptionData this.$store.commit('assetDcListChange');
this.$emit('refreshData'); this.$emit('refreshData');
} }
}) })

View File

@@ -337,7 +337,6 @@
// 每个模块均有返回,当全部模块返回完成时,将sub计数器重置 // 每个模块均有返回,当全部模块返回完成时,将sub计数器重置
//alert('box第二步subCount和元素个数一样了就从deleteIndex开始删除一个元素this.subCount='+this.subCount); //alert('box第二步subCount和元素个数一样了就从deleteIndex开始删除一个元素this.subCount='+this.subCount);
this.subCount += 1; this.subCount += 1;
//alert(this.elements.length);
if (this.subCount === this.elements.length) { if (this.subCount === this.elements.length) {
this.subCount = 0; this.subCount = 0;
// 保存完成,进行删除操作 // 保存完成,进行删除操作

View File

@@ -65,6 +65,20 @@
color: #F98D9A; color: #F98D9A;
} }
/* end--Panel-自定义可编辑的el-select下拉框样式*/ /* end--Panel-自定义可编辑的el-select下拉框样式*/
.panel-select-width{
width: 150px;
}
.panel-refresh-interval{
margin-right: 5px;
float: right;
}
.panel-refresh-interval-select{
width: 95px;
}
.panel-calendar{
float: right;
margin-right: 1px;
}
</style> </style>
<template> <template>
@@ -81,8 +95,8 @@
<button @click="toAddChart" class="nz-btn nz-btn-size-normal nz-btn-style-normal float-right"> <button @click="toAddChart" class="nz-btn nz-btn-size-normal nz-btn-style-normal float-right">
<span class="top-tool-btn-txt">{{$t('overall.add')}}</span> <span class="top-tool-btn-txt">{{$t('overall.add')}}</span>
</button> </button>
<div class="top-tool-search float-right"><search-input :searchMsg="searchMsg" @search="search"></search-input></div> <div class="top-tool-search float-right"><search-input ref="searchInput" :searchMsg="searchMsg" @search="search" ></search-input></div>
<el-select class="right-box-row-with-btn" popper-class="" v-model="showPanel.id" placeholder="" size="small" @change="panelChange"> <el-select class="panel-select-width" popper-class="" v-model="showPanel.id" placeholder="" size="small" @change="panelChange">
<el-option > <el-option >
<span class="panel-dropdown-btn-create" @click.stop="toAdd" >{{$t('dashboard.panel.createPanelTitleSec')}}</span> <span class="panel-dropdown-btn-create" @click.stop="toAdd" >{{$t('dashboard.panel.createPanelTitleSec')}}</span>
</el-option> </el-option>
@@ -99,12 +113,27 @@
<span class="panel-dropdown-btn panel-dropdown-btn-delete" @click.stop="del(item)"><i class="el-icon-delete"></i></span> <span class="panel-dropdown-btn panel-dropdown-btn-delete" @click.stop="del(item)"><i class="el-icon-delete"></i></span>
</el-option> </el-option>
</el-select> </el-select>
<div class="float-right" style="margin-right: 10px;"> <div class="panel-refresh-interval" >
<div class="block">
<!--
<button type="button" class="nz-btn nz-btn-size-normal nz-btn-style-light nz-btn-style-square">
<span class="top-tool-btn-txt"><i class="el-icon-refresh-right"></i></span>
</button>
-->
<el-select class="panel-refresh-interval-select" placeholder="" v-model="interval" @change="selectInterval" size="small">
<el-option v-for="item in intervalList"
:value="item.value"
:label="item.name"
:key="item.value">{{item.name}}</el-option>
</el-select>
</div>
</div>
<div class="panel-calendar" >
<div class="block"> <div class="block">
<el-date-picker size="small" ref="calendar" <el-date-picker size="small" ref="calendar"
format="yyyy/MM/dd HH:mm" format="yyyy/MM/dd HH:mm"
@change="dateChange" @change="dateChange"
v-model="value2" v-model="searchTime"
type="datetimerange" type="datetimerange"
:picker-options="pickerOptions" :picker-options="pickerOptions"
:range-separator="$t('dashboard.panel.to')" :range-separator="$t('dashboard.panel.to')"
@@ -132,6 +161,7 @@
<script> <script>
import ChartBox from "./chartBox"; import ChartBox from "./chartBox";
import ChartList from '../../charts/chart-list'; import ChartList from '../../charts/chart-list';
import bus from '../../../libs/bus';
export default { export default {
name: "panel", name: "panel",
@@ -222,7 +252,24 @@
} }
}] }]
}, },
value2: [new Date(), new Date()], searchTime: [new Date().setHours(new Date().getHours()-1),new Date()],
intervalList: [{
value: 0,
name: this.$t("dashboard.panel.refreshInterval.never"),
}, {
value: 60,
name: this.$t("dashboard.panel.refreshInterval.oneMinute"),
}, {
value: 180,
name: this.$t("dashboard.panel.refreshInterval.threeMinutes"),
}, {
value: 300,
name: this.$t("dashboard.panel.refreshInterval.fiveMinutes"),
}, {
value: 600,
name: this.$t("dashboard.panel.refreshInterval.tenMinutes"),
}],
interval: 0,
showPanel:{//panel下拉列表 showPanel:{//panel下拉列表
id:'', id:'',
name:'' name:''
@@ -252,30 +299,27 @@
panelData: [], panelData: [],
searchMsg: { //给搜索框子组件传递的信息 searchMsg: { //给搜索框子组件传递的信息
zheze_none: true, zheze_none: true,
searchLabelList: [{ searchLabelList: [
/*
{
id: 1, id: 1,
name: this.$t("dashboard.panel.panelForm.panelId"), name: this.$t("dashboard.panel.searchItem.name"),
type: 'input',
label: 'id',
disabled: false
},{
id: 2,
name: this.$t("dashboard.panel.panelForm.panelName"),
type: 'input', type: 'input',
label: 'name', label: 'name',
disabled: false disabled: false
}], }
*/],
}, },
searchLabel: {}, //搜索参数 searchLabel: {}, //搜索参数
//---图表相关参数--start //---图表相关参数--start
dataList: [], // 数据列表 dataList: [], // 数据列表
searchName: '', // 搜索名称 //searchName: '', // 搜索名称
filter: { // 过滤条件 filter: { // 过滤条件
//productId: 0, //productId: 0,
panelId: 0, panelId: 0,
start_time: '', start_time: '',
end_time: '', end_time: '',
searchName:''
}, },
panelId: 0, panelId: 0,
//removeModal: false, // 删除弹出 //removeModal: false, // 删除弹出
@@ -290,6 +334,7 @@
methods: { methods: {
//面板相关操作 //面板相关操作
panelChange(){ panelChange(){
this.$refs.searchInput.select();
this.filter.panelId = this.showPanel.id; this.filter.panelId = this.showPanel.id;
this.getData(this.filter); this.getData(this.filter);
}, },
@@ -383,11 +428,27 @@
}, },
// 获取数据,用在子页面 // 获取数据,用在子页面
getData(params) { getData(params) {
if( params.start_time===''||params.end_time===''){
let now = new Date();
let endTimeTmp = bus.timeFormate(now, 'yyyy-MM-dd hh:mm:ss');
let startTimeTmp = bus.timeFormate(now.setHours(now.getHours()-1), 'yyyy-MM-dd hh:mm:ss');
params.start_time = startTimeTmp;
params.end_time = endTimeTmp;
}
this.$refs.chartList.initData(params); this.$refs.chartList.initData(params);
}, },
/*图表相关操作--end*/ /*图表相关操作--end*/
/*时间条件查询--start*/
// 选择日期变化
dateChange() {
this.$refs.searchInput.select();
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.filter.panelId = this.showPanel.id;
this.getData(this.filter);
},
/*时间条件查询--end*/
//公用操作 //公用操作
jumpTo(data,id) { jumpTo(data,id) {
this.$store.state.assetData.moduleData = data this.$store.state.assetData.moduleData = data
@@ -400,9 +461,7 @@
}); });
}, },
getTableData: function() { getTableData: function() {
this.$set(this.searchLabel, "pageNo", this.pageObj.pageNo); this.$get('panel').then(response => {
this.$set(this.searchLabel, "pageSize", this.pageObj.pageSize);
this.$get('panel', this.searchLabel).then(response => {
if (response.code === 200) { if (response.code === 200) {
this.panelData = response.data.list; this.panelData = response.data.list;
if( response.data.list.length>0 ){ if( response.data.list.length>0 ){
@@ -433,19 +492,26 @@
this.getTableData(); this.getTableData();
}, },
search: function(searchObj) { search: function(searchObj) {
console.info(searchObj);
this.searchLabel = {}; this.searchLabel = {};
let containTitle = false;
for (let item in searchObj) { for (let item in searchObj) {
if (searchObj[item]) { if (searchObj[item]) {
this.$set(this.searchLabel, item, searchObj[item]); this.$set(this.searchLabel, item, searchObj[item]);
if(item==='name'){
this.filter.searchName = searchObj[item];//此处就一个条件
containTitle= true;
}
} }
} }
this.getTableData(); if(!containTitle){
this.filter.searchName = '';
}
this.filter.panelId = this.showPanel.id;
this.getData(this.filter);
} }
}, },
created() { created() {
this.getTableData(); this.getTableData();
this.getData(this.filter);
}, },
mounted: function() { mounted: function() {
}, },

View File

@@ -79,7 +79,7 @@
:label="item.label" :label="item.label"
> >
<template slot-scope="scope" :column="item"> <template slot-scope="scope" :column="item">
<span v-if="item.prop == 'asset' && scope.row[item.prop]" @click="viewAsset(scope.row[item.prop].id)">{{scope.row[item.prop].host}}</span> <span v-if="item.prop == 'asset' && scope.row[item.prop]" class="content-right-option" @click="viewAsset(scope.row[item.prop].id)">{{scope.row[item.prop].host}}</span>
<span v-else-if="item.prop == 'param'"> <span v-else-if="item.prop == 'param'">
<span v-for="p in scope.row.paramObj">{{p.key}}={{p.value}}</span> <span v-for="p in scope.row.paramObj">{{p.key}}={{p.value}}</span>
</span> </span>
@@ -103,7 +103,7 @@
<module-box :currentProject="currentProject" :module="editModule" @reload="getModuleList" ref="moduleBox"></module-box> <module-box :currentProject="currentProject" :module="editModule" @reload="getModuleList" ref="moduleBox"></module-box>
<edit-endpoint-box :currentProject="currentProject" :currentModule="currentModule" :endpoint="editEndpoint" @reload="getEndpointTableData" ref="editEndpointBox"></edit-endpoint-box> <edit-endpoint-box :currentProject="currentProject" :currentModule="currentModule" :endpoint="editEndpoint" @reload="getEndpointTableData" ref="editEndpointBox"></edit-endpoint-box>
<add-endpoint-box :currentProject="currentProject" :currentModule="currentModule" @reload="getEndpointTableData" ref="addEndpointBox"></add-endpoint-box> <add-endpoint-box :currentProject="currentProject" :currentModule="currentModule" @reload="getEndpointTableData" ref="addEndpointBox"></add-endpoint-box>
<asset-edit-unit :edit-unit-show='viewAssetState' @refreshData="" @sendStateData="" ref="assetEditUnit"></asset-edit-unit> <asset-edit-unit :edit-unit-show='viewAssetState' @refreshData="getEndpointTableData" @sendStateData="tabControl" ref="assetEditUnit"></asset-edit-unit>
</div> </div>
</template> </template>
@@ -355,6 +355,14 @@
this.rightBoxHandler(2); this.rightBoxHandler(2);
}, },
//asset弹框控制
tabControl(data) {
if (data === 'close') {
this.viewAssetState = false
this.$refs['assetEditUnit'].tabView = false
}
},
//搜索 //搜索
endpointSearch: function(searchObj) { endpointSearch: function(searchObj) {
this.endpointSearchLabel = {}; this.endpointSearchLabel = {};

View File

@@ -8,6 +8,7 @@ const store = new Vuex.Store({
selectedData:'', selectedData:'',
step: 0 step: 0
}, },
assetDcList: 0,
currentProject: { currentProject: {
id: '', id: '',
name: '', name: '',
@@ -35,6 +36,9 @@ const store = new Vuex.Store({
}, },
panelListChange(state,status){ panelListChange(state,status){
state.panelListReload = status; state.panelListReload = status;
},
assetDcListChange(state) {
state.assetDcList++;
} }
}, },
actions: { actions: {