From 96989af7e330a08d376002b0759705a477039f61 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 19 十月 2023 19:46:41 +0800
Subject: [PATCH] Merge branch 'positec' into dms

---
 src/components/header/index.jsx |   34 ++++++++++++++++++++++++++++++----
 1 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx
index 4ad3d8a..546fb88 100644
--- a/src/components/header/index.jsx
+++ b/src/components/header/index.jsx
@@ -60,7 +60,7 @@
       if (e.key === 'getSessionStorage' && e.newValue === window.GLOB.appkey) {
         localStorage.setItem('sessionStorage', JSON.stringify(sessionStorage))
       } else if (e.key === 'getSysPermission' && e.newValue === window.GLOB.appkey) {
-        localStorage.setItem('sysPermissions', JSON.stringify({mkThdMenus: window.GLOB.mkThdMenus, mkActions: window.GLOB.mkActions}))
+        localStorage.setItem('sysPermissions', JSON.stringify({mkThdMenus: this.state.thdMenuList, mkActions: window.GLOB.mkActions}))
       } else if (e.key === 'menuUpdate') {
         let vals = e.newValue.split(',')
         let menuId = vals[1]
@@ -180,13 +180,22 @@
       }
 
       window.GLOB.mainMenu = mainMenu
-      window.GLOB.mkThdMenus = [...thdMenuList, {MenuID: 'home_page_id', EasyCode: '', MenuName: 'home', type: 'CustomPage'}]
+
+      thdMenuList.forEach(item => {
+        window.GLOB.mkThdMenus.set(item.MenuID, item)
+      })
+
+      window.GLOB.mkThdMenus.set('home_page_id', {MenuID: 'home_page_id', EasyCode: '', MenuName: 'home', type: 'CustomPage'})
 
       MKEmitter.emit('mainMenuChange')
 
       if (_menu) {
         this.openTab(_menu, 0)
       }
+
+      setTimeout(() => {
+        this.getwork()
+      }, 100)
     })
     
     // 鑾峰彇瑙掕壊鏉冮檺, edition_type 鎺ュ彛鐗堟湰鎺у埗 ''銆�'Y'銆�'A'
@@ -205,7 +214,7 @@
               _permAction[menu.MenuID] = true
             })
           }
-        } else {
+        } else if (!/PRIMARY KEY/ig.test(result.message)) {
           notification.error({
             top: 92,
             message: result.message,
@@ -216,6 +225,23 @@
         window.GLOB.mkActions = _permAction
       })
     }, 50)
+  }
+
+  getwork = () => {
+    if (sessionStorage.getItem('work_grade')) return
+
+    Api.genericInterface({func: 's_get_local_my_worker_v1'}).then(result => {
+      sessionStorage.setItem('work_grade', result.work_grade || 0)
+      sessionStorage.setItem('work_group', result.work_group || '')
+
+      if (!result.status && sessionStorage.getItem('debug') === 'true') {
+        notification.error({
+          top: 92,
+          message: /s_get_local_my_worker_v1/.test(result.message) ? '鑱屽憳淇℃伅鑾峰彇澶辫触锛岃鑱旂郴绠$悊鍛樸��' : result.message,
+          duration: 10
+        })
+      }
+    })
   }
 
   openTab = (menu, times) => {
@@ -387,7 +413,7 @@
             if (!isNaN(s) && s > 90) {
               Modal.warning({
                 width: 520,
-                title: <span>绯荤粺妫�娴嬪埌鎮ㄧ殑璐︽埛瀛樺湪椋庨櫓锛岃鍙婃椂鍒�<a target="_blank" rel="noopener noreferrer" href="https://cloud.mk9h.cn/admin/index.html">浜戜腑蹇�</a>淇敼瀵嗙爜锛�</span>,
+                title: <span>绯荤粺妫�娴嬪埌鎮ㄧ殑璐︽埛瀛樺湪椋庨櫓锛岃鍙婃椂鍒�<a target="_blank" rel="noopener noreferrer" href="https://cloud.positecgroup.com/admin/index.html">浜戜腑蹇�</a>淇敼瀵嗙爜锛�</span>,
                 okText: '鐭ラ亾浜�'
               })
               return

--
Gitblit v1.8.0