diff --git a/nezha-fronted/src/assets/stylus/main.scss b/nezha-fronted/src/assets/stylus/main.scss index cd56f03de..67eeac420 100644 --- a/nezha-fronted/src/assets/stylus/main.scss +++ b/nezha-fronted/src/assets/stylus/main.scss @@ -1451,7 +1451,7 @@ li{ border-radius: 5px !important; } .line-chart-block-modal .el-dialog { - margin-top: 5% !important; + //margin-top: 5% !important; } .table-chart-dialog .el-dialog { height: 80%; diff --git a/nezha-fronted/src/components/charts/chart-list.vue b/nezha-fronted/src/components/charts/chart-list.vue index f0fafe5be..ae1443285 100644 --- a/nezha-fronted/src/components/charts/chart-list.vue +++ b/nezha-fronted/src/components/charts/chart-list.vue @@ -587,6 +587,7 @@ export default { let errorMsg = ""; res.forEach((response, innerPos) => { if (response.status === 'success') { + errorMsg = ""; if (response.data.result) { // console.log(response.data.result) // 循环处理每个elements下获取的数据列 diff --git a/nezha-fronted/src/components/charts/chart-table.scss b/nezha-fronted/src/components/charts/chart-table.scss index f7411ad6b..f1a726462 100644 --- a/nezha-fronted/src/components/charts/chart-table.scss +++ b/nezha-fronted/src/components/charts/chart-table.scss @@ -78,46 +78,6 @@ text-align: center; width: 100%; line-height: 28px; - .panel-info-corner { - color: #767980; - cursor: pointer; - position: absolute; - display: none; - left: 0; - width: 28px; - height: 28px; - z-index: 2; - top: 0; - } - .panel-info-corner--error { - display: block; - color: #fff; - } - .panel-info-corner .fa { - position: relative; - top: -6px; - left: -6px; - font-size: 75%; - z-index: 3; - } - .fa { - display: inline-block; - text-rendering: auto; - -webkit-font-smoothing: antialiased; - } - - .panel-info-corner--error .panel-info-corner-inner { - border-left: 28px solid #e02f44; - border-right: none; - border-bottom: 28px solid rgba(0,0,0,0); - } - .panel-info-corner-inner { - width: 0; - height: 0; - position: absolute; - left: 0; - bottom: 0; - } .nz-chart-top{ width:100%; } diff --git a/nezha-fronted/src/components/charts/chart-table.vue b/nezha-fronted/src/components/charts/chart-table.vue index 8f049a68a..9554318fb 100644 --- a/nezha-fronted/src/components/charts/chart-table.vue +++ b/nezha-fronted/src/components/charts/chart-table.vue @@ -20,7 +20,7 @@
@@ -72,8 +72,10 @@
{{data.title}}
+ +
@@ -112,11 +114,13 @@ import bus from '../../libs/bus'; import {Loading} from 'element-ui'; import chartDataFormat from './chartDataFormat' import loading from "../common/loading"; +import timePicker from '../common/timePicker' export default { name: 'chartTable', components: { 'loading': loading, + 'time-picker':timePicker }, props: { // 看板id @@ -216,7 +220,7 @@ export default { }], searchTime: [new Date().setHours(new Date().getHours() - 1), new Date()],//全屏显示的时间 oldSearchTime: [], - pickerOptions: { + /*pickerOptions: { shortcuts: [{ text: this.$t("dashboard.panel.recOne"), onClick(picker) { @@ -295,7 +299,7 @@ export default { picker.$emit('pick', [start, end]); } }] - }, + },*/ }; }, created() { @@ -543,6 +547,7 @@ export default { //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({//表格数据 @@ -568,8 +573,12 @@ export default { //this.searchTime = this.oldSearchTime; //alert(JSON.stringify(this.oldSearchTime)); this.searchTime = []; - this.searchTime[0] = this.oldSearchTime[0];//将列表的查询时间复制给全屏的查询时间 - this.searchTime[1] = this.oldSearchTime[1]; + //this.searchTime[0] = this.oldSearchTime[0];//将列表的查询时间复制给全屏的查询时间 + //this.searchTime[1] = this.oldSearchTime[1]; + this.$set(this.searchTime, 0, this.oldSearchTime[0]); + this.$set(this.searchTime, 1, this.oldSearchTime[1]); + this.$refs.calendarPanel.setCustomTime(this.searchTime); + this.seriesItemScreen = this.seriesItem; this.screenModal = true; //this.startLoading('screen'); diff --git a/nezha-fronted/src/components/charts/chartPreview.vue b/nezha-fronted/src/components/charts/chartPreview.vue index 82d982f1b..61a200860 100644 --- a/nezha-fronted/src/components/charts/chartPreview.vue +++ b/nezha-fronted/src/components/charts/chartPreview.vue @@ -28,9 +28,24 @@ :modal-append-to-body='false' @close="handleClose" @opened="initDialog"> + +
{{errorContent}}
+ + + + +
{{chart.title}}
+ + +
@@ -96,11 +111,13 @@ import loading from "../common/loading"; import chartDataFormat from './chartDataFormat' import {randomcolor} from '../common/js/radomcolor/randomcolor.js' + import timePicker from '../common/timePicker' export default { name: 'chartPreview', components: { 'loading': loading, + 'time-picker':timePicker }, props: { panelId:Number, @@ -111,6 +128,8 @@ //data: {}, // 该图表信息,chartItem dailogWidth:'80%', //seriesItem: [], // 保存信息 + isError:false, + errorContent:'', seriesItemScreen:[], pageSizes:[50,100,200], screenPageObj:{ @@ -149,13 +168,17 @@ showLegend:true, tableShow:true, urlShow:true, - searchTime:[new Date().setHours(new Date().getHours()-1),new Date()], + searchTime: [ + new Date(bus.computeTimezone(new Date().getTime())).setMinutes(new Date(bus.computeTimezone(new Date().getTime())).getMinutes() - 5), + new Date(bus.computeTimezone(new Date().getTime())) + ], //oldSearchTime:[], minHeight:200, chartSpaceHeight:5,//top-border: 1,bottom-border: 1,padding-bottome:3 titleHeight:50, legendHeight:80, //oldChartBoxCss:'', + /* pickerOptions: { shortcuts: [ { @@ -236,7 +259,7 @@ picker.$emit('pick', [start, end]); } }] - }, + },*/ }; }, computed: { @@ -245,7 +268,9 @@ methods: { // 全屏查看 show(chartInfo) { - this.searchTime = [new Date().setHours(new Date().getHours()-1),new Date()]; + this.isError = false; + this.searchTime = [new Date(bus.computeTimezone(new Date().getTime())).setMinutes(new Date(bus.computeTimezone(new Date().getTime())).getMinutes() - 5), + new Date(bus.computeTimezone(new Date().getTime()))]; this.chart=chartInfo; let chartType= chartInfo.type; @@ -388,6 +413,8 @@ console.log('=======',this.chart); }; res.forEach((response, innerPos) => { if (response.status === 'success') { + this.isError = false; + this.errorContent = ""; if (response.data.result) { // console.log(response.data.result) // 循环处理每个elements下获取的数据列 @@ -472,12 +499,14 @@ console.log('=======',this.chart); }); } }else{ + alert('error') + this.isError = true; if(response.msg){ - this.$message.error(response.msg); + this.errorContent = response.msg; }else if(response.error){ - this.$message.error(response.error); + this.errorContent = response.error; }else { - this.$message.error(response); + this.errorContent = response; } } }); @@ -940,6 +969,7 @@ console.log('=======',this.chart); }, */ dateChange(time) { + this.searchTime = [...time]; let chartType = this.chart.type; if (chartType === 'table') { this.seriesItemScreen = []; @@ -997,6 +1027,8 @@ console.log('=======',this.chart); } res.forEach((response,pos) => { if (response.status === 'success') { + this.isError = false; + this.errorContent = ""; if (response.data.result) { // 循环处理每个elements下获取的数据列 response.data.result.forEach((queryItem,innerPos) => { @@ -1063,6 +1095,15 @@ console.log('=======',this.chart); } }); } + }else{ + this.isError = true; + if(response.msg){ + this.errorContent = response.msg; + }else if(response.error){ + this.errorContent = response.error; + }else { + this.errorContent = response; + } } }); this.initChart(this.chart,series, this.$refs.screenShowArea,legend); diff --git a/nezha-fronted/src/components/charts/line-chart-block.scss b/nezha-fronted/src/components/charts/line-chart-block.scss index 634256f59..aa356148a 100644 --- a/nezha-fronted/src/components/charts/line-chart-block.scss +++ b/nezha-fronted/src/components/charts/line-chart-block.scss @@ -74,8 +74,62 @@ } } } +.panel-info-corner { + color: #767980; + cursor: pointer; + position: absolute; + display: none; + left: 0; + width: 28px; + height: 28px; + z-index: 2; + top: 0; +} +.panel-info-corner--error { + display: block; + color: #fff; +} +.panel-info-corner .fa { + position: relative; + top: -6px; + left: -6px; + font-size: 75%; + z-index: 3; +} +.panel-info-corner .fa-model { + position: relative; + top: -3px; + left: 4px; + font-size: 75%; + z-index: 3; +} +.fa , .fa-model{ + display: inline-block; + text-rendering: auto; + -webkit-font-smoothing: antialiased; +} + +.panel-info-corner--error .panel-info-corner-inner { + border-left: 28px solid #e02f44; + border-right: none; + border-bottom: 28px solid rgba(0,0,0,0); +} +.panel-info-corner-inner { + width: 0; + height: 0; + position: absolute; + left: 0; + bottom: 0; +} .chart-error-popper[x-placement^=top] .popper__arrow::after { border-top-color: #e02f44; + bottom:0px; +} +.chart-error-popper[x-placement^=bottom] .popper__arrow::after { + border-bottom-color: #e02f44; +} +.popper__arrow::after{ + border:solid 3px yellow } .chart-error-popper{ background-color:#e02f44; @@ -123,46 +177,6 @@ text-align: center; width: 100%; line-height: 28px; - .panel-info-corner { - color: #767980; - cursor: pointer; - position: absolute; - display: none; - left: 0; - width: 28px; - height: 28px; - z-index: 2; - top: 0; - } - .panel-info-corner--error { - display: block; - color: #fff; - } - .panel-info-corner .fa { - position: relative; - top: -6px; - left: -6px; - font-size: 75%; - z-index: 3; - } - .fa { - display: inline-block; - text-rendering: auto; - -webkit-font-smoothing: antialiased; - } - - .panel-info-corner--error .panel-info-corner-inner { - border-left: 28px solid #e02f44; - border-right: none; - border-bottom: 28px solid rgba(0,0,0,0); - } - .panel-info-corner-inner { - width: 0; - height: 0; - position: absolute; - left: 0; - bottom: 0; - } .nz-chart-top{ width:100%; diff --git a/nezha-fronted/src/components/charts/line-chart-block.vue b/nezha-fronted/src/components/charts/line-chart-block.vue index 3809fcd3f..4ef61ced8 100644 --- a/nezha-fronted/src/components/charts/line-chart-block.vue +++ b/nezha-fronted/src/components/charts/line-chart-block.vue @@ -27,7 +27,7 @@
{{errorContent}}
@@ -91,11 +91,27 @@ :visible.sync="screenModal" width="90%" @close="screenModal = false" + style="margin-top: 1vh !important;" @opened="initDialog"> + +
{{errorContent}}
+ + + + +
{{data.title}}  
+ + +
@@ -133,11 +149,13 @@ import loading from "../common/loading"; import chartDataFormat from './chartDataFormat' import {randomcolor} from '../common/js/radomcolor/randomcolor.js' + import timePicker from '../common/timePicker' export default { name: 'lineChartBlock', components: { 'loading': loading, + 'time-picker':timePicker }, props: { editChartId: { @@ -215,7 +233,7 @@ chartSpaceHeight:5,//top-border: 1,bottom-border: 1,padding-bottome:3 titleHeight:28, legendHeight:80, - pickerOptions: { + /*pickerOptions: { shortcuts: [ { text: this.$t("dashboard.panel.recOne"), @@ -295,7 +313,7 @@ picker.$emit('pick', [start, end]); } }] - }, + },*/ }; }, computed: { @@ -1268,7 +1286,10 @@ // 初始化同步时间 this.filter.start_time = this.stableFilter.start_time; this.filter.end_time = this.stableFilter.end_time; - this.searchTime = this.oldSearchTime; + //this.searchTime = this.oldSearchTime; + this.$set(this.searchTime, 0, this.oldSearchTime[0]); + this.$set(this.searchTime, 1, this.oldSearchTime[1]); + this.$refs.calendarPanel.setCustomTime(this.searchTime); this.screenModal = true; this.isGreyScreen=[]; @@ -1283,6 +1304,7 @@ //this.dateChange(); }, dateChange(time) { + this.searchTime = [...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.echartModalStore.clear(); @@ -1345,6 +1367,8 @@ } res.forEach((response,pos) => { if (response.status === 'success') { + this.isError = false; + this.errorContent = ""; if (response.data.result) { // 循环处理每个elements下获取的数据列 response.data.result.forEach((queryItem,innerPos) => { @@ -1428,6 +1452,15 @@ } }); } + }else{ + this.isError = true; + if(response.msg){ + this.errorContent = response.msg; + }else if(response.error){ + this.errorContent = response.error; + }else { + this.errorContent = response; + } } }); /* diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/endpointQueryTab.vue b/nezha-fronted/src/components/common/bottomBox/tabs/endpointQueryTab.vue index d822112bc..a8cc59106 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/endpointQueryTab.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/endpointQueryTab.vue @@ -4,6 +4,11 @@ margin-top: 16px; } +