From 600fe725775e28af1f86f7f7f1e2521f494252b1 Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期二, 01 九月 2026 15:27:26 +0800
Subject: [PATCH] feat(mes): 新增管理驾驶舱页面
---
src/views/management-cockpit/modules/outbound-chart.vue | 77 ++++++++++++++++++++++++++++++++++++++
1 files changed, 77 insertions(+), 0 deletions(-)
diff --git a/src/views/management-cockpit/modules/outbound-chart.vue b/src/views/management-cockpit/modules/outbound-chart.vue
new file mode 100644
index 0000000..7be7864
--- /dev/null
+++ b/src/views/management-cockpit/modules/outbound-chart.vue
@@ -0,0 +1,77 @@
+<script lang="ts" setup>
+import type { EchartsUIType } from '@vben/plugins/echarts';
+
+import { onMounted, ref } from 'vue';
+
+import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
+
+import { Card, Col, RadioButton, RadioGroup, Row, Spin } from 'ant-design-vue';
+
+import { getManagementCockpitOutbound } from '#/api/mes/management-cockpit';
+
+import { getLineChartOptions, getPieChartOptions } from '../chart-options';
+
+defineOptions({ name: 'ManagementCockpitOutboundChart' });
+
+const trendDays = ref(30);
+const loading = ref(false);
+const trendRef = ref<EchartsUIType>();
+const dealerRef = ref<EchartsUIType>();
+const { renderEcharts: renderTrend } = useEcharts(trendRef);
+const { renderEcharts: renderDealer } = useEcharts(dealerRef);
+
+/** 鍔犺浇鍑哄簱缁熻骞舵覆鏌� */
+async function loadData() {
+ loading.value = true;
+ try {
+ const data = await getManagementCockpitOutbound(trendDays.value);
+ const trend = data.trend || [];
+ const dealers = data.dealerDistribution || [];
+ await renderTrend(
+ getLineChartOptions(
+ trend.map((d) => d.date.slice(5)),
+ trend.map((d) => Number(d.count ?? 0)),
+ '鍑哄簱鏁伴噺',
+ ),
+ );
+ await renderDealer(
+ getPieChartOptions(dealers.map((d) => ({ name: d.name, value: d.count }))),
+ );
+ } finally {
+ loading.value = false;
+ }
+}
+
+/** 鍒囨崲澶╂暟鑼冨洿 */
+function handleDaysChange() {
+ loadData();
+}
+
+onMounted(() => {
+ loadData();
+});
+</script>
+
+<template>
+ <Card title="鍑哄簱缁村害缁熻" class="h-full">
+ <template #extra>
+ <RadioGroup v-model:value="trendDays" size="small" @change="handleDaysChange">
+ <RadioButton :value="7">杩� 7 澶�</RadioButton>
+ <RadioButton :value="30">杩� 30 澶�</RadioButton>
+ <RadioButton :value="90">杩� 90 澶�</RadioButton>
+ </RadioGroup>
+ </template>
+ <Spin :spinning="loading">
+ <Row :gutter="16">
+ <Col :lg="15" :md="24" :sm="24" :xs="24">
+ <div class="mb-1 text-sm text-gray-500">鍑哄簱瓒嬪娍</div>
+ <EchartsUI ref="trendRef" class="h-[280px] w-full" />
+ </Col>
+ <Col :lg="9" :md="24" :sm="24" :xs="24">
+ <div class="mb-1 text-sm text-gray-500">缁忛攢鍟嗗嚭搴撳崰姣旓紙TOP 20锛�</div>
+ <EchartsUI ref="dealerRef" class="h-[280px] w-full" />
+ </Col>
+ </Row>
+ </Spin>
+ </Card>
+</template>
--
Gitblit v1.9.3