From d33d00cafeea2c4f980ea3af268d9260269edcc1 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 25 一月 2021 18:24:20 +0800
Subject: [PATCH] 2021-01-25

---
 src/tabviews/subtabtable/index.jsx |   28 +++++++++-------------------
 1 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx
index f1a937b..1492713 100644
--- a/src/tabviews/subtabtable/index.jsx
+++ b/src/tabviews/subtabtable/index.jsx
@@ -75,6 +75,7 @@
 
       try { // 閰嶇疆淇℃伅瑙f瀽
         config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam)))
+        config.setting.MenuName = Tab.label
       } catch (e) {
         console.warn('Parse Failure')
         config = ''
@@ -244,7 +245,7 @@
       config.setting.execute = config.setting.default !== 'false'     // 榛樿sql鏄惁鎵ц锛岃浆涓篵oolean 缁熶竴鏍煎紡
       config.setting.customScript = ''                                // 鑷畾涔夎剼鏈�
 
-      if (config.setting.interType === 'system') {
+      if (config.setting.interType === 'system' || (config.setting.interType === 'custom' && config.setting.requestMode === 'system')) {
         if (config.setting.scripts && config.setting.scripts.length > 0) {
           let _customScript = ''
           config.setting.scripts.forEach(item => {
@@ -291,7 +292,6 @@
       }, () => {
         if (config.setting.onload !== 'false' && valid) { // 鍒濆鍖栧彲鍔犺浇
           this.loadmaindata()
-          this.getStatFieldsValue()
         }
       })
     } else {
@@ -346,6 +346,9 @@
     }
 
     let result = await Api.genericInterface(param)
+
+    this.getStatFieldsValue(searches)
+
     if (result.status) {
       this.setState({
         data: result.data.map((item, index) => {
@@ -381,21 +384,11 @@
   /**
    * @description 鑾峰彇鍚堣瀛楁鍊�
    */
-  getStatFieldsValue = () => {
-    const { mainSearch, BID } = this.props
-    const { setting, search, orderBy, statFields } = this.state
+  getStatFieldsValue = (searches) => {
+    const { BID } = this.props
+    const { setting, orderBy, statFields } = this.state
 
-    let searches = fromJS(search).toJS()
-    if (mainSearch && mainSearch.length > 0) { // 涓昏〃鎼滅储鏉′欢
-      searches = [...mainSearch, ...searches]
-    }
-
-    if (statFields.length === 0 || setting.interType !== 'system' || !setting.dataresource) return
-
-    let requireFields = search.filter(item => item.required && (!item.value || item.value.length === 0))
-    if (requireFields.length > 0) {
-      return
-    }
+    if (statFields.length === 0 || !(setting.interType === 'system' || (setting.interType === 'custom' && setting.requestMode === 'system')) || !setting.dataresource) return
 
     let _orderBy = orderBy || setting.order
     let param = UtilsDM.getStatQueryDataParams(setting, statFields, searches, _orderBy, BID, this.props.menuType)
@@ -448,7 +441,6 @@
       search: searches
     }, () => {
       this.loadmaindata()
-      this.getStatFieldsValue()
     })
   }
 
@@ -483,12 +475,10 @@
         pageIndex: 1
       }, () => {
         this.loadmaindata()
-        this.getStatFieldsValue()
       })
     } else {
       MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid, 'false') // 鍒楄〃閲嶇疆
       this.loadmaindata()
-      this.getStatFieldsValue()
     }
     
   }

--
Gitblit v1.8.0