From 49f09cc6f8ff8c30a75ed1a9d6f510b69b73962a Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 12 十二月 2023 21:05:37 +0800
Subject: [PATCH] 2023-12-12

---
 src/tabviews/custom/components/module/account/index.jsx |   48 ++++++++++++++++++++++++++++++------------------
 1 files changed, 30 insertions(+), 18 deletions(-)

diff --git a/src/tabviews/custom/components/module/account/index.jsx b/src/tabviews/custom/components/module/account/index.jsx
index 4ac66a4..bdc02be 100644
--- a/src/tabviews/custom/components/module/account/index.jsx
+++ b/src/tabviews/custom/components/module/account/index.jsx
@@ -25,6 +25,7 @@
 
   componentDidMount () {
     this.loadData()
+    MKEmitter.addListener('reloadData', this.reloadData)
   }
 
   shouldComponentUpdate (nextProps, nextState) {
@@ -37,6 +38,20 @@
   componentWillUnmount () {
     this.setState = () => {
       return
+    }
+    MKEmitter.removeListener('reloadData', this.reloadData)
+  }
+
+  reloadData = (menuId) => {
+    const { config } = this.props
+    const { activeItem } = this.state
+    
+    if (config.uuid !== menuId) return
+
+    if (activeItem) {
+      MKEmitter.emit('resetSelectLine', config.uuid, activeItem.id, activeItem)
+    } else {
+      this.loadData()
     }
   }
 
@@ -105,10 +120,12 @@
   }
 
   setBook = (item, resolve) => {
+    const { config } = this.props
+
     if (!resolve) {
       this.setState({activeItem: item})
   
-      MKEmitter.emit('resetSelectLine', this.props.config.uuid, item.id, item)
+      MKEmitter.emit('resetSelectLine', config.uuid, item.id, item)
     }
     
     let userid = sessionStorage.getItem('UserID') || ''
@@ -137,6 +154,7 @@
       }
 
       if (resolve) {
+        sessionStorage.setItem('ThirdMenu', config.$pageId)
         window.location.reload()
       }
     })
@@ -145,24 +163,18 @@
   addBook = () => {
     const { config } = this.props
 
-    let menuId = config.wrap.MenuID
-    let menu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0]
-
-    if (!menu && config.wrap.MenuNo) {
-      menu = {
-        MenuID: menuId,
-        MenuName: config.wrap.MenuName,
-        MenuNo: config.wrap.MenuNo || '',
-        type: config.wrap.tabType
-      }
-    }
-
-    let newtab = {
-      ...menu,
+    let menu = {
+      MenuID: config.wrap.MenuID,
+      MenuName: config.wrap.MenuName,
+      type: config.wrap.tabType,
       param: {}
     }
 
-    MKEmitter.emit('modifyTabs', newtab, true)
+    if (window.GLOB.mkThdMenus.has(config.wrap.MenuID)) {
+      menu = {...window.GLOB.mkThdMenus.get(config.wrap.MenuID), param: {}}
+    }
+
+    MKEmitter.emit('modifyTabs', menu, true)
   }
 
   render() {
@@ -181,11 +193,11 @@
           </div>
         )}>
           {books.map(item => (
-            <Option disabled={!item.months} key={item.id}>{item.account_name}</Option>
+            <Option disabled={!item.months} title={item.account_name} key={item.id}>{item.account_name}</Option>
           ))}
         </Select> : <Select showSearch filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} value={activeItem ? activeItem.id : ''} disabled={config.wrap.readonly === 'true'} placeholder="璇烽�夋嫨璐﹀" onChange={this.changeBook}>
           {books.map(item => (
-            <Option disabled={!item.months} key={item.id}>{item.account_name}</Option>
+            <Option disabled={!item.months} title={item.account_name} key={item.id}>{item.account_name}</Option>
           ))}
         </Select>}
         {activeItem ? <span className="date">{activeItem.date}</span> : null}

--
Gitblit v1.8.0