From c2e8526f8f857be5e3a8c6f2b39c5efd424de33e Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期四, 15 十月 2026 11:50:24 +0800
Subject: [PATCH] refactor(auth): 优化认证逻辑和界面组件结构
---
src/views/mes/pro/task/data.ts | 63 ++++++++++++++++++++++++-------
1 files changed, 48 insertions(+), 15 deletions(-)
diff --git a/src/views/mes/pro/task/data.ts b/src/views/mes/pro/task/data.ts
index aeb9868..0739c03 100644
--- a/src/views/mes/pro/task/data.ts
+++ b/src/views/mes/pro/task/data.ts
@@ -2,6 +2,8 @@
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';
@@ -84,6 +86,7 @@
/** 寰呮帓浜ц鍗曞垪琛ㄧ殑瀛楁 */
export function useGridColumns(): VxeTableGridOptions<MesProWorkOrderApi.WorkOrder>['columns'] {
return [
+ { type: 'checkbox', width: 48, fixed: 'left' },
{
field: 'code',
title: '璁㈠崟缂栫爜',
@@ -141,15 +144,6 @@
},
},
{
- field: 'productionStatus',
- title: '鐢熶骇鐘舵��',
- width: 100,
- cellRender: {
- name: 'CellDict',
- props: { type: DICT_TYPE.ORDER_PRODUCTION_STATUS },
- },
- },
- {
field: 'quantity',
title: '璁㈠崟鏁伴噺',
width: 100,
@@ -165,9 +159,10 @@
width: 100,
},
{
- field: 'clientCode',
- title: '瀹㈡埛缂栫爜',
- width: 120,
+ field: 'progressPercent',
+ title: '瀹屾垚杩涘害',
+ width: 150,
+ slots: { default: 'progressPercent' },
},
{
field: 'clientName',
@@ -183,7 +178,7 @@
{
title: '鎿嶄綔',
- width: 160,
+ width: 240,
fixed: 'right',
slots: { default: 'actions' },
},
@@ -347,6 +342,12 @@
width: 120,
},
{
+ field: 'paramTemplateId',
+ title: '宸ヨ壓鍙傛暟妯℃澘',
+ minWidth: 140,
+ formatter: ({ cellValue }) => cellValue ? `妯℃澘 #${cellValue}` : '鏈厤缃�',
+ },
+ {
field: 'quantity',
title: '鎺掍骇鏁伴噺',
width: 100,
@@ -395,6 +396,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: '宸ヤ綔绔�',
@@ -475,11 +489,18 @@
component: 'ApiSelect',
componentProps: {
placeholder: '璇烽�夋嫨鎶ュ伐浜�',
- api: getSimpleUserListByRoleCode,
- params: { code: 'production_submit_work' },
+ 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([]),
},
@@ -500,6 +521,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