From 67dafcc72a53ca172d13fa3b7cd3dc4ddc65d6f5 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 6 Apr 2025 09:28:18 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E5=A2=9E=E5=8A=A0=20area=20?= =?UTF-8?q?=E5=9C=B0=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/api/system/area/index.ts | 24 ++++++ apps/web-antd/src/views/system/area/data.ts | 50 +++++++++++++ apps/web-antd/src/views/system/area/index.vue | 73 +++++++++++++++++++ .../src/views/system/area/modules/form.vue | 47 ++++++++++++ 4 files changed, 194 insertions(+) create mode 100644 apps/web-antd/src/api/system/area/index.ts create mode 100644 apps/web-antd/src/views/system/area/data.ts create mode 100644 apps/web-antd/src/views/system/area/index.vue create mode 100644 apps/web-antd/src/views/system/area/modules/form.vue 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 000000000..fb06eda3e --- /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 000000000..e4316f70e --- /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 000000000..88d71d216 --- /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 000000000..adce24200 --- /dev/null +++ b/apps/web-antd/src/views/system/area/modules/form.vue @@ -0,0 +1,47 @@ + + +