From 8d66ff34fae5b048a6b7923cc75d34f13a08be9d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 02 八月 2022 11:42:43 +0800
Subject: [PATCH] Merge branch 'develop'

---
 src/tabviews/custom/components/table/normal-table/index.jsx |   93 +++++++++++++++++++++-------------------------
 1 files changed, 42 insertions(+), 51 deletions(-)

diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx
index b7e0ba2..29532d5 100644
--- a/src/tabviews/custom/components/table/normal-table/index.jsx
+++ b/src/tabviews/custom/components/table/normal-table/index.jsx
@@ -1,6 +1,5 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import {connect} from 'react-redux'
 import { is, fromJS } from 'immutable'
 import { notification, Collapse } from 'antd'
 
@@ -25,14 +24,12 @@
     data: PropTypes.array,           // 缁熶竴鏌ヨ鏁版嵁
     config: PropTypes.object,        // 缁勪欢閰嶇疆淇℃伅
     mainSearch: PropTypes.any,       // 澶栧眰鎼滅储鏉′欢
-    menuType: PropTypes.any,         // 鑿滃崟绫诲瀷
   }
 
   state = {
     BID: '',              // 涓婄骇ID
     BData: '',            // 涓婄骇缁勪欢琛屾暟鎹�
     config: {},           // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佹悳绱€�佹樉绀哄垪銆佹爣绛剧瓑
-    searchlist: null,     // 鎼滅储鏉′欢
     actions: null,        // 鎸夐挳闆�
     columns: null,        // 鏄剧ず鍒�
     arr_field: '',        // 浣跨敤 sPC_Get_TableData 鏃剁殑鏌ヨ瀛楁闆�
@@ -67,10 +64,12 @@
       }
     }
 
-    let setting = {..._config.setting, ..._config.wrap, style: {}}
+    let setting = {..._config.setting, ..._config.wrap}
 
     if (setting.selected !== 'always' && setting.selected !== 'init') {
       setting.selected = 'false'
+    } else {
+      setting.orisel = true
     }
 
     if (_config.setting.sync === 'true' && data) {
@@ -127,12 +126,12 @@
       }
     })
 
-    if (setting.color) {
-      setting.style.color = setting.color
-    }
-    if (setting.fontSize) {
-      setting.style.fontSize = setting.fontSize
-    }
+    // if (setting.color) {
+    //   setting.style.color = setting.color
+    // }
+    // if (setting.fontSize) {
+    //   setting.style.fontSize = setting.fontSize
+    // }
 
     if (_config.wrap.collapse === 'true') {
       _config.wrap.title = _config.wrap.title || ' '
@@ -149,15 +148,16 @@
       data: _data,
       config: _config,
       setting: setting,
-      searchlist: _config.search,
       actions: _config.action,
       columns: _config.cols,
       arr_field: _config.columns.map(col => col.field).join(','),
       search: Utils.initMainSearch(_config.search) // 鎼滅储鏉′欢鍒濆鍖栵紙鍚湁鏃堕棿鏍煎紡锛岄渶瑕佽浆鍖栵級
     }, () => {
       if (_config.setting.sync !== 'true' && _config.setting.onload === 'true') {
-        this.loadmaindata()
-        this.getStatFieldsValue()
+        setTimeout(() => {
+          this.loadmaindata()
+          this.getStatFieldsValue()
+        }, _config.setting.delay || 0)
       } else if (_config.setting.onload === 'true') {
         this.getStatFieldsValue()
       }
@@ -169,7 +169,7 @@
    * @param { Boolean } reset  琛ㄦ牸鏄惁閲嶇疆
    * @param { String }  repage 琛ㄦ牸鏄惁閲嶇疆椤电爜
    */
-  async loadmaindata (reset, repage) {
+  async loadmaindata (reset, repage, id) {
     const { mainSearch } = this.props
     const { setting, config, arr_field, search, orderBy, BID, pageIndex, pageSize, BData } = this.state
 
@@ -179,6 +179,7 @@
         selectedData: [],
         total: 0
       })
+      
       MKEmitter.emit('resetSelectLine', config.uuid, '', '') // 骞挎挱鏁版嵁鍒囨崲
       reset && MKEmitter.emit('resetTable', config.uuid, repage) // 鍒楄〃閲嶇疆
       if (setting.$hasSyncModule) {
@@ -207,13 +208,13 @@
     })
 
     let _orderBy = orderBy || setting.order
-    let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, this.props.menuType)
+    let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID)
 
     let result = await Api.genericInterface(param)
     if (result.status) {
-      if (setting.selected !== 'false' && result.data && result.data.length > 0) {
+      if ((setting.selected !== 'false' || (setting.orisel && id)) && result.data && result.data.length > 0) {
         setTimeout(() => {
-          MKEmitter.emit('mkCheckTopLine', config.uuid)
+          MKEmitter.emit('mkCheckTopLine', config.uuid, id)
         }, 200)
         if (setting.selected === 'init') {
           this.setState({setting: {...setting, selected: 'false'}})
@@ -287,7 +288,7 @@
     })
 
     let _orderBy = orderBy || setting.order
-    let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, this.props.menuType, id)
+    let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, id)
 
     let result = await Api.genericInterface(param)
     if (result.status) {
@@ -318,6 +319,8 @@
         } catch (e) {
           console.warn('鏁版嵁鏌ヨ閿欒')
         }
