Files
admin-vben5/apps/web-antd/src/views/property/cityArea/data.ts
2025-06-19 09:50:46 +08:00

172 lines
3.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
import { getDictOptions } from '#/utils/dict';
import { renderDict } from '#/utils/render';
export const querySchema: FormSchemaGetter = () => [
{
component: 'Input',
fieldName: 'areaCode',
label: '城市编码',
},
{
component: 'Input',
fieldName: 'areaName',
label: '城市名称',
},
{
component: 'Select',
componentProps: {
// 可选从DictEnum中获取 DictEnum.WY_QYJB 便于维护
options: getDictOptions('wy_qyjb'),
},
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: '维度',
},
{
component: 'Input',
fieldName: 'dataState',
label: '数据状态1有效0无效',
},
];
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{
title: '主键ID',
field: 'id',
},
{
title: '城市编码',
field: 'areaCode',
},
{
title: '城市名称',
field: 'areaName',
},
{
title: '101 省级 202 市州 303 区县',
field: 'areaLevel',
slots: {
default: ({ row }) => {
// 可选从DictEnum中获取 DictEnum.WY_QYJB 便于维护
return renderDict(row.areaLevel, 'wy_qyjb');
},
},
},
{
title: '父级城市编码',
field: 'parentAreaCode',
},
{
title: '父级城市名称',
field: 'parentAreaName',
},
{
title: '经度',
field: 'lon',
},
{
title: '维度',
field: 'lat',
},
{
title: '数据状态1有效0无效',
field: 'dataState',
},
{
field: 'action',
fixed: 'right',
slots: { default: 'action' },
title: '操作',
width: 180,
},
];
export const modalSchema: FormSchemaGetter = () => [
{
label: '主键ID',
fieldName: 'id',
component: 'Input',
rules: 'required',
},
{
label: '城市编码',
fieldName: 'areaCode',
component: 'Input',
dependencies: {
show: () => false,
triggerFields: [''],
},
},
{
label: '城市名称',
fieldName: 'areaName',
component: 'Input',
rules: 'required',
},
{
label: '101 省级 202 市州 303 区县',
fieldName: 'areaLevel',
component: 'Select',
componentProps: {
// 可选从DictEnum中获取 DictEnum.WY_QYJB 便于维护
options: getDictOptions('wy_qyjb'),
},
rules: 'selectRequired',
},
{
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',
},
{
label: '数据状态1有效0无效',
fieldName: 'dataState',
component: 'Input',
rules: 'required',
},
];