2
0

feat:wlan增加密码配置以及band限制提示

This commit is contained in:
zhongzm
2025-04-15 18:52:40 +08:00
parent b27aebed73
commit 59d54185f5
4 changed files with 116 additions and 6 deletions

View File

@@ -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',

View File

@@ -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:'关闭',

13
src/typings/api.d.ts vendored
View File

@@ -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;

View File

@@ -132,7 +132,17 @@
</a-space>
</a-form-item>
<a-form-item name="band" :label="t('page.wlan.band')">
<a-form-item name="band">
<template #label>
<span class="ant-form-item-label-wrap">
<span class="ant-form-item-label-text">{{ t('page.wlan.band') }}</span>
<a-tooltip placement="topLeft" :title="t('page.wlan.bandtip')">
<span class="ant-form-item-tooltip">
<InfoCircleOutlined />
</span>
</a-tooltip>
</span>
</template>
<a-space>
<a-checkbox v-model:checked="addForm.band.band24G">2.4GHz</a-checkbox>
<a-checkbox v-model:checked="addForm.band.band5G">5GHz</a-checkbox>
@@ -147,9 +157,20 @@
<a-form-item name="security" :label="t('page.wlan.security.security')">
<a-select v-model:value="addForm.security">
<a-select-option :value="0">{{ t('page.wlan.none') }}</a-select-option>
<a-select-option :value="3">{{ t('page.wlan.security.wpaPersonal') }}</a-select-option>
</a-select>
</a-form-item>
<a-form-item
v-if="addForm.security === 3"
name="password"
:label="t('page.wlan.password')"
>
<a-input
v-model:value="addForm.password"
/>
</a-form-item>
<a-form-item name="broadcast" :label="t('page.wlan.broadcast')">
<a-checkbox v-model:checked="addForm.broadcast" /> {{t('page.wlan.open')}}
</a-form-item>
@@ -197,7 +218,17 @@
</a-space>
</a-form-item>
<a-form-item name="band" :label="t('page.wlan.band')">
<a-form-item name="band">
<template #label>
<span class="ant-form-item-label-wrap">
<span class="ant-form-item-label-text">{{ t('page.wlan.band') }}</span>
<a-tooltip placement="topLeft" :title="t('page.wlan.bandtip')">
<span class="ant-form-item-tooltip">
<InfoCircleOutlined />
</span>
</a-tooltip>
</span>
</template>
<a-space>
<a-checkbox v-model:checked="editForm.band.band24G">2.4GHz</a-checkbox>
<a-checkbox v-model:checked="editForm.band.band5G">5GHz</a-checkbox>
@@ -212,9 +243,22 @@
<a-form-item name="security" :label="t('page.wlan.security.security')">
<a-select v-model:value="editForm.security">
<a-select-option :value="0">{{ t('page.wlan.none') }}</a-select-option>
<a-select-option :value="3">{{ t('page.wlan.security.wpaPersonal') }}</a-select-option>
</a-select>
</a-form-item>
<a-form-item
v-if="editForm.security === 3"
name="password"
:label="t('page.wlan.password')"
validateFirst
>
<a-input
v-model:value="editForm.password"
:placeholder="t('page.wlan.passwordPlaceholder')"
/>
</a-form-item>
<a-form-item name="broadcast" :label="t('page.wlan.broadcast')">
<a-checkbox v-model:checked="editForm.broadcast" /> {{t('page.wlan.open')}}
</a-form-item>
@@ -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<Api.Wlan.WlanSsidForm>({
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<Api.Wlan.WlanSsidForm>({
},
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,