From f9697383bc9097be8a444558e09ae21b27f1e831 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 31 十二月 2019 09:27:21 +0800
Subject: [PATCH] 2019-12-31

---
 src/tabviews/subtabtable/index.jsx |  111 +++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 71 insertions(+), 40 deletions(-)

diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx
index 4a81988..466ead3 100644
--- a/src/tabviews/subtabtable/index.jsx
+++ b/src/tabviews/subtabtable/index.jsx
@@ -15,10 +15,9 @@
 
 export default class NormalTable extends Component {
   static propTpyes = {
-    Tab: PropTypes.object,       // 鏍囩淇℃伅
-    BID: PropTypes.string,       // 涓婄骇鏁版嵁ID
-    MenuID: PropTypes.string,    // 鑿滃崟Id
-    SupMenuID: PropTypes.string  // 涓婄骇鑿滃崟Id
+    BID: PropTypes.string,         // 涓婄骇鏁版嵁ID
+    MenuID: PropTypes.string,      // 鑿滃崟Id
+    SupMenuID: PropTypes.string   // 涓婄骇鑿滃崟Id
   }
 
   state = {
@@ -26,27 +25,21 @@
     loadingview: true,    // 椤甸潰鍔犺浇涓�
     viewlost: false,      // 椤甸潰涓㈠け锛�1銆佹湭鑾峰彇鍒伴厤缃�-椤甸潰涓㈠け锛�2銆侀〉闈㈡湭鍚敤
     lostmsg: '',          // 椤甸潰涓㈠け鏃剁殑鎻愮ず淇℃伅
-    config: {},
-    searchlist: null,
-    actions: null,
-    columns: null,
-    arr_field: '',
-    setting: null,
-    data: [],
-    total: 0,
-    loading: false,
-    pageIndex: 1,
-    pageSize: 10,
-    orderColumn: '',
-    orderType: 'asc',
-    search: '',
-    configMap: {}
-  }
-
-  UNSAFE_componentWillReceiveProps(nextProps) {
-    if (this.props.Tab.supMenu && !is(fromJS(this.props.BID), fromJS(nextProps.BID))) {
-      this.loadmaindata()
-    }
+    config: {},           // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佹悳绱€�佹樉绀哄垪銆佹爣绛剧瓑
+    searchlist: null,     // 鎼滅储鏉′欢
+    actions: null,        // 鎸夐挳闆�
+    columns: null,        // 鏄剧ず鍒�
+    arr_field: '',        // 浣跨敤 sPC_Get_TableData 鏃剁殑鏌ヨ瀛楁闆�
+    setting: null,        // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑
+    data: null,           // 鍒楄〃鏁版嵁闆�
+    total: 0,             // 鎬绘暟
+    loading: false,       // 鍒楄〃鏁版嵁鍔犺浇涓�
+    pageIndex: 1,         // 椤电爜
+    pageSize: 10,         // 姣忛〉鏁版嵁鏉℃暟
+    orderColumn: '',      // 鎺掑簭瀛楁
+    orderType: 'asc',     // 鎺掑簭鏂瑰紡
+    search: '',           // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞�
+    configMap: {}         // 椤甸潰閰嶇疆淇℃伅锛氫笅鎷夈�佹寜閽瓑
   }
 
   /**
@@ -162,6 +155,9 @@
     }
   }
 
+  /**
+   * @description 鎼滅储鏉′欢涓嬫媺閫夐」棰勫姞杞�
+   */
   improveSearch = () => {
     let searchlist = JSON.parse(JSON.stringify(this.state.searchlist))
     let deffers = []
@@ -237,7 +233,9 @@
     })
   }
 
-
+  /**
+   * @description 瀛愯〃鏁版嵁鍔犺浇
+   */
   async loadmaindata () {
     const { setting } = this.state
     let param = ''
@@ -270,6 +268,9 @@
     }
   }
 
+  /**
+   * @description 鑾峰彇鐢ㄦ埛鑷畾涔夊瓨鍌ㄨ繃绋嬩紶鍙�
+   */
   getCustomParam = () => {
     const { pageIndex, pageSize, orderColumn, orderType, search, setting } = this.state
 
@@ -295,6 +296,9 @@
     return param
   }
 
+  /**
+   * @description 鑾峰彇绯荤粺瀛樺偍杩囩▼ sPC_Get_TableData 鐨勫弬鏁�
+   */
   getDefaultParam = () => {
     const { arr_field, pageIndex, pageSize, orderColumn, orderType, search, setting } = this.state
 
@@ -326,8 +330,11 @@
     return param
   }
 
+  /**
+   * @description 鎼滅储鏉′欢鏀瑰彉鏃讹紝閲嶇疆琛ㄦ牸鏁版嵁
+   * 鍚湁鍒濆涓嶅姞杞界殑椤甸潰锛屼慨鏀硅缃�
+   */
   refreshbysearch = (searches) => {
-    // 鎼滅储鏉′欢鍙樺寲
     this.refs.subTable.resetTable()
 
     this.setState({
@@ -339,8 +346,10 @@
     })
   }
 
