From b6ccd63b80fc7017bfabc446787732a98c7cbab7 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 06 一月 2021 19:10:28 +0800
Subject: [PATCH] 2021-01-06

---
 src/tabviews/custom/components/card/table-card/index.jsx |   31 ++++++++++++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/src/tabviews/custom/components/card/table-card/index.jsx b/src/tabviews/custom/components/card/table-card/index.jsx
index 4fb7168..5552c95 100644
--- a/src/tabviews/custom/components/card/table-card/index.jsx
+++ b/src/tabviews/custom/components/card/table-card/index.jsx
@@ -104,6 +104,7 @@
   componentDidMount () {
     MKEmitter.addListener('syncRefreshComponentId', this.reload)
     MKEmitter.addListener('resetSelectLine', this.resetParentParam)
+    MKEmitter.addListener('getexceloutparam', this.getexceloutparam)
   }
 
   shouldComponentUpdate (nextProps, nextState) {
@@ -116,6 +117,7 @@
     }
     MKEmitter.removeListener('syncRefreshComponentId', this.reload)
     MKEmitter.removeListener('resetSelectLine', this.resetParentParam)
+    MKEmitter.removeListener('getexceloutparam', this.getexceloutparam)
   }
 
   /**
@@ -170,6 +172,33 @@
     })
   }
 
+   /**
+   * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁�
+   */
+  getexceloutparam = (menuId, btnId) => {
+    const { mainSearch } = this.props
+    const { arr_field, config, search } = this.state
+
+    if (config.uuid !== menuId) return
+
+    let searches = search ? fromJS(search).toJS() : []
+    if (mainSearch && mainSearch.length > 0) { // 涓昏〃鎼滅储鏉′欢
+      let keys = searches.map(item => item.key.toLowerCase())
+      mainSearch.forEach(item => {
+        if (!keys.includes(item.key.toLowerCase())) {
+          searches.push(item)
+        }
+      })
+    }
+
+    MKEmitter.emit('execExcelout', config.uuid, btnId, {
+      arr_field: arr_field,
+      orderBy: config.setting.order || '',
+      search: searches,
+      menuName: config.name
+    })
+  }
+
   async loadData () {
     const { mainSearch, menuType } = this.props
     const { config, arr_field, pageIndex, search, BID } = this.state
@@ -183,7 +212,7 @@
       return
     }
 
-    let searches = fromJS(search).toJS()
+    let searches = search ? fromJS(search).toJS() : []
     if (mainSearch && mainSearch.length > 0) { // 涓昏〃鎼滅储鏉′欢
       let keys = searches.map(item => item.key)
       mainSearch.forEach(item => {

--
Gitblit v1.8.0