fix: bug#16382、16381、16384

This commit is contained in:
XieYongHong 2023-07-15 16:09:30 +08:00
parent 37868fd908
commit 291b65ba19
3 changed files with 57 additions and 26 deletions

View File

@ -210,6 +210,7 @@ import { PropertiesModal, FunctionModal, EventModal, TagsModal } from './DetailM
import { Modal } from 'jetlinks-ui-components'
import {EventEmitter} from "@/utils/utils";
import {watch} from "vue";
import {cloneDeep} from "lodash";
const props = defineProps({
target: {
@ -361,7 +362,7 @@ const handleAddClick = async (_data?: any, index?: number) => {
};
const copyItem = (record: any, index: number) => {
const copyData = omit(record, ['_uuid', '_sortIndex'])
const copyData = cloneDeep(omit(record, ['_uuid', '_sortIndex']))
copyData.id = `copy_${copyData.id}`.slice(0,64)
handleAddClick(copyData, index)
}

View File

@ -151,6 +151,14 @@
/^([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])$/,
message: '请输入正确的IP地址',
},
{
max: 65535,
message: '请输入1~65535之间的正整数'
},
{
min: 1,
message: '请输入1~65535之间的正整数'
},
]"
>
<j-input-number
@ -185,6 +193,7 @@
"
:min="1"
:max="65535"
:precision="0"
/>
</j-form-item>
</j-col>
@ -238,7 +247,6 @@
v-model:value="
cluster.clusterNodeId
"
:options="clustersList"
placeholder="请选择节点名称"
allowClear
show-search
@ -246,6 +254,9 @@
filterOption
"
>
<j-select-option v-for="i in getClusterNodeIds(cluster.clusterNodeId)" :value="i.value">
{{ i.label}}
</j-select-option>
</j-select>
</j-form-item>
</j-col>
@ -309,16 +320,20 @@
<div class="form-label"></div>
<j-select
v-model:value="cluster.port"
:options="
sipListIndex[index]
"
placeholder="请选择端口"
allowClear
show-search
:filter-option="
filterOption
"
/>
>
<j-select-option
v-for="i in getSipListOption(sipListIndex[index], cluster.port)"
:value="i.value"
>
{{ i.label }}
</j-select-option>
</j-select>
</j-form-item>
</j-col>
<j-col :span="4">
@ -389,6 +404,7 @@
"
:min="1"
:max="65535"
:precision="0"
/>
</j-form-item>
</j-col>
@ -450,23 +466,26 @@
</div>
</j-col>
<j-col :span="12">
<div class="doc" style="height: 400px">
<h1>接入方式</h1>
<p>
{{ provider.name }}
</p>
<p>
{{ provider.description }}
</p>
<h1>消息协议</h1>
<p>
{{
provider?.id === 'fixed-media'
? 'URL'
: 'SIP'
}}
</p>
</div>
<div style="height: 400px">
<title-component data="配置概览" />
<j-descriptions :column="1" :labelStyle="{ width: '80px'}">
<j-descriptions-item label="接入方式">{{ provider.name }}</j-descriptions-item>
<j-descriptions-item>
<span style="color: #a3a3a3">{{ provider.description }}</span>
</j-descriptions-item>
<j-descriptions-item label="SIP 域">{{ formState.domain }}</j-descriptions-item>
<j-descriptions-item label="SIP ID">{{ formState.sipId }}</j-descriptions-item>
<j-descriptions-item>
<!-- 共享配置 -->
<template v-if="formState.shareCluster">
<a-badge :text="`${formState.hostPort.publicHost}:${formState.hostPort.publicPort}`" status="processing" />
</template>
<template v-else>
<a-badge v-for="i in dynamicValidateForm.cluster" :text="`${i.publicHost}:${i.publicPort}`" status="processing" />
</template>
</j-descriptions-item>
</j-descriptions>
</div>
</j-col>
</j-row>
</div>
@ -667,8 +686,9 @@ const saveData = () => {
};
const next = async () => {
let data1: any = await formRef1.value?.validate();
if (!isNumber(data1.hostPort.port)) {
if (data1.hostPort?.port && !isNumber(data1.hostPort.port) && data1.shareCluster) {
data1.hostPort.port = JSON.parse(data1.hostPort.port).port;
}
if (!data1?.shareCluster) {
@ -721,6 +741,16 @@ const develop = () => {
}
};
const getClusterNodeIds = (id?: string) => {
const keys = dynamicValidateForm?.cluster?.map?.(item => item.clusterNodeId) || []
return clustersList.value.filter(item => item.value === id || !keys.includes(item.value) )
}
const getSipListOption = (list: any[], id: string) => {
const keys = dynamicValidateForm?.cluster?.map?.(item => item.port) || []
return (list || []).filter(item => item.value === id || !keys.includes(item.value) )
}
onMounted(() => {
getResourcesCurrent().then((resp) => {
if (resp.status === 200) {

View File

@ -3837,8 +3837,8 @@ jetlinks-ui-components@^1.0.23:
jetlinks-ui-components@^1.0.24:
version "1.0.24"
resolved "http://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.24.tgz#0bd3caf482367d46974244558519dfa7919baf1f"
integrity sha512-bXJZUWU27kDpnvhR+zKtUZQjrq+S130abBD2D37PnbHeUtT8g/i1CRV8Qnp1SMzk7aRDH9glVSjbzIQxem3YMQ==
resolved "http://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.24.tgz#a1262b3a735a01cd1fd9801406d16291b5070367"
integrity sha512-P4aolPQb1/wq4edN0AZ6WSavVAvQ+KEOEFzAarL/0dy6Oz3tTVemZmtgu20TsGbrNnEe/LheMu0QpvmkOq+3dg==
dependencies:
"@vueuse/core" "^9.12.0"
"@vueuse/router" "^9.13.0"