From 2d16080f03da9f87bc146a455de0cb104c355bc7 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 21 Dec 2025 15:55:33 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E3=80=90system=E3=80=91=E5=9C=B0?= =?UTF-8?q?=E5=8C=BA=E7=AE=A1=E7=90=86=EF=BC=9A100%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../area/components/area-tree-item.vue | 63 +++++++++++++ .../area/components/ip-query-form.vue | 74 +++++++++++++++ src/pages-system/area/index.vue | 91 +++++++++++++++++++ src/pages/index/index.ts | 7 ++ src/utils/validator.ts | 17 ++++ 5 files changed, 252 insertions(+) create mode 100644 src/pages-system/area/components/area-tree-item.vue create mode 100644 src/pages-system/area/components/ip-query-form.vue create mode 100644 src/pages-system/area/index.vue diff --git a/src/pages-system/area/components/area-tree-item.vue b/src/pages-system/area/components/area-tree-item.vue new file mode 100644 index 0000000..e3b402e --- /dev/null +++ b/src/pages-system/area/components/area-tree-item.vue @@ -0,0 +1,63 @@ + + + + + diff --git a/src/pages-system/area/components/ip-query-form.vue b/src/pages-system/area/components/ip-query-form.vue new file mode 100644 index 0000000..c3e2a5d --- /dev/null +++ b/src/pages-system/area/components/ip-query-form.vue @@ -0,0 +1,74 @@ + + + + + diff --git a/src/pages-system/area/index.vue b/src/pages-system/area/index.vue new file mode 100644 index 0000000..0e8b1db --- /dev/null +++ b/src/pages-system/area/index.vue @@ -0,0 +1,91 @@ + + + + + diff --git a/src/pages/index/index.ts b/src/pages/index/index.ts index 9f48a97..f404f7e 100644 --- a/src/pages/index/index.ts +++ b/src/pages/index/index.ts @@ -149,6 +149,13 @@ const menuGroupsData: MenuGroup[] = [ iconColor: '#faad14', permission: 'system:dict:query', }, + { + key: 'area', + name: '地区管理', + icon: 'location', + url: '/pages-system/area/index', + iconColor: '#d50f0f', + }, ], }, { diff --git a/src/utils/validator.ts b/src/utils/validator.ts index 1a35beb..db12000 100644 --- a/src/utils/validator.ts +++ b/src/utils/validator.ts @@ -4,6 +4,10 @@ const MOBILE_REGEX = /^1[3-9]\d{9}$/ /** 邮箱正则表达式 */ const EMAIL_REGEX = /^[\w-]+(?:\.[\w-]+)*@[\w-]+(?:\.[\w-]+)+$/ +/** IP 地址正则表达式(IPv4) */ +// eslint-disable-next-line regexp/no-unused-capturing-group +const IP_REGEX = /^(\d{1,3}\.){3}\d{1,3}$/ + /** * 判断字符串是否为空白(null、undefined、空字符串或仅包含空白字符) * @@ -39,3 +43,16 @@ export function isEmail(value?: null | string): boolean { } return EMAIL_REGEX.test(value) } + +/** + * 验证是否为 IP 地址(IPv4) + * + * @param value 值 + * @returns 是否为 IP 地址 + */ +export function isIp(value?: null | string): boolean { + if (!value) { + return false + } + return IP_REGEX.test(value) +}