refactor platform admin from backend contract
This commit is contained in:
41
frontend/platform_admin/src/views/dashboard/ReportPage.vue
Normal file
41
frontend/platform_admin/src/views/dashboard/ReportPage.vue
Normal file
@@ -0,0 +1,41 @@
|
||||
<template>
|
||||
<a-space direction="vertical" fill :size="16">
|
||||
<a-alert>统计报表仅展示后端当前提供的真实汇总数据。</a-alert>
|
||||
<a-card title="平台资源统计" :bordered="false">
|
||||
<a-spin :loading="loading" style="width: 100%">
|
||||
<a-grid :cols="{ xs: 1, sm: 2, md: 3, lg: 4 }" :col-gap="16" :row-gap="16">
|
||||
<a-grid-item v-for="[key, value] in metrics" :key="key">
|
||||
<a-statistic :title="labels[key] ?? key" :value="value" show-group-separator />
|
||||
</a-grid-item>
|
||||
</a-grid>
|
||||
</a-spin>
|
||||
</a-card>
|
||||
</a-space>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { platformApi } from '@/api/platform';
|
||||
|
||||
const loading = ref(false);
|
||||
const overview = ref<Record<string, number>>({});
|
||||
const labels: Record<string, string> = {
|
||||
gas_basic_count: '气站数量',
|
||||
delivery_basic_count: '配送站数量',
|
||||
staff_account_count: '工作人员数量',
|
||||
user_account_count: '用户数量',
|
||||
};
|
||||
const metrics = computed(() => Object.entries(overview.value));
|
||||
|
||||
onMounted(async () => {
|
||||
loading.value = true;
|
||||
try {
|
||||
overview.value = await platformApi.overview();
|
||||
} catch (error) {
|
||||
Message.error((error as Error).message);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user