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

259 lines
5.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',
label: '社区名称',
},
{
component: 'Input',
fieldName: 'communityCode',
label: '社区编码',
},
{
component: 'Select',
componentProps: {
2025-06-18 16:50:58 +08:00
// 可选从DictEnum中获取 DictEnum.WY_SQLX 便于维护
options: getDictOptions('wy_sqlx'),
2025-06-18 11:03:42 +08:00
},
fieldName: 'communityType',
label: '社区类型 1园区2小区',
},
{
component: 'Input',
fieldName: 'province',
label: '省',
},
{
component: 'Input',
fieldName: 'city',
label: '市',
},
{
component: 'Input',
fieldName: 'district',
label: '区',
},
{
component: 'Input',
fieldName: 'addr',
label: '地址',
},
{
component: 'Input',
fieldName: 'lon',
label: '经度',
},
{
component: 'Input',
fieldName: 'lat',
label: '维度',
},
{
component: 'Input',
fieldName: 'img',
label: '小图图片',
},
{
component: 'Input',
fieldName: 'orgCode',
label: '组织编码',
},
{
component: 'Input',
fieldName: 'dataState',
label: '数据状态1有效0无效',
},
2025-06-19 09:50:46 +08:00
{
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
fieldName: 'modifyTime',
label: '修改时间',
},
2025-06-18 11:03:42 +08:00
];
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
2025-06-19 09:50:46 +08:00
{
title: '主键',
field: 'id',
},
2025-06-18 11:03:42 +08:00
{
title: '社区名称',
field: 'communityName',
},
{
title: '社区编码',
field: 'communityCode',
},
{
title: '社区类型 1园区2小区',
field: 'communityType',
2025-06-18 16:50:58 +08:00
slots: {
default: ({ row }) => {
// 可选从DictEnum中获取 DictEnum.WY_SQLX 便于维护
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',
},
{
title: '组织编码',
field: 'orgCode',
},
2025-06-19 09:50:46 +08:00
{
title: '数据状态1有效0无效',
field: 'dataState',
},
{
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: [''],
},
},
{
label: '社区名称',
fieldName: 'communityName',
component: 'Input',
rules: 'required',
},
{
label: '社区编码',
fieldName: 'communityCode',
component: 'Input',
rules: 'required',
},
{
label: '社区类型 1园区2小区',
fieldName: 'communityType',
component: 'Select',
componentProps: {
2025-06-18 16:50:58 +08:00
// 可选从DictEnum中获取 DictEnum.WY_SQLX 便于维护
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: {
// accept: 'image/*', // 可选拓展名或者mime类型 ,拼接
// maxCount: 1, // 最大上传文件数 默认为1 为1会绑定为string而非string[]类型
},
2025-06-18 11:03:42 +08:00
},
{
label: '组织编码',
fieldName: 'orgCode',
component: 'Input',
rules: 'required',
},
2025-06-19 09:50:46 +08:00
{
label: '数据状态1有效0无效',
fieldName: 'dataState',
component: 'Input',
rules: 'required',
},
{
label: '修改时间',
fieldName: 'modifyTime',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
},
2025-06-18 11:03:42 +08:00
];