From abe57d274e6b12c3612788e0be3d1b9201852ebd Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 24 三月 2021 17:34:55 +0800
Subject: [PATCH] 2021-03-24

---
 src/tabviews/zshare/actionList/normalbutton/index.jsx |   35 ++++++++++++++++++++++++++++++-----
 1 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx
index b3dfeee..d1693db 100644
--- a/src/tabviews/zshare/actionList/normalbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -54,6 +54,8 @@
 
     if (position === 'toolbar') {
       MKEmitter.addListener('triggerBtnId', this.actionTrigger)
+    } else if (position === 'form') {
+      MKEmitter.addListener('triggerFormSubmit', this.actionSubmit)
     }
   }
 
@@ -62,6 +64,23 @@
       return
     }
     MKEmitter.removeListener('triggerBtnId', this.actionTrigger)
+    MKEmitter.removeListener('triggerFormSubmit', this.actionSubmit)
+  }
+
+  actionSubmit = (res) => {
+    const { btn } = this.props
+
+    if (btn.uuid !== res.menuId) return
+
+    this.setState({
+      confirmLoading: true
+    })
+
+    this.execSubmit(this.state.tabledata, () => {
+      this.setState({
+        confirmLoading: false
+      })
+    }, res.form)
   }
 
   /**
@@ -117,7 +136,7 @@
         duration: 5
       })
       return
-    } else if (!setting.primaryKey) {
+    } else if (btn.OpenType !== 'formSubmit' && !setting.primaryKey) {
       // 闇�瑕侀�夋嫨琛屾椂锛屾牎楠屾槸鍚﹁缃富閿�
       notification.warning({
         top: 92,
@@ -179,7 +198,13 @@
       return
     }
 
-    if (btn.OpenType === 'prompt') {
+    if (btn.OpenType === 'formSubmit') {
+      this.setState({
+        tabledata: data
+      })
+      MKEmitter.emit('mkFormSubmit', btn.uuid)
+      return
+    } else if (btn.OpenType === 'prompt') {
       this.updateStatus('start')
       confirm({
         title: this.state.dict['main.action.confirm.tip'],
@@ -275,7 +300,7 @@
         }
 
         param.LText = Utils.formatOptions(param.LText)
-      } else if (btn.OpenType === 'pop') { // 琛ㄥ崟
+      } else if (btn.OpenType === 'pop' || btn.OpenType === 'formSubmit') { // 琛ㄥ崟
         if (btn.sqlType === 'insert') { // 绯荤粺鍑芥暟娣诲姞鏃讹紝鐢熸垚uuid
           primaryId = ''
 
@@ -499,7 +524,7 @@
 
       param[setting.primaryKey] = primaryId // 璁剧疆涓婚敭鍙傛暟
 
-      if (btn.OpenType === 'pop') { // 琛ㄥ崟
+      if (btn.OpenType === 'pop' || btn.OpenType === 'formSubmit') { // 琛ㄥ崟
         formdata.forEach(_data => {
           param[_data.key] = _data.value
         })
@@ -610,7 +635,7 @@
           param.BID = this.props.BID
         }
 
-        if (btn.OpenType === 'pop' && formdata) { // 琛ㄥ崟
+        if ((btn.OpenType === 'pop' || btn.OpenType === 'formSubmit') && formdata) { // 琛ㄥ崟
           formdata.forEach(_data => {
             param[_data.key] = _data.value
           })

--
Gitblit v1.8.0