From 9e3911480ea589b73dec7ca944334e742e627f6f Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期四, 06 八月 2026 16:48:37 +0800
Subject: [PATCH] feat(bi): 新增仓库坐标配置功能并优化地图可视化效果
---
src/adapter/vxe-table.ts | 47 +++++++++++++++++++++++++++++++++++++++--------
1 files changed, 39 insertions(+), 8 deletions(-)
diff --git a/src/adapter/vxe-table.ts b/src/adapter/vxe-table.ts
index da062bb..01f7374 100644
--- a/src/adapter/vxe-table.ts
+++ b/src/adapter/vxe-table.ts
@@ -1,19 +1,19 @@
-import type { VxeTableGridOptions } from '..\packages\effects\plugins\src\vxe-table';
-import type { Recordable } from '..\packages\types\src';
+import type { VxeTableGridOptions } from '@vben/plugins/vxe-table';
+import type { Recordable } from '@vben/types';
import type { ComponentPropsMap, ComponentType } from './component';
import { h } from 'vue';
-import { IconifyIcon } from '..\packages\icons\src';
-import { $te } from '..\packages\locales\src';
+import { IconifyIcon } from '@vben/icons';
+import { $te } from '@vben/locales';
import {
AsyncVxeColumn,
AsyncVxeTable,
createRequiredValidation,
setupVbenVxeTable,
useVbenVxeGrid as useGrid,
-} from '..\packages\effects\plugins\src\vxe-table';
+} from '@vben/plugins/vxe-table';
import {
erpCountInputFormatter,
erpNumberFormatter,
@@ -22,7 +22,7 @@
formatPast2,
isFunction,
isString,
-} from '..\packages\utils\src';
+} from '@vben/utils';
import {
Button,
@@ -120,11 +120,42 @@
});
// 琛ㄦ牸閰嶇疆椤瑰彲浠ョ敤 cellRender: { name: 'CellTag' },
+ // props: { data: [{value, color}], labels?: {[value]: label} }
+ // 鏀寔涓ょ鍖归厤妯″紡:
+ // 1. 绮剧‘鍖归厤: data 鍜� labels 涓兘鏄簿纭�� (鐘舵��/绫诲瀷鏋氫妇)
+ // 2. 闃堝�煎尮閰�: data 涓洪檷搴忛槇鍊�, label 鏄剧ず鍘熷鏁板�� (璇勫垎)
vxeUI.renderer.add('CellTag', {
renderTableDefault(renderOpts, params) {
const { props } = renderOpts;
const { column, row } = params;
- return h(Tag, { color: props?.color }, () => row[column.field]);
+ const rawValue = row[column.field];
+
+ // 鏌ユ壘鏄剧ず鏂囨湰
+ let label = rawValue;
+ if (props?.labels && rawValue !== undefined && rawValue !== null) {
+ label = props.labels[rawValue] ?? rawValue;
+ }
+
+ // 鏌ユ壘棰滆壊: 浼樺厛绮剧‘鍖归厤锛屽惁鍒欓槇鍊煎尮閰�
+ let color: string | undefined;
+ if (props?.data) {
+ const exact = props.data.find(
+ (item: any) => item.value === rawValue,
+ );
+ if (exact) {
+ color = exact.color;
+ } else {
+ const sorted = [...props.data]
+ .filter((item: any) => typeof item.value === 'number')
+ .sort((a: any, b: any) => b.value - a.value);
+ const threshold = sorted.find(
+ (item: any) => Number(rawValue) >= item.value,
+ );
+ if (threshold) color = threshold.color;
+ }
+ }
+
+ return h(Tag, { color }, () => label);
},
});
@@ -374,4 +405,4 @@
...rest: Parameters<typeof useGrid<T, ComponentType, ComponentPropsMap>>
) => useGrid<T, ComponentType, ComponentPropsMap>(...rest);
-export type * from '..\packages\effects\plugins\src\vxe-table';
+export type * from '@vben/plugins/vxe-table';
--
Gitblit v1.9.3