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/quality-chart.vue | 67 +++++++++++++++++++++++++++++++++
1 files changed, 67 insertions(+), 0 deletions(-)
diff --git a/src/views/management-cockpit/modules/quality-chart.vue b/src/views/management-cockpit/modules/quality-chart.vue
new file mode 100644
index 0000000..38cc0e5
--- /dev/null
+++ b/src/views/management-cockpit/modules/quality-chart.vue
@@ -0,0 +1,67 @@
+<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 { getManagementCockpitQuality } from '#/api/mes/management-cockpit';
+
+import { getPieChartOptions, getQualityIndicatorChartOptions } from '../chart-options';
+
+defineOptions({ name: 'ManagementCockpitQualityChart' });
+
+const loading = ref(false);
+const resultChartRef = ref<EchartsUIType>();
+const indicatorChartRef = ref<EchartsUIType>();
+const { renderEcharts: renderResult } = useEcharts(resultChartRef);
+const { renderEcharts: renderIndicator } = useEcharts(indicatorChartRef);
+
+/** 鍔犺浇璐ㄦ缁熻骞舵覆鏌� */
+async function loadData() {
+ loading.value = true;
+ try {
+ const data = await getManagementCockpitQuality();
+ // 1. 妫�楠岀粨鏋滃垎甯冪幆褰㈠浘
+ const pieData = (data.resultDistribution || []).map((item) => ({
+ name: item.name,
+ value: item.count,
+ }));
+ await renderResult(getPieChartOptions(pieData));
+ // 2. 鍥涢」鎸囨爣鍧囧�� + 鍚堟牸鐜囨煴鐘跺浘
+ const indicators = data.indicatorList || [];
+ await renderIndicator(
+ getQualityIndicatorChartOptions(
+ indicators.map((i) => i.indicatorName || i.indicatorCode),
+ indicators.map((i) => Number(i.averageValue ?? 0)),
+ indicators.map((i) => Number(i.passRate ?? 0)),
+ ),
+ );
+ } finally {
+ loading.value = false;
+ }
+}
+
+onMounted(() => {
+ loadData();
+});
+</script>
+
+<template>
+ <Card title="璐ㄦ缁村害缁熻" class="h-full">
+ <Spin :spinning="loading">
+ <Row :gutter="16">
+ <Col :lg="10" :md="24" :sm="24" :xs="24">
+ <div class="mb-1 text-sm text-gray-500">妫�楠岀粨鏋滃垎甯�</div>
+ <EchartsUI ref="resultChartRef" class="h-[280px] w-full" />
+ </Col>
+ <Col :lg="14" :md="24" :sm="24" :xs="24">
+ <div class="mb-1 text-sm text-gray-500">鍥涢」鎸囨爣鍧囧�间笌鍚堟牸鐜�</div>
+ <EchartsUI ref="indicatorChartRef" class="h-[280px] w-full" />
+ </Col>
+ </Row>
+ </Spin>
+ </Card>
+</template>
--
Gitblit v1.9.3