From b7ffa7395cddfeb10f88d70a81567371f62021c3 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期日, 25 十月 2026 16:30:17 +0800
Subject: [PATCH] feat(router): 排除AI模块页面并添加访问权限控制

---
 src/views/mes/pro/route/data.ts |   77 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 77 insertions(+), 0 deletions(-)

diff --git a/src/views/mes/pro/route/data.ts b/src/views/mes/pro/route/data.ts
index d59d436..71199db 100644
--- a/src/views/mes/pro/route/data.ts
+++ b/src/views/mes/pro/route/data.ts
@@ -18,6 +18,9 @@
 
 import { z } from '#/adapter/form';
 import { generateAutoCode } from '#/api/mes/md/autocode/record';
+import { getWarehouseSimpleList } from '#/api/mes/wm/warehouse';
+import { getWarehouseAreaSimpleList } from '#/api/mes/wm/warehouse/area';
+import { getWarehouseLocationSimpleList } from '#/api/mes/wm/warehouse/location';
 import {
   MdItemSelect,
   MdProductBomSelect,
@@ -180,6 +183,7 @@
 /** 宸ヨ壓璺嚎宸ュ簭鏄庣粏琛ㄥ崟 */
 export function useRouteProcessFormSchema(
   processOptions: Array<{ label: string; value: number }>,
+  productIds: number[] = [],
 ): VbenFormSchema[] {
   return [
     {
@@ -250,6 +254,17 @@
         unCheckedChildren: '鍚�',
       },
       rules: z.boolean().default(false),
+    },
+    {
+      fieldName: 'outputItemIds',
+      label: '浜у嚭浜у搧',
+      component: markRaw(MdItemSelect),
+      componentProps: {
+        multiple: true,
+        productIds,
+        placeholder: '涓棿宸ュ簭閫夊崐鎴愬搧锛屾湯閬撳伐搴忛�夊叏閮ㄦ垚鍝�',
+      },
+      formItemClass: 'col-span-2',
     },
     {
       fieldName: 'prepareTime',
@@ -323,6 +338,7 @@
     },
     { field: 'prepareTime', title: '鍑嗗鏃堕棿(鍒�)', width: 110 },
     { field: 'waitTime', title: '绛夊緟鏃堕棿(鍒�)', width: 110 },
+    { field: 'outputItemNames', title: '浜у嚭浜у搧', minWidth: 180 },
     {
       field: 'colorCode',
       title: '鐢樼壒鍥鹃鑹�',
@@ -347,6 +363,9 @@
     { field: 'specification', title: '瑙勬牸鍨嬪彿', width: 150 },
     { field: 'unitName', title: '鍗曚綅', width: 80 },
     { field: 'quantity', title: '鐢熶骇鏁伴噺', width: 100 },
+    { field: 'warehouseName', title: '鎶ュ伐浠撳簱', width: 130 },
+    { field: 'locationName', title: '搴撳尯', width: 120 },
+    { field: 'areaName', title: '搴撲綅', width: 120 },
     {
       field: 'productionTime',
       title: '鐢熶骇鐢ㄦ椂',
@@ -384,6 +403,7 @@
 /** 宸ヨ壓璺嚎浜у搧琛ㄥ崟 */
 export function useRouteProductFormSchema(
   onItemChange?: (item: any) => void,
+  getFormApi?: () => VbenFormApi,
 ): VbenFormSchema[] {
   return [
     {
@@ -419,6 +439,63 @@
       rules: z.number().default(1),
     },
     {
+      fieldName: 'warehouseId',
+      label: '鎶ュ伐浠撳簱',
+      component: 'ApiSelect',
+      componentProps: {
+        api: getWarehouseSimpleList,
+        labelField: 'name',
+        valueField: 'id',
+        placeholder: '璇烽�夋嫨鎶ュ伐浜у嚭浠撳簱',
+        onChange: async () => {
+          await getFormApi?.().setFieldValue('locationId', undefined);
+          await getFormApi?.().setFieldValue('areaId', undefined);
+        },
+      },
+      rules: 'selectRequired',
+    },
+    {
+      fieldName: 'locationId',
+      label: '鎶ュ伐搴撳尯',
+      component: 'Select',
+      dependencies: {
+        triggerFields: ['warehouseId'],
+        disabled: (values) => !values.warehouseId,
+        async componentProps(values) {
+          const options = values.warehouseId
+            ? await getWarehouseLocationSimpleList(values.warehouseId)
+            : [];
+          return {
+            fieldNames: { label: 'name', value: 'id' },
+            options,
+            placeholder: '璇烽�夋嫨鎶ュ伐浜у嚭搴撳尯',
+            onChange: async () => getFormApi?.().setFieldValue('areaId', undefined),
+          };
+        },
+      },
+      rules: 'selectRequired',
+    },
+    {
+      fieldName: 'areaId',
+      label: '鎶ュ伐搴撲綅',
+      component: 'Select',
+      dependencies: {
+        triggerFields: ['locationId'],
+        disabled: (values) => !values.locationId,
+        async componentProps(values) {
+          const options = values.locationId
+            ? await getWarehouseAreaSimpleList(values.locationId)
+            : [];
+          return {
+            fieldNames: { label: 'name', value: 'id' },
+            options,
+            placeholder: '璇烽�夋嫨鎶ュ伐浜у嚭搴撲綅',
+          };
+        },
+      },
+      rules: 'selectRequired',
+    },
+    {
       fieldName: 'productionTime',
       label: '鐢熶骇鐢ㄦ椂',
       component: 'InputNumber',

--
Gitblit v1.9.3