From 4f2e4e84fd2cdca1407ac06c1b44319518be39b9 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 21 十二月 2020 19:11:05 +0800
Subject: [PATCH] 2020-12-21

---
 src/tabviews/custom/components/table/normal-table/index.jsx |   41 +++++++++++++++++++++++++++++++++++++----
 1 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx
index 3831a8f..06357dc 100644
--- a/src/tabviews/custom/components/table/normal-table/index.jsx
+++ b/src/tabviews/custom/components/table/normal-table/index.jsx
@@ -121,6 +121,7 @@
    * @param { String }  repage 琛ㄦ牸鏄惁閲嶇疆椤电爜
    */
   async loadmaindata (reset, repage) {
+    const { mainSearch } = this.props
     const { setting, config, arr_field, search, orderBy, BID, pageIndex, pageSize } = this.state
     let requireFields = search.filter(item => item.required && (!item.value || item.value.length === 0))
 
@@ -146,12 +147,22 @@
       return
     }
 
+    let searches = 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)
+        }
+      })
+    }
+
     this.setState({
       loading: true
     })
 
     let _orderBy = orderBy || setting.order
-    let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, this.props.menuType)
+    let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, this.props.menuType)
 
     if (param.func === 'sPC_Get_TableData') {
       param.menuname = config.name || ''
@@ -189,14 +200,25 @@
    * @description 鑾峰彇鍗曡鏁版嵁
    */ 
   async loadmainLinedata (id) {
+    const { mainSearch } = this.props
     const { setting, config, arr_field, search, orderBy, BID, pageIndex, pageSize } = this.state
+
+    let searches = 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)
+        }
+      })
+    }
 
     this.setState({
       loading: true
     })
 
     let _orderBy = orderBy || setting.order
-    let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, this.props.menuType, id)
+    let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, this.props.menuType, id)
 
     if (param.func === 'sPC_Get_TableData') {
       param.menuname = config.name || ''
@@ -244,6 +266,7 @@
    * @description 鑾峰彇鍚堣瀛楁鍊�
    */
   getStatFieldsValue = () => {
+    const { mainSearch } = this.props
     const { setting, config, search, BID, orderBy, statFields } = this.state
 
     if (setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇�
@@ -260,8 +283,18 @@
       return
     }
 
+    let searches = 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)
+        }
+      })
+    }
+
     let _orderBy = orderBy || setting.order
-    let param = UtilsDM.getStatQueryDataParams(setting, statFields, search, _orderBy, BID, this.props.menuType)
+    let param = UtilsDM.getStatQueryDataParams(setting, statFields, searches, _orderBy, BID, this.props.menuType)
 
     if (param.func === 'sPC_Get_TableData') {
       param.menuname = config.name || ''
@@ -438,7 +471,7 @@
       })
 
       this.setState({sync: false, data: _data})
-    } else if (!is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) {
+    } else if (nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) {
       if (config.setting.syncRefresh === 'true') {
         this.setState({}, () => {
           this.reloadtable()

--
Gitblit v1.8.0