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

189 lines
3.7 KiB
TypeScript
Raw Normal View History

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