From 31ec63f0419895876cbaba99637a884a32d33d0d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 01 九月 2021 10:31:45 +0800
Subject: [PATCH] 2021-09-01

---
 src/tabviews/subtable/index.jsx |   36 ++++++++++++++----------------------
 1 files changed, 14 insertions(+), 22 deletions(-)

diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx
index f8eab73..929b19f 100644
--- a/src/tabviews/subtable/index.jsx
+++ b/src/tabviews/subtable/index.jsx
@@ -102,6 +102,7 @@
       try { // 閰嶇疆淇℃伅瑙f瀽
         config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam)))
         config.setting.MenuName = Tab.label
+        config.setting.$name = Tab.label
       } catch (e) {
         console.warn('Parse Failure')
         config = ''
@@ -361,17 +362,17 @@
       searches = [...mainSearch, ...searches]
     }
 
-    let requireFields = []
     if (hasReqFields) {
-      requireFields = searches.filter(item => item.required && item.value === '')
+      let requireFields = searches.filter(item => item.required && item.value === '')
+      if (requireFields.length > 0) {
+        this.setState({
+          loading: false
+        })
+        return
+      }
     }
     
-    if (requireFields.length > 0) {
-      this.setState({
-        loading: false
-      })
-      return
-    } else if (this.props.Tab.supMenu && !BID) { // 涓昏〃ID涓嶅瓨鍦ㄦ椂锛屼笉鏌ヨ瀛愯〃
+    if (this.props.Tab.supMenu && !BID) { // 涓昏〃ID涓嶅瓨鍦ㄦ椂锛屼笉鏌ヨ瀛愯〃
       this.setState({
         data: [],
         selectedData: [],
@@ -471,7 +472,7 @@
     })
 
     Api.directRequest(url, setting.method, param, setting.cross).then(res => {
-      if (typeof(res) !== 'object' || Array.isArray(res)) {
+      if (typeof(res) !== 'object') {
         let error = '鏈煡鐨勮繑鍥炵粨鏋滐紒'
 
         if (typeof(res) === 'string') {
@@ -486,6 +487,9 @@
 
         this.customCallbackRequest(_result)
       } else {
+        if (Array.isArray(res)) {
+          res = { data: res }
+        }
         res.mk_api_key = mkey
         this.customCallbackRequest(res)
       }
@@ -592,10 +596,6 @@
     let _orderBy = orderBy || setting.order
     let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, this.props.menuType)
 
-    if (param.func === 'sPC_Get_TableData') {
-      param.menuname = this.props.Tab.label || ''
-    }
-
     let result = await Api.genericInterface(param)
 
     this.getStatFieldsValue(searches)
@@ -660,10 +660,6 @@
     let _orderBy = orderBy || setting.order
     let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, this.props.menuType, id)
 
-    if (param.func === 'sPC_Get_TableData') {
-      param.menuname = this.props.Tab.label || ''
-    }
-
     let result = await Api.genericInterface(param)
     if (result.status) {
       let data = fromJS(this.state.data).toJS()
@@ -699,7 +695,7 @@
             }
             return item
           })
-        } catch {
+        } catch (e) {
           console.warn('鏁版嵁鏌ヨ閿欒')
         }
       }
@@ -733,10 +729,6 @@
     let _orderBy = orderBy || setting.order
     let param = UtilsDM.getStatQueryDataParams(setting, statFields, searches, _orderBy, BID, this.props.menuType)
 
-    if (param.func === 'sPC_Get_TableData') {
-      param.menuname = this.props.Tab.label || ''
-    }
-    
     Api.genericInterface(param).then(res => {
       if (res.status) {
         let _data = res.data[0]

--
Gitblit v1.8.0