admin-vben5/apps/web-antd/src/views/sis/personLib/data.ts

109 lines
2.3 KiB
TypeScript
Raw Normal View History

2025-06-24 23:55:59 +08:00
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
2025-06-26 22:02:40 +08:00
import { DictEnum } from '@vben/constants';
import { getPopupContainer } from '@vben/utils';
2025-06-27 17:13:34 +08:00
import { queryListByFactoryNo } from '#/api/sis/accessControlDevice';
2025-06-27 22:19:56 +08:00
import { getDictOptions } from '#/utils/dict';
2025-06-26 22:02:40 +08:00
2025-06-24 23:55:59 +08:00
export const querySchema: FormSchemaGetter = () => [
{
component: 'Input',
fieldName: 'libName',
label: '人员库名称',
},
2025-06-26 22:02:40 +08:00
2025-06-24 23:55:59 +08:00
{
component: 'Select',
2025-06-26 22:02:40 +08:00
componentProps: {
getPopupContainer,
options: getDictOptions(DictEnum.SIS_LIB_TYPE),
},
2025-06-24 23:55:59 +08:00
fieldName: 'libType',
2025-06-25 00:37:48 +08:00
label: '库类型',
2025-06-24 23:55:59 +08:00
},
];
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
2025-06-26 22:02:40 +08:00
2025-06-24 23:55:59 +08:00
{
title: '人员库编码',
field: 'libCode',
},
{
title: '人员库名称',
field: 'libName',
},
{
title: '人员库描述',
field: 'libDesc',
},
{
2025-06-26 22:02:40 +08:00
title: '库类型',
2025-06-24 23:55:59 +08:00
field: 'libType',
2025-06-27 22:19:56 +08:00
slots: { default: 'libType' },
2025-06-24 23:55:59 +08:00
},
2025-06-26 22:02:40 +08:00
/* {
title: '业务类型',
2025-06-24 23:55:59 +08:00
field: 'busiType',
2025-06-26 22:02:40 +08:00
},*/
2025-06-24 23:55:59 +08:00
{
field: 'action',
fixed: 'right',
slots: { default: 'action' },
title: '操作',
width: 180,
},
];
export const modalSchema: FormSchemaGetter = () => [
2025-06-27 22:19:56 +08:00
{
label: '主键',
fieldName: 'id',
component: 'Input',
dependencies: {
show: () => false,
triggerFields: [''],
},
},
2025-06-24 23:55:59 +08:00
{
label: '人员库名称',
fieldName: 'libName',
component: 'Input',
rules: 'required',
},
{
label: '人员库描述',
fieldName: 'libDesc',
component: 'Input',
},
{
2025-06-25 00:37:48 +08:00
label: '库类型',
2025-06-24 23:55:59 +08:00
fieldName: 'libType',
component: 'Select',
2025-06-26 22:02:40 +08:00
componentProps: {
getPopupContainer,
options: getDictOptions(DictEnum.SIS_LIB_TYPE),
},
2025-06-24 23:55:59 +08:00
},
2025-06-27 17:13:34 +08:00
{
label: '设备',
fieldName: 'eqpIds',
component: 'ApiSelect',
rules: 'required',
componentProps: {
mode: 'multiple', // 关键属性,启用多选模式
resultField: 'list', // 根据API返回结构调整
labelField: 'eqpName',
2025-06-27 22:19:56 +08:00
valueField: 'id',
2025-06-27 17:13:34 +08:00
api: async () => {
return await queryListByFactoryNo('2');
},
},
},
2025-06-24 23:55:59 +08:00
];