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; } };