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/inventory-chart.vue |   82 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 82 insertions(+), 0 deletions(-)

diff --git a/src/views/management-cockpit/modules/inventory-chart.vue b/src/views/management-cockpit/modules/inventory-chart.vue
new file mode 100644
index 0000000..61647c2
--- /dev/null
+++ b/src/views/management-cockpit/modules/inventory-chart.vue
@@ -0,0 +1,82 @@
+<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, Row, Spin } from 'ant-design-vue';
+
+import { getManagementCockpitInventory } from '#/api/mes/management-cockpit';
+
+import { getBarChartOptions, getPieChartOptions } from '../chart-options';
+
+defineOptions({ name: 'ManagementCockpitInventoryChart' });
+
+const loading = ref(false);
+const warehouseRef = ref<EchartsUIType>();
+const itemRef = ref<EchartsUIType>();
+const stateRef = ref<EchartsUIType>();
+const { renderEcharts: renderWarehouse } = useEcharts(warehouseRef);
+const { renderEcharts: renderItem } = useEcharts(itemRef);
+const { renderEcharts: renderState } = useEcharts(stateRef);
+
+/** 鍔犺浇搴撳瓨缁熻骞舵覆鏌� */
+async function loadData() {
+  loading.value = true;
+  try {
+    const data = await getManagementCockpitInventory();
+    const warehouses = data.warehouseDistribution || [];
+    const items = data.itemDistribution || [];
+    const states = data.stateDistribution || [];
+    await renderWarehouse(
+      getBarChartOptions(
+        warehouses.map((w) => w.name),
+        warehouses.map((w) => w.count),
+        '搴撳瓨鏁伴噺',
+        '#409EFF',
+      ),
+    );
+    await renderItem(
+      getBarChartOptions(
+        items.map((i) => i.name),
+        items.map((i) => i.count),
+        '搴撳瓨鏁伴噺',
+        '#36cfc9',
+      ),
+    );
+    await renderState(
+      getPieChartOptions(
+        states.map((s) => ({ name: s.name, value: s.count })),
+      ),
+    );
+  } finally {
+    loading.value = false;
+  }
+}
+
+onMounted(() => {
+  loadData();
+});
+</script>
+
+<template>
+  <Card title="搴撳瓨缁村害缁熻" class="h-full">
+    <Spin :spinning="loading">
+      <Row :gutter="16">
+        <Col :lg="9" :md="24" :sm="24" :xs="24">
+          <div class="mb-1 text-sm text-gray-500">鎸変粨搴撳垎甯�</div>
+          <EchartsUI ref="warehouseRef" class="h-[280px] w-full" />
+        </Col>
+        <Col :lg="9" :md="24" :sm="24" :xs="24">
+          <div class="mb-1 text-sm text-gray-500">鎸夊搧绉嶅垎甯�</div>
+          <EchartsUI ref="itemRef" class="h-[280px] w-full" />
+        </Col>
+        <Col :lg="6" :md="24" :sm="24" :xs="24">
+          <div class="mb-1 text-sm text-gray-500">鎸夊簱瀛樼姸鎬�</div>
+          <EchartsUI ref="stateRef" class="h-[280px] w-full" />
+        </Col>
+      </Row>
+    </Spin>
+  </Card>
+</template>

--
Gitblit v1.9.3