From 28d65cf7ebfe0dd30ade6973e0634e1c8f663b63 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 28 十月 2020 16:12:20 +0800
Subject: [PATCH] 2020-10-28

---
 src/tabviews/subtable/index.jsx |   56 +++++++++++++++-----------------------------------------
 1 files changed, 15 insertions(+), 41 deletions(-)

diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx
index f7108a0..6ff99f1 100644
--- a/src/tabviews/subtable/index.jsx
+++ b/src/tabviews/subtable/index.jsx
@@ -16,6 +16,7 @@
 import asyncComponent from '@/utils/asyncComponent'
 import asyncSpinComponent from '@/utils/asyncSpinComponent'
 import NotFount from '@/components/404'
+import MKEmitter from '@/utils/events.js'
 
 import './index.scss'
 
@@ -38,7 +39,6 @@
     handleMainTable: PropTypes.func, // 鍒锋柊涓昏〃
     refreshtabs: PropTypes.any,      // 鏍囩鍒锋柊鎺у埗
     userConfig: PropTypes.any,       // 鐢ㄦ埛鑷畾涔夎缃�
-    triggerBtn: PropTypes.any        // 蹇嵎閿垨鐐瑰嚮琛屾寜閽Е鍙戜簨浠�
   }
 
   state = {
@@ -55,7 +55,6 @@
     setting: null,        // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑
     data: null,           // 鍒楄〃鏁版嵁闆�
     selectedData: [],     // 宸查�夎〃鏍兼暟鎹�
-    resetTable: false,    // 琛ㄦ牸閲嶇疆锛屽�煎湪true涓巉alse涔嬮棿鍒囨崲锛屽垏鎹㈡椂琛ㄦ牸閲嶇疆
     total: 0,             // 鎬绘暟
     loading: false,       // 鍒楄〃鏁版嵁鍔犺浇涓�
     pageIndex: 1,         // 椤电爜
@@ -63,7 +62,6 @@
     orderBy: '',          // 鎺掑簭
     search: [],           // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞�
     pickup: false,        // 瀛愯〃鏁版嵁闅愯棌鏄剧ず鍒囨崲
-    triggerBtn: null,     // 鎸夐挳瑙﹀彂
     chartId: '',          // 灞曞紑鍥捐〃ID
     statFields: [],       // 鍚堣瀛楁
     statFValue: []        // 鍚堣鍊�
@@ -74,10 +72,9 @@
    */
   UNSAFE_componentWillReceiveProps(nextProps) {
     if (this.state.config && this.props.Tab.supMenu && !is(fromJS(this.props.BID), fromJS(nextProps.BID))) {
+      MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid) // 鍒楄〃閲嶇疆
       this.setState({
-        pageIndex: 1,
-        selectedData: [],
-        resetTable: !this.state.resetTable,
+        pageIndex: 1
       }, () => {
         if (this.state.setting) {
           this.loadmaindata(nextProps.BID, 'refresh')
@@ -86,14 +83,6 @@
       })
     } else if (this.state.config && nextProps.refreshtabs && nextProps.refreshtabs.includes(this.props.Tab.uuid)) {
       this.reloadtable()
-    } else if (nextProps.triggerBtn && !is(fromJS(this.props.triggerBtn), fromJS(nextProps.triggerBtn)) && nextProps.triggerBtn.parentId === this.props.Tab.uuid) {
-      let trigger = nextProps.triggerBtn
-
-      trigger.parentId = this.props.MenuID
-
-      this.setState({
-        triggerBtn: trigger
-      })
     } else if (!this.props.Tab.supMenu && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) {
       if (this.state.setting) {
         this.setState({}, () => {
@@ -453,6 +442,7 @@
           return item
         }),
         total: result.total,
+        selectedData: [],
         pickup: false,
         loading: false
       })
@@ -541,11 +531,10 @@
    * 鍚湁鍒濆涓嶅姞杞界殑椤甸潰锛屼慨鏀硅缃�
    */
   refreshbysearch = (searches) => {
+    MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid) // 鍒楄〃閲嶇疆
     this.setState({
       pageIndex: 1,
       search: searches,
-      resetTable: !this.state.resetTable,
-      selectedData: [],
     }, () => {
       this.loadmaindata()
       this.getStatFieldsValue()
@@ -565,7 +554,6 @@
     }
 
     this.setState({
-      selectedData: [],
       pageIndex: pagination.current,
       pageSize: pagination.pageSize,
       orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : ''
@@ -578,10 +566,9 @@
    * @description 琛ㄦ牸鍒锋柊
    */
   reloadtable = () => {
+    MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid) // 鍒楄〃閲嶇疆
     this.setState({
-      pageIndex: 1,
-      selectedData: [],
-      resetTable: !this.state.resetTable
+      pageIndex: 1
     }, () => {
       this.loadmaindata()
       this.getStatFieldsValue()
@@ -594,7 +581,7 @@
   reloadview = () => {
     this.setState({ loadingview: true, viewlost: false, lostmsg: '', config: null, searchlist: null, actions: null,
       columns: null, arr_field: '', setting: null, data: null, total: 0, loading: false, pageIndex: 1, pageSize: 10,
-      orderBy: '', search: [], triggerBtn: null
+      orderBy: '', search: []
     }, () => {
       this.loadconfig()
     })
@@ -652,20 +639,6 @@
   }
 
   /**
-   * @description 琛ㄦ牸涓紝鎸夐挳瑙﹀彂浜嬩欢浼犻��
-   */
-  buttonTrigger = (btn, record) => {
-    this.setState({
-      triggerBtn: {
-        uuid: new Date().getTime(),
-        parentId: this.props.MenuID,
-        button: btn,
-        data: record
-      }
-    })
-  }
-
-  /**
    * @description 琛ㄦ牸Id鍙樺寲
    */
   handleTableId = (type = this.props.Tab.uuid, id = '', data = '') => {
@@ -709,7 +682,7 @@
   }
 
   render() {
-    const { config, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, triggerBtn, chartId, selectedData } = this.state
+    const { config, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, chartId, selectedData } = this.state
 
     return (
       <div className="subtable" id={'subtable' + this.props.MenuID}>
@@ -743,14 +716,12 @@
                       actions={actions}
                       Tab={this.props.Tab}
                       BID={this.props.BID}
-                      triggerBtn={triggerBtn}
                       BData={this.props.BData}
                       MenuID={this.props.MenuID}
                       selectedData={selectedData}
                       logcolumns={this.state.logcolumns}
                       refreshdata={this.refreshbyaction}
                       ContainerId={this.props.ContainerId}
-                      operations={config.gridBtn.operations || []}
                       getexceloutparam={this.getexceloutparam}
                     />
                   </div>
@@ -765,16 +736,19 @@
                       setting={setting}
                       columns={columns}
                       pageSize={pageSize}
+                      BID={this.props.BID}
                       dict={this.state.dict}
                       data={this.state.data}
+                      BData={this.props.BData}
                       total={this.state.total}
                       MenuID={this.props.MenuID}
                       loading={this.state.loading}
-                      statFValue={this.state.statFValue}
                       refreshdata={this.refreshbytable}
-                      buttonTrigger={this.buttonTrigger}
+                      logcolumns={this.state.logcolumns}
+                      statFValue={this.state.statFValue}
                       handleTableId={this.handleTableId}
-                      resetTable={this.state.resetTable}
+                      ContainerId={this.props.ContainerId}
+                      refreshbyaction={this.refreshbyaction}
                       chgSelectData={this.changeSelectedData}
                     />
                   </div>

--
Gitblit v1.8.0