From 14817696a26eb142ccae03fa7c43050840e057f5 Mon Sep 17 00:00:00 2001
From: hsy <1029150275@qq.com>
Date: 星期一, 17 八月 2026 09:35:03 +0800
Subject: [PATCH] feat(mes): 优化生产订单与排产任务列表显示,新增启停工及校验逻辑 1. 生产订单列表展示优化 (WorkOrder)   - 新增「生产状态」列,全局注册 `ORDER_PRODUCTION_STATUS` 常量并绑定系统动态字典。   - 彻底重构「工序生产进度」单元格显示:弃用臃肿的 Steps 组件,改为极简横向布局(彩色状态圆点 + 进度百分比),解决表格行高被强行撑开及内容截断问题,支持横向滚动。   - 优化「完成进度」列宽及展示样式,将百分比数值外置同行显示,更加直观。 2. 排产任务列表改造 (Task)   - 顶部表头重构,由单一标题重构为「全部 / 未完成 / 已完成」的 Tabs 标签页切换结构。   - 重写数据过滤逻辑,剥离写死的 status 查询,改为使用 `scheduleStatus` 字段动态响应 Tabs 切换 (0: 未完成, 1: 已完成)。 3. 工单业务逻辑增强与状态流转   - 落实「工单查询逻辑设计方案」,优化底层的工单条件检索逻辑。   - 实现「添加工单启停功能」与「停工状态」,支持工单在执行过程中的暂停与恢复业务流转。   - 强化容错与防呆设计:操作「完成订单」时增加前置校验 `handleCheckFinish`,若生产状态为未完成,强制弹出二次确认 Modal,避免误操作。 # 相关讨论/参考方案 # - 添加工单启停功能 # - 停工状态功能设计方案 # - 工单查询逻辑设计方案 # - 工单完成进度显示优化

---
 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