diff --git a/src/components/common/CommonTab.vue b/src/components/common/CommonTab.vue index 381d82c..e62e8f9 100644 --- a/src/components/common/CommonTab.vue +++ b/src/components/common/CommonTab.vue @@ -1,43 +1,20 @@ @@ -138,14 +115,14 @@ export default { // 查找当前激活的标签(effect为'dark'的标签) const scrollWrapper = this.$refs.scrollWrapper; const tagElements = scrollWrapper.querySelectorAll('.el-tag'); - + // 遍历标签元素,找到与当前路由匹配的标签 let activeTag = null; for (let i = 0; i < tagElements.length; i++) { const tagElement = tagElements[i]; // 获取标签内的文本内容 const tagText = tagElement.textContent ? tagElement.textContent.trim() : ''; - + // 检查标签文本是否与当前路由名称匹配 if (tagText === this.$route.name) { activeTag = tagElement; @@ -155,14 +132,14 @@ export default { if (activeTag) { const tagPosition = activeTag.offsetLeft; const tagWidth = activeTag.offsetWidth; - + // 无论如何都滚动到使标签居中的位置 const scrollTo = tagPosition - (scrollWrapper.clientWidth - tagWidth) / 2; scrollWrapper.scrollTo({ left: scrollTo, behavior: 'smooth' }); - + // 滚动后更新按钮状态(防抖) setTimeout(() => { this.debouncedUpdateButtonStates(); @@ -170,15 +147,34 @@ export default { } }); }, + handleClose(tag, index) { let length = this.tags.length - 1; this.close(tag); + // 关闭医生诊台时,要关闭医生诊台的监听 add by pengj 2026-02-26 + if (tag?.displayName == "体检医生诊台" && this.$peisAPI) { + console.log("CommonTab.handleClose", tag) + try { + // 取消采图热键监听 + this.$peisAPI.removeAllListeners("event-from-picture-hot-key-main") + this.$peisAPI.removeAllListeners("event-from-picture-and-print-hot-key-main") + this.$peisAPI.removeAllListeners("event-from-picture-print-hot-key-main") + this.$peisAPI.removeAllListeners("event-from-picture-cancel-print-hot-key-main") + this.$peisAPI.removeAllListeners("event-from-picture-delete-hot-key-main") + + // 取消 身高体重仪、血压仪 监听 + this.$peisAPI.removeAllListeners("serial:data") + } catch (error) { + console.error(error) + } + } + // 如果关闭的标签不是当前路由的话,就不跳转 if (tag.displayName !== this.$route.name) { this.handleScroll(); return; } - + // 关闭的标签是最右边的话,往左边跳转一个 if (index === length) { if (this.tags[index - 1]) { @@ -238,6 +234,7 @@ export default {