From d36c27e80e668b3bc1dcd687a18a2f2d125b32db Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期日, 24 一月 2021 02:15:12 +0800
Subject: [PATCH] 2021-01-24

---
 src/menu/components/share/actioncomponent/actionform/index.jsx |   88 +++++++++++++++++++++++++++++++------------
 1 files changed, 63 insertions(+), 25 deletions(-)

diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx
index 1240c61..29f3493 100644
--- a/src/menu/components/share/actioncomponent/actionform/index.jsx
+++ b/src/menu/components/share/actioncomponent/actionform/index.jsx
@@ -34,6 +34,7 @@
     openType: null,  // 鎵撳紑鏂瑰紡
     interType: null, // 鎺ュ彛绫诲瀷锛氬唴閮ㄣ�佸閮�
     funcType: null,  // 鍔熻兘绫诲瀷
+    procMode: null,  // 鍙傛暟鏂瑰紡
     requireOptions: [{
       value: 'notRequired',
       text: this.props.dict['header.form.notRequired']
@@ -66,6 +67,19 @@
     }, {
       value: 'custom',
       text: this.props.dict['header.form.custom']
+    }],
+    interTypeOptions: [{
+      value: 'system',
+      text: this.props.dict['model.interface.system']
+    }, {
+      value: 'inner',
+      text: this.props.dict['model.interface.inner']
+    }, {
+      value: 'outer',
+      text: this.props.dict['model.interface.outer']
+    }, {
+      value: 'custom',
+      text: '鑷畾涔�'
     }]
   }
 
@@ -76,16 +90,23 @@
     let _opentype = card.OpenType                // 鎵撳紑鏂瑰紡
     let _intertype = card.intertype || 'system'  // 鎺ュ彛绫诲瀷
     let _funcType = card.funcType || 'print'     // 鍔熻兘鎸夐挳榛樿绫诲瀷
+    let _procMode = card.procMode || 'system'     // 鍙傛暟璇锋眰鏂瑰紡
 
