fix: 修改物模型BUG

This commit is contained in:
wangshuaiswim 2023-03-23 11:38:27 +08:00
parent 93f56a6441
commit e278ae3ebc
2 changed files with 14 additions and 10 deletions

View File

@ -196,11 +196,12 @@ const resetMetadata = async () => {
// } // }
const { id } = route.params const { id } = route.params
if (target === 'device') { if (target === 'device') {
instanceStore.refresh(id as string) await instanceStore.refresh(id as string)
} else { } else {
productStore.refresh(id as string) await productStore.getDetail(id as string)
} }
metadataStore.set('importMetadata', true) metadataStore.set('importMetadata', true)
}; };
const removeItem = async (record: MetadataItem) => { const removeItem = async (record: MetadataItem) => {

View File

@ -61,12 +61,15 @@ const close = () => {
const instanceStore = useInstanceStore() const instanceStore = useInstanceStore()
const productStore = useProductStore() const productStore = useProductStore()
const metadataMap = { const metadata = computed(() => {
product: productStore.current?.metadata as string, const metadataMap = {
device: instanceStore.current?.metadata as string, product: productStore.current?.metadata as string,
}; device: instanceStore.current?.metadata as string,
const metadata = metadataMap[props.type]; };
const value = ref(metadata) return metadataMap[props.type];
})
// const metadata = metadataMap[props.type];
const value = ref(metadata.value)
const handleExport = async () => { const handleExport = async () => {
try { try {
downloadObject( downloadObject(
@ -86,14 +89,14 @@ const handleConvertMetadata = (key: Key) => {
if (key === 'alink') { if (key === 'alink') {
value.value = ''; value.value = '';
if (metadata) { if (metadata) {
convertMetadata('to', 'alink', JSON.parse(metadata)).then(res => { convertMetadata('to', 'alink', JSON.parse(metadata.value)).then(res => {
if (res.status === 200) { if (res.status === 200) {
value.value = JSON.stringify(res.result) value.value = JSON.stringify(res.result)
} }
}); });
} }
} else { } else {
value.value = metadata; value.value = metadata.value;
} }
}; };