From 5088d267c69e87673c85ba302dd9dc62c9da4951 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期日, 16 二月 2020 18:54:49 +0800
Subject: [PATCH] 2020-02-16

---
 src/tabviews/tableshare/actionList/index.jsx |  104 ++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 84 insertions(+), 20 deletions(-)

diff --git a/src/tabviews/tableshare/actionList/index.jsx b/src/tabviews/tableshare/actionList/index.jsx
index 5f897b6..77d8372 100644
--- a/src/tabviews/tableshare/actionList/index.jsx
+++ b/src/tabviews/tableshare/actionList/index.jsx
@@ -818,17 +818,19 @@
       })
       return
     }
-    if (!btn.innerFunc) {
-      let param = { // 绯荤粺瀛樺偍杩囩▼
-        func: 'sPC_TableData_InUpDe',
-        BID: this.props.BID
-      }
 
-      param.LText = Utils.formatOptions(result.sql)
-      param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
-      param.secretkey = Utils.encrypt(param.LText, param.timestamp)
+    let param = {
+      BID: this.props.BID
+    }
 
-      this.setState({loadingUuid: btn.uuid})
+    param.LText = Utils.formatOptions(result.sql)
+    param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
+    param.secretkey = Utils.encrypt(param.LText, param.timestamp)
+
+    this.setState({loadingUuid: btn.uuid})
+
+    if (btn.intertype === 'inner' && !btn.innerFunc) { // 绯荤粺瀛樺偍杩囩▼
+      param.func = 'sPC_TableData_InUpDe'
 
       Api.genericInterface(param).then((res) => {
         if (res.status) {
@@ -837,17 +839,8 @@
           this.execError(res, btn)
         }
       })
-    } else {
-      let param = { // 鑷畾涔夊瓨鍌ㄨ繃绋�
-        func: btn.innerFunc,
-        BID: this.props.BID
-      }
-
-      param.LText = Utils.formatOptions(result.sql)
-      param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
-      param.secretkey = Utils.encrypt(param.LText, param.timestamp)
-
-      this.setState({loadingUuid: btn.uuid})
+    } else if (btn.intertype === 'inner' && btn.innerFunc) { // 鑷畾涔夊瓨鍌ㄨ繃绋�
+      param.func = btn.innerFunc
 
       Api.genericInterface(param).then((res) => {
         if (res.status) {
@@ -856,6 +849,77 @@
           this.execError(res, btn)
         }
       })
+    } else if (btn.intertype === 'outer') { // 澶栭儴鎺ュ彛
+      let _outParam = null
+
+      new Promise(resolve => {
+        // 鍐呴儴璇锋眰
+        if (btn.innerFunc) {
+          param.func = btn.innerFunc
+          // 瀛樺湪鍐呴儴鍑芥暟鏃讹紝鏁版嵁棰勫鐞�
+          Api.genericInterface(param).then(res => {
+            if (res.status) {
+              delete res.ErrCode
+              delete res.ErrMesg
+              delete res.message
+              delete res.status
+
+              // 浣跨敤澶勭悊鍚庣殑鏁版嵁璋冪敤澶栭儴鎺ュ彛
+              resolve(res)
+            } else {
+              this.execError(res, btn)
+              resolve(false)
+            }
+          })
+        } else {
+          resolve(param)
+        }
+      }).then(res => {
+        if (!res) return
+        // 澶栭儴璇锋眰
+        _outParam = JSON.parse(JSON.stringify(res))
+
+        if (btn.sysInterface === 'true') {
+          res.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi
+        } else {
+          res.rduri = btn.interface
+        }
+
+        if (btn.outerFunc) {
+          res.func = btn.outerFunc
+        }
+
+        res.appkey = window.GLOB.appkey || '' // 澶栭儴璇锋眰鏃讹紝缁熶竴娣诲姞appkey
+
+        return Api.genericInterface(res)
+      }).then(response => {
+        if (!response) return
+        // 鍥炶皟璇锋眰
+        if (btn.callbackFunc) {
+          // 瀛樺湪鍥炶皟鍑芥暟鏃讹紝璋冪敤
+          delete response.message
+          delete response.status
+
+          response.func = btn.callbackFunc
+
+          let _callbackparam = {..._outParam, ...response}
+          return Api.genericInterface(_callbackparam)
+        } else {
+          if (response.status) {
+            this.execSuccess(btn, response)
+          } else {
+            this.execError(response, btn)
+          }
+        }
+      }).then(res => {
+        if (!res) return
+
+        if (res.status) {
+          this.execSuccess(btn, res)
+        } else {
+          this.execError(res, btn)
+        }
+      })
     }
   }
 

--
Gitblit v1.8.0