admin-vben5/apps/web-antd/src/views/property/community/data.ts

189 lines
3.7 KiB
TypeScript

import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
import { getPopupContainer } from '@vben/utils';
import { getDictOptions } from '#/utils/dict';
import { DictEnum } from '@vben/constants';
export const querySchema: FormSchemaGetter = () => [
{
component: 'Select',
componentProps: {
getPopupContainer,
options: getDictOptions(DictEnum.wy_sqlx),
},
fieldName: 'communityType',
label: '社区类型',
},
{
component: 'Input',
fieldName: 'propertyCompany',
label: '物业公司',
},
];
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{
title: '社区名称',
field: 'communityName',
},
{
title: '社区类型',
field: 'communityType',
slots: { default: 'communityType' },
},
{
title: '城市',
field: 'cityFullName',
},
{
title: '地址',
field: 'addr',
},
// {
// title: '经度',
// field: 'lon',
// },
// {
// title: '维度',
// field: 'lat',
// },
{
title: '占地面积',
field: 'area',
},
{
title: '建成时间',
field: 'builtYear',
},
{
title: '物业公司',
field: 'propertyCompany',
},
{
title: '联系电话',
field: 'contactPhone',
},
{
title: '社区描述',
field: 'description',
},
{
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: 'communityName',
component: 'Input',
rules: 'required',
},
{
label: '社区类型',
fieldName: 'communityType',
component: 'Select',
componentProps: {
getPopupContainer,
options: getDictOptions(DictEnum.wy_sqlx),
},
rules: 'selectRequired',
},
{
component: 'TreeSelect',
fieldName: 'cityFullCode',
defaultValue: undefined,
label: '城市',
rules: 'selectRequired',
},
/*{
label: '省',
fieldName: 'province',
component: 'Input',
rules: 'required',
},
{
label: '市',
fieldName: 'city',
component: 'Input',
rules: 'required',
},
{
label: '区',
fieldName: 'district',
component: 'Input',
rules: 'required',
},*/
{
label: '地址',
fieldName: 'addr',
component: 'Input',
rules: 'required',
},
// {
// label: '经度',
// fieldName: 'lon',
// component: 'Input',
// },
// {
// label: '维度',
// fieldName: 'lat',
// component: 'Input',
// },
{
label: '占地面积',
fieldName: 'area',
component: 'Input',
},
{
label: '建成时间',
fieldName: 'builtYear',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD',
},
},
{
label: '物业公司',
fieldName: 'propertyCompany',
component: 'Input',
},
{
label: '联系电话',
fieldName: 'contactPhone',
component: 'Input',
},
{
label: '社区描述',
fieldName: 'description',
component: 'Textarea',
},
{
label: '人像图片',
fieldName: 'img',
component: 'ImageUpload',
componentProps: {
maxCount: 1, // 最大上传文件数 默认为1 为1会绑定为string而非string[]类型
},
formItemClass: 'col-span-2',
},
];