From 3baaad59171ded6aca17340fcc907acbeeb45b7b Mon Sep 17 00:00:00 2001 From: zhuguifei <zhuguifei@zhuguifeideiMac.local> Date: 星期二, 08 四月 2025 08:14:43 +0800 Subject: [PATCH] Merge branch 'main' of http://lanpucloud.cn:1111/r/eims-master --- eims-ui/apps/web-antd/src/views/eims/spare-type/data.tsx | 196 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 196 insertions(+), 0 deletions(-) diff --git a/eims-ui/apps/web-antd/src/views/eims/spare-type/data.tsx b/eims-ui/apps/web-antd/src/views/eims/spare-type/data.tsx new file mode 100644 index 0000000..838ba58 --- /dev/null +++ b/eims-ui/apps/web-antd/src/views/eims/spare-type/data.tsx @@ -0,0 +1,196 @@ +import type { VxeGridProps } from '#/adapter/vxe-table'; + +import { h } from 'vue'; + +import { DictEnum } from '@vben/constants'; +import { FolderIcon, MenuIcon, VbenIcon } from '@vben/icons'; +import { getPopupContainer } from '@vben/utils'; + +import { type FormSchemaGetter } from '#/adapter/form'; +import { getDictOptions } from '#/utils/dict'; +import { renderDict } from '#/utils/render'; + +export const querySchema: FormSchemaGetter = () => [ + { + component: 'Input', + fieldName: 'typeName', + label: '绫诲瀷鍚嶇О ' + }, + { + component: 'Select', + componentProps: { + getPopupContainer, + options: getDictOptions(DictEnum.SYS_NORMAL_DISABLE) + }, + fieldName: 'status', + label: '绫诲瀷鐘舵�� ' + } +]; + +// 鑿滃崟绫诲瀷锛圡鐩綍 C鑿滃崟 F鎸夐挳锛� +export const spareTypeOptions = [ + { label: '澶囦欢鐩綍', value: 'M' }, + { label: '澶囦欢绫诲瀷', value: 'C' } +]; + +export const yesNoOptions = [ + { label: '鏄�', value: '0' }, + { label: '鍚�', value: '1' } +]; + +// 锛圡鐩綍 C鑿滃崟锛� +const menuTypes = { + M: { icon: FolderIcon, value: '澶囦欢鐩綍' }, + C: { icon: MenuIcon, value: '澶囦欢绫诲瀷' } +}; +export const columns: VxeGridProps['columns'] = [ + { + title: '绫诲瀷鍚嶇О', + field: 'typeName', + treeNode: true, + width: 200 + }, + { + title: '绫诲瀷缂栫爜', + field: 'typeCode', + width: 200 + }, + { + title: '鍥炬爣', + field: 'icon', + width: 80, + slots: { + default: ({ row }) => { + if (row?.icon === '#') { + return ''; + } + return ( + <span class={'flex justify-center'}> + <VbenIcon icon={row.icon} /> + </span> + ); + } + } + }, + { + title: '鎺掑簭', + field: 'orderNum', + width: 120 + }, + { + title: '鑺傜偣绫诲瀷', + field: 'menuType', + width: 150, + slots: { + default: ({ row }) => { + const current = menuTypes[row.menuType as 'C' | 'M']; + if (!current) { + return '鏈煡'; + } + return ( + <span class="flex items-center justify-center gap-1"> + {h(current.icon, { class: 'size-[18px]' })} + <span>{current.value}</span> + </span> + ); + } + } + }, + { + title: '鐘舵��', + field: 'status', + width: 100, + slots: { + default: ({ row }) => { + return renderDict(row.status, DictEnum.SYS_NORMAL_DISABLE); + } + } + }, + { + title: '鍒涘缓鏃堕棿', + field: 'createTime' + }, + { + field: 'action', + fixed: 'right', + slots: { default: 'action' }, + title: '鎿嶄綔', + width: 200 + } +]; + +export const drawerSchema: FormSchemaGetter = () => [ + { + component: 'Input', + dependencies: { + show: () => false, + triggerFields: [''] + }, + fieldName: 'id' + }, + { + component: 'TreeSelect', + defaultValue: 0, + fieldName: 'parentId', + label: '涓婄骇鑿滃崟', + rules: 'selectRequired' + }, + { + component: 'RadioGroup', + componentProps: { + buttonStyle: 'solid', + options: spareTypeOptions, + optionType: 'button' + }, + defaultValue: 'M', + dependencies: { + componentProps: (_, api) => { + // 鍒囨崲鏃舵竻绌烘牎楠� + // 鐩存帴鎶勭殑婧愮爜 娌℃湁娓呯┖鏍¢獙鐨勬柟娉� + Object.keys(api.errors.value).forEach((key) => { + api.setFieldError(key, undefined); + }); + return {}; + }, + triggerFields: ['menuType'] + }, + fieldName: 'menuType', + label: '鑺傜偣绫诲瀷' + }, + { + component: 'Input', + fieldName: 'typeName', + label: '绫诲瀷鍚嶇О', + rules: 'required' + }, + { + component: 'Input', + fieldName: 'typeCode', + label: '绫诲瀷缂栫爜', + rules: 'required' + }, + { + component: 'InputNumber', + fieldName: 'orderNum', + help: '鎺掑簭, 鏁板瓧瓒婂皬瓒婇潬鍓�', + label: '鏄剧ず鎺掑簭', + rules: 'required' + }, + { + component: 'RadioGroup', + componentProps: { + buttonStyle: 'solid', + options: getDictOptions(DictEnum.SYS_NORMAL_DISABLE), + optionType: 'button' + }, + defaultValue: '0', + dependencies: { + // 绫诲瀷涓嶄负鎸夐挳鏃舵樉绀� + show: (values) => values.menuType !== 'F', + triggerFields: ['menuType'] + }, + fieldName: 'status', + help: '鍋滅敤鍚庝笉浼氬嚭鐜板湪鍒楄〃', + label: '绫诲瀷鐘舵��' + } +]; -- Gitblit v1.9.3