From 7619c19a67c2ac824f803090bab753fc5ea14408 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期四, 16 七月 2026 12:01:49 +0800
Subject: [PATCH] 工作台完善
---
src/views/mes/process-design/parameter/data.ts | 189 +++++++++++++++++++++-------------------------
1 files changed, 86 insertions(+), 103 deletions(-)
diff --git a/src/views/mes/process-design/parameter/data.ts b/src/views/mes/process-design/parameter/data.ts
index e90cfed..c59fa12 100644
--- a/src/views/mes/process-design/parameter/data.ts
+++ b/src/views/mes/process-design/parameter/data.ts
@@ -1,113 +1,96 @@
-import type { VbenFormSchema } from '#/adapter/form';
-import type { VxeTableGridOptions } from '#/adapter/vxe-table';
-import type { MesPdParameterApi } from '#/api/mes/pro/processdesign/parameter';
+import type { VbenFormSchema } from "#/adapter/form";
+import type { VxeTableGridOptions } from "#/adapter/vxe-table";
+import type { MesPdParameterApi } from "#/api/mes/pro/processdesign/parameter";
-import { DICT_TYPE } from '../../../../packages/constants/src';
-import { getDictOptions } from '../../../../packages/effects/hooks/src';
+import { DICT_TYPE } from "@vben/constants";
+import { getDictOptions } from "@vben/hooks";
-import { z } from '#/adapter/form';
-
-/** 鍙傛暟绫诲瀷 - 涓嬫媺閫夐」鐨勫�� */
-const PARAM_TYPE_SELECT = 3;
+import { z } from "#/adapter/form";
+import { getUnitPage } from "#/api/mdm/unit";
/** 琛ㄥ崟绫诲瀷 */
-export type FormType = 'create' | 'detail' | 'update';
+export type FormType = "create" | "detail" | "update";
/** 鏂板/淇敼宸ヨ壓鍙傛暟鐨勮〃鍗� */
export function useFormSchema(): VbenFormSchema[] {
return [
{
- fieldName: 'id',
- component: 'Input',
+ fieldName: "id",
+ component: "Input",
dependencies: {
- triggerFields: [''],
+ triggerFields: [""],
show: () => false,
},
},
{
- fieldName: 'code',
- label: '鍙傛暟缂栫爜',
- component: 'Input',
+ fieldName: "paramCode",
+ label: "鍙傛暟缂栫爜",
+ component: "Input",
componentProps: {
maxLength: 64,
- placeholder: '璇疯緭鍏ュ弬鏁扮紪鐮�',
+ placeholder: "鍙傛暟缂栫爜鑷姩鐢熸垚",
+ disabled: true,
},
- rules: z.string().min(1, '鍙傛暟缂栫爜涓嶈兘涓虹┖').max(64),
},
{
- fieldName: 'name',
- label: '鍙傛暟鍚嶇О',
- component: 'Input',
+ fieldName: "paramName",
+ label: "鍙傛暟鍚嶇О",
+ component: "Input",
componentProps: {
maxLength: 100,
- placeholder: '璇疯緭鍏ュ弬鏁板悕绉�',
+ placeholder: "璇疯緭鍏ュ弬鏁板悕绉�",
},
- rules: z.string().min(1, '鍙傛暟鍚嶇О涓嶈兘涓虹┖').max(100),
+ rules: z.string().min(1, "鍙傛暟鍚嶇О涓嶈兘涓虹┖").max(100),
},
{
- fieldName: 'type',
- label: '鍙傛暟绫诲瀷',
- component: 'Select',
+ fieldName: "paramType",
+ label: "鍙傛暟绫诲瀷",
+ component: "Select",
componentProps: {
allowClear: true,
- options: getDictOptions(DICT_TYPE.MES_PD_PARAM_TYPE, 'number'),
- placeholder: '璇烽�夋嫨鍙傛暟绫诲瀷',
+ options: getDictOptions(DICT_TYPE.MES_PD_PARAM_TYPE, "number"),
+ placeholder: "璇烽�夋嫨鍙傛暟绫诲瀷",
},
- rules: 'selectRequired',
+ rules: "selectRequired",
},
{
- fieldName: 'unit',
- label: '鍗曚綅',
- component: 'Input',
+ fieldName: "unitMeasureId",
+ label: "璁¢噺鍗曚綅",
+ component: "ApiSelect",
componentProps: {
- maxLength: 20,
- placeholder: '璇疯緭鍏ュ崟浣�',
+ allowClear: true,
+ api: async () => {
+ const result = await getUnitPage({ pageNo: 1, pageSize: 100 });
+ return result.list.map(item => ({
+ label: item.name || "",
+ value: item.id || 0,
+ }));
+ },
+ labelField: "label",
+ valueField: "value",
+ placeholder: "璇烽�夋嫨璁¢噺鍗曚綅",
+ showSearch: true,
+ filterOption: true,
},
},
{
- fieldName: 'requiredFlag',
- label: '鏄惁蹇呭~',
- component: 'Switch',
+ fieldName: "required",
+ label: "鏄惁蹇呭~",
+ component: "Switch",
componentProps: {
- checkedChildren: '鏄�',
- unCheckedChildren: '鍚�',
+ checkedChildren: "鏄�",
+ unCheckedChildren: "鍚�",
},
rules: z.boolean().default(false),
},
{
- fieldName: 'dictType',
- label: '瀛楀吀绫诲瀷',
- component: 'Input',
- componentProps: {
- maxLength: 64,
- placeholder: '璇疯緭鍏ュ瓧鍏哥被鍨嬶紙涓嬫媺閫夐」鏃堕厤缃級',
- },
- dependencies: {
- triggerFields: ['type'],
- show: (values) => values?.type === PARAM_TYPE_SELECT,
- },
- },
- {
- fieldName: 'apiUrl',
- label: '鎺ュ彛鍦板潃',
- component: 'Input',
+ fieldName: "remark",
+ label: "澶囨敞",
+ component: "Textarea",
+ formItemClass: "col-span-2",
componentProps: {
maxLength: 250,
- placeholder: '璇疯緭鍏ユ帴鍙e湴鍧�锛堜笅鎷夐�夐」鏃堕厤缃級',
- },
- dependencies: {
- triggerFields: ['type'],
- show: (values) => values?.type === PARAM_TYPE_SELECT,
- },
- },
- {
- fieldName: 'remark',
- label: '澶囨敞',
- component: 'Textarea',
- formItemClass: 'col-span-2',
- componentProps: {
- maxLength: 250,
- placeholder: '璇疯緭鍏ュ娉�',
+ placeholder: "璇疯緭鍏ュ娉�",
rows: 3,
},
},
@@ -118,79 +101,79 @@
export function useGridFormSchema(): VbenFormSchema[] {
return [
{
- fieldName: 'code',
- label: '鍙傛暟缂栫爜',
- component: 'Input',
+ fieldName: "paramCode",
+ label: "鍙傛暟缂栫爜",
+ component: "Input",
componentProps: {
allowClear: true,
- placeholder: '璇疯緭鍏ュ弬鏁扮紪鐮�',
+ placeholder: "璇疯緭鍏ュ弬鏁扮紪鐮�",
},
},
{
- fieldName: 'name',
- label: '鍙傛暟鍚嶇О',
- component: 'Input',
+ fieldName: "paramName",
+ label: "鍙傛暟鍚嶇О",
+ component: "Input",
componentProps: {
allowClear: true,
- placeholder: '璇疯緭鍏ュ弬鏁板悕绉�',
+ placeholder: "璇疯緭鍏ュ弬鏁板悕绉�",
},
},
{
- fieldName: 'type',
- label: '鍙傛暟绫诲瀷',
- component: 'Select',
+ fieldName: "paramType",
+ label: "鍙傛暟绫诲瀷",
+ component: "Select",
componentProps: {
allowClear: true,
- options: getDictOptions(DICT_TYPE.MES_PD_PARAM_TYPE, 'number'),
- placeholder: '璇烽�夋嫨鍙傛暟绫诲瀷',
+ options: getDictOptions(DICT_TYPE.MES_PD_PARAM_TYPE, "number"),
+ placeholder: "璇烽�夋嫨鍙傛暟绫诲瀷",
},
},
];
}
/** 鍒楄〃鐨勫瓧娈� */
-export function useGridColumns(): VxeTableGridOptions<MesPdParameterApi.Parameter>['columns'] {
+export function useGridColumns(): VxeTableGridOptions<MesPdParameterApi.Parameter>["columns"] {
return [
{
- type: 'seq',
- title: '搴忓彿',
+ type: "seq",
+ title: "搴忓彿",
width: 60,
- align: 'center',
+ align: "center",
},
- { field: 'code', title: '鍙傛暟缂栫爜', minWidth: 150 },
- { field: 'name', title: '鍙傛暟鍚嶇О', minWidth: 180 },
+ { field: "paramCode", title: "鍙傛暟缂栫爜", minWidth: 150 },
+ { field: "paramName", title: "鍙傛暟鍚嶇О", minWidth: 180 },
{
- field: 'type',
- title: '鍙傛暟绫诲瀷',
+ field: "paramType",
+ title: "鍙傛暟绫诲瀷",
width: 120,
cellRender: {
- name: 'CellDict',
+ name: "CellDict",
props: { type: DICT_TYPE.MES_PD_PARAM_TYPE },
},
},
- { field: 'unit', title: '鍗曚綅', width: 80 },
+ { field: "unitMeasureName", title: "鍗曚綅", width: 80 },
{
- field: 'requiredFlag',
- title: '鏄惁蹇呭~',
+ field: "required",
+ title: "鏄惁蹇呭~",
width: 90,
cellRender: {
- name: 'CellDict',
+ name: "CellDict",
props: { type: DICT_TYPE.INFRA_BOOLEAN_STRING },
},
},
- { field: 'remark', title: '澶囨敞', minWidth: 180 },
+ { field: "remark", title: "澶囨敞", minWidth: 180 },
{
- field: 'createTime',
- title: '鍒涘缓鏃堕棿',
+ field: "createTime",
+ title: "鍒涘缓鏃堕棿",
width: 180,
- formatter: 'formatDateTime',
+ formatter: "formatDateTime",
},
{
- title: '鎿嶄綔',
+ title: "鎿嶄綔",
width: 150,
- fixed: 'right',
+ fixed: "right",
slots: {
- default: 'actions',
+ default: "actions",
},
},
];
--
Gitblit v1.9.3