From 749cb2f4ad815c5a68c19fe961d5ca2149a84dd4 Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期四, 17 九月 2026 11:28:54 +0800
Subject: [PATCH] feat(mes): 新增员工排班明细页面,修复计划排程菜单404

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

diff --git a/src/views/mes/pro/task/data.ts b/src/views/mes/pro/task/data.ts
index c5fec1a..50b2ca0 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';
 
@@ -17,6 +19,7 @@
 import { getRangePickerDefaultProps } from '#/utils';
 import { MdItemSelect } from '#/views/mes/md/item/components';
 import { MdWorkstationSelect } from '#/views/mes/md/workstation/components';
+import { CalTeamSelect } from '#/views/mes/cal/team/components';
 import { ProProcessSelect } from '#/views/mes/process-design/process/components';
 import { RouteColorPicker } from '#/views/mes/process-design/route/components';
 import { ProWorkOrderSelect } from '#/views/mes/pro/workorder/components';
@@ -345,6 +348,11 @@
       width: 120,
     },
     {
+      field: 'teamName',
+      title: '鐝粍',
+      width: 120,
+    },
+    {
       field: 'quantity',
       title: '鎺掍骇鏁伴噺',
       width: 100,
@@ -402,6 +410,14 @@
         onChange: () => recalcDuration(formApi),
       },
       rules: 'selectRequired',
+    },
+    {
+      fieldName: 'teamId',
+      label: '鐝粍',
+      component: markRaw(CalTeamSelect),
+      componentProps: {
+        placeholder: '璇烽�夋嫨鐝粍',
+      },
     },
     {
       fieldName: 'quantity',
@@ -468,6 +484,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',
@@ -484,6 +521,21 @@
 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