Files
iot-device-management-frontend/apps/web-antd/src/views/system/area/data.ts

47 lines
1.0 KiB
TypeScript
Raw Normal View History

2025-04-06 09:28:18 +08:00
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
2025-04-06 09:28:18 +08:00
import type { SystemAreaApi } from '#/api/system/area';
2025-06-24 17:35:43 +08:00
import { z } from '#/adapter/form';
2025-04-06 09:28:18 +08:00
/** 查询 IP 的表单 */
export function useFormSchema(): VbenFormSchema[] {
return [
{
fieldName: 'ip',
label: 'IP 地址',
component: 'Input',
componentProps: {
placeholder: '请输入 IP 地址',
},
2025-06-24 17:35:43 +08:00
rules: z.string().ip({ message: '请输入正确的 IP 地址' }),
2025-04-06 09:28:18 +08:00
},
{
fieldName: 'result',
label: '地址',
component: 'Input',
componentProps: {
placeholder: '展示查询 IP 结果',
readonly: true,
2025-04-22 11:25:11 +08:00
},
2025-04-06 09:28:18 +08:00
},
];
}
/** 列表的字段 */
2025-04-22 22:10:33 +08:00
export function useGridColumns(): VxeTableGridOptions<SystemAreaApi.Area>['columns'] {
2025-04-06 09:28:18 +08:00
return [
{
field: 'id',
title: '地区编码',
align: 'left',
fixed: 'left',
treeNode: true,
},
{
field: 'name',
title: '地区名称',
},
];
}