From 9014b2c11d1221f63dc1e3c0b7e3a55587889fe6 Mon Sep 17 00:00:00 2001 From: zhaojisen <1301338853@qq.com> Date: Wed, 8 Jan 2025 14:18:21 +0800 Subject: [PATCH] perf: Add Dashboard Summery --- src/views/dashboard/ChangeSecret/index.vue | 79 +++++++++--- src/views/dashboard/Console/index.vue | 3 +- .../dashboard/Pam/AssetProportionSummary.vue | 29 ++++- src/views/dashboard/Pam/index.vue | 117 +++++++++++++++--- 4 files changed, 185 insertions(+), 43 deletions(-) diff --git a/src/views/dashboard/ChangeSecret/index.vue b/src/views/dashboard/ChangeSecret/index.vue index c27274c2bc..94d9d8170a 100644 --- a/src/views/dashboard/ChangeSecret/index.vue +++ b/src/views/dashboard/ChangeSecret/index.vue @@ -1,6 +1,6 @@ diff --git a/src/views/dashboard/Console/index.vue b/src/views/dashboard/Console/index.vue index 046bf6ff9d..8a46965403 100644 --- a/src/views/dashboard/Console/index.vue +++ b/src/views/dashboard/Console/index.vue @@ -11,7 +11,7 @@ - + @@ -42,6 +42,7 @@ export default { }, data() { return { + url: '/api/v1/index/?total_count_type_to_assets_amount=1' } } } diff --git a/src/views/dashboard/Pam/AssetProportionSummary.vue b/src/views/dashboard/Pam/AssetProportionSummary.vue index fbee35614b..8c1b2d190e 100644 --- a/src/views/dashboard/Pam/AssetProportionSummary.vue +++ b/src/views/dashboard/Pam/AssetProportionSummary.vue @@ -17,10 +17,16 @@ export default { Title, ProgressChart }, + props: { + url: { + type: String, + default: '' + } + }, data() { return { titleConfig: { - title: this.$t('ProportionOfAssetTypes'), + title: '', tip: this.$t('ProportionOfAssetTypes') }, config: { @@ -33,9 +39,24 @@ export default { }, methods: { async getChartData() { - const url = '/api/v1/index/?total_count_type_to_assets_amount=1' - const data = await this.$axios.get(url) - this.$set(this.config, 'data', data.total_count_type_to_assets_amount) + if (!this.url) return + + try { + const data = await this.$axios.get(this.url) + const str = data[this.url.split('?')[1].split('=')[0]] + + if (this.url.includes('accounts')) { + this.titleConfig.title = this.$t('ProportionOfAccontTypes') + this.titleConfig.tip = this.$t('ProportionOfAccountTypes') + } else { + this.titleConfig.title = this.$t('ProportionOfAssetTypes') + this.titleConfig.tip = this.$t('ProportionOfAssetTypes') + } + + this.$set(this.config, 'data', str) + } catch (e) { + this.$message.error(e.message) + } } } } diff --git a/src/views/dashboard/Pam/index.vue b/src/views/dashboard/Pam/index.vue index e2b98ef509..98b5bb3c9f 100644 --- a/src/views/dashboard/Pam/index.vue +++ b/src/views/dashboard/Pam/index.vue @@ -2,33 +2,48 @@
- - - - - - - - - - - - + +
+ + + +
+ +
+
+ + + +
+ + + + + + + + + + + + +