fix: bug#10645、10616 修复网络组件部分bug

This commit is contained in:
jackhoo_98 2023-03-22 17:18:07 +08:00
parent a3ac144a72
commit 8606bfdb0b
2 changed files with 55 additions and 10 deletions

View File

@ -91,17 +91,41 @@
>
<j-collapse
v-model:activeKey="activeKey"
class="collapse"
:class="[
!formData.shareCluster
? 'collapse'
: 'collapse-panel',
]"
:ghost="formData.shareCluster"
collapsible="header"
>
<j-collapse-panel
:key="cluster.id"
:show-arrow="!formData.shareCluster"
>
<!-- <j-collapse-panel
:key="cluster.id"
:header="
cluster.serverId
? cluster.serverId
: `#${index + 1}.配置信息`
: !formData.shareCluster
? `#${index + 1}.配置信息`
: ''
"
collapsible="header"
>
:show-arrow="!formData.shareCluster"
> -->
<template #header v-if="!shareCluster">
<div class="collapse-header">
{{
cluster.serverId
? cluster.serverId
: !formData.shareCluster
? `#${index + 1}.配置信息`
: ''
}}
</div>
</template>
<template #extra v-if="!shareCluster">
<j-popconfirm
@confirm.prevent="
@ -1112,6 +1136,10 @@ const filterConfigByType = (data: any, type: string) => {
});
};
const changeheader = (value: string) => {
console.log(22, value);
};
const getPortOptions = (portOptions: object, index = 0) => {
if (!portOptions) return;
const type = formData.value.type;
@ -1369,7 +1397,20 @@ watch(
.collapse {
margin-bottom: 20px;
background: #f4f4f4;
:deep(.ant-collapse-header-text) {
flex: 1;
}
}
.collapse-panel {
margin-bottom: 20px;
border: #d9d9d9 1px solid;
background: #f4f4f4;
border-radius: 2px;
:deep(.ant-collapse-header) {
padding: 0;
}
}
.delete-btn {
display: inline-block;
color: #e50012;

View File

@ -20,8 +20,8 @@ export const Configuration = {
script: '',
size: '',
length: '4',
offset: '0',
little: 'false',
offset: undefined,
little: undefined,
},
};
@ -103,11 +103,12 @@ export const isVisible = (
) => VisibleData[LastName].includes(dependencies);
export const Validator = {
regIp: new RegExp(
/((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/,
regIpv4: new RegExp(
/^((([01]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))\.){3}(([01]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))$/,
),
regIPv6: new RegExp(/^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/),
regDomain: new RegExp(
/[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\.?/,
/^https?:\/\/(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i,
),
regOnlyNumber: new RegExp(/^\d+$/),
};
@ -159,7 +160,8 @@ export const Rules = {
message: '请输入公网地址',
},
{
pattern: Validator.regIp || Validator.regDomain,
pattern:
Validator.regIpv4 || Validator.regIPv6 || Validator.regDomain,
message: '请输入正确格式的域名或ip',
},
],
@ -179,7 +181,9 @@ export const Rules = {
message: '请输入远程地址',
},
{
pattern: Validator.regIp || Validator.regDomain,
pattern:
Validator.regIpv4 || Validator.regIPv6 || Validator.regDomain,
message: '请输入正确格式的域名或ip',
},
],