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/chart-options.ts | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 113 insertions(+), 0 deletions(-)
diff --git a/src/views/management-cockpit/chart-options.ts b/src/views/management-cockpit/chart-options.ts
new file mode 100644
index 0000000..cb61b2a
--- /dev/null
+++ b/src/views/management-cockpit/chart-options.ts
@@ -0,0 +1,113 @@
+import type { EChartsOption } from '@vben/plugins/echarts';
+
+/** 鐢熶骇瓒嬪娍鍥鹃厤缃紙澶氱郴鍒楁煴鐘�/鎶樼嚎锛� */
+export function getProductionTrendChartOptions(
+ dates: string[],
+ batchCounts: number[],
+ bagCodeCounts: number[],
+ palletCounts: number[],
+ inboundCounts: number[],
+): EChartsOption {
+ return {
+ color: ['#409EFF', '#36cfc9', '#f59e0b', '#67c23a'],
+ grid: { bottom: 40, left: 50, right: 30, top: 30 },
+ legend: { bottom: 0, type: 'scroll' },
+ series: [
+ { barMaxWidth: 24, data: batchCounts, name: '鏂板鎵规', type: 'bar' },
+ { barMaxWidth: 24, data: bagCodeCounts, name: '鏂板琚嬬爜', type: 'bar' },
+ { barMaxWidth: 24, data: palletCounts, name: '鏂板鎵樼洏', type: 'bar' },
+ { data: inboundCounts, name: '鍏ュ簱琚嬫暟', smooth: true, type: 'line' },
+ ],
+ tooltip: { trigger: 'axis' },
+ xAxis: { axisTick: { show: false }, data: dates, type: 'category' },
+ yAxis: { minInterval: 1, type: 'value' },
+ };
+}
+
+/** 閫氱敤楗煎浘/鐜舰鍥鹃厤缃� */
+export function getPieChartOptions(
+ data: Array<{ name: string; value: number }>,
+): EChartsOption {
+ return {
+ legend: { bottom: 0, type: 'scroll' },
+ series: [
+ {
+ avoidLabelOverlap: true,
+ data,
+ emphasis: { label: { fontSize: 14, fontWeight: 'bold', show: true } },
+ itemStyle: { borderColor: '#fff', borderRadius: 6, borderWidth: 2 },
+ label: { formatter: '{b}\n{c}', show: true },
+ radius: ['40%', '70%'],
+ type: 'pie',
+ },
+ ],
+ tooltip: { formatter: '{b}: {c} ({d}%)', trigger: 'item' },
+ };
+}
+
+/** 閫氱敤鏌辩姸鍥鹃厤缃� */
+export function getBarChartOptions(
+ categories: string[],
+ values: number[],
+ name: string,
+ color = '#409EFF',
+): EChartsOption {
+ return {
+ grid: { bottom: 50, left: 60, right: 20, top: 30 },
+ series: [
+ {
+ barMaxWidth: 36,
+ data: values,
+ itemStyle: { borderRadius: 4, color },
+ name,
+ type: 'bar',
+ },
+ ],
+ tooltip: { axisPointer: { type: 'shadow' }, trigger: 'axis' },
+ xAxis: {
+ axisLabel: { interval: 0, rotate: categories.length > 6 ? 30 : 0 },
+ axisTick: { show: false },
+ data: categories,
+ type: 'category',
+ },
+ yAxis: { minInterval: 1, type: 'value' },
+ };
+}
+
+/** 閫氱敤鎶樼嚎鍥鹃厤缃� */
+export function getLineChartOptions(
+ dates: string[],
+ values: number[],
+ name: string,
+ color = '#36cfc9',
+): EChartsOption {
+ return {
+ grid: { bottom: 40, left: 60, right: 20, top: 30 },
+ series: [
+ { areaStyle: { opacity: 0.12 }, data: values, itemStyle: { color }, name, smooth: true, type: 'line' },
+ ],
+ tooltip: { trigger: 'axis' },
+ xAxis: { axisTick: { show: false }, data: dates, type: 'category' },
+ yAxis: { minInterval: 1, type: 'value' },
+ };
+}
+
+/** 璐ㄦ鎸囨爣鍧囧�� + 鍚堟牸鐜囧弻绯诲垪鏌辩姸鍥鹃厤缃� */
+export function getQualityIndicatorChartOptions(
+ labels: string[],
+ avgValues: number[],
+ passRates: number[],
+): EChartsOption {
+ return {
+ color: ['#409EFF', '#67c23a'],
+ grid: { bottom: 40, left: 60, right: 60, top: 30 },
+ legend: { bottom: 0, data: ['骞冲潎鍊�', '鍚堟牸鐜�(%)'] },
+ series: [
+ { barMaxWidth: 30, data: avgValues, name: '骞冲潎鍊�', type: 'bar' },
+ { barMaxWidth: 30, data: passRates, name: '鍚堟牸鐜�(%)', type: 'bar' },
+ ],
+ tooltip: { trigger: 'axis' },
+ xAxis: { axisTick: { show: false }, data: labels, type: 'category' },
+ yAxis: [{ minInterval: 1, type: 'value' }],
+ };
+}
--
Gitblit v1.9.3