From 4ed5c7900326e98d3c517c694d4b6bbb0566f43e Mon Sep 17 00:00:00 2001 From: DongZeLiang <2746733890@qq.com> Date: Sat, 13 Apr 2024 12:01:54 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/icons/svg/carAlt.svg | 1 + src/router/index.js | 5 + src/views/statistics/client-detail/index.vue | 8 + src/views/statistics/node-list/index.vue | 28 +++ .../overview/dashboard/BarChart.vue | 103 ++++++++++ .../overview/dashboard/LineChart.vue | 136 +++++++++++++ .../overview/dashboard/PanelGroup.vue | 189 ++++++++++++++++++ .../overview/dashboard/PieChart.vue | 80 ++++++++ .../overview/dashboard/RaddarChart.vue | 117 +++++++++++ .../overview/dashboard/mixins/resize.js | 56 ++++++ src/views/statistics/overview/index.vue | 99 ++++++++- 11 files changed, 814 insertions(+), 8 deletions(-) create mode 100644 src/assets/icons/svg/carAlt.svg create mode 100644 src/views/statistics/node-list/index.vue create mode 100644 src/views/statistics/overview/dashboard/BarChart.vue create mode 100644 src/views/statistics/overview/dashboard/LineChart.vue create mode 100644 src/views/statistics/overview/dashboard/PanelGroup.vue create mode 100644 src/views/statistics/overview/dashboard/PieChart.vue create mode 100644 src/views/statistics/overview/dashboard/RaddarChart.vue create mode 100644 src/views/statistics/overview/dashboard/mixins/resize.js diff --git a/src/assets/icons/svg/carAlt.svg b/src/assets/icons/svg/carAlt.svg new file mode 100644 index 0000000..c406ccd --- /dev/null +++ b/src/assets/icons/svg/carAlt.svg @@ -0,0 +1 @@ + Car \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js index 2d1669b..9dddc3d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -50,6 +50,11 @@ export const constantRoutes = [ component: () => import('@/views/statistics/overview'), hidden: true }, + { + path: '/node/list', + component: () => import('@/views/statistics/node-list'), + hidden: true + }, { path: '/client/detail', component: () => import('@/views/statistics/client-detail'), diff --git a/src/views/statistics/client-detail/index.vue b/src/views/statistics/client-detail/index.vue index 6c32578..ecc3938 100644 --- a/src/views/statistics/client-detail/index.vue +++ b/src/views/statistics/client-detail/index.vue @@ -1,5 +1,13 @@ diff --git a/src/views/statistics/node-list/index.vue b/src/views/statistics/node-list/index.vue new file mode 100644 index 0000000..cd0cb0a --- /dev/null +++ b/src/views/statistics/node-list/index.vue @@ -0,0 +1,28 @@ + + + + + diff --git a/src/views/statistics/overview/dashboard/BarChart.vue b/src/views/statistics/overview/dashboard/BarChart.vue new file mode 100644 index 0000000..e175369 --- /dev/null +++ b/src/views/statistics/overview/dashboard/BarChart.vue @@ -0,0 +1,103 @@ + + + diff --git a/src/views/statistics/overview/dashboard/LineChart.vue b/src/views/statistics/overview/dashboard/LineChart.vue new file mode 100644 index 0000000..ca6ccfd --- /dev/null +++ b/src/views/statistics/overview/dashboard/LineChart.vue @@ -0,0 +1,136 @@ + + + diff --git a/src/views/statistics/overview/dashboard/PanelGroup.vue b/src/views/statistics/overview/dashboard/PanelGroup.vue new file mode 100644 index 0000000..65de91f --- /dev/null +++ b/src/views/statistics/overview/dashboard/PanelGroup.vue @@ -0,0 +1,189 @@ + + + + + diff --git a/src/views/statistics/overview/dashboard/PieChart.vue b/src/views/statistics/overview/dashboard/PieChart.vue new file mode 100644 index 0000000..3ba4411 --- /dev/null +++ b/src/views/statistics/overview/dashboard/PieChart.vue @@ -0,0 +1,80 @@ + + + diff --git a/src/views/statistics/overview/dashboard/RaddarChart.vue b/src/views/statistics/overview/dashboard/RaddarChart.vue new file mode 100644 index 0000000..2a5e27d --- /dev/null +++ b/src/views/statistics/overview/dashboard/RaddarChart.vue @@ -0,0 +1,117 @@ + + + diff --git a/src/views/statistics/overview/dashboard/mixins/resize.js b/src/views/statistics/overview/dashboard/mixins/resize.js new file mode 100644 index 0000000..d0410ec --- /dev/null +++ b/src/views/statistics/overview/dashboard/mixins/resize.js @@ -0,0 +1,56 @@ +import {debounce} from '@/utils' + +export default { + data() { + return { + $_sidebarElm: null, + $_resizeHandler: null + } + }, + mounted() { + this.initListener() + }, + activated() { + if (!this.$_resizeHandler) { + // avoid duplication init + this.initListener() + } + + // when keep-alive chart activated, auto resize + this.resize() + }, + beforeDestroy() { + this.destroyListener() + }, + deactivated() { + this.destroyListener() + }, + methods: { + // use $_ for mixins properties + // https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential + $_sidebarResizeHandler(e) { + if (e.propertyName === 'width') { + this.$_resizeHandler() + } + }, + initListener() { + this.$_resizeHandler = debounce(() => { + this.resize() + }, 100) + window.addEventListener('resize', this.$_resizeHandler) + + this.$_sidebarElm = document.getElementsByClassName('sidebar-container')[0] + this.$_sidebarElm && this.$_sidebarElm.addEventListener('transitionend', this.$_sidebarResizeHandler) + }, + destroyListener() { + window.removeEventListener('resize', this.$_resizeHandler) + this.$_resizeHandler = null + + this.$_sidebarElm && this.$_sidebarElm.removeEventListener('transitionend', this.$_sidebarResizeHandler) + }, + resize() { + const {chart} = this + chart && chart.resize() + } + } +} diff --git a/src/views/statistics/overview/index.vue b/src/views/statistics/overview/index.vue index 000eb01..330019d 100644 --- a/src/views/statistics/overview/index.vue +++ b/src/views/statistics/overview/index.vue @@ -1,21 +1,104 @@ -