From f01086dc94827dbb15811760e5d13683977fcec9 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 10 十一月 2022 00:40:12 +0800
Subject: [PATCH] 2022-11-10

---
 src/menu/components/form/formaction/actionform/index.jsx |  115 ++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 92 insertions(+), 23 deletions(-)

diff --git a/src/menu/components/form/formaction/actionform/index.jsx b/src/menu/components/form/formaction/actionform/index.jsx
index f36d0b1..7f5eae5 100644
--- a/src/menu/components/form/formaction/actionform/index.jsx
+++ b/src/menu/components/form/formaction/actionform/index.jsx
@@ -11,7 +11,6 @@
 
 class ActionForm extends Component {
   static propTpyes = {
-    dict: PropTypes.object,      // 瀛楀吀椤�
     formlist: PropTypes.any,     // 琛ㄥ崟淇℃伅
     card: PropTypes.any,         // 鎸夐挳淇℃伅
     inputSubmit: PropTypes.any   // 鍥炶溅鎻愪氦浜嬩欢
@@ -21,6 +20,8 @@
     formlist: null,  // 琛ㄥ崟淇℃伅
     interType: null, // 鎺ュ彛绫诲瀷锛氬唴閮ㄣ�佸閮�
     procMode: null,  // 鍙傛暟鏂瑰紡
+    linkmenu: null,
+    callbackType: null
   }
 
   
@@ -29,12 +30,15 @@
 
     let _intertype = card.intertype || 'system'  // 鎺ュ彛绫诲瀷
     let _procMode = card.procMode || 'system'    // 鍙傛暟璇锋眰鏂瑰紡
+    let _callbackType = card.callbackType || 'script'
 
-    let _options = this.getOptions(_intertype, _procMode)
+    let _options = this.getOptions(_intertype, _procMode, card.linkmenu, _callbackType)
 
     this.setState({
       interType: _intertype,
       procMode: _procMode,
+      callbackType: _callbackType,
+      linkmenu: card.linkmenu,
       formlist: this.props.formlist.map(item => {
         if (item.key === 'innerFunc' && _procMode === 'inner') {
           item.required = true
@@ -46,30 +50,53 @@
     })
   }
 
-  getOptions = (_intertype, _procMode) => {
+  getOptions = (_intertype, _procMode, linkmenu, _callbackType) => {
     const { card } = this.props
 
     if (card.type === 'prev') {
-      return ['type', 'label', 'enable']
+      return ['type', 'label', 'enable', 'actionType']
     } else if (card.type === 'next') {
+      return ['type', 'label', 'enable', 'actionType']
+    } else if (card.type === 'close') {
       return ['type', 'label', 'enable']
     }
-    let _options = ['type', 'label', 'intertype', 'syncComponent', 'linkmenu', 'open', 'enable', 'output'] // 閫夐」鍒楄〃
+    
+    let _options = ['type', 'label', 'intertype', 'Ot', 'execSuccess', 'syncComponent', 'anchors', 'linkmenu', 'enable', 'output', 'reload'] // 閫夐」鍒楄〃
     
     if (_intertype === 'custom') {
       _options.pop()
-      _options.push('procMode', 'interface', 'callbackType', 'cbTable', 'proInterface', 'method', 'cross')
+      _options.push('procMode', 'interface', 'callbackType', 'proInterface', 'method', 'cross')
       if (_procMode === 'system') {
         _options.push('sql', 'sqlType')
       } else {
         _options.push('innerFunc')
       }
+      if (_callbackType === 'func') {
+        _options.push('callbackFunc')
+      } else if (_callbackType !== 'none') {
+        _options.push('cbTable')
+      }
     } else if (_intertype === 'outer') {
-      _options.push('innerFunc', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackFunc')
+      _options.push('procMode', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackType')
+      if (_procMode === 'system') {
+        _options.push('sql', 'sqlType')
+      } else if (_procMode === 'inner') {
+        _options.push('innerFunc')
+      }
+      if (_callbackType === 'func') {
+        _options.push('callbackFunc')
+      } else if (_callbackType !== 'none') {
+        _options.push('cbTable')
+      }
+
     } else if (_intertype === 'inner') {
       _options.push('innerFunc')
     } else {
       _options.push('sql', 'sqlType')
+    }
+    
+    if (linkmenu && linkmenu !== 'goback') {
+      _options.push('open')
     }
 
     return _options
@@ -82,10 +109,10 @@
    * 3銆佸垏鎹㈡爣绛剧被鍨嬶紝閲嶇疆鍙�夋爣绛�
    */
   optionChange = (key, value) => {
-    const { procMode } = this.state
+    const { procMode, linkmenu, callbackType } = this.state
 
     if (key === 'intertype') {
-      let _options = this.getOptions(value, procMode)
+      let _options = this.getOptions(value, procMode, linkmenu, callbackType)
 
       this.setState({
         interType: value,
@@ -101,16 +128,39 @@
         })
       })
     } else if (key === 'procMode') {
-      let _options = this.getOptions(this.state.interType, value)
+      let _options = this.getOptions(this.state.interType, value, linkmenu, callbackType)
 
       this.setState({
         procMode: value,
         formlist: this.state.formlist.map(item => {
           item.hidden = !_options.includes(item.key)
 
-          if (item.key === 'innerFunc') {
-            item.required = true
+          if (item.key === 'procMode') {
+            item.initVal = value
           }
+          return item
+        })
+      })
+    } else if (key === 'linkmenu') {
+      let _options = this.getOptions(this.state.interType, procMode, value, callbackType)
+
+      this.setState({
+        linkmenu: value,
+        formlist: this.state.formlist.map(item => {
+          item.hidden = !_options.includes(item.key)
+          return item
+        })
+      })
+    } else if (key === 'callbackType') {
+      let _options = this.getOptions(this.state.interType, procMode, linkmenu, value)
+
+      this.setState({
+        callbackType: value,
+        formlist: this.state.formlist.map(item => {
+          if (item.key === 'callbackType') {
+            item.initVal = value
+          }
+          item.hidden = !_options.includes(item.key)
           return item
         })
       })
@@ -144,12 +194,13 @@
 
   getFields() {
     const { getFieldDecorator } = this.props.form
+    const { interType, callbackType } = this.state
     const fields = []
 
     this.state.formlist.forEach((item, index) => {
       if (item.hidden || item.forbid) return
 
-      if (item.type === 'text') { // 鏂囨湰鎼滅储
+      if (item.type === 'text') {
         let _rules = []
         if (item.key === 'innerFunc') {
           let str = '^(' + item.fields.join('|') + ')'
@@ -169,6 +220,24 @@
             max: formRule.func.max,
             message: formRule.func.maxMessage
           }]
+        } else if (item.key === 'output') {
+          if (interType === 'system' || ((interType === 'outer' || interType === 'custom') && callbackType === 'script')) {
+            _rules = [{
+              pattern: /^@[0-9a-zA-Z_]+@?$/,
+              message: '鍙橀噺浠绗﹀紑澶达紝鍙娇鐢ㄥ瓧姣嶃�佹暟瀛椾互鍙奯'
+            }, {
+              max: 100,
+              message: '鏈�澶�100涓瓧绗︺��'
+            }]
+          } else {
+            _rules = [{
+              pattern: /^[0-9a-zA-Z_]*$/,
+              message: '瀛楁鍙娇鐢ㄥ瓧姣嶃�佹暟瀛椾互鍙奯'
+            }, {
+              max: 100,
+              message: '鏈�澶�100涓瓧绗︺��'
+            }]
+          }
         } else {
           _rules = [{
             max: formRule.input.max,
@@ -188,7 +257,7 @@
                 rules: [
                   {
                     required: item.readonly ? false : !!item.required,
-                    message: this.props.dict['form.required.input'] + item.label + '!'
+                    message: '璇疯緭鍏�' + item.label + '!'
                   },
                   ..._rules
                 ]
@@ -218,17 +287,17 @@
                 rules: [
                   {
                     required: item.readonly ? false : !!item.required,
-                    message: this.props.dict['form.required.input'] + item.label + '!'
+                    message: '璇疯緭鍏�' + item.label + '!'
                   }
                 ]
-              })(<InputNumber min={0} max={10000} precision={0} />)}
+              })(<InputNumber min={0} max={10000} precision={0} onPressEnter={this.handleSubmit}/>)}
             </Form.Item>
           </Col>
         )
       } else if (item.type === 'select') { // 涓嬫媺鎼滅储
         fields.push(
           <Col span={12} key={index}>
-            <Form.Item label={item.tooltip ?
+            <Form.Item help={item.help || null} label={item.tooltip ?
               <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}>
                 <QuestionCircleOutlined className="mk-form-tip" />
                 {item.label}
@@ -239,13 +308,13 @@
                 rules: [
                   {
                     required: !!item.required,
-                    message: this.props.dict['form.required.select'] + item.label + '!'
+                    message: '璇烽�夋嫨' + item.label + '!'
                   }
                 ]
               })(
                 <Select
                   showSearch
-                  filterOption={(input, option) => option.props.children[2].toLowerCase().indexOf(input.toLowerCase()) >= 0}
+                  filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                   onChange={(value) => {this.optionChange(item.key, value)}}
                   getPopupContainer={() => document.getElementById('winter')}
                   allowClear={item.allowClear}
@@ -274,7 +343,7 @@
                 rules: [
                   {
                     required: !!item.required,
-                    message: this.props.dict['form.required.select'] + item.label + '!'
+                    message: '璇烽�夋嫨' + item.label + '!'
                   }
                 ]
               })(
@@ -300,7 +369,7 @@
                 rules: [
                   {
                     required: item.readonly ? false : !!item.required,
-                    message: this.props.dict['form.required.input'] + item.label + '!'
+                    message: '璇疯緭鍏�' + item.label + '!'
                   }
                 ]
               })(<TextArea rows={2} readOnly={item.readonly}/>)}
@@ -321,7 +390,7 @@
                 rules: [
                   {
                     required: !!item.required,
-                    message: this.props.dict['form.required.select'] + item.label + '!'
+                    message: '璇烽�夋嫨' + item.label + '!'
                   }
                 ]
               })(
@@ -360,7 +429,7 @@
       }
     }
     return (
-      <Form {...formItemLayout} className="menu-action-list-form" id="winter">
+      <Form {...formItemLayout} className="menu-form-action-list" id="winter">
         <Row gutter={24}>{this.getFields()}</Row>
       </Form>
     )

--
Gitblit v1.8.0