update: 国标级联表单数据赋值方式更改
This commit is contained in:
parent
020a917b13
commit
fac1b5d1df
|
@ -1,12 +1,13 @@
|
|||
<template>
|
||||
<a-card>
|
||||
<a-empty
|
||||
v-if="!metadata || (metadata && !metadata.functions)"
|
||||
style="margin-top: 100px"
|
||||
v-if="!metadata || (metadata && !metadata.functions.length)"
|
||||
style="margin-top: 50px"
|
||||
>
|
||||
<template #description>
|
||||
暂无数据,请配置
|
||||
<a @click="emits('onJump', 'Metadata')">物模型</a>
|
||||
请配置对应产品的
|
||||
<!-- <a @click="emits('onJump', 'Metadata')">物模型属性功能</a> -->
|
||||
<a @click="onJump">物模型属性功能</a>
|
||||
</template>
|
||||
</a-empty>
|
||||
<template v-else>
|
||||
|
@ -23,9 +24,12 @@
|
|||
import { useInstanceStore } from '@/store/instance';
|
||||
import Simple from './components/Simple.vue';
|
||||
import Advance from './components/Advance.vue';
|
||||
import { useMenuStore } from 'store/menu';
|
||||
|
||||
const menuStory = useMenuStore();
|
||||
|
||||
const instanceStore = useInstanceStore();
|
||||
const emits = defineEmits(['onJump']);
|
||||
// const emits = defineEmits(['onJump']);
|
||||
|
||||
const metadata = computed(() => JSON.parse(instanceStore.detail.metadata));
|
||||
|
||||
|
@ -34,6 +38,14 @@ const tabs = {
|
|||
Simple,
|
||||
Advance,
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
const onJump = () => {
|
||||
menuStory.jumpPage(
|
||||
'device/Product/Detail',
|
||||
{
|
||||
id: instanceStore.current.productId,
|
||||
},
|
||||
{ key: 'metadata' },
|
||||
);
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -637,33 +637,14 @@ const setPorts = () => {
|
|||
const getDetail = async () => {
|
||||
if (!route.query.id) return;
|
||||
const res = await CascadeApi.detail(route.query.id as string);
|
||||
const { id, name, proxyStream, sipConfigs } = res.result;
|
||||
formData.value = {
|
||||
id,
|
||||
cascadeName: name,
|
||||
proxyStream,
|
||||
clusterNodeId: sipConfigs[0]?.clusterNodeId,
|
||||
name: sipConfigs[0]?.name,
|
||||
sipId: sipConfigs[0]?.sipId,
|
||||
domain: sipConfigs[0]?.domain,
|
||||
remoteAddress: sipConfigs[0]?.remoteAddress,
|
||||
remotePort: sipConfigs[0]?.remotePort,
|
||||
localSipId: sipConfigs[0]?.localSipId,
|
||||
host: sipConfigs[0]?.host,
|
||||
port: sipConfigs[0]?.port,
|
||||
publicHost: sipConfigs[0]?.publicHost,
|
||||
publicPort: sipConfigs[0]?.publicPort,
|
||||
transport: sipConfigs[0]?.transport,
|
||||
user: sipConfigs[0]?.user,
|
||||
password: sipConfigs[0]?.password,
|
||||
manufacturer: sipConfigs[0]?.manufacturer,
|
||||
model: sipConfigs[0]?.model,
|
||||
firmware: sipConfigs[0]?.firmware,
|
||||
keepaliveInterval: sipConfigs[0]?.keepaliveInterval,
|
||||
registerInterval: sipConfigs[0]?.registerInterval,
|
||||
};
|
||||
|
||||
console.log('formData.value: ', formData.value);
|
||||
const { id, name, proxyStream, sipConfigs, ...others } = res.result;
|
||||
Object.keys(formData.value).forEach((key: string) => {
|
||||
if (key === 'id') formData.value[key] = id;
|
||||
else if (key === 'cascadeName') formData.value[key] = name;
|
||||
else if (key === 'proxyStream') formData.value[key] = proxyStream;
|
||||
else formData.value[key] = sipConfigs[0][key];
|
||||
});
|
||||
// console.log('formData.value: ', formData.value);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
|
|
Loading…
Reference in New Issue