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