import type { FormSchemaGetter } from '#/adapter/form'; import type { VxeGridProps } from '#/adapter/vxe-table'; import { DictEnum } from '@vben/constants'; import { getPopupContainer } from '@vben/utils'; import { getDictOptions } from '#/utils/dict'; export const querySchema: FormSchemaGetter = () => [ { component: 'Input', fieldName: 'imgName', label: '人像名称', }, { component: 'Select', componentProps: { getPopupContainer, options: getDictOptions(DictEnum.SYS_USER_SEX), }, fieldName: 'sex', label: '性别', }, ]; // 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新 // export const columns: () => VxeGridProps['columns'] = () => [ export const columns: VxeGridProps['columns'] = [ { type: 'checkbox', width: 60 }, /* { title: '人员库编码', field: 'libCode', },*/ { title: '人像名称', field: 'imgName', }, { title: '性别', field: 'sex', }, { title: '邮箱', field: 'email', }, { title: '联系方式', field: 'tel', }, { title: '证件类型', field: 'certificateType', }, { title: '证件号码', field: 'certificateNo', }, { title: '出生日期', field: 'birthDate', }, { field: 'action', fixed: 'right', slots: { default: 'action' }, title: '操作', width: 180, }, ]; export const modalSchema: FormSchemaGetter = () => [ { label: '人像名称', fieldName: 'imgName', component: 'Input', rules: 'required', }, { label: '性别', fieldName: 'sex', component: 'Select', componentProps: { getPopupContainer, options: getDictOptions(DictEnum.SYS_USER_SEX), }, }, { label: '邮箱', fieldName: 'email', component: 'Input', }, { label: '联系方式', fieldName: 'tel', component: 'Input', }, { label: '证件类型', fieldName: 'certificateType', component: 'Select', componentProps: { getPopupContainer, options: getDictOptions(DictEnum.SYS_CERTIFICATE_TYPE), }, }, { label: '证件号码', fieldName: 'certificateNo', component: 'Input', }, { label: '出生日期', fieldName: 'birthDate', component: 'Input', }, { label: '人像图片', fieldName: 'img', component: 'ImageUpload', componentProps: { // accept: 'image/*', // 可选拓展名或者mime类型 ,拼接 maxCount: 1, // 最大上传文件数 默认为1 为1会绑定为string而非string[]类型 }, formItemClass: 'col-span-2', }, ];