From d9dacf63fab93521f74eccd462e464bbe6ac905f Mon Sep 17 00:00:00 2001 From: zhongzm Date: Fri, 21 Feb 2025 15:49:25 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9AWLAN=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/locales/langs/en-us.ts | 34 ++ src/locales/langs/zh-cn.ts | 34 ++ src/service/api/auth.ts | 43 +++ src/typings/api.d.ts | 86 ++++- src/typings/auto-imports.d.ts | 5 + src/views/device/wlan/index.vue | 639 +++++++++++++++++++++++++++++++- 6 files changed, 829 insertions(+), 12 deletions(-) diff --git a/src/locales/langs/en-us.ts b/src/locales/langs/en-us.ts index 9b0ffc6..7e60789 100644 --- a/src/locales/langs/en-us.ts +++ b/src/locales/langs/en-us.ts @@ -757,6 +757,40 @@ const local: any = { configSuccess:'Config success', configError:'config error', }, + wlan:{ + title:'WLAN', + selectSite:'No Site', + selectGroup:'No Group', + total:'Total', + name:'SSid name', + security:'Security', + none:'None', + wpaEnterprise:'WPA-Enterprise', + wpaPersonal:'WPA-Personal', + ppskWithoutRadius:'PPSK without RADIUS', + ppskWithRadius:'PPSK with RADIUS', + band:'Band', + guestNetwork:'Guest Network', + enable:'Enable', + disable:'Disable', + deviceType:'Device Type', + broadcast:'SSID Broadcast', + vlan:'VLAN', + addSsid:'Add Ssid', + open:'Open', + vlanId:'VLAN ID', + default:'Default', + custom:'Custom', + nameRequired:'Name can not be empty', + nameLength:'Length of name is 1~32 characters', + vlanIdRequired:'VLAN ID can not be empty', + addSuccess:'Add success', + confirmDelete:'Delete device', + deleteConfirmContent:'Do you want to delete the device?', + deleteSuccess:'Delete success', + editSsid:'Edit ssid', + updateSuccess:'Update success', + }, terminal:{ title:'Terminal', total:'Total', diff --git a/src/locales/langs/zh-cn.ts b/src/locales/langs/zh-cn.ts index d8b0e44..d349475 100644 --- a/src/locales/langs/zh-cn.ts +++ b/src/locales/langs/zh-cn.ts @@ -758,6 +758,40 @@ const local:any = { configError:'配置失败', }, + wlan:{ + title:'无线网络', + selectSite:'无站点', + selectGroup:'无网络组', + total:'共', + name:'SSid名称', + security:'安全性', + none:'无', + wpaEnterprise:'WPA-Enterprise', + wpaPersonal:'WPA-Personal', + ppskWithoutRadius:'PPSK without RADIUS', + ppskWithRadius:'PPSK with RADIUS', + band:'频段', + guestNetwork:'访客网络', + enable:'开启', + disable:'关闭', + deviceType:'设备类型', + broadcast:'广播', + vlan:'VLAN', + addSsid:'Ssid配置', + open:'开启', + vlanId:'VLAN ID', + default:'默认', + custom:'定制', + nameRequired:'名称不能为空', + nameLength:'名称长度1~32字符', + vlanIdRequired:'VLAN ID不能为空', + addSuccess:'添加成功', + confirmDelete:'删除设备', + deleteConfirmContent:'确认要删除设备吗', + deleteSuccess:'删除成功', + editSsid:'修改配置', + updateSuccess:'修改成功', + }, terminal:{ title:'终端设备', total:'共', diff --git a/src/service/api/auth.ts b/src/service/api/auth.ts index 51dada2..5be9872 100644 --- a/src/service/api/auth.ts +++ b/src/service/api/auth.ts @@ -307,6 +307,49 @@ export function fetchWlanGroups(siteId: string) { method: 'get' }); } +/** 获取无线网络列表 */ +export function fetchWlanSsidList(siteId: string, wlanId: string, params: { pageNum: number; pageSize: number }) { + return request({ + url: `/system/wlan/ssid/${siteId}/${wlanId}`, + method: 'get', + params: { + pageNum: params.pageNum, + pageSize: params.pageSize + } + }); +} +/** 添加无线网络 */ +export function addWlanSsid(siteId: string, wlanId: string, params: Api.Wlan.AddWlanSsidParams) { + return request({ + url: `/system/wlan/ssid/${siteId}/${wlanId}`, + method: 'post', + data: params + }); +} +/** 删除无线网络 */ +export function deleteWlanSsid(siteId: string, wlanId: string, ssidId: string) { + return request({ + url: `/system/wlan/ssid/${siteId}/${wlanId}/${ssidId}`, + method: 'delete' + }); +} +/** 获取无线网络配置 */ +export function getWlanSsidConfig(siteId: string, wlanId: string, ssidId: string) { + return request({ + url: `/system/wlan/ssid/${siteId}/${wlanId}/${ssidId}`, + method: 'get' + }); +} +/** 修改无线网络配置 */ +export function updateWlanSsid(siteId: string, wlanId: string, ssidId: string, params: Api.Wlan.AddWlanSsidParams) { + return request({ + url: `/system/wlan/ssid/${siteId}/${wlanId}/${ssidId}`, + method: 'put', + data: params + }); +} + + diff --git a/src/typings/api.d.ts b/src/typings/api.d.ts index ece33fa..02f13b5 100644 --- a/src/typings/api.d.ts +++ b/src/typings/api.d.ts @@ -798,12 +798,12 @@ declare namespace Api { rows: SiteInfo[]; } - interface SiteResponse { - code: number; - msg: string; - data: SiteListData; - } + type SiteResponse = App.Service.ApiResponse<{ + rows: SiteInfo[]; + total: number; + }>; } + namespace Wlan { interface WlanGroup { wlanId: string; @@ -811,10 +811,78 @@ declare namespace Api { primary: boolean; } - interface WlanGroupResponse { - code: number; - msg: string; - data: WlanGroup[]; + type WlanGroupResponse = App.Service.ApiResponse; + + interface WlanSsid { + ssidId: string; + name: string; + deviceType: number; + band: number; + guestNetEnable: boolean; + security: number; + broadcast: boolean; + vlanEnable: boolean; + vlanId: number | null; + mloEnable?: boolean; + pmfMode?: number; + enable11r?: boolean; + hidePwd?: boolean; + } + + interface WlanSsidConfigResponse extends App.Service.ApiResponse {} + + interface WlanSsidResponse extends App.Service.ApiResponse<{ + rows: WlanSsid[]; + total: number; + }>{} + + interface WlanSsidParams { + pageNum: number; + pageSize: number; + } + interface AddWlanSsidParams { + name: string; + deviceType: number; + band: number; + guestNetEnable: boolean; + security: number; + broadcast: boolean; + vlanEnable: boolean; + vlanId?: number; + // 固定值字段 + mloEnable: false; + pmfMode: 1; + enable11r: false; + hidePwd: false; + greEnable: false; + } + + // 表单数据类型 + interface WlanSsidForm { + name: string; + deviceType: { + eap: boolean; + gateway: boolean; + }; + band: { + band24G: boolean; + band5G: boolean; + band6G: boolean; + }; + guestNetEnable: boolean; + security: number; + broadcast: boolean; + vlanEnable: boolean; + vlanId?: number; + } + } +} + +declare namespace App { + namespace Service { + interface ApiResponse { + data: T; + error: any; } } } diff --git a/src/typings/auto-imports.d.ts b/src/typings/auto-imports.d.ts index dc09ea3..3297b01 100644 --- a/src/typings/auto-imports.d.ts +++ b/src/typings/auto-imports.d.ts @@ -16,6 +16,7 @@ declare global { const addPackage: typeof import('../service/api/auth')['addPackage'] const addRateLimit: typeof import('../service/api/auth')['addRateLimit'] const addThemeVarsToHtml: typeof import('../store/modules/theme/shared')['addThemeVarsToHtml'] + const addWlanSsid: typeof import('../service/api/auth')['addWlanSsid'] const adoptApDevice: typeof import('../service/api/auth')['adoptApDevice'] const afterAll: typeof import('vitest')['afterAll'] const afterEach: typeof import('vitest')['afterEach'] @@ -65,6 +66,7 @@ declare global { const delJobLog: typeof import('../service/api/job')['delJobLog'] const deleteApDevices: typeof import('../service/api/auth')['deleteApDevices'] const deletePackage: typeof import('../service/api/auth')['deletePackage'] + const deleteWlanSsid: typeof import('../service/api/auth')['deleteWlanSsid'] const describe: typeof import('vitest')['describe'] const dict: typeof import('../store/modules/dict/index')['default'] const doAddDept: typeof import('../service/api/dept')['doAddDept'] @@ -146,6 +148,7 @@ declare global { const fetchSiteList: typeof import('../service/api/auth')['fetchSiteList'] const fetchTerminalList: typeof import('../service/api/auth')['fetchTerminalList'] const fetchWlanGroups: typeof import('../service/api/auth')['fetchWlanGroups'] + const fetchWlanSsidList: typeof import('../service/api/auth')['fetchWlanSsidList'] const filterAuthRoutesByRoles: typeof import('../store/modules/route/shared')['filterAuthRoutesByRoles'] const filterTabsById: typeof import('../store/modules/tab/shared')['filterTabsById'] const filterTabsByIds: typeof import('../store/modules/tab/shared')['filterTabsByIds'] @@ -178,6 +181,7 @@ declare global { const getTabByRoute: typeof import('../store/modules/tab/shared')['getTabByRoute'] const getTabIdByRoute: typeof import('../store/modules/tab/shared')['getTabIdByRoute'] const getToken: typeof import('../store/modules/auth/shared')['getToken'] + const getWlanSsidConfig: typeof import('../service/api/auth')['getWlanSsidConfig'] const h: typeof import('vue')['h'] const ignorableWatch: typeof import('@vueuse/core')['ignorableWatch'] const initThemeSettings: typeof import('../store/modules/theme/shared')['initThemeSettings'] @@ -297,6 +301,7 @@ declare global { const updatePackage: typeof import('../service/api/auth')['updatePackage'] const updateTabByI18nKey: typeof import('../store/modules/tab/shared')['updateTabByI18nKey'] const updateTabsByI18nKey: typeof import('../store/modules/tab/shared')['updateTabsByI18nKey'] + const updateWlanSsid: typeof import('../service/api/auth')['updateWlanSsid'] const useActiveElement: typeof import('@vueuse/core')['useActiveElement'] const useAnimate: typeof import('@vueuse/core')['useAnimate'] const useAntdForm: typeof import('../hooks/common/form')['useAntdForm'] diff --git a/src/views/device/wlan/index.vue b/src/views/device/wlan/index.vue index 803f1b7..5ba6f67 100644 --- a/src/views/device/wlan/index.vue +++ b/src/views/device/wlan/index.vue @@ -1,6 +1,639 @@ - + + + + +