From b78b29398a080a57808b9b51f727bfcbc8f03b76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=8A=B2=E6=9D=BE?= Date: Wed, 21 Oct 2020 16:29:44 +0800 Subject: [PATCH] =?UTF-8?q?NEZ-421=20perf:=20overview=E5=9C=B0=E5=9B=BE?= =?UTF-8?q?=E6=82=AC=E6=B5=AE=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../page/dashboard/overview/chartConfig.vue | 40 ++- .../page/dashboard/overview/overview2.scss | 181 ++++++++++ .../page/dashboard/overview/overview2.vue | 315 +++++++----------- 3 files changed, 334 insertions(+), 202 deletions(-) diff --git a/nezha-fronted/src/components/page/dashboard/overview/chartConfig.vue b/nezha-fronted/src/components/page/dashboard/overview/chartConfig.vue index 9c110ee89..151697b60 100644 --- a/nezha-fronted/src/components/page/dashboard/overview/chartConfig.vue +++ b/nezha-fronted/src/components/page/dashboard/overview/chartConfig.vue @@ -442,6 +442,43 @@ }, series: null, }; + const tooltipPieOption = { + color: ["#60C6B4", "#EEA694"], + title: { + show: true, + textStyle: { + color: "#333333", + fontSize: 14, + }, + top: 8, + left: 8 + }, + legend: { + data: [], + show: true, + left: 70, + top: 44, + icon: "circle", + itemHeight: 4, + orient: "vertical", + itemGap: 6, + textStyle: { + fontSize: 12, + padding: [0, 0, 0, -10] + }, + }, + series: [ + { + type: "pie", + center: [40, 63], + radius: [14, 22], + data: [], + label: { + show: false + } + } + ] + }; function createTempTimes(){ let times=[]; for(let i=0;i<10;i++){ @@ -460,10 +497,11 @@ ruleBar: {name: 'ruleMessage', option: alertMessageBarByRule}, assetBar: {name: 'assetMessage', option: alertMessageBarByAsset}, noData:{name:'noData',option:noDataOption}, + tooltipPie: {option: tooltipPieOption}, }; export default { getOption:function(type){ - return Object.assign({},chartTypes[type].option); + return JSON.parse(JSON.stringify(chartTypes[type].option)); }, setMap:function(map){ mapOptions.geo.map=map diff --git a/nezha-fronted/src/components/page/dashboard/overview/overview2.scss b/nezha-fronted/src/components/page/dashboard/overview/overview2.scss index e7ee564ac..b220a4114 100644 --- a/nezha-fronted/src/components/page/dashboard/overview/overview2.scss +++ b/nezha-fronted/src/components/page/dashboard/overview/overview2.scss @@ -366,3 +366,184 @@ top: -5px; left: 0px; } + +.tooltip{ + opacity: 0.99; + background: rgba(255,255,255,0.94); + border-radius: 2px; + padding: 10px 20px; + box-sizing: border-box; + width: 390px; + height: 285px; +} +.tooltip--title { + color: #333333; + font-size: 14px; + font-weight: 600; + padding-bottom: 10px; +} +.tooltip--row { + display: flex; + justify-content: space-between; + margin-bottom: 10px; + position: relative; + + .legend-value { + font-size: 12px; + color: #333333; + position: absolute; + left: 132px; + top: 45px; + } + .legend-value + .legend-value { + left: 310px; + } + + .tooltip-asset { + width: 240px; + height: 124px; + border: 1px solid #DEDEDE; + border-radius: 2px; + + .tooltip-asset--title { + padding: 0 10px; + height: 24px; + line-height: 24px; + font-size: 14px; + color: #333333; + display: flex; + justify-content: space-between; + border-bottom: 1px solid #DEDEDE; + box-sizing: border-box; + } + .tooltip-asset--title span:first-of-type { + font-weight: 600; + } + + .tooltip-asset--row { + display: flex; + height: 50px; + box-sizing: border-box; + border-bottom: 1px solid #DEDEDE; + } + .tooltip-asset--row + .tooltip-asset--row { + border-bottom: none; + } + .tooltip-asset--row>div { + line-height: 25px; + } + .tooltip-asset--row>div:first-of-type { + width: 70px; + padding-left: 10px; + line-height: 50px; + font-size: 14px; + border-right: 1px solid #DEDEDE; + color: #333333; + box-sizing: border-box; + } + .tooltip-asset--sub-row { + padding-left: 10px; + font-size: 13px; + color: #333333; + line-height: 25px; + display: flex; + + .sub-row--label { + width: 94px; + } + .sub-row--value { + position: relative; + + .sign { + position: absolute; + height: 5px; + width: 5px; + border-radius: 50%; + top: 50%; + transform: translateY(-50%); + left: 0; + } + .red-sign { + background-color: $danger-color; + } + .green-sign { + background-color: $success-color; + } + + span { + position: absolute; + left: 11px; + } + } + } + } + .tooltip-alert { + width: 96px; + height: 125px; + box-shadow: 1px 2px 4px 0 rgba(0,0,0,0.12), -1px 1px 4px -1px rgba(205,205,205,0.47); + + .tooltip-alert--title { + height: 36px; + line-height: 36px; + font-size: 14px; + padding: 0 10px; + } + .tooltip-alert--title span:first-of-type { + font-weight: 600; + } + .tooltip-alert--title span:last-of-type { + padding-left: 10px; + } + .tooltip-alert--row { + padding: 0 10px; + margin-bottom: 10px; + height: 20px; + font-size: 12px; + display: flex; + + .row--label { + width: 36px; + border-radius: 4px 0 0 4px; + color: white; + text-align: center; + } + .row--label__p1 { + background-color: #F2866E; + border-color: #F2866E; + } + .row--label__p2 { + background-color: #F89984; + border-color: #F89984; + } + .row--label__p3 { + background-color: #F7BA78; + border-color: #F7BA78; + } + .row--value { + width: 40px; + border: 1px solid; + border-radius: 0 4px 4px 0; + text-align: center; + } + .row--value__p1 { + color: #F2866E; + border-color: #F2866E; + } + .row--value__p2 { + color: #F89984; + border-color: #F89984; + } + .row--value__p3 { + color: #F7BA78; + border-color: #F7BA78; + } + } + } + + .tooltip-chart { + width: calc(50% - 7px); + height: 100px; + box-shadow: 1px 2px 4px 0 rgba(0,0,0,0.12), -1px 1px 4px -1px rgba(205,205,205,0.47); + } +} + diff --git a/nezha-fronted/src/components/page/dashboard/overview/overview2.vue b/nezha-fronted/src/components/page/dashboard/overview/overview2.vue index c831b4f69..55bfcdb0f 100644 --- a/nezha-fronted/src/components/page/dashboard/overview/overview2.vue +++ b/nezha-fronted/src/components/page/dashboard/overview/overview2.vue @@ -115,6 +115,8 @@
+ +