diff --git a/src/layouts/DrawLayout.vue b/src/layouts/DrawLayout.vue index 0439c26..85be230 100644 --- a/src/layouts/DrawLayout.vue +++ b/src/layouts/DrawLayout.vue @@ -236,7 +236,9 @@ import { SectionDraw } from 'src/graphics/section/SectionDrawAssistant'; import { Section } from 'src/graphics/section/Section'; import { LogicSection } from 'src/graphics/logicSection/LogicSection'; import { LogicSectionDraw } from 'src/graphics/logicSection/LogicSectionDrawAssistant'; +import { useQuasar } from 'quasar'; +const $q = useQuasar(); const route = useRoute(); const router = useRouter(); const searchId = ref(''); @@ -254,14 +256,19 @@ watch( watch( () => searchId.value, () => { - if (searchId.value) { - const device = drawStore - .getDrawApp() - .queryStore.queryById(searchId.value); - if (device) { + try { + if (searchId.value) { + const device = drawStore + .getDrawApp() + .queryStore.queryById(searchId.value); drawStore.getDrawApp().makeGraphicCenterShow(device); drawStore.getDrawApp().updateSelected(device); } + } catch (err) { + $q.notify({ + type: 'negative', + message: `未查找到id为【${searchId.value}】的设备`, + }); } } );