From fdd158306bf6dc3584f5110a385323f4a8dfb463 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期三, 02 九月 2026 14:25:10 +0800
Subject: [PATCH] feat(wms): 重构仓库管理系统并优化图表显示

---
 src/adapter/vxe-table.ts |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/adapter/vxe-table.ts b/src/adapter/vxe-table.ts
index 01f7374..e6412e4 100644
--- a/src/adapter/vxe-table.ts
+++ b/src/adapter/vxe-table.ts
@@ -121,8 +121,9 @@
 
     // 琛ㄦ牸閰嶇疆椤瑰彲浠ョ敤 cellRender: { name: 'CellTag' },
     // props: { data: [{value, color}], labels?: {[value]: label} }
+    // 涔熷吋瀹� options 鏍煎紡: [{ label, value, color }]
     // 鏀寔涓ょ鍖归厤妯″紡:
-    //   1. 绮剧‘鍖归厤: data 鍜� labels 涓兘鏄簿纭�� (鐘舵��/绫诲瀷鏋氫妇)
+    //   1. 绮剧‘鍖归厤: data/labels/options 涓兘鏄簿纭�� (鐘舵��/绫诲瀷鏋氫妇)
     //   2. 闃堝�煎尮閰�: data 涓洪檷搴忛槇鍊�, label 鏄剧ず鍘熷鏁板�� (璇勫垎)
     vxeUI.renderer.add('CellTag', {
       renderTableDefault(renderOpts, params) {
@@ -130,15 +131,25 @@
         const { column, row } = params;
         const rawValue = row[column.field];
 
+        // 鍏煎 options 鏍煎紡锛岀簿纭尮閰嶆樉绀烘枃鏈笌棰滆壊
+        const matchedOption = props?.options?.find(
+          (item: any) =>
+            item.value === rawValue || Number(item.value) === Number(rawValue),
+        );
+
         // 鏌ユ壘鏄剧ず鏂囨湰
         let label = rawValue;
-        if (props?.labels && rawValue !== undefined && rawValue !== null) {
+        if (matchedOption) {
+          label = matchedOption.label;
+        } else if (props?.labels && rawValue !== undefined && rawValue !== null) {
           label = props.labels[rawValue] ?? rawValue;
         }
 
         // 鏌ユ壘棰滆壊: 浼樺厛绮剧‘鍖归厤锛屽惁鍒欓槇鍊煎尮閰�
         let color: string | undefined;
-        if (props?.data) {
+        if (matchedOption) {
+          color = matchedOption.color;
+        } else if (props?.data) {
           const exact = props.data.find(
             (item: any) => item.value === rawValue,
           );

--
Gitblit v1.9.3