From ee7ac8df8bce38add1f75baf876b49de94b9e00a Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期五, 16 十月 2026 17:58:33 +0800
Subject: [PATCH] feat(mes): 赋码管理绑定托盘支持未录入批次的袋码

---
 src/main.ts |   42 +++++++++++++++++++++++++++++++++++++++---
 1 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/src/main.ts b/src/main.ts
index 3189674..1239af9 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -1,7 +1,17 @@
-import { initPreferences } from './packages\preferences\src';
-import { unmountGlobalLoading } from './packages\utils\src';
+import { initPreferences, preferencesManager } from './packages/preferences/src';
+import { unmountGlobalLoading } from './packages/utils/src';
 
 import { overridesPreferences, preferencesExtension } from './preferences';
+
+declare const __APP_LOGO__: string;
+declare const __APP_FAVICON__: string;
+declare const __APP_NAME__: string;
+
+declare global {
+  interface Window {
+    __MOM_STARTUP__?: { finish: () => void; fail: (error: unknown) => void };
+  }
+}
 
 /**
  * 搴旂敤鍒濆鍖栧畬鎴愪箣鍚庡啀杩涜椤甸潰鍔犺浇娓叉煋
@@ -20,6 +30,28 @@
     overrides: overridesPreferences,
   });
 
+  // 寮哄埗瑕嗙洊鍏徃 logo 鍜� favicon锛岀粫杩� localStorage 缂撳瓨
+  if (__APP_LOGO__) {
+    preferencesManager.updatePreferences({ logo: { source: __APP_LOGO__ } });
+  }
+  // 寮哄埗瑕嗙洊鍏徃鍚嶇О锛岀粫杩� localStorage 缂撳瓨
+  if (__APP_NAME__) {
+    preferencesManager.updatePreferences({
+      app: { name: __APP_NAME__ },
+      copyright: { companyName: __APP_NAME__ },
+    });
+  }
+  // 寮哄埗瑕嗙洊榛樿棣栭〉涓�"鍩虹鏁版嵁涓庝竴琚嬩竴鐮�"锛岀粫杩� localStorage 缂撳瓨
+  preferencesManager.updatePreferences({
+    app: { defaultHomePath: '/bagcode-home' },
+  });
+  if (__APP_FAVICON__) {
+    const link = document.querySelector('link[rel="icon"]');
+    if (link) {
+      link.setAttribute('href', __APP_FAVICON__);
+    }
+  }
+
   // 鍚姩搴旂敤骞舵寕杞�
   // vue搴旂敤涓昏閫昏緫鍙婅鍥�
   const { bootstrap } = await import('./bootstrap');
@@ -27,6 +59,10 @@
 
   // 绉婚櫎骞堕攢姣乴oading
   unmountGlobalLoading();
+  window.__MOM_STARTUP__?.finish();
 }
 
-initApplication();
+initApplication().catch((error: unknown) => {
+  window.__MOM_STARTUP__?.fail(error);
+  console.error('Application startup failed', error);
+});

--
Gitblit v1.9.3