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
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) => {

View File

@ -61,12 +61,15 @@ const close = () => {
const instanceStore = useInstanceStore()
const productStore = useProductStore()
const metadata = computed(() => {
const metadataMap = {
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 () => {
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;
}
};