From 137fb8ea6af2789b3238b22bac31d80bced41dfe Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 28 七月 2021 11:39:39 +0800
Subject: [PATCH] 2021-07-28

---
 src/templates/sharecomponent/actioncomponent/actionform/index.jsx |   37 +++++++++++++++++++++++++++----------
 1 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx
index 1addfe3..53a733a 100644
--- a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx
+++ b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx
@@ -38,6 +38,7 @@
     position: null,  // 鎸夐挳浣嶇疆
     procMode: null,  // 澶栭儴鎺ュ彛鍙傛暟澶勭悊鏂瑰紡
     pageTemplate: null,
+    Ot: null,
     requireOptions: [{
       value: 'notRequired',
       text: this.props.dict['header.form.notRequired']
@@ -97,6 +98,7 @@
     let _funcType = card.funcType || ''         // 鍔熻兘鎸夐挳榛樿绫诲瀷
     let _tabTemplate = card.tabTemplate         // 鎸夐挳涓烘爣绛鹃〉鏃讹紝鏍囩绫诲瀷锛氫笁绾ц彍鍗曟垨琛ㄥ崟鏍囩椤�
     let _pageTemplate = card.pageTemplate       // 鏂伴〉闈㈢被鍨�
+    let _Ot = card.Ot || 'requiredSgl'
 
     if (_opentype === 'outerpage') {
       card.pageTemplate = 'custom'
@@ -104,9 +106,10 @@
     }
 
     let _tabs = this.props.tabs.filter(tab => tab.type === 'SubTable')
-    let _options = this.getOptions(_opentype, _intertype, _funcType, _pageTemplate, _tabTemplate, _procMode)
+    let _options = this.getOptions(_opentype, _intertype, _funcType, _pageTemplate, _tabTemplate, _procMode, _Ot)
     
     this.setState({
+      Ot: _Ot,
       openType: _opentype,
       pageTemplate: _pageTemplate,
       interType: _intertype,
@@ -172,7 +175,7 @@
     }
   }
 
-  getOptions = (_opentype, _intertype, _funcType, _pageTemplate, _tabTemplate, _procMode) => {
+  getOptions = (_opentype, _intertype, _funcType, _pageTemplate, _tabTemplate, _procMode, _Ot) => {
     let _options = fromJS(actionTypeOptions[_opentype]).toJS() // 閫夐」鍒楄〃
     
     if (_opentype === 'innerpage') {         // 鏂伴〉闈紝鍙�夋ā鏉�(鑷畾涔夋椂锛屽彲濉叆澶栭儴閾炬帴)
@@ -227,6 +230,10 @@
       _options.push('resetPageIndex')
     }
 
+    if (_Ot !== 'notRequired' && _opentype !== 'excelOut') {
+      _options.push('controlField', 'controlVal')
+    }
+
     return _options
   }
 
@@ -234,11 +241,11 @@
    * @description 鍒囨崲
    */
   optionChange = (key, value) => {
-    const { openType, funcType, procMode } = this.state
+    const { openType, funcType, procMode, Ot } = this.state
     const { card } = this.props
 
     if (key === 'OpenType') {
-      let _options = this.getOptions(value, 'system', '', this.state.pageTemplate, card.tabTemplate, 'system')
+      let _options = this.getOptions(value, 'system', '', this.state.pageTemplate, card.tabTemplate, 'system', Ot)
       let _fieldval = {}
       let _formlist = this.state.formlist.map(item => {
         item.hidden = !_options.includes(item.key)
@@ -343,7 +350,7 @@
     //     this.props.form.setFieldsValue(_fieldval)
     //   })
     } else if (key === 'funcType') {
-      let _options = this.getOptions('funcbutton', this.state.interType, value, card.pageTemplate, card.tabTemplate, procMode)
+      let _options = this.getOptions('funcbutton', this.state.interType, value, card.pageTemplate, card.tabTemplate, procMode, Ot)
       let _fieldval = {}
 
       this.setState({
@@ -397,7 +404,7 @@
         this.props.form.setFieldsValue(_fieldval)
       })
     } else if (key === 'pageTemplate') {
-      let _options = this.getOptions('innerpage', this.state.interType, this.state.funcType, value, card.tabTemplate, procMode)
+      let _options = this.getOptions('innerpage', this.state.interType, this.state.funcType, value, card.tabTemplate, procMode, Ot)
       let _fieldval = {}
 
       this.setState({
@@ -438,7 +445,7 @@
         })
       })
     } else if (key === 'intertype') {
-      let _options = this.getOptions(openType, value, funcType, '', '', procMode)
+      let _options = this.getOptions(openType, value, funcType, '', '', procMode, Ot)
 
       this.setState({
         interType: value,
@@ -458,7 +465,7 @@
         })
       })
     } else if (key === 'procMode') {
-      let _options = this.getOptions(openType, this.state.interType, funcType, '', '', value)
+      let _options = this.getOptions(openType, this.state.interType, funcType, '', '', value, Ot)
 
       this.setState({
         procMode: value,
@@ -468,6 +475,16 @@
           if (item.key === 'innerFunc') {
             item.required = true
           }
+          return item
+        })
+      })
+    } else if (key === 'Ot') {
+      let _options = this.getOptions(openType, this.state.interType, funcType, this.state.pageTemplate, card.tabTemplate, procMode, value)
+
+      this.setState({
+        Ot: value,
+        formlist: this.state.formlist.map(item => {
+          item.hidden = !_options.includes(item.key)
           return item
         })
       })
@@ -599,8 +616,8 @@
                   getPopupContainer={() => document.getElementById('winter')}
                 >
                   {item.options.map((option, index) =>
-                    <Select.Option id={`${index}`} title={option.text} key={`${index}`} value={option.value}>
-                      {item.key === 'icon' && option.value && <Icon type={option.value} />} {option.text}
+                    <Select.Option id={`${index}`} title={option.text} key={`${index}`} value={option.value || option.field}>
+                      {item.key === 'icon' && option.value ? <Icon type={option.value} /> : null} {option.text || option.label}
                     </Select.Option>
                   )}
                 </Select>

--
Gitblit v1.8.0