fix: 修改物模型导入后调用的刷新接口

This commit is contained in:
wangshuaiswim 2023-04-01 15:13:18 +08:00
parent 2649b6f755
commit 391ed48365
2 changed files with 4 additions and 14 deletions

View File

@ -25,7 +25,7 @@ export const useProductStore = defineStore({
} }
}, },
async refresh(id: string) { async refresh(id: string) {
this.getDetail(id) await this.getDetail(id)
const res = await getDeviceNumber(encodeQuery({ terms: { productId: id } })) const res = await getDeviceNumber(encodeQuery({ terms: { productId: id } }))
if (res.status === 200) { if (res.status === 200) {
this.current.count = res.result this.current.count = res.result

View File

@ -227,7 +227,7 @@ const handleImport = async () => {
if (props?.type === 'device') { if (props?.type === 'device') {
await instanceStore.refresh(id as string) await instanceStore.refresh(id as string)
} else { } else {
await productStore.refresh(id as string) await productStore.getDetail(id as string)
} }
metadataStore.set('importMetadata', true) metadataStore.set('importMetadata', true)
// Store.set(SystemConst.GET_METADATA, true) // Store.set(SystemConst.GET_METADATA, true)
@ -257,22 +257,12 @@ const handleImport = async () => {
} }
loading.value = false loading.value = false
if (resp.success) { if (resp.success) {
if (props?.type === 'device') { message.success('导入成功')
// const detail = instanceStore.current
// detail.metadata = JSON.stringify(paramsDevice)
// instanceStore.setCurrent(detail)
message.success('导入成功')
} else {
// const detail = productStore.current
// detail.metadata = params.metadata
// productStore.setCurrent(detail)
message.success('导入成功')
}
} }
if (props?.type === 'device') { if (props?.type === 'device') {
await instanceStore.refresh(id as string) await instanceStore.refresh(id as string)
} else { } else {
await productStore.refresh(id as string) await productStore.getDetail(id as string)
} }
metadataStore.set('importMetadata', true) metadataStore.set('importMetadata', true)
// Store.set(SystemConst.GET_METADATA, true) // Store.set(SystemConst.GET_METADATA, true)