From b20a4d7c75c2ff8951e93d9c0394df9277fc6093 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 15 五月 2023 21:05:17 +0800
Subject: [PATCH] 2023-05-15

---
 src/menu/components/share/actioncomponent/actionform/index.jsx    |    5 +
 src/templates/zshare/formconfig.jsx                               |   10 ---
 src/menu/components/share/actioncomponent/formconfig.jsx          |   17 +++++
 src/templates/sharecomponent/actioncomponent/actionform/index.jsx |    2 
 src/tabviews/zshare/actionList/normalbutton/index.jsx             |   91 ++++++++++++------------------
 5 files changed, 59 insertions(+), 66 deletions(-)

diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx
index 9b4f575..eef2620 100644
--- a/src/menu/components/share/actioncomponent/actionform/index.jsx
+++ b/src/menu/components/share/actioncomponent/actionform/index.jsx
@@ -206,6 +206,9 @@
         }
       } else if (intertype === 'inner') {
         shows.push('innerFunc', 'output')
+        if (Ot === 'requiredOnce') { // 鍓嶇疆鍑芥暟
+          shows.push('preFunc')
+        }
         reRequired.innerFunc = true
       } else {
         shows.push('sql', 'sqlType', 'output')
@@ -763,7 +766,7 @@
             { pattern: /^[a-zA-Z0-9@_]+$/, message: '琛ㄥ悕鍙彲浣跨敤瀛楁瘝銆佹暟瀛椾互鍙奯' },
             { max: formRule.func.max, message: formRule.func.maxMessage }
           )