+  /**
+   * @description 琛ㄦ牸鏉′欢鏀瑰彉鏃堕噸缃暟鎹紙鍒嗛〉鎴栨帓搴忥級
+   */
   refreshbytable = (pagination, filters, sorter) => {
-    // 琛ㄦ牸鏌ヨ鏉′欢淇敼
     if (sorter.order) {
       let _chg = {
         ascend: 'asc',
@@ -360,6 +369,9 @@
     })
   }
 
+  /**
+   * @description 琛ㄦ牸鍒锋柊
+   */
   reloadtable = () => {
     this.refs.subTable.resetTable()
     this.setState({
@@ -370,11 +382,14 @@
     })
   }
 
+  /**
+   * @description 椤甸潰鍒锋柊锛岄噸鏂拌幏鍙栭厤缃�
+   */
   reloadview = () => {
     this.setState({
-      loadingview: true,    // 椤甸潰鍔犺浇涓�
-      viewlost: false,      // 椤甸潰涓㈠け锛�1銆佹湭鑾峰彇鍒伴厤缃�-椤甸潰涓㈠け锛�2銆侀〉闈㈡湭鍚敤
-      lostmsg: '',          // 椤甸潰涓㈠け鏃剁殑鎻愮ず淇℃伅
+      loadingview: true,
+      viewlost: false,
+      lostmsg: '',
       config: {},
       searchlist: null,
       actions: null,
@@ -395,8 +410,10 @@
     })
   }
 
+  /**
+   * @description 鎸夐挳鎿嶄綔瀹屾垚鍚庯紙鎴愬姛鎴栧け璐ワ級锛岄〉闈㈠埛鏂帮紝閲嶇疆椤电爜鍙婇�夋嫨椤�
+   */
   refreshbyaction = (btn, type) => {
-    // 鎸夐挳鎿嶄綔鍚庡埛鏂拌〃鏍�,閲嶇疆椤电爜鍙婇�夋嫨椤�
     if (btn.execSuccess === 'grid' && type === 'success') {
       this.reloadtable()
     } else if (btn.execError === 'grid' && type === 'error') {
@@ -410,6 +427,9 @@
     }
   }
 
+  /**
+   * @description 浣跨敤榛樿瀛樺偍杩囩▼ sPC_Get_TableData 瀵煎嚭excel琛ㄦ牸
+   */
   handleDefaultExcelout = (btn) => {
     const { MenuName } = this.props
     const { arr_field, orderColumn, orderType, search, setting, config } = this.state
@@ -454,15 +474,17 @@
 
     Api.getExcelOut(param, name).then(res => {
       if (res && res.status === false) {
-        this.refs.subButton.execError(res, btn)
+        this.refs.subtabButton.execError(res, btn)
       } else {
-        this.refs.subButton.execSuccess(btn)
+        this.refs.subtabButton.execSuccess(btn)
       }
     })
   }
 
+  /**
+   * @description 鑾峰彇琛ㄦ牸閫夋嫨椤�
+   */
   gettableselected = () => {
-    // 鑾峰彇琛ㄦ牸閫夋嫨椤�
     let data = []
     this.refs.subTable.state.selectedRowKeys.forEach(item => {
       data.push(this.refs.subTable.props.data[item])
@@ -470,9 +492,17 @@
     return data
   }
 
+  /**
+   * @description 琛ㄦ牸涓紝鎸夐挳瑙﹀彂浜嬩欢浼犻��
+   */
   buttonTrigger = (btn, record) => {
-    this.refs.subButton.actionTrigger(btn, record)
+    this.refs.subtabButton.actionTrigger(btn, record)
   }
+
+  /**
+   * @description 琛ㄦ牸Id鍙樺寲
+   */
+  handleTableId = () => {}
 
   UNSAFE_componentWillMount () {
     // 缁勪欢鍔犺浇鏃讹紝鑾峰彇鑿滃崟鏁版嵁
@@ -487,7 +517,7 @@
    * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊
    */
   componentWillUnmount () {
-    this.setState = (state, callback) => {
+    this.setState = () => {
       return
     }
   }
@@ -496,7 +526,7 @@
     const { setting, searchlist, actions, columns, loadingview, viewlost } = this.state
 
     return (
-      <div className="subtable" id={'subtable' + this.props.MenuID}>
+      <div className="subtabtable" id={'subtabtable' + this.props.MenuID}>
         {loadingview && <Spin size="large" />}
         {searchlist && searchlist.length > 0 ?
           <SubSearch
@@ -507,8 +537,8 @@
         }
         {actions &&
           <SubAction
-            ref="subButton"
-            type="sub"
+            ref="subtabButton"
+            type="subtab"
             setting={setting}
             actions={actions}
             BID={this.props.BID}
@@ -530,6 +560,7 @@
             loading={this.state.loading}
             refreshdata={this.refreshbytable}
             buttonTrigger={this.buttonTrigger}
+            handleTableId={this.handleTableId}
           />
         }
         {viewlost ? <NotFount msg={this.state.lostmsg} /> : null}

--
Gitblit v1.8.0