diff --git a/nezha-fronted/src/components/page/dashboard/overview/chart.vue b/nezha-fronted/src/components/page/dashboard/overview/chart.vue index 30b176dc5..d01ee6e3e 100644 --- a/nezha-fronted/src/components/page/dashboard/overview/chart.vue +++ b/nezha-fronted/src/components/page/dashboard/overview/chart.vue @@ -30,6 +30,7 @@ 'loading':loading, }, props:{ + name: {type: String}, chartTitle:{type:String}, showToolbox:{type:Boolean,default:true}, chartType:{type:String,default:'line'}, @@ -41,7 +42,7 @@ return { chart:null, option:{}, - chartId:new uuidv1()+'-'+new Date().getTime(), + chartId: this.name + new uuidv1()+'-'+new Date().getTime(), legend:[], } }, @@ -64,9 +65,9 @@ }, setSeries:function(series){ if(!this.chart){ - this.chart=echarts.init(document.getElementById(this.chartId)); + this.chart = echarts.init(document.getElementById(this.chartId)); } - this.series=series; + this.series = series; if(this.chartType == 'map'){ if(this.map){ echarts.registerMap(this.map.name,this.map.geoJson); @@ -85,7 +86,7 @@ if (this.tooltipFormatter) { this.modifyOption('tooltip', 'formatter', this.tooltipFormatter) } else { - this.modifyOption('tooltip', 'formatter', this.defaultTooltipFormatter) + //this.modifyOption('tooltip', 'formatter', this.defaultTooltipFormatter) } if(this.chartType == 'line'){ diff --git a/nezha-fronted/src/components/page/dashboard/overview/chartConfig.vue b/nezha-fronted/src/components/page/dashboard/overview/chartConfig.vue index 08dfbb15b..967a3338c 100644 --- a/nezha-fronted/src/components/page/dashboard/overview/chartConfig.vue +++ b/nezha-fronted/src/components/page/dashboard/overview/chartConfig.vue @@ -90,7 +90,7 @@ }, useUTC: false,//使用本地时间 series: [], - } + }; const mapOptions={ geo:{ map:'', @@ -133,11 +133,44 @@ borderWidth: 1, padding: 0, }, - } + }; + const assetTypePie = { + title: { + show: false, + }, + color: bgColorList, + legend: { + show: false, + }, + grid: {}, + series: [], + tooltip : {} + }; + const alertMessageBar = { + title: { + show: false, + }, + color: bgColorList, + legend: { + show: false, + }, + grid: {}, + series: [], + tooltip : {}, + xAxis: { + type: 'value' + }, + yAxis: { + type: 'category', + data: [] + }, + }; const chartTypes={ line:{name:'line',option:commonOption}, map:{name:'map',option:mapOptions}, - } + pie: {name: 'assetType', option: assetTypePie}, + bar: {name: 'alertMessage', option: alertMessageBar} + }; export default { getOption:function(type){ return Object.assign({},chartTypes[type].option); diff --git a/nezha-fronted/src/components/page/dashboard/overview/overview2.scss b/nezha-fronted/src/components/page/dashboard/overview/overview2.scss index 404a4f748..e4fc06c23 100644 --- a/nezha-fronted/src/components/page/dashboard/overview/overview2.scss +++ b/nezha-fronted/src/components/page/dashboard/overview/overview2.scss @@ -72,6 +72,9 @@ .overview-content .content-row-box:nth-of-type(3) { height: 39%; } +.overview-content .content-row-box:nth-of-type(2) .content-col-box { + width: calc(50% - 10px); +} .content-row-box .content-col-box{ margin: 5px; display: inline-block; @@ -79,21 +82,58 @@ flex: 1; } .content-col-title { - height: 25px; - line-height: 25px; + height: 1.6rem; + line-height: 1.6rem; border-bottom: 1px solid #f2f2f2; color: #333; - font-size: 16px; + font-size: 1rem; padding-left: 8px; } +.dropdown-btn { + position: relative; +} +.dropdown-btn .el-popper { + top: 20px; + left: unset; + right: 0; +} +.dropdown-btn .el-popper::after { + content: ''; + display: block; + width:0; + height:0; + overflow: hidden; + font-size: 0; + line-height: 0; + border: 5px; + border-style: dashed dashed solid dashed; + border-color: transparent transparent #fff transparent; + position: absolute; + left: 50%; + bottom: 0; + transform: translate(-50%, -54px); +} .content-col-content { display: flex; align-items: center; - height: calc(100% - 26px); + height: calc(100% - 1.6rem); justify-content: center; + padding: 0 8px; +} +.content-row-box:nth-of-type(2) .content-col-content:last-of-type { + padding: 0; +} +.content-row-box:first-of-type .content-col-content:last-of-type { + position: relative; +} +.content-row-box:first-of-type .content-col-content:last-of-type span { + position: absolute; + bottom: 5%; + right: 5%; + font-size: 0.9rem; } .content-col-content-num { - font-size: 40px; + font-size: 2.5rem; color: #333; } diff --git a/nezha-fronted/src/components/page/dashboard/overview/overview2.vue b/nezha-fronted/src/components/page/dashboard/overview/overview2.vue index 86b0aaeec..cfc9b4422 100644 --- a/nezha-fronted/src/components/page/dashboard/overview/overview2.vue +++ b/nezha-fronted/src/components/page/dashboard/overview/overview2.vue @@ -29,58 +29,86 @@