fix: bug#10614、10617、10620、10623、10624、10627、10645、10648、10652、10656、10661、10664、10665 修复网络组件部分bug

This commit is contained in:
jackhoo_98 2023-03-21 17:43:50 +08:00
parent 3bb63f3d41
commit 0b83a9c4df
3 changed files with 67 additions and 27 deletions

View File

@ -95,13 +95,23 @@
>
<j-collapse-panel
:key="cluster.id"
:header="`#${index + 1}.节点`"
:header="
cluster.serverId
? cluster.serverId
: `#${index + 1}.配置信息`
"
collapsible="header"
>
<template #extra v-if="!shareCluster">
<AIcon
@click="removeCluster(cluster)"
type="DeleteOutlined"
/>
<j-popconfirm
@confirm.prevent="
removeCluster(cluster)
"
>
<span class="delete-btn">
删除
</span>
</j-popconfirm>
</template>
<j-row :gutter="[24, 0]">
<j-col :span="12" v-if="!shareCluster">
@ -558,8 +568,8 @@
'secure',
formData.type,
)
? '开启TLS'
: '开启DTLS'
? '开启DTLS'
: '开启TLS'
"
:name="[
'cluster',
@ -801,7 +811,7 @@
>
<j-monaco-editor
theme="vs"
v-model:value="
v-model:modelValue="
cluster
.configuration
.parserConfiguration
@ -968,7 +978,12 @@
</j-collapse>
</div>
<j-form-item v-if="!shareCluster">
<j-button type="dashed" block @click="addCluster">
<j-button
type="primary"
block
ghost
@click="addCluster"
>
<AIcon type="PlusOutlined" />
新增
</j-button>
@ -1116,6 +1131,7 @@ const changeShareCluster = (value: boolean) => {
};
const changeType = (value: string) => {
getResourcesCurrent();
dynamicValidateForm.cluster = [{ ...cloneDeep(FormStates2), id: '1' }];
if (value !== 'MQTT_CLIENT') {
const { configuration } = dynamicValidateForm.cluster[0];
@ -1170,7 +1186,15 @@ const changeParserType = (value: string | undefined, index: number) => {
const saveData = async () => {
await formRef1.value?.validate();
const formRef2Data = await formRef2.value?.validate();
const formRef2Data = await formRef2.value?.validate().catch((err) => {
err.errorFields.forEach((item: any) => {
const activeId: any = dynamicValidateForm.cluster[item.name[1]].id;
if (!activeKey.value.includes(activeId)) {
activeKey.value.push(activeId); //
}
});
});
const { configuration } = formRef2Data?.cluster[0];
const params = shareCluster.value
@ -1179,9 +1203,8 @@ const saveData = async () => {
loading.value = true;
const resp: any =
id === ':id'
? await save(params).catch(() => {})
: await update({ ...params, id }).catch(() => {});
id === ':id' ? await save(params) : await update({ ...params, id });
loading.value = false;
if (resp?.status === 200) {
onlyMessage('操作成功', 'success');
history.back();
@ -1194,7 +1217,6 @@ const saveData = async () => {
}
}
}
loading.value = false;
};
const getSupports = async () => {
@ -1243,6 +1265,10 @@ const getDetail = () => {
} else {
dynamicValidateForm.cluster = cluster;
}
if (dynamicValidateForm.cluster.length === 1) {
dynamicValidateForm.cluster[0].id = '1';
}
}
});
loading.value = false;
@ -1286,6 +1312,7 @@ watch(
},
{ deep: true, immediate: true },
);
watch(
() => NetworkType,
(value) => {
@ -1343,4 +1370,12 @@ watch(
margin-bottom: 20px;
background: #f4f4f4;
}
.delete-btn {
display: inline-block;
color: #e50012;
padding: 0px 8px;
background: #ffffff;
border: 1px solid #e50012;
border-radius: 2px;
}
</style>

View File

@ -63,7 +63,7 @@ export const VisibleData = {
serverId: ['MQTT_CLIENT'],
remoteHost: ['MQTT_CLIENT'],
remotePort: ['MQTT_CLIENT'],
secure: ['TCP_SERVER', 'UDP', 'COAP_SERVER'],
secure: ['UDP', 'COAP_SERVER'],
username: ['MQTT_CLIENT'],
password: ['MQTT_CLIENT'],
topicPrefix: ['MQTT_CLIENT'],
@ -160,7 +160,7 @@ export const Rules = {
},
{
pattern: Validator.regIp || Validator.regDomain,
message: '请输入IP或者域名',
message: '请输入正确格式的域名或ip',
},
],
publicPort: [
@ -180,7 +180,7 @@ export const Rules = {
},
{
pattern: Validator.regIp || Validator.regDomain,
message: '请输入IP或者域名',
message: '请输入正确格式的域名或ip',
},
],
remotePort: [
@ -215,7 +215,8 @@ export const Rules = {
],
password: [
{
required: true,
// required: true,
required: false,
message: '请输入密码',
},
{

View File

@ -157,7 +157,7 @@
</template>
<template #shareCluster="slotProps">
{{
slotProps.shareCluster === true
slotProps.shareCluster === 'true'
? '共享配置'
: '独立配置'
}}
@ -185,10 +185,6 @@ const tableRef = ref<Record<string, any>>({});
const params = ref<Record<string, any>>({});
const options = ref([]);
// const statusMap = new Map();
// statusMap.set('enabled', 'processing');
// statusMap.set('disabled', 'error');
const columns = [
{
title: '名称',
@ -223,8 +219,8 @@ const columns = [
search: {
type: 'select',
options: [
{ label: '共享配置', value: true },
{ label: '独立配置', value: false },
{ label: '共享配置', value: 'true' },
{ label: '独立配置', value: 'false' },
],
},
},
@ -255,6 +251,9 @@ const columns = [
dataIndex: 'description',
key: 'description',
ellipsis: true,
search: {
type: 'string',
},
},
{
title: '操作',
@ -367,8 +366,13 @@ const getDetails = (slotProps: Partial<Record<string, any>>) => {
':' +
(cluster[0].configuration.publicPort ||
cluster[0].configuration.remotePort);
return headers + content;
let head = '远程:';
if (!!shareCluster) {
!!configuration.publicHost && (head = '公网:');
} else {
!!cluster[0].configuration.publicHos && (head = '公网:');
}
return head + headers + content;
};
const getSupports = async () => {