From 1c7b0c4e02f351064b9c68ec8f6e85d7665f66ab Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期四, 27 八月 2026 11:22:52 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_pro2.0' into dev_pro2.0

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

diff --git a/src/views/mes/pro/task/data.ts b/src/views/mes/pro/task/data.ts
index c5fec1a..7dae255 100644
--- a/src/views/mes/pro/task/data.ts
+++ b/src/views/mes/pro/task/data.ts
@@ -1,5 +1,9 @@
-锘縤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 { getSimpleUserListByRoleCode } from '#/api/system/user';
+import { getTemplatePage } from '#/api/mes/pro/processdesign/template';
+import { getUserListByWorkstationId } from '#/api/mes/md/workstation/worker';
 import type { MesProTaskApi } from '#/api/mes/pro/task';
 import type { MesProWorkOrderApi } from '#/api/mes/pro/workorder';
 
@@ -161,6 +165,12 @@
       field: 'quantityProduced',
       title: '宸茬敓浜ф暟閲�',
       width: 100,
+    },
+    {
+      field: 'progressPercent',
+      title: '瀹屾垚杩涘害',
+      width: 150,
+      slots: { default: 'progressPercent' },
     },
     {
       field: 'clientCode',
@@ -345,6 +355,12 @@
       width: 120,
     },
     {
+      field: 'paramTemplateId',
+      title: '宸ヨ壓鍙傛暟妯℃澘',
+      minWidth: 140,
+      formatter: ({ cellValue }) => cellValue ? `妯℃澘 #${cellValue}` : '鏈厤缃�',
+    },
+    {
       field: 'quantity',
       title: '鎺掍骇鏁伴噺',
       width: 100,
@@ -393,6 +409,19 @@
 /** 鐢熶骇浠诲姟鏂板/淇敼鐨勮〃鍗� */
 export function useTaskFormSchema(formApi?: VbenFormApi, workOrderQuantity?: Ref<number | undefined>): VbenFormSchema[] {
   return [
+    {
+      fieldName: 'paramTemplateId',
+      label: '宸ヨ壓鍙傛暟妯℃澘',
+      component: 'ApiSelect',
+      componentProps: {
+        api: () => getTemplatePage({ pageNo: 1, pageSize: 100 }),
+        labelField: 'templateName',
+        valueField: 'id',
+        resultField: 'list',
+        allowClear: true,
+        placeholder: '璇烽�夋嫨宸ヨ壓鍙傛暟妯℃澘',
+      },
+    },
     {
       fieldName: 'workstationId',
       label: '宸ヤ綔绔�',
@@ -468,6 +497,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 +534,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