+
+        MKEmitter.emit('resetSelectLine', config.uuid, _data.$$uuid || '', _data)
       }
 
       this.setState({
@@ -368,7 +371,7 @@
     }
 
     let _orderBy = orderBy || setting.order
-    let param = UtilsDM.getStatQueryDataParams(setting, config.statFields, searches, _orderBy, BID, this.props.menuType)
+    let param = UtilsDM.getStatQueryDataParams(setting, config.statFields, searches, _orderBy, BID)
 
     Api.genericInterface(param).then(res => {
       if (res.status) {
@@ -454,16 +457,16 @@
   /**
    * @description 琛ㄦ牸鍒锋柊
    */
-  reloadtable = (btn) => {
+  reloadtable = (btn, id) => {
     if (!btn || btn.resetPageIndex !== 'false') {
       this.setState({
         pageIndex: 1
       }, () => {
-        this.loadmaindata(true, 'true')
+        this.loadmaindata(true, 'true', id)
         this.getStatFieldsValue()
       })
     } else {
-      this.loadmaindata(true, 'false')
+      this.loadmaindata(true, 'false', id)
       this.getStatFieldsValue()
     }
   }
@@ -499,7 +502,6 @@
     const { config } = this.state
 
     if (config.uuid !== menuId) return
-    if (id === 'empty') return
 
     if (!id) {
       this.reloadtable()
@@ -535,20 +537,19 @@
 
     if (config.uuid !== menuId) return
 
-    if (position === 'line' && lines && lines.length === 1) {
-      this.loadmainLinedata(lines[0].$$uuid)
+    if (position === 'line') {
+      if (lines && lines.length === 1) {
+        this.loadmainLinedata(lines[0].$$uuid)
+      } else {
+        this.reloadtable(btn, id)
+      }
+    } else if ((position === 'mainline' || position === 'popclose') && config.setting.supModule && BID) { // 鍒锋柊婧愮粍浠舵椂锛岄檮甯﹀埛鏂颁笂绾ц涓庡綋鍓嶇粍浠�
+      MKEmitter.emit('reloadData', config.setting.supModule, BID)
     } else {
-      this.reloadtable(btn)                                                    // 鏁版嵁鍒锋柊
+      this.reloadtable(btn, id)
     }
 
-    if (btn.syncComponentId && btn.syncComponentId !== config.uuid && btn.syncComponentId !== config.setting.supModule) {
-      MKEmitter.emit('reloadData', btn.syncComponentId)                        // 鍚岀骇鏍囩鍒锋柊
-    }
-
-    if (position === 'mainline' && config.setting.supModule) {                 // 涓昏〃琛屽埛鏂�
-      MKEmitter.emit('reloadData', config.setting.supModule, (BID || 'empty'))
-    } else if (position === 'popclose') {                                      // 鏍囩鍏抽棴鍒锋柊
-      config.setting.supModule && MKEmitter.emit('reloadData', config.setting.supModule, (BID || 'empty'))
+    if (position === 'popclose') { // 鎵ц鍚姩寮圭獥鐨勬寜閽墍閫夋嫨鐨勫埛鏂伴」
       btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId)
     }
   }
@@ -620,7 +621,7 @@
   }
 
   render() {
-    const { BID, setting, searchlist, actions, config, columns, selectedData, BData, data } = this.state
+    const { BID, setting, actions, config, columns, selectedData, BData, data } = this.state
 
     let style = {...config.style}
     if (config.wrap.empty === 'hidden' && (!data || data.length === 0)) {
@@ -628,11 +629,11 @@
     }
 
     return (
-      <div className="custom-normal-table" style={style}>
+      <div className="custom-normal-table" id={'anchor' + config.uuid} style={style}>
         {config.wrap.collapse === 'true' ? <Collapse bordered={false} defaultActiveKey="1" expandIconPosition="right">
           <Panel forceRender={true} header={<NormalHeader config={config}/>} key="1">
-            {searchlist && searchlist.length ?
-              <MainSearch BID={BID} setting={config.wrap} searchlist={searchlist} menuType={this.props.menuType} refreshdata={this.refreshbysearch}/> : null
+            {config.search && config.search.length ?
+              <MainSearch BID={BID} config={config} refreshdata={this.refreshbysearch}/> : null
             }
             <MainAction
               BID={BID}
@@ -660,8 +661,8 @@
           </Panel>
         </Collapse> : <>
           <NormalHeader config={config}/>
-          {searchlist && searchlist.length ?
-            <MainSearch BID={BID} setting={config.wrap} searchlist={searchlist} menuType={this.props.menuType} refreshdata={this.refreshbysearch}/> : null
+          {config.search && config.search.length ?
+            <MainSearch BID={BID} config={config} refreshdata={this.refreshbysearch}/> : null
           }
           <MainAction
             BID={BID}
@@ -692,14 +693,4 @@
   }
 }
 
-const mapStateToProps = (state) => {
-  return {
-    menuType: state.editLevel
-  }
-}
-
-const mapDispatchToProps = () => {
-  return {}
-}
-
-export default connect(mapStateToProps, mapDispatchToProps)(NormalTable)
\ No newline at end of file
+export default NormalTable
\ No newline at end of file

--
Gitblit v1.8.0