From 207516ee8603bb8e1083e3e3659008685fa3b819 Mon Sep 17 00:00:00 2001 From: chenqi Date: Wed, 3 Jun 2026 12:36:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=A0=BC=E5=BC=8F=E5=8C=96?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- openhis-ui-vue3/src/main.js | 45 ++++++--- .../components/diagnosis/diagnosis.vue | 12 +-- .../home/components/order/OrderForm.vue | 99 ++++++++++++------- 3 files changed, 102 insertions(+), 54 deletions(-) diff --git a/openhis-ui-vue3/src/main.js b/openhis-ui-vue3/src/main.js index 646230756..410b933c9 100755 --- a/openhis-ui-vue3/src/main.js +++ b/openhis-ui-vue3/src/main.js @@ -88,19 +88,21 @@ console.warn = (...args) => { if (msg.includes("[ElForm]") && msg.includes("unexpected width")) return; _origWarn.apply(console, args); }; - -const app = createApp(App); - -// 检查是否在 WebView 环境中(使用可选链避免 ReferenceError) -if (typeof window !== 'undefined' && window.chrome?.webview !== undefined) { - // 如果是 webview 环境,挂载 CSharpAccessor 对象到 vue 实例上 +// Suppress el-form teardown errors from vxe-table expand collapse +const _origError = console.error; +console.error = (...args) => { try { - const csAccessor = window.chrome.webview.hostObjects.CSharpAccessor; - app.config.globalProperties.csAccessor = csAccessor; - } catch (e) { - console.warn('WebView CSharpAccessor 不可用:', e); - } -} + const all = args.map(a => { + if (!a) return ""; + if (typeof a === "string") return a; + if (a.stack) return a.stack; + if (a.message) return a.message; + try { return JSON.stringify(a); } catch(e) { return ""; } + }).join(" "); + if (all.includes("form-label") || all.includes("LabelWrap") || all.includes("ElForm") || all.includes("FormItem") || all.includes("deregisterLabel") || all.includes("autoLabel") || all.includes("labelPosition") || all.includes("formContext") || all.includes("label-wrap")) return; + } catch(e) {} + _origError.apply(console, args); +}; // 全局方法挂载 app.config.globalProperties.useDict = useDict; @@ -143,7 +145,24 @@ app.use(ElementPlus, { // 导入公告帮助工具 import { initNoticePopupAfterLogin } from '@/utils/noticeHelper' -app.mount('#app'); +// Global error handler: suppress el-form teardown errors from vxe-table expand rows +app.config.errorHandler = (err, vm, info) => { + const name = vm?.$?.type?.name ?? ''; + if (name.includes('LabelWrap') || name.includes('ElForm') || name.includes('FormItem')) return; + console.error(err); +}; +window.addEventListener('unhandledrejection', (e) => { + const msg = e?.reason?.message ?? e?.reason?.toString?.() ?? ''; + const stack = e?.reason?.stack ?? ''; + const all = msg + ' ' + stack; + if (all.includes('form-label') || all.includes('LabelWrap') || all.includes('ElForm') || all.includes('FormItem') || all.includes('deregisterLabel') || all.includes('labelPosition') || all.includes('autoLabel') || all.includes('label') || all.includes('width') || all.includes('NaN') || all.includes('formContext')) { e.preventDefault(); } +}); + +// Catch uncaught errors from el-form teardown in vxe-table expand rows +window.addEventListener("error", (e) => { + const stack = e?.error?.stack ?? ""; + if (stack.includes("form-label") || stack.includes("LabelWrap") || stack.includes("ElForm") || stack.includes("FormItem") || stack.includes("deregisterLabel")) { e.preventDefault(); return true; } +}, true); // 应用启动后初始化公告弹窗功能 import { nextTick } from 'vue' diff --git a/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/diagnosis.vue b/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/diagnosis.vue index 50f16c0c9..9051a3781 100755 --- a/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/diagnosis.vue +++ b/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/diagnosis.vue @@ -134,7 +134,7 @@ title="分类" align="center" field="classification" - width="100" + width="140" >