From 5d41cbe3722ff40b65bfa4de82d62a79f171f5a5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 15 八月 2022 17:41:55 +0800
Subject: [PATCH] 2022-08-15

---
 src/tabviews/custom/components/tree/antd-tree/index.jsx |   44 +++++++++++++++++++++++++++++++-------------
 1 files changed, 31 insertions(+), 13 deletions(-)

diff --git a/src/tabviews/custom/components/tree/antd-tree/index.jsx b/src/tabviews/custom/components/tree/antd-tree/index.jsx
index 305d461..6b82284 100644
--- a/src/tabviews/custom/components/tree/antd-tree/index.jsx
+++ b/src/tabviews/custom/components/tree/antd-tree/index.jsx
@@ -16,11 +16,9 @@
 
 class NormalTree extends Component {
   static propTpyes = {
-    BID: PropTypes.any,              // 鐖剁骇Id
     data: PropTypes.array,           // 缁熶竴鏌ヨ鏁版嵁
     config: PropTypes.object,        // 缁勪欢閰嶇疆淇℃伅
     mainSearch: PropTypes.any,       // 澶栧眰鎼滅储鏉′欢
-    menuType: PropTypes.any,         // 鑿滃崟绫诲瀷
   }
 
   state = {
@@ -38,10 +36,22 @@
   }
 
   UNSAFE_componentWillMount () {
-    const { config, data, initdata, BID } = this.props
+    const { config, data, initdata } = this.props
     let _config = fromJS(config).toJS()
     let _data = null
     let _sync = config.setting.sync === 'true'
+
+    let BID = ''
+    let BData = ''
+
+    if (_config.setting.supModule) {
+      BData = window.GLOB.CacheData.get(_config.setting.supModule)
+    } else {
+      BData = window.GLOB.CacheData.get(_config.$pageId)
+    }
+    if (BData) {
+      BID = BData.$BID || ''
+    }
 
     if (config.setting.sync === 'true' && data) {
       _data = data[config.dataName] || []
@@ -146,22 +156,30 @@
         })
         return
       } else if (result.run_type) {
-        this.setState({timer})
+        let repeats = config.timerRepeats || 0
+        this.setState({timer, repeats})
         this.timer = setTimeout(() => {
-          this.timerTask()
+          this.timerTask(repeats)
         }, timer)
       }
     })
   }
 
-  timerTask = () => {
-    const { timer } = this.state
+  timerTask = (times) => {
+    const { timer, repeats } = this.state
     if (!timer) return
     
     this.loadData(true)
-    
+
+    if (repeats) {
+      times = times - 1
+      if (times <= 0) {
+        clearTimeout(this.timer)
+        return
+      }
+    }
     this.timer = setTimeout(() => {
-      this.timerTask()
+      this.timerTask(times)
     }, timer)
   }
 
@@ -188,7 +206,7 @@
    * @description 鏁版嵁鍔犺浇
    */
   async loadData (hastimer) {
-    const { mainSearch, menuType } = this.props
+    const { mainSearch } = this.props
     const { config, arr_field, BID } = this.state
 
     if (config.setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇�
@@ -214,7 +232,7 @@
     }
 
     let _orderBy = config.setting.order || ''
-    let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, '', '', BID, menuType)
+    let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, '', '', BID)
 
     let result = await Api.genericInterface(param)
     if (result.status) {
@@ -462,7 +480,7 @@
     const { config, loading, treeNodes, expandedKeys, selectedKeys } = this.state
 
     return (
-      <div className="custom-tree-box" style={config.style}>
+      <div className="custom-tree-box" id={'anchor' + config.uuid} style={config.style}>
         {loading ?
           <div className="loading-mask">
             <div className="ant-spin-blur"></div>
@@ -470,7 +488,7 @@
           </div> : null
         }
         {config.wrap.title || config.wrap.searchable === 'true' ? <div className="tree-header" style={config.headerStyle}>
-          <span className="title">{config.wrap.title}</span>
+          <span className={'title ' + (config.wrap.searchable !== 'true' ? 'search-unable' : '')}>{config.wrap.title}</span>
           {config.wrap.searchable === 'true' ? <Search allowClear onSearch={this.treeFilter} /> : null}
         </div> : null}
         {treeNodes && treeNodes.length > 0 ? <div className="tree-box" style={{height: config.wrap.contentHeight}}>

--
Gitblit v1.8.0