From cd8b52bdf89a4d1101f72e0ece9f4df22a3d3f7a Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 15 十月 2026 16:03:32 +0800
Subject: [PATCH] feat(mdm): 物料列表隐藏辅单位与销售价列

---
 src/main.ts |   48 ++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 40 insertions(+), 8 deletions(-)

diff --git a/src/main.ts b/src/main.ts
index dab2d7c..e60e320 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -1,7 +1,12 @@
-import { initPreferences, preferencesManager } from './packages/preferences/src';
+import { watch } from 'vue';
+import { initPreferences, preferences, 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;
 
 /**
  * 搴旂敤鍒濆鍖栧畬鎴愪箣鍚庡啀杩涜椤甸潰鍔犺浇娓叉煋
@@ -20,16 +25,43 @@
     overrides: overridesPreferences,
   });
 
-  // 閫氳繃鐜鍙橀噺寮哄埗瑕嗙洊鍏徃 logo 鍜� favicon锛岀粫杩囩紦瀛�
-  const envLogo = import.meta.env.VITE_APP_LOGO;
-  const envFavicon = import.meta.env.VITE_APP_FAVICON;
-  if (envLogo) {
-    preferencesManager.updatePreferences({ logo: { source: envLogo } });
+  // 棣栨鍗囩骇鍚屾鍝佺墝涓昏壊锛岄伩鍏嶆棫鐨勮摑鑹插亸濂介伄鐩栨湰娆′富棰樻洿鏂般��
+  // 鍗囩骇鍚庣敤鎴峰湪鍋忓ソ璁剧疆涓�夋嫨鐨勯鑹插拰鏄庢殫妯″紡浠嶄細淇濈暀銆�
+  document.documentElement.dataset.brandTheme = 'herbal';
+  const brandThemeKey = `${namespace}-herbal-theme-v1`;
+  try {
+    if (!localStorage.getItem(brandThemeKey)) {
+      preferencesManager.updatePreferences({
+        theme: { builtinType: 'custom', colorPrimary: '#a51d24' },
+      });
+      localStorage.setItem(brandThemeKey, '1');
+    }
+  } catch {
+    preferencesManager.updatePreferences({
+      theme: { builtinType: 'custom', colorPrimary: '#a51d24' },
+    });
   }
-  if (envFavicon) {
+  watch(
+    () => preferences.theme.colorPrimary,
+    (color) => { document.documentElement.dataset.herbalPalette = String(color.toLowerCase() === '#a51d24'); },
+    { immediate: true, flush: 'sync' },
+  );
+
+  // 寮哄埗瑕嗙洊鍏徃 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__ },
+    });
+  }
+  if (__APP_FAVICON__) {
     const link = document.querySelector('link[rel="icon"]');
     if (link) {
-      link.setAttribute('href', envFavicon);
+      link.setAttribute('href', __APP_FAVICON__);
     }
   }
 

--
Gitblit v1.9.3