From b35e3f0bacdbadf5823e06fe8dc6e047089aae38 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期日, 19 一月 2020 00:25:45 +0800
Subject: [PATCH] 2020-01-19

---
 src/tabviews/subtable/index.jsx |   30 ++++++++++++++++++++++++++----
 1 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx
index ee5fa1e..3ed8c99 100644
--- a/src/tabviews/subtable/index.jsx
+++ b/src/tabviews/subtable/index.jsx
@@ -65,7 +65,7 @@
    * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅
    */
   async loadconfig () {
-    const { permAction } = this.props
+    const { permAction, Tab, BID } = this.props
 
     let param = {
       func: 'sPC_Get_LongParam',
@@ -159,11 +159,16 @@
         actions: _actions,
         columns: _columns,
         arr_field: _arrField.join(','),
-        search: Utils.initMainSearch(config.search), // 鎼滅储鏉′欢鍒濆鍖栵紙鍚湁鏃堕棿鏍煎紡锛岄渶瑕佽浆鍖栵級
-        loading: true
+        search: Utils.initMainSearch(config.search) // 鎼滅储鏉′欢鍒濆鍖栵紙鍚湁鏃堕棿鏍煎紡锛岄渶瑕佽浆鍖栵級
       }, () => {
         this.improveSearch()
-        this.loadmaindata()
+
+        if (config.setting.onload !== 'false' && (!Tab.supMenu || BID)) { // 鍒濆鍖栧彲鍔犺浇
+          this.setState({
+            loading: true
+          })
+          this.loadmaindata()
+        }
       })
     } else {
       this.setState({
@@ -364,6 +369,22 @@
 
     if (/\s/.test(_dataresource)) {
       _dataresource = '(' + _dataresource + ') tb'
+    }
+
+    if (setting.queryType === 'statistics') { // 缁熻鏁版嵁婧愶紝鍐呭鏇挎崲
+      let fieldmap = new Map()
+      search.forEach(item => {
+        let _field = item.key
+
+        if (fieldmap.has(_field)) {
+          _field = _field + '1'
+        }
+
+        fieldmap.set(item.key, true)
+
+        let reg = new RegExp('@' + _field, 'ig')
+        _dataresource = _dataresource.replace(reg, `'${item.value}'`)
+      })
     }
 
     let LText = `select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows`
@@ -612,6 +633,7 @@
             type="sub"
             setting={setting}
             actions={actions}
+            Tab={this.props.Tab}
             BID={this.props.BID}
             dict={this.state.dict}
             MenuID={this.props.SupMenuID}

--
Gitblit v1.8.0