增加人像图片
This commit is contained in:
168
apps/web-antd/src/views/sis/personLibImg/data.tsx
Normal file
168
apps/web-antd/src/views/sis/personLibImg/data.tsx
Normal file
@@ -0,0 +1,168 @@
|
||||
import type { FormSchemaGetter, VbenFormSchema } 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';
|
||||
import { personLibList } from '#/api/sis/personLib';
|
||||
import type { PersonLibQuery, PersonLibVO } from '#/api/sis/personLib/model';
|
||||
import { Tag } from 'ant-design-vue';
|
||||
|
||||
let libArr: PersonLibVO[] = [];
|
||||
const labelText: VbenFormSchema = {
|
||||
label: '图片库',
|
||||
fieldName: 'libId',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
resultField: 'list', // 根据API返回结构调整
|
||||
labelField: 'labelText',
|
||||
valueField: 'id',
|
||||
// immediate: true,
|
||||
api: async () => {
|
||||
if(!libArr || libArr.length == 0){
|
||||
const params: PersonLibQuery = {
|
||||
pageNum: 1,
|
||||
pageSize: 500,
|
||||
};
|
||||
const res = await personLibList(params);
|
||||
res.rows.forEach((item) => {
|
||||
let tag =
|
||||
item.libType == 1 ? (
|
||||
<Tag color="#108ee9">人像库</Tag>
|
||||
) : (
|
||||
<Tag color="#2db7f5">工服库</Tag>
|
||||
);
|
||||
item.labelText = (
|
||||
<span>
|
||||
{item.libName} {tag}
|
||||
</span>
|
||||
);
|
||||
});
|
||||
libArr = res.rows
|
||||
}
|
||||
return libArr;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
labelText,
|
||||
{
|
||||
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 = () => [
|
||||
labelText,
|
||||
{
|
||||
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: 'imgUrl',
|
||||
component: 'ImageUpload',
|
||||
componentProps: {
|
||||
// accept: 'image/*', // 可选拓展名或者mime类型 ,拼接
|
||||
maxCount: 1, // 最大上传文件数 默认为1 为1会绑定为string而非string[]类型
|
||||
},
|
||||
formItemClass: 'col-span-2',
|
||||
},
|
||||
];
|
Reference in New Issue
Block a user