From b3abd460d8f68b9f501b48aeecaa344ff18c033a Mon Sep 17 00:00:00 2001
From: hsy <1029150275@qq.com>
Date: 星期三, 26 八月 2026 17:05:29 +0800
Subject: [PATCH] feat(mes): 生产任务报工人下拉源调整为工作站人力配置

---
 src/views/mes/pro/task/data.ts |   75 ++++++++++++++++++++++++++++++-------
 1 files changed, 60 insertions(+), 15 deletions(-)

diff --git a/src/views/mes/pro/task/data.ts b/src/views/mes/pro/task/data.ts
index a24e576..0098d65 100644
--- a/src/views/mes/pro/task/data.ts
+++ b/src/views/mes/pro/task/data.ts
@@ -1,5 +1,7 @@
-锘縤mport type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
+import type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
 import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+import { z } from '#/adapter/form';
+import { getUserListByWorkstationId } from '#/api/mes/md/workstation/worker';
 import type { MesProTaskApi } from '#/api/mes/pro/task';
 import type { MesProWorkOrderApi } from '#/api/mes/pro/workorder';
 
@@ -130,15 +132,33 @@
       width: 80,
     },
     {
+      field: 'status',
+      title: '璁㈠崟鐘舵��',
+      width: 100,
+      cellRender: {
+        name: 'CellDict',
+        props: { type: DICT_TYPE.MES_PRO_WORK_ORDER_STATUS },
+      },
+    },
+    {
+      field: 'productionStatus',
+      title: '鐢熶骇鐘舵��',
+      width: 100,
+      cellRender: {
+        name: 'CellDict',
+        props: { type: DICT_TYPE.ORDER_PRODUCTION_STATUS },
+      },
+    },
+    {
       field: 'quantity',
       title: '璁㈠崟鏁伴噺',
       width: 100,
     },
-    {
-      field: 'quantityChanged',
-      title: '璋冩暣鏁伴噺',
-      width: 100,
-    },
+    // {
+    //   field: 'quantityChanged',
+    //   title: '璋冩暣鏁伴噺',
+    //   width: 100,
+    // },
     {
       field: 'quantityProduced',
       title: '宸茬敓浜ф暟閲�',
@@ -160,15 +180,7 @@
       width: 120,
       formatter: 'formatDate',
     },
-    {
-      field: 'status',
-      title: '鎺掍骇鐘舵��',
-      width: 100,
-      cellRender: {
-        name: 'CellDict',
-        props: { type: DICT_TYPE.MES_PRO_WORK_ORDER_STATUS },
-      },
-    },
+
     {
       title: '鎿嶄綔',
       width: 160,
@@ -458,6 +470,27 @@
       },
     },
     {
+      fieldName: 'assigneeUserIds',
+      label: '鎶ュ伐浜�',
+      component: 'ApiSelect',
+      componentProps: {
+        placeholder: '璇烽�夋嫨鎶ュ伐浜�',
+        api: getUserListByWorkstationId,
+        labelField: 'nickname',
+        valueField: 'id',
+        mode: 'multiple',
+      },
+      dependencies: {
+        triggerFields: ['workstationId'],
+        componentProps: (values) => ({
+          params: { workstationId: values.workstationId },
+          disabled: !values.workstationId,
+          placeholder: values.workstationId ? '璇烽�夋嫨鎶ュ伐浜�' : '璇峰厛閫夋嫨宸ヤ綔绔�',
+        }),
+      },
+      rules: z.array(z.number()).min(1, '璇烽�夋嫨鎶ュ伐浜�').default([]),
+    },
+    {
       fieldName: 'remark',
       label: '澶囨敞',
       component: 'Textarea',
@@ -474,6 +507,18 @@
 async function recalcDuration(formApi?: VbenFormApi) {
   if (!formApi) return;
   const values = await formApi.getValues();
+  
+  if (values.workstationId) {
+    try {
+      const users = await getUserListByWorkstationId({ workstationId: values.workstationId });
+      if (!users || users.length === 0) {
+        message.warning('褰撳墠宸ヤ綔绔欐病鏈夐厤缃汉鍔涜祫婧�');
+      }
+    } catch {
+      // ignore
+    }
+  }
+
   if (!values.workstationId || !values.quantity) return;
   try {
     const res = await calculateTaskDuration(values.workstationId, values.quantity);

--
Gitblit v1.9.3