From c76e56d9cc6f8f5e93aaf355b269ec8cac8c6b95 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期六, 15 二月 2020 02:18:10 +0800
Subject: [PATCH] 2020-02-15

---
 src/templates/formtabconfig/actionform/index.jsx |  124 +++++++++++++++++++++++++++++++++++++----
 1 files changed, 112 insertions(+), 12 deletions(-)

diff --git a/src/templates/formtabconfig/actionform/index.jsx b/src/templates/formtabconfig/actionform/index.jsx
index 95bdf11..a87c475 100644
--- a/src/templates/formtabconfig/actionform/index.jsx
+++ b/src/templates/formtabconfig/actionform/index.jsx
@@ -28,6 +28,23 @@
     }, {
       value: 'update',
       text: this.props.dict['header.form.action.update']
+    }],
+    returnoptions: [{ // 杩斿洖鍚�-涓嶅埛鏂般�佸埛鏂伴〉闈€�佸埛鏂拌〃鏍�
+      value: 'never',
+      text: this.props.dict['header.form.refresh.never']
+    }, {
+      value: 'grid',
+      text: this.props.dict['header.form.refresh.grid']
+    }, {
+      value: 'view',
+      text: this.props.dict['header.form.refresh.view']
+    }],
+    currentoptions: [{ // 涓嶈繑鍥炴椂-涓嶅埛鏂般�佸埛鏂�
+      value: 'never',
+      text: this.props.dict['header.form.refresh.never']
+    }, {
+      value: 'refresh',
+      text: this.props.dict['header.form.refresh']
     }]
   }
 
@@ -36,20 +53,32 @@
     const { card } = this.props
     let _intertype = ''
     let _options = null
-    console.log(this.props.card.btnType)
+    let _success = 'close'
+    let _error = 'notclose'
+
+    this.props.formlist.forEach(form => {
+      if (form.key === 'intertype') {
+        _intertype = form.initVal
+      } else if (form.key === 'afterExecSuccess') {
+        _success = form.initVal
+      } else if (form.key === 'afterExecError') {
+        _error = form.initVal
+      }
+    })
+
     if (card.btnType === 'cancel') {
       _options = ['label', 'OpenType', 'icon', 'class', 'execSuccess']
-    } else {
-      this.props.formlist.forEach(form => {
-        if (form.key === 'intertype') {
-          _intertype = form.initVal
-        }
-      })
-  
+    } else if (card.btnType === 'confirm') {
       if (_intertype === 'outer') {
         _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'sysInterface', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError']
       } else {
         _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType', 'afterExecSuccess', 'afterExecError']
+      }
+    } else {
+      if (_intertype === 'outer') {
+        _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'sysInterface', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError']
+      } else {
+        _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError']
       }
     }
 
@@ -76,7 +105,22 @@
           }
         } else if (item.key === 'execSuccess' && card.btnType === 'cancel') {
           item.label = '鍏抽棴鍚�'
+        } else if (item.key === 'execSuccess' && card.btnType !== 'cancel') {
+          if (_success === 'close') {
+            item.options = this.state.returnoptions
+          } else {
+            item.options = this.state.currentoptions
+          }
+        } else if (item.key === 'execError') {
+          if (_error === 'close') {
+            item.options = this.state.returnoptions
+          } else {
+            item.options = this.state.currentoptions
+          }
+        } else if (item.key === 'innerFunc' && card.btnType !== 'confirm' && _intertype === 'inner') {
+          item.required = true
         }
+
         item.hidden = !_options.includes(item.key)
         return item
       })
@@ -96,15 +140,66 @@
     }
   }
 
+  selectChange = (key, value) => {
+    if (key === 'afterExecSuccess') {
+      this.setState({
+        formlist: this.state.formlist.map(item => {
+          if (item.key === 'execSuccess') {
+            if (value === 'close') {
+              item.options = this.state.returnoptions
+            } else {
+              item.options = this.state.currentoptions
+            }
+          }
+
+          return item
+        })
+      })
+      this.props.form.setFieldsValue({
+        execSuccess: 'never'
+      })
+    } else if (key === 'afterExecError') {
+      this.setState({
+        formlist: this.state.formlist.map(item => {
+          if (item.key === 'execError') {
+            if (value === 'close') {
+              item.options = this.state.returnoptions
+            } else {
+              item.options = this.state.currentoptions
+            }
+          }
+  
+          return item
+        })
+      })
+      this.props.form.setFieldsValue({
+        execError: 'never'
+      })
+    }
+  }
+
   onChange = (e, key) => {
+    const { card } = this.props
+
     let value = e.target.value
+
     if (key === 'intertype') {
       let _options = null
-      if (value === 'inner') {
-        _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType', 'afterExecSuccess', 'afterExecError']
+
+      if (card.btnType === 'confirm') {
+        if (value === 'outer') {
+          _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'sysInterface', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError']
+        } else {
+          _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType', 'afterExecSuccess', 'afterExecError']
+        }
       } else {
-        _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'afterExecSuccess', 'afterExecError']
+        if (value === 'outer') {
+          _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'sysInterface', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError']
+        } else {
+          _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError']
+        }
       }
+
       this.setState({
         interType: value,
         formlist: this.state.formlist.map(item => {
@@ -114,7 +209,12 @@
             item.readonly = false
           } else if (item.key === 'sysInterface') {
             item.initVal = 'false'
+          } else if (item.key === 'innerFunc' && card.btnType !== 'confirm' && value === 'inner') {
+            item.required = true
+          } else if (item.key === 'innerFunc' && card.btnType !== 'confirm' && value === 'outer') {
+            item.required = false
           }
+
           return item
         })
       })
@@ -125,7 +225,6 @@
         })
       }
       this.setState({
-        // interType: value,
         formlist: this.state.formlist.map(item => {
           if (item.key === 'interface' && value === 'true') {
             item.readonly = true
@@ -230,6 +329,7 @@
                   showSearch
                   filterOption={(input, option) => option.props.children[2].toLowerCase().indexOf(input.toLowerCase()) >= 0}
                   getPopupContainer={() => document.getElementById('winter')}
+                  onChange={(val) => this.selectChange(item.key, val)}
                   disabled={!!item.readonly}
                 >
                   {item.options.map((option, index) =>

--
Gitblit v1.8.0