-        } else if (item.key === 'outerFunc' || item.key === 'callbackFunc') {
+        } else if (item.key === 'outerFunc' || item.key === 'callbackFunc' || item.key === 'preFunc') {
           rules.push(
             { pattern: formRule.func.pattern, message: formRule.func.message },
             { max: formRule.func.max, message: formRule.func.maxMessage }
diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx
index a5a42e4..394da22 100644
--- a/src/menu/components/share/actioncomponent/formconfig.jsx
+++ b/src/menu/components/share/actioncomponent/formconfig.jsx
@@ -974,6 +974,15 @@
       }]
     },
     {
+      type: 'text',
+      key: 'preFunc',
+      label: '鍓嶇疆鍑芥暟',
+      initVal: card.preFunc || '',
+      tooltip: '鍓嶇疆鍑芥暟鎵ц瀹屾垚鍚庯紝缁撴灉浼氫紶鍏ュ唴閮ㄥ嚱鏁颁腑锛屾鏃跺唴閮ㄥ嚱鏁颁細寮傛鎵ц锛涘綋鍓嶇疆鍑芥暟杩斿洖涓璄rrCode绛変簬-1鏃讹紝灏嗕笉鍐嶆墽琛屽唴閮ㄥ嚱鏁般��',
+      required: false,
+      forbid: appType === 'mob'
+    },
+    {
       type: 'radio',
       key: 'control',
       label: '鎸夐挳鎺у埗',
@@ -1824,6 +1833,14 @@
       }]
     },
     {
+      type: 'text',
+      key: 'preFunc',
+      label: '鍓嶇疆鍑芥暟',
+      initVal: card.preFunc || '',
+      tooltip: '鍓嶇疆鍑芥暟鎵ц瀹屾垚鍚庯紝缁撴灉浼氫紶鍏ュ唴閮ㄥ嚱鏁颁腑锛屾鏃跺唴閮ㄥ嚱鏁颁細寮傛鎵ц锛涘綋鍓嶇疆鍑芥暟杩斿洖涓璄rrCode绛変簬-1鏃讹紝灏嗕笉鍐嶆墽琛屽唴閮ㄥ嚱鏁般��',
+      required: false
+    },
+    {
       type: 'radio',
       key: 'control',
       label: '鎸夐挳鎺у埗',
diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx
index 9f4b267..8cb10c1 100644
--- a/src/tabviews/zshare/actionList/normalbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -1061,37 +1061,48 @@
 
       if (params[0].$unCheckParam) {
         this.checkLoopRequest(params, _resolve)
+      } else if (btn.preFunc && params.length === 1) {
+        let param = params[0]
+        let _param = fromJS(param).toJS()
+        _param.func = btn.preFunc
+
+        Api.genericInterface(_param).then(res => {
+          if (res.status) {
+            if (res.ErrCode !== '-1') {
+              param = {...param, ...res}
+
+              delete param.status
+              delete param.ErrCode
+              delete param.ErrMesg
+              delete param.message
+  
+              setTimeout(() => {
+                Api.genericInterface(param).then(result => {
+                  if (!result.status) {
+                    notification.warning({
+                      top: 92,
+                      message: result.message,
+                      duration: 5
+                    })
+                  }
+                })
+              }, 600)
+            }
+
+            this.triggerNote(res) // 娑堟伅
+            this.execSuccess(res)
+          } else {
+            this.execError(res)
+          }
+        }, () => {
+          this.updateStatus()
+          _resolve()
+        })
       } else if (params.length <= 20 && btn.execType !== 'single') {
         let deffers = params.map((param, i) => {
           return new Promise(resolve => {
             setTimeout(() => {
-              let _param = null
-              if (btn.preFunc) {
-                _param = fromJS(param).toJS()
-                param.func = btn.preFunc
-              }
               Api.genericInterface(param).then(res => {
-                if (btn.preFunc && res.status && res.ErrCode !== '-1') {
-                  _param = {..._param, ...res}
-
-                  delete _param.status
-                  delete _param.ErrCode
-                  delete _param.ErrMesg
-                  delete _param.message
-
-                  setTimeout(() => {
-                    Api.genericInterface(_param).then(result => {
-                      if (!result.status) {
-                        notification.warning({
-                          top: 92,
-                          message: result.message,
-                          duration: 5
-                        })
-                      }
-                    })
-                  }, 600)
-                }
-
                 if (res.status) {
                   this.triggerNote(res) // 娑堟伅
                 }
@@ -1566,36 +1577,8 @@
       loadingNumber: params.length
     })
 
-    let _param = null
-
-    if (btn.preFunc) {
-      _param = fromJS(param).toJS()
-      param.func = btn.preFunc
-    }
-
     Api.genericInterface(param).then(res => {
       if (res.status) {
-        if (btn.preFunc && res.ErrCode !== '-1') {
-          _param = {..._param, ...res}
-  
-          delete _param.status
-          delete _param.ErrCode
-          delete _param.ErrMesg
-          delete _param.message
-  
-          setTimeout(() => {
-            Api.genericInterface(_param).then(result => {
-              if (!result.status) {
-                notification.warning({
-                  top: 92,
-                  message: result.message,
-                  duration: 5
-                })
-              }
-            })
-          }, 600)
-        }
-
         this.triggerNote(res) // 娑堟伅
 
         if (params.length === 0) {
diff --git a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx
index 13bf576..d3d1ea1 100644
--- a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx
+++ b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx
@@ -186,7 +186,7 @@
           reReadonly.interface = true
           reRequired.interface = false
         }
-      } else if (intertype === 'inner') { // preFunc 鍓嶇疆鍑芥暟
+      } else if (intertype === 'inner') {
         shows.push('innerFunc', 'output')
         reRequired.innerFunc = true
       } else {
diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx
index 1fc2482..750ad13 100644
--- a/src/templates/zshare/formconfig.jsx
+++ b/src/templates/zshare/formconfig.jsx
@@ -1521,16 +1521,6 @@
       }]
     },
     {
-      type: 'text',
-      key: 'preFunc',
-      label: '鍓嶇疆鍑芥暟',
-      initVal: card.preFunc || '',
-      tooltip: usefulFields.length ? `鍑芥暟鍚嶇О闇�浠�${usefulFields.join(', ')}绛夊瓧绗﹀紑濮嬶紱鍓嶇疆鍑芥暟鎵ц瀹屾垚鍚庯紝缁撴灉浼氫紶鍏ュ唴閮ㄥ嚱鏁颁腑锛屾鏃跺唴閮ㄥ嚱鏁颁細寮傛鎵ц锛涘綋鍓嶇疆鍑芥暟杩斿洖涓璄rrCode绛変簬-1鏃讹紝灏嗕笉鍐嶆墽琛屽唴閮ㄥ嚱鏁般�俙 : '',
-      fields: usefulFields,
-      required: false,
-      readonly: false
-    },
-    {
       type: 'radio',
       key: 'control',
       label: '鎸夐挳鎺у埗',

--
Gitblit v1.8.0