From e278ae3ebc13e58dfd9bff7c37c44aa68f790230 Mon Sep 17 00:00:00 2001 From: wangshuaiswim Date: Thu, 23 Mar 2023 11:38:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E7=89=A9=E6=A8=A1?= =?UTF-8?q?=E5=9E=8BBUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device/components/Metadata/Base/index.vue | 5 +++-- .../device/components/Metadata/Cat/index.vue | 19 +++++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/views/device/components/Metadata/Base/index.vue b/src/views/device/components/Metadata/Base/index.vue index f6a4a2fe..2de332eb 100644 --- a/src/views/device/components/Metadata/Base/index.vue +++ b/src/views/device/components/Metadata/Base/index.vue @@ -196,11 +196,12 @@ const resetMetadata = async () => { // } const { id } = route.params if (target === 'device') { - instanceStore.refresh(id as string) + await instanceStore.refresh(id as string) } else { - productStore.refresh(id as string) + await productStore.getDetail(id as string) } metadataStore.set('importMetadata', true) + }; const removeItem = async (record: MetadataItem) => { diff --git a/src/views/device/components/Metadata/Cat/index.vue b/src/views/device/components/Metadata/Cat/index.vue index 994cce45..9ff7c0bd 100644 --- a/src/views/device/components/Metadata/Cat/index.vue +++ b/src/views/device/components/Metadata/Cat/index.vue @@ -61,12 +61,15 @@ const close = () => { const instanceStore = useInstanceStore() const productStore = useProductStore() -const metadataMap = { - product: productStore.current?.metadata as string, - device: instanceStore.current?.metadata as string, -}; -const metadata = metadataMap[props.type]; -const value = ref(metadata) +const metadata = computed(() => { + const metadataMap = { + product: productStore.current?.metadata as string, + device: instanceStore.current?.metadata as string, + }; + return metadataMap[props.type]; +}) +// const metadata = metadataMap[props.type]; +const value = ref(metadata.value) const handleExport = async () => { try { downloadObject( @@ -86,14 +89,14 @@ const handleConvertMetadata = (key: Key) => { if (key === 'alink') { value.value = ''; if (metadata) { - convertMetadata('to', 'alink', JSON.parse(metadata)).then(res => { + convertMetadata('to', 'alink', JSON.parse(metadata.value)).then(res => { if (res.status === 200) { value.value = JSON.stringify(res.result) } }); } } else { - value.value = metadata; + value.value = metadata.value; } };