人像库页面优化
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run

增加人像图片
This commit is contained in:
15683799673 2025-06-28 01:29:34 +08:00
parent b2d902a2e0
commit 81a89bb4dc
4 changed files with 48 additions and 3 deletions

View File

@ -46,6 +46,8 @@ export interface PersonLibVO {
*/ */
searchValue: string; searchValue: string;
labelText: any;
} }
export interface PersonLibForm extends BaseEntity { export interface PersonLibForm extends BaseEntity {

View File

@ -32,7 +32,7 @@ export const columns: VxeGridProps['columns'] = [
{ {
title: '人员库编码', title: '人员库编码',
field: 'libCode', field: 'id',
}, },
{ {
title: '人员库名称', title: '人员库名称',

View File

@ -1,12 +1,53 @@
import type { FormSchemaGetter } from '#/adapter/form'; import type { FormSchemaGetter, VbenFormSchema } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table'; import type { VxeGridProps } from '#/adapter/vxe-table';
import { DictEnum } from '@vben/constants'; import { DictEnum } from '@vben/constants';
import { getPopupContainer } from '@vben/utils'; import { getPopupContainer } from '@vben/utils';
import { getDictOptions } from '#/utils/dict'; 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 = () => [ export const querySchema: FormSchemaGetter = () => [
labelText,
{ {
component: 'Input', component: 'Input',
fieldName: 'imgName', fieldName: 'imgName',
@ -69,6 +110,7 @@ export const columns: VxeGridProps['columns'] = [
]; ];
export const modalSchema: FormSchemaGetter = () => [ export const modalSchema: FormSchemaGetter = () => [
labelText,
{ {
label: '人像名称', label: '人像名称',
fieldName: 'imgName', fieldName: 'imgName',
@ -115,7 +157,7 @@ export const modalSchema: FormSchemaGetter = () => [
}, },
{ {
label: '人像图片', label: '人像图片',
fieldName: 'img', fieldName: 'imgUrl',
component: 'ImageUpload', component: 'ImageUpload',
componentProps: { componentProps: {
// accept: 'image/*', // 可选拓展名或者mime类型 ,拼接 // accept: 'image/*', // 可选拓展名或者mime类型 ,拼接

View File

@ -31,6 +31,7 @@ const [BasicForm, formApi] = useVbenForm({
// //
componentProps: { componentProps: {
class: 'w-full', class: 'w-full',
allowClear: true,
}, },
}, },
schema: modalSchema(), schema: modalSchema(),