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

171 lines
3.0 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-18 16:50:58 +08:00
import { getDictOptions } from '#/utils/dict';
import { renderDict } from '#/utils/render';
2025-06-18 11:03:42 +08:00
export const querySchema: FormSchemaGetter = () => [
{
component: 'Input',
fieldName: 'communityName',
2025-06-27 15:16:06 +08:00
label: '小区名称',
2025-06-18 11:03:42 +08:00
},
{
component: 'Input',
fieldName: 'communityCode',
2025-06-27 15:16:06 +08:00
label: '小区编码',
2025-06-18 11:03:42 +08:00
},
{
component: 'Select',
componentProps: {
2025-06-18 16:50:58 +08:00
options: getDictOptions('wy_sqlx'),
2025-06-18 11:03:42 +08:00
},
fieldName: 'communityType',
2025-06-27 15:16:06 +08:00
label: '小区类型',
2025-06-26 17:59:00 +08:00
}
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-27 15:16:06 +08:00
title: '序号',
2025-06-19 09:50:46 +08:00
field: 'id',
2025-06-27 15:16:06 +08:00
slots: {
default: ({ rowIndex }) => {
return (rowIndex + 1).toString();
},
},
2025-06-19 09:50:46 +08:00
},
2025-06-18 11:03:42 +08:00
{
2025-06-27 15:16:06 +08:00
title: '小区名称',
2025-06-18 11:03:42 +08:00
field: 'communityName',
},
{
2025-06-27 15:16:06 +08:00
title: '小区编码',
2025-06-18 11:03:42 +08:00
field: 'communityCode',
},
{
2025-06-27 15:16:06 +08:00
title: '小区类型',
2025-06-18 11:03:42 +08:00
field: 'communityType',
2025-06-18 16:50:58 +08:00
slots: {
default: ({ row }) => {
return renderDict(row.communityType, 'wy_sqlx');
},
},
2025-06-18 11:03:42 +08:00
},
{
title: '省',
field: 'province',
},
{
title: '市',
field: 'city',
},
{
title: '区',
field: 'district',
},
{
title: '地址',
field: 'addr',
},
{
title: '经度',
field: 'lon',
},
{
title: '维度',
field: 'lat',
},
{
title: '小图图片',
field: 'img',
},
2025-06-19 09:50:46 +08:00
{
title: '修改时间',
field: 'modifyTime',
},
2025-06-18 11:03:42 +08:00
{
field: 'action',
fixed: 'right',
slots: { default: 'action' },
title: '操作',
width: 180,
},
];
export const modalSchema: FormSchemaGetter = () => [
{
2025-06-19 09:50:46 +08:00
label: '主键',
2025-06-18 11:03:42 +08:00
fieldName: 'id',
component: 'Input',
dependencies: {
show: () => false,
triggerFields: [''],
},
},
{
2025-06-27 15:16:06 +08:00
label: '小区名称',
2025-06-18 11:03:42 +08:00
fieldName: 'communityName',
component: 'Input',
rules: 'required',
},
{
2025-06-27 15:16:06 +08:00
label: '小区编码',
2025-06-18 11:03:42 +08:00
fieldName: 'communityCode',
component: 'Input',
rules: 'required',
},
{
2025-06-27 15:16:06 +08:00
label: '小区类型',
2025-06-18 11:03:42 +08:00
fieldName: 'communityType',
component: 'Select',
componentProps: {
2025-06-18 16:50:58 +08:00
options: getDictOptions('wy_sqlx'),
2025-06-18 11:03:42 +08:00
},
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',
rules: 'required',
},
{
label: '维度',
fieldName: 'lat',
component: 'Input',
rules: 'required',
},
{
label: '小图图片',
fieldName: 'img',
2025-06-18 16:50:58 +08:00
component: 'ImageUpload',
componentProps: {
},
2025-06-27 15:16:06 +08:00
}
2025-06-18 11:03:42 +08:00
];