diff --git a/src/locales/langs/en-us.ts b/src/locales/langs/en-us.ts index 8422cea..f3cf3e1 100644 --- a/src/locales/langs/en-us.ts +++ b/src/locales/langs/en-us.ts @@ -797,6 +797,9 @@ const local: any = { total:'Total', name:'SSID Name', none:'None', + passwordPlaceholder:'Please enter an 8~63-digit password', + passwordRequired:'The password cannot be empty', + passwordLength:'Please enter 8~63 characters or numbers for the password', security: { security:'Security', wpaEnterprise: 'WPA-Enterprise', @@ -804,9 +807,11 @@ const local: any = { ppskWithoutRadius: 'PPSK without RADIUS', ppskWithRadius: 'PPSK with RADIUS', }, + password:'Password', portalEnable:'Portal', portalName:'Portal Name', band:'Band', + bandtip:'Only 8 SSIDs can exist for each band type at 2.4 GHz, 5 GHz, and 6 GHz', guestNetwork:'Guest Network', enable:'Enable', disable:'Disable', diff --git a/src/locales/langs/zh-cn.ts b/src/locales/langs/zh-cn.ts index b6fc5b8..6dffc13 100644 --- a/src/locales/langs/zh-cn.ts +++ b/src/locales/langs/zh-cn.ts @@ -798,6 +798,9 @@ const local:any = { total:'共', name:'SSID名称', none:'无', + passwordPlaceholder:'请输入8~63位的密码', + passwordRequired:'密码不能为空', + passwordLength:'密码请输入长度8~63位字符或数字', security: { security:'安全性', wpaEnterprise: 'WPA-Enterprise', @@ -808,6 +811,7 @@ const local:any = { portalEnable:'门户', portalName:'门户名称', band:'频段', + bandtip:'2.4GHz、5GHz、6GHz每种Band类型只能存在8个ssid', guestNetwork:'访客网络', enable:'开启', disable:'关闭', diff --git a/src/typings/api.d.ts b/src/typings/api.d.ts index 65cc296..a54ceb8 100644 --- a/src/typings/api.d.ts +++ b/src/typings/api.d.ts @@ -873,6 +873,12 @@ declare namespace Api { broadcast: boolean; vlanEnable: boolean; vlanId?: number; + pskSetting:{ + securityKey:string; + versionPsk:number; + encryptionPsk:number; + gikRekeyPskEnable:boolean; + }; // 固定值字段 mloEnable: false; pmfMode: 1; @@ -893,8 +899,15 @@ declare namespace Api { band5G: boolean; band6G: boolean; }; + password:string; guestNetEnable: boolean; security: number; + pskSetting:{ + securityKey:string; + versionPsk:number; + encryptionPsk:number; + gikRekeyPskEnable:boolean; + }; broadcast: boolean; vlanEnable: boolean; vlanId?: number; diff --git a/src/views/device/wlan/index.vue b/src/views/device/wlan/index.vue index 3e244f0..6584feb 100644 --- a/src/views/device/wlan/index.vue +++ b/src/views/device/wlan/index.vue @@ -132,7 +132,17 @@ - + + 2.4GHz 5GHz @@ -147,9 +157,20 @@ {{ t('page.wlan.none') }} + {{ t('page.wlan.security.wpaPersonal') }} + + + + {{t('page.wlan.open')}} @@ -197,7 +218,17 @@ - + + 2.4GHz 5GHz @@ -212,9 +243,22 @@ {{ t('page.wlan.none') }} + {{ t('page.wlan.security.wpaPersonal') }} + + + + {{t('page.wlan.open')}} @@ -246,7 +290,7 @@ import { Card as ACard, Table as ATable, message, Modal } from 'ant-design-vue'; import { useI18n } from 'vue-i18n'; import { fetchSiteList, fetchWlanGroups, fetchWlanSsidList, addWlanSsid, deleteWlanSsid, updateWlanSsid, getWlanSsidConfig } from '@/service/api/auth'; import { useTable } from '@/hooks/common/table'; -import { DeleteOutlined, EditOutlined } from '@ant-design/icons-vue'; +import { DeleteOutlined, EditOutlined,InfoCircleOutlined } from '@ant-design/icons-vue'; import {centerAlign} from "consola/utils"; const { t } = useI18n(); @@ -443,8 +487,15 @@ const addForm = ref({ band5G: true, band6G: false }, + password:'', guestNetEnable: false, - security: 0, + pskSetting:{ + securityKey:'', + versionPsk:2, + encryptionPsk:3, + gikRekeyPskEnable:false, + }, + security:0, broadcast: true, vlanEnable: false, vlanId: undefined @@ -456,6 +507,10 @@ const addRules = { { required: true, message: t('page.wlan.nameRequired') }, { min: 1, max: 32, message: t('page.wlan.nameLength') } ], + password: [ + { required: true, message: t('page.wlan.passwordRequired') }, + { min: 8, max: 63, message: t('page.wlan.passwordLength') }, + ], vlanId: [ { required: true, @@ -466,7 +521,7 @@ const addRules = { return Promise.resolve(); } } - ] + ], }; // 处理添加按钮点击 @@ -497,9 +552,19 @@ const handleAddConfirm = async () => { pmfMode: 1, enable11r: false, hidePwd: false, - greEnable:false, + greEnable: false, }; + // 只有当 security 为 WPA Personal (3) 时才添加 pskSetting + if (addForm.value.security === 3) { + params.pskSetting = { + securityKey: addForm.value.password, + versionPsk: 2, + encryptionPsk: 3, + gikRekeyPskEnable: false + }; + } + const { error } = await addWlanSsid(selectedSiteId.value, selectedGroupId.value, params); hide(); @@ -528,6 +593,13 @@ const editForm = ref({ }, guestNetEnable: false, security: 0, + password:'', + pskSetting:{ + securityKey:'', + versionPsk:2, + encryptionPsk:3, + gikRekeyPskEnable:false, + }, broadcast: true, vlanEnable: false, vlanId: undefined @@ -561,6 +633,12 @@ const handleEdit = async (record: Api.Wlan.WlanSsid) => { band5G: !!(data.band & 2), band6G: !!(data.band & 4) }, + pskSetting:{ + securityKey:data.securityKey, + versionPsk:data.versionPsk, + encryptionPsk:data.encryptionPsk, + gikRekeyPskEnable:data.gikRekeyPskEnable, + }, guestNetEnable: data.guestNetEnable, security: data.security, broadcast: data.broadcast, @@ -598,6 +676,16 @@ const handleEditConfirm = async () => { greEnable: false, }; + // 只有当 security 为 WPA Personal (3) 时才添加 pskSetting + if (editForm.value.security === 3) { + params.pskSetting = { + securityKey: editForm.value.password, + versionPsk: 2, + encryptionPsk: 3, + gikRekeyPskEnable: false + }; + } + const { error } = await updateWlanSsid( selectedSiteId.value, selectedGroupId.value,