From 2897fe721d782a83cb5bce1ca93bd64cf1e9c26e Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 17 十一月 2021 22:19:19 +0800
Subject: [PATCH] 2021-11-17

---
 src/menu/components/share/actioncomponent/actionform/index.jsx |   38 ++++++++++++++++++++++++++++----------
 1 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx
index 2bc9602..c7ce951 100644
--- a/src/menu/components/share/actioncomponent/actionform/index.jsx
+++ b/src/menu/components/share/actioncomponent/actionform/index.jsx
@@ -38,6 +38,7 @@
     interType: null, // 鎺ュ彛绫诲瀷锛氬唴閮ㄣ�佸閮�
     funcType: null,  // 鍔熻兘绫诲瀷
     procMode: null,  // 鍙傛暟鏂瑰紡
+    control: '',
     pageTemplate: null,
     appType: sessionStorage.getItem('appType'),
     Ot: null,
@@ -99,11 +100,13 @@
     let _procMode = card.procMode || 'system'
     let _Ot = card.Ot || 'requiredSgl'
     let _pageTemplate = card.pageTemplate || ''
+    let control = card.control || ''
 
-    let _options = this.getOptions(_opentype, _intertype, _funcType, _pageTemplate, _procMode, _Ot)
+    let _options = this.getOptions(_opentype, _intertype, _funcType, _pageTemplate, _procMode, _Ot, control)
 
     this.setState({
       Ot: _Ot,
+      control: control,
       openType: _opentype,
       interType: _intertype,
       procMode: _procMode,
@@ -157,7 +160,7 @@
     })
   }
 
-  getOptions = (_opentype, _intertype, _funcType, _pageTemplate, _procMode, _Ot) => {
+  getOptions = (_opentype, _intertype, _funcType, _pageTemplate, _procMode, _Ot, _control) => {
     let _options = actionTypeOptions[_opentype] ? fromJS(actionTypeOptions[_opentype]).toJS() : [] // 閫夐」鍒楄〃
 
     if (_opentype === 'innerpage') {         // 鏂伴〉闈紝鍙�夋ā鏉�(鑷畾涔夋椂锛屽彲濉叆澶栭儴閾炬帴)
@@ -216,7 +219,10 @@
     }
 
     if (_Ot !== 'notRequired' && _opentype !== 'excelOut') {
-      _options.push('controlField', 'controlVal')
+      _options.push('control')
+      if (_control) {
+        _options.push('controlField', 'controlVal')
+      }
     }
     if (_Ot === 'requiredSgl' && ['pop', 'prompt', 'exec'].includes(_opentype)) {
       _options.push('swipe')
@@ -246,10 +252,10 @@
    */
   optionChange = (key, value) => {
     const { card, type } = this.props
-    const { openType, procMode, Ot, pageTemplate } = this.state
+    const { openType, procMode, Ot, pageTemplate, control } = this.state
 
     if (key === 'OpenType') {
-      let _options = this.getOptions(value, 'system', this.state.funcType, '', 'system', Ot)
+      let _options = this.getOptions(value, 'system', this.state.funcType, '', 'system', Ot, control)
 
       let _fieldval = {}
       let _formlist = this.state.formlist.map(item => {
@@ -258,6 +264,8 @@
         if (item.key === 'intertype') {
           let iscustom = ['pop', 'prompt', 'exec'].includes(value)
           item.options = this.state.interTypeOptions.filter(op => (iscustom || op.value !== 'custom'))
+        } else if (item.key === 'control') {
+          item.initVal = control
         }
 
         if (item.hidden) return item
@@ -316,7 +324,7 @@
         this.props.form.setFieldsValue(_fieldval)
       })
     } else if (key === 'funcType') {
-      let _options = this.getOptions(openType, this.state.interType, value, pageTemplate, procMode, Ot)
+      let _options = this.getOptions(openType, this.state.interType, value, pageTemplate, procMode, Ot, control)
       let _fieldval = {}
 
       if (value === 'print') {
@@ -399,7 +407,7 @@
       })
     } else if (key === 'pageTemplate') {
       let _fieldval = {}
-      let _options = this.getOptions(openType, this.state.interType, this.state.funcType, value, procMode, Ot)
+      let _options = this.getOptions(openType, this.state.interType, this.state.funcType, value, procMode, Ot, control)
 
       this.setState({
         pageTemplate: value,
@@ -423,7 +431,7 @@
         this.props.form.setFieldsValue(_fieldval)
       })
     } else if (key === 'intertype') {
-      let _options = this.getOptions(openType, value, this.state.funcType, pageTemplate, procMode, Ot)
+      let _options = this.getOptions(openType, value, this.state.funcType, pageTemplate, procMode, Ot, control)
 
       this.setState({
         interType: value,
@@ -445,7 +453,7 @@
         })
       })
     } else if (key === 'procMode') {
-      let _options = this.getOptions(openType, this.state.interType, this.state.funcType, pageTemplate, value, Ot)
+      let _options = this.getOptions(openType, this.state.interType, this.state.funcType, pageTemplate, value, Ot, control)
 
       this.setState({
         procMode: value,
@@ -459,7 +467,7 @@
         })
       })
     } else if (key === 'Ot') {
-      let _options = this.getOptions(openType, this.state.interType, this.state.funcType, pageTemplate, procMode, value)
+      let _options = this.getOptions(openType, this.state.interType, this.state.funcType, pageTemplate, procMode, value, control)
 
       this.setState({
         Ot: value,
@@ -468,6 +476,16 @@
           return item
         })
       })
+    } else if (key === 'control') {
+      let _options = this.getOptions(openType, this.state.interType, this.state.funcType, pageTemplate, procMode, Ot, value)
+
+      this.setState({
+        control: value,
+        formlist: this.state.formlist.map(item => {
+          item.hidden = !_options.includes(item.key)
+          return item
+        })
+      })
     } else if (key === 'sysInterface') {
       if (value === 'true') {
         this.props.form.setFieldsValue({

--
Gitblit v1.8.0