diff --git a/src/store/instance.ts b/src/store/instance.ts index 5d617ae2..92e06b47 100644 --- a/src/store/instance.ts +++ b/src/store/instance.ts @@ -1,6 +1,7 @@ import { DeviceInstance, InstanceModel } from "@/views/device/Instance/typings" import { defineStore } from "pinia" import { detail } from '@/api/device/instance' +import { onlyMessage } from "@/utils/comm" export const useInstanceStore = defineStore({ id: 'device', @@ -15,10 +16,14 @@ export const useInstanceStore = defineStore({ this.detail = current }, async refresh(id: string) { - const resp = await detail(id) + const resp: any = await detail(id).catch((err) => { + onlyMessage(err.response.data.message, 'error') + }) if(resp.status === 200){ this.current = resp.result this.detail = resp.result + } else { + onlyMessage(resp?.message, 'error') } }, setTabActiveKey(key: string) { diff --git a/src/views/device/Instance/Detail/index.vue b/src/views/device/Instance/Detail/index.vue index 7cadf19e..5b41c6f6 100644 --- a/src/views/device/Instance/Detail/index.vue +++ b/src/views/device/Instance/Detail/index.vue @@ -328,6 +328,7 @@ const jumpProduct = () => { }; onUnmounted(() => { + instanceStore.current = {} as any statusRef.value && statusRef.value.unsubscribe(); }); diff --git a/src/views/edge/Device/index.vue b/src/views/edge/Device/index.vue index 38315647..8aae7440 100644 --- a/src/views/edge/Device/index.vue +++ b/src/views/edge/Device/index.vue @@ -51,7 +51,9 @@ >