-    let _options = this.getOptions(_opentype, _intertype, _funcType, card.pageTemplate)
+    let _options = this.getOptions(_opentype, _intertype, _funcType, card.pageTemplate, _procMode)
 
     this.setState({
       openType: _opentype,
       interType: _intertype,
+      procMode: _procMode,
       funcType: _funcType,
       formlist: this.props.formlist.map(item => {
         if (item.key === 'class') {
           item.options = btnCustomClasses
+        } else if (item.key === 'innerFunc' && _procMode === 'inner') {
+          item.required = true
+        } else if (item.key === 'intertype') {
+          let iscustom = ['pop', 'prompt', 'exec'].includes(_opentype)
+          item.options = this.state.interTypeOptions.filter(op => (iscustom || op.value !== 'custom'))
         } else if (item.key === 'icon') {
           item.options = btnIcons
         } else if (item.key === 'Ot') {
@@ -116,7 +137,7 @@
     })
   }
 
-  getOptions = (_opentype, _intertype, _funcType, _pageTemplate) => {
+  getOptions = (_opentype, _intertype, _funcType, _pageTemplate, _procMode) => {
     let _options = fromJS(actionTypeOptions[_opentype]).toJS() // 閫夐」鍒楄〃
     
     if (_opentype === 'innerpage') {         // 鏂伴〉闈紝鍙�夋ā鏉�(鑷畾涔夋椂锛屽彲濉叆澶栭儴閾炬帴)
@@ -145,7 +166,14 @@
         }
       }
     } else if (_opentype !== 'popview' && _opentype !== 'tab') {
-      if (_intertype === 'outer') {
+      if (_intertype === 'custom') {
+        _options.push('procMode', 'interface', 'callbackType', 'cbTable', 'proInterface', 'method')
+        if (_procMode === 'system') {
+          _options.push('sql', 'sqlType')
+        } else {
+          _options.push('innerFunc')
+        }
+      } else if (_intertype === 'outer') {
         _options.push('innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc')
       } else if (_intertype === 'inner') {
         _options.push('innerFunc')
@@ -176,21 +204,27 @@
    * 2銆佹樉绀轰綅缃垏鎹紝閲嶇疆閫夋嫨琛�
    * 3銆佸垏鎹㈡爣绛剧被鍨嬶紝閲嶇疆鍙�夋爣绛�
    */
-  openTypeChange = (key, value) => {
+  optionChange = (key, value) => {
     const { card, type } = this.props
+    const { openType, procMode } = this.state
 
     if (key === 'OpenType') {
-      let _options = this.getOptions(value, this.state.interType, this.state.funcType, card.pageTemplate)
+      let _options = this.getOptions(value, 'system', this.state.funcType, card.pageTemplate, 'system')
 
       let _fieldval = {}
       
       let _formlist = this.state.formlist.map(item => {
         item.hidden = !_options.includes(item.key)
 
+        if (item.key === 'intertype') {
+          let iscustom = ['pop', 'prompt', 'exec'].includes(value)
+          item.options = this.state.interTypeOptions.filter(op => (iscustom || op.value !== 'custom'))
+        }
+
         if (item.hidden) return item
 
         if (item.key === 'intertype') {
-          _fieldval.intertype = this.state.interType
+          _fieldval.intertype = 'system'
         } else if (item.key === 'Ot') {
           if (type === 'card') {
             item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value))
@@ -217,6 +251,8 @@
 
       this.setState({
         openType: value,
+        intertype: 'system',
+        procMode: 'system',
         formlist: _formlist
       }, () => {
         if (value === 'excelIn') {
@@ -230,7 +266,7 @@
         this.props.form.setFieldsValue(_fieldval)
       })
     } else if (key === 'funcType') {
-      let _options = this.getOptions(this.state.openType, this.state.interType, value, card.pageTemplate)
+      let _options = this.getOptions(this.state.openType, this.state.interType, value, card.pageTemplate, procMode)
       let _fieldval = {}
 
       this.setState({
@@ -294,7 +330,7 @@
       })
     } else if (key === 'pageTemplate') {
       let _fieldval = {}
-      let _options = this.getOptions(this.state.openType, this.state.interType, this.state.funcType, value)
+      let _options = this.getOptions(this.state.openType, this.state.interType, this.state.funcType, value, procMode)
 
       this.setState({
         openType: value,
@@ -317,16 +353,8 @@
       }, () => {
         this.props.form.setFieldsValue(_fieldval)
       })
-    }
-  }
-
-  onChange = (e, key) => {
-    const { type } = this.props
-    const { openType } = this.state
-    let value = e.target.value
-
-    if (key === 'intertype') {
-      let _options = this.getOptions(openType, value, this.state.funcType)
+    } else if (key === 'intertype') {
+      let _options = this.getOptions(openType, value, this.state.funcType, '', procMode)
 
       this.setState({
         interType: value,
@@ -346,10 +374,20 @@
           }
           return item
         })
-      }, () => {
-        if (this.props.form.getFieldValue('sqlType') !== undefined) {
-          this.props.form.setFieldsValue({sqlType: ''})
-        }
+      })
+    } else if (key === 'procMode') {
+      let _options = this.getOptions(openType, this.state.interType, this.state.funcType, '', value)
+
+      this.setState({
+        procMode: value,
+        formlist: this.state.formlist.map(item => {
+          item.hidden = !_options.includes(item.key)
+
+          if (item.key === 'innerFunc') {
+            item.required = true
+          }
+          return item
+        })
       })
     } else if (key === 'sysInterface') {
       if (value === 'true') {
@@ -475,7 +513,7 @@
                 <Select
                   showSearch
                   filterOption={(input, option) => option.props.children[2].toLowerCase().indexOf(input.toLowerCase()) >= 0}
-                  onChange={(value) => {this.openTypeChange(item.key, value)}}
+                  onChange={(value) => {this.optionChange(item.key, value)}}
                   getPopupContainer={() => document.getElementById('winter')}
                 >
                   {item.options.map((option, index) =>
@@ -501,7 +539,7 @@
                   }
                 ]
               })(
-                <Radio.Group onChange={(e) => {this.onChange(e, item.key)}} disabled={item.readonly}>
+                <Radio.Group onChange={(e) => {this.optionChange(item.key, e.target.value)}} disabled={item.readonly}>
                   {
                     item.options.map(option => {
                       return (
@@ -520,7 +558,7 @@
             <Form.Item label={item.label} className="textarea">
               {getFieldDecorator(item.key, {
                 initialValue: item.initVal
-              })(<TextArea rows={4} />)}
+              })(<TextArea rows={2} />)}
             </Form.Item>
           </Col>
         )

--
Gitblit v1.8.0