From c7762490def77695bedf179ffc63e3e95d15e14d Mon Sep 17 00:00:00 2001 From: Soybean Date: Wed, 1 Jun 2022 00:27:28 +0800 Subject: [PATCH] =?UTF-8?q?feat(projects):=20=E8=A1=A5=E5=85=85=E6=9B=B4?= =?UTF-8?q?=E5=A4=9A=E7=9A=84ECharts=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ISSUES CLOSED: \ --- mock/model/route.ts | 164 +++---- src/composables/echarts.ts | 18 +- src/router/modules/charts.ts | 43 -- src/router/modules/plugin.ts | 41 ++ src/views/plugin/charts/echarts/index.vue | 529 ++++++++++++++++++++-- 5 files changed, 635 insertions(+), 160 deletions(-) delete mode 100644 src/router/modules/charts.ts diff --git a/mock/model/route.ts b/mock/model/route.ts index a2f57a060..bd911cf26 100644 --- a/mock/model/route.ts +++ b/mock/model/route.ts @@ -131,6 +131,47 @@ export const routeModel: Record = { path: '/plugin', component: 'basic', children: [ + { + name: 'plugin_charts', + path: '/plugin/charts', + component: 'multi', + children: [ + { + name: 'plugin_charts_echarts', + path: '/plugin/charts/echarts', + component: 'self', + meta: { + title: 'ECharts', + requiresAuth: true, + icon: 'simple-icons:apacheecharts' + } + }, + { + name: 'plugin_charts_d3', + path: '/plugin/charts/d3', + component: 'self', + meta: { + title: 'D3', + requiresAuth: true, + icon: 'simple-icons:d3dotjs' + } + }, + { + name: 'plugin_charts_antv', + path: '/plugin/charts/antv', + component: 'self', + meta: { + title: 'AntV', + requiresAuth: true, + icon: 'ant-design:bar-chart-outlined' + } + } + ], + meta: { + title: '图表', + icon: 'material-symbols:bar-chart-rounded' + } + }, { name: 'plugin_map', path: '/plugin/map', @@ -221,47 +262,6 @@ export const routeModel: Record = { requiresAuth: true, icon: 'ic:baseline-local-printshop' } - }, - { - name: 'plugin_charts', - path: '/plugin/charts', - component: 'multi', - children: [ - { - name: 'plugin_charts_echarts', - path: '/plugin/charts/echarts', - component: 'self', - meta: { - title: 'ECharts', - requiresAuth: true, - icon: 'simple-icons:apacheecharts' - } - }, - { - name: 'plugin_charts_d3', - path: '/plugin/charts/d3', - component: 'self', - meta: { - title: 'D3', - requiresAuth: true, - icon: 'simple-icons:d3dotjs' - } - }, - { - name: 'plugin_charts_antv', - path: '/plugin/charts/antv', - component: 'self', - meta: { - title: 'AntV', - requiresAuth: true, - icon: 'ant-design:bar-chart-outlined' - } - } - ], - meta: { - title: '图表', - icon: 'material-symbols:bar-chart-rounded' - } } ], meta: { @@ -543,6 +543,47 @@ export const routeModel: Record = { path: '/plugin', component: 'basic', children: [ + { + name: 'plugin_charts', + path: '/plugin/charts', + component: 'multi', + children: [ + { + name: 'plugin_charts_echarts', + path: '/plugin/charts/echarts', + component: 'self', + meta: { + title: 'ECharts', + requiresAuth: true, + icon: 'simple-icons:apacheecharts' + } + }, + { + name: 'plugin_charts_d3', + path: '/plugin/charts/d3', + component: 'self', + meta: { + title: 'D3', + requiresAuth: true, + icon: 'simple-icons:d3dotjs' + } + }, + { + name: 'plugin_charts_antv', + path: '/plugin/charts/antv', + component: 'self', + meta: { + title: 'AntV', + requiresAuth: true, + icon: 'ant-design:bar-chart-outlined' + } + } + ], + meta: { + title: '图表', + icon: 'material-symbols:bar-chart-rounded' + } + }, { name: 'plugin_map', path: '/plugin/map', @@ -633,47 +674,6 @@ export const routeModel: Record = { requiresAuth: true, icon: 'ic:baseline-local-printshop' } - }, - { - name: 'plugin_charts', - path: '/plugin/charts', - component: 'multi', - children: [ - { - name: 'plugin_charts_echarts', - path: '/plugin/charts/echarts', - component: 'self', - meta: { - title: 'ECharts', - requiresAuth: true, - icon: 'simple-icons:apacheecharts' - } - }, - { - name: 'plugin_charts_d3', - path: '/plugin/charts/d3', - component: 'self', - meta: { - title: 'D3', - requiresAuth: true, - icon: 'simple-icons:d3dotjs' - } - }, - { - name: 'plugin_charts_antv', - path: '/plugin/charts/antv', - component: 'self', - meta: { - title: 'AntV', - requiresAuth: true, - icon: 'ant-design:bar-chart-outlined' - } - } - ], - meta: { - title: '图表', - icon: 'material-symbols:bar-chart-rounded' - } } ], meta: { diff --git a/src/composables/echarts.ts b/src/composables/echarts.ts index b8d31aa6f..57ff9ca30 100644 --- a/src/composables/echarts.ts +++ b/src/composables/echarts.ts @@ -1,8 +1,16 @@ import { ref, watch, nextTick, onUnmounted } from 'vue'; import type { Ref, ComputedRef } from 'vue'; import * as echarts from 'echarts/core'; -import { BarChart, LineChart, PieChart, ScatterChart } from 'echarts/charts'; -import type { BarSeriesOption, LineSeriesOption, PieSeriesOption, ScatterSeriesOption } from 'echarts/charts'; +import { BarChart, LineChart, PieChart, ScatterChart, PictorialBarChart, RadarChart, GaugeChart } from 'echarts/charts'; +import type { + BarSeriesOption, + LineSeriesOption, + PieSeriesOption, + ScatterSeriesOption, + PictorialBarSeriesOption, + RadarSeriesOption, + GaugeSeriesOption +} from 'echarts/charts'; import { TitleComponent, LegendComponent, @@ -30,6 +38,9 @@ export type ECOption = echarts.ComposeOption< | LineSeriesOption | PieSeriesOption | ScatterSeriesOption + | PictorialBarSeriesOption + | RadarSeriesOption + | GaugeSeriesOption | TitleComponentOption | LegendComponentOption | TooltipComponentOption @@ -50,6 +61,9 @@ echarts.use([ LineChart, PieChart, ScatterChart, + PictorialBarChart, + RadarChart, + GaugeChart, LabelLayout, UniversalTransition, CanvasRenderer diff --git a/src/router/modules/charts.ts b/src/router/modules/charts.ts deleted file mode 100644 index 6f8736653..000000000 --- a/src/router/modules/charts.ts +++ /dev/null @@ -1,43 +0,0 @@ -const charts: AuthRoute.Route = { - name: 'plugin_charts', - path: '/plugin/charts', - component: 'multi', - children: [ - { - name: 'plugin_charts_echarts', - path: '/plugin/charts/echarts', - component: 'self', - meta: { - title: 'ECharts', - requiresAuth: true, - icon: 'simple-icons:apacheecharts' - } - }, - { - name: 'plugin_charts_d3', - path: '/plugin/charts/d3', - component: 'self', - meta: { - title: 'D3', - requiresAuth: true, - icon: 'simple-icons:d3dotjs' - } - }, - { - name: 'plugin_charts_antv', - path: '/plugin/charts/antv', - component: 'self', - meta: { - title: 'AntV', - requiresAuth: true, - icon: 'ant-design:bar-chart-outlined' - } - } - ], - meta: { - title: '图表', - icon: 'material-symbols:bar-chart-rounded' - } -}; - -export default charts; diff --git a/src/router/modules/plugin.ts b/src/router/modules/plugin.ts index 0419d6e05..8ce056454 100644 --- a/src/router/modules/plugin.ts +++ b/src/router/modules/plugin.ts @@ -3,6 +3,47 @@ const plugin: AuthRoute.Route = { path: '/plugin', component: 'basic', children: [ + { + name: 'plugin_charts', + path: '/plugin/charts', + component: 'multi', + children: [ + { + name: 'plugin_charts_echarts', + path: '/plugin/charts/echarts', + component: 'self', + meta: { + title: 'ECharts', + requiresAuth: true, + icon: 'simple-icons:apacheecharts' + } + }, + { + name: 'plugin_charts_d3', + path: '/plugin/charts/d3', + component: 'self', + meta: { + title: 'D3', + requiresAuth: true, + icon: 'simple-icons:d3dotjs' + } + }, + { + name: 'plugin_charts_antv', + path: '/plugin/charts/antv', + component: 'self', + meta: { + title: 'AntV', + requiresAuth: true, + icon: 'ant-design:bar-chart-outlined' + } + } + ], + meta: { + title: '图表', + icon: 'material-symbols:bar-chart-rounded' + } + }, { name: 'plugin_map', path: '/plugin/map', diff --git a/src/views/plugin/charts/echarts/index.vue b/src/views/plugin/charts/echarts/index.vue index f7e908f4f..16ded37a4 100644 --- a/src/views/plugin/charts/echarts/index.vue +++ b/src/views/plugin/charts/echarts/index.vue @@ -10,13 +10,23 @@
-
+
+
+ +
+
+ +
+
+ +