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

172 lines
3.4 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: 'areaCode',
label: '城市编码',
},
{
component: 'Input',
fieldName: 'areaName',
label: '城市名称',
},
{
2025-06-18 16:50:58 +08:00
component: 'Select',
componentProps: {
// 可选从DictEnum中获取 DictEnum.WY_QYJB 便于维护
options: getDictOptions('wy_qyjb'),
},
2025-06-18 11:03:42 +08:00
fieldName: 'areaLevel',
label: '101 省级 202 市州 303 区县',
},
{
component: 'Input',
fieldName: 'parentAreaCode',
label: '父级城市编码',
},
{
component: 'Input',
fieldName: 'parentAreaName',
label: '父级城市名称',
},
{
component: 'Input',
fieldName: 'lon',
label: '经度',
},
{
component: 'Input',
fieldName: 'lat',
label: '维度',
},
2025-06-19 09:50:46 +08:00
{
component: 'Input',
fieldName: 'dataState',
label: '数据状态1有效0无效',
},
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: '主键ID',
field: 'id',
},
2025-06-18 11:03:42 +08:00
{
title: '城市编码',
field: 'areaCode',
},
{
title: '城市名称',
field: 'areaName',
},
{
title: '101 省级 202 市州 303 区县',
field: 'areaLevel',
2025-06-18 16:50:58 +08:00
slots: {
default: ({ row }) => {
// 可选从DictEnum中获取 DictEnum.WY_QYJB 便于维护
return renderDict(row.areaLevel, 'wy_qyjb');
},
},
2025-06-18 11:03:42 +08:00
},
{
title: '父级城市编码',
field: 'parentAreaCode',
},
{
title: '父级城市名称',
field: 'parentAreaName',
},
{
title: '经度',
field: 'lon',
},
{
title: '维度',
field: 'lat',
},
2025-06-19 09:50:46 +08:00
{
title: '数据状态1有效0无效',
field: 'dataState',
},
2025-06-18 11:03:42 +08:00
{
field: 'action',
fixed: 'right',
slots: { default: 'action' },
title: '操作',
width: 180,
},
];
export const modalSchema: FormSchemaGetter = () => [
{
label: '主键ID',
fieldName: 'id',
component: 'Input',
2025-06-19 09:50:46 +08:00
rules: 'required',
2025-06-18 11:03:42 +08:00
},
{
label: '城市编码',
fieldName: 'areaCode',
component: 'Input',
dependencies: {
show: () => false,
triggerFields: [''],
},
},
{
label: '城市名称',
fieldName: 'areaName',
component: 'Input',
rules: 'required',
},
{
label: '101 省级 202 市州 303 区县',
fieldName: 'areaLevel',
2025-06-18 16:50:58 +08:00
component: 'Select',
componentProps: {
// 可选从DictEnum中获取 DictEnum.WY_QYJB 便于维护
options: getDictOptions('wy_qyjb'),
},
rules: 'selectRequired',
2025-06-18 11:03:42 +08:00
},
{
label: '父级城市编码',
fieldName: 'parentAreaCode',
component: 'Input',
rules: 'required',
},
{
label: '父级城市名称',
fieldName: 'parentAreaName',
component: 'Input',
rules: 'required',
},
{
label: '经度',
fieldName: 'lon',
component: 'Input',
rules: 'required',
},
{
label: '维度',
fieldName: 'lat',
component: 'Input',
rules: 'required',
},
2025-06-19 09:50:46 +08:00
{
label: '数据状态1有效0无效',
fieldName: 'dataState',
component: 'Input',
rules: 'required',
},
2025-06-18 11:03:42 +08:00
];