diff --git a/apps/web-antd/src/api/system/area/index.ts b/apps/web-antd/src/api/system/area/index.ts new file mode 100644 index 00000000..fb06eda3 --- /dev/null +++ b/apps/web-antd/src/api/system/area/index.ts @@ -0,0 +1,24 @@ +import { requestClient } from '#/api/request'; + +export namespace SystemAreaApi { + /** 地区信息 */ + export interface SystemArea { + id?: number; + name: string; + code: string; + parentId?: number; + sort?: number; + status?: number; + createTime?: Date; + } +} + +/** 获得地区树 */ +export function getAreaTree() { + return requestClient.get('/system/area/tree'); +} + +/** 获得 IP 对应的地区名 */ +export function getAreaByIp(ip: string) { + return requestClient.get(`/system/area/get-by-ip?ip=${ip}`); +} diff --git a/apps/web-antd/src/views/system/area/data.ts b/apps/web-antd/src/views/system/area/data.ts new file mode 100644 index 00000000..e4316f70 --- /dev/null +++ b/apps/web-antd/src/views/system/area/data.ts @@ -0,0 +1,50 @@ +import type { VxeTableGridOptions } from '@vben/plugins/vxe-table'; +import type { VbenFormSchema } from '#/adapter/form'; +import type { OnActionClickFn } from '#/adapter/vxe-table'; +import type { SystemAreaApi } from '#/api/system/area'; + +import { z } from '#/adapter/form'; +import { useAccess } from '@vben/access'; + +/** 查询 IP 的表单 */ +export function useFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'ip', + label: 'IP 地址', + component: 'Input', + componentProps: { + placeholder: '请输入 IP 地址', + }, + rules: 'required', + }, + { + fieldName: 'result', + label: '地址', + component: 'Input', + componentProps: { + placeholder: '展示查询 IP 结果', + readonly: true, + } + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + field: 'id', + title: '地区编码', + minWidth: 120, + align: 'left', + fixed: 'left', + treeNode: true, + }, + { + field: 'name', + title: '地区名称', + minWidth: 200, + }, + ]; +} diff --git a/apps/web-antd/src/views/system/area/index.vue b/apps/web-antd/src/views/system/area/index.vue new file mode 100644 index 00000000..88d71d21 --- /dev/null +++ b/apps/web-antd/src/views/system/area/index.vue @@ -0,0 +1,73 @@ + + + diff --git a/apps/web-antd/src/views/system/area/modules/form.vue b/apps/web-antd/src/views/system/area/modules/form.vue new file mode 100644 index 00000000..adce2420 --- /dev/null +++ b/apps/web-antd/src/views/system/area/modules/form.vue @@ -0,0 +1,47 @@ + + +