gaoluyang
2026-07-01 7d5f9791941d0ef9cd6d2daae80b5ae391e18b43
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { SystemAreaApi } from '#/api/system/area';
 
import { z } from '#/adapter/form';
 
/** 查询 IP 的表单 */
export function useFormSchema(): VbenFormSchema[] {
  return [
    {
      fieldName: 'ip',
      label: 'IP 地址',
      component: 'Input',
      componentProps: {
        placeholder: '请输入 IP 地址',
      },
      rules: z.string().ip({ message: '请输入正确的 IP 地址' }),
    },
    {
      fieldName: 'result',
      label: '地址',
      component: 'Input',
      componentProps: {
        placeholder: '展示查询 IP 结果',
        readonly: true,
      },
    },
  ];
}
 
/** 列表的字段 */
export function useGridColumns(): VxeTableGridOptions<SystemAreaApi.Area>['columns'] {
  return [
    {
      field: 'id',
      title: '地区编码',
      minWidth: 120,
      align: 'left',
      fixed: 'left',
      treeNode: true,
    },
    {
      field: 'name',
      title: '地区名称',
      minWidth: 200,
    },
  ];
}