From 0c84df247914f893ef5e41d57a422e10a2dc814c Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 12 十一月 2021 17:02:06 +0800
Subject: [PATCH] 2021-11-12

---
 src/menu/components/share/actioncomponent/actionform/index.jsx |  361 +++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 275 insertions(+), 86 deletions(-)

diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx
index 7f58d49..3636575 100644
--- a/src/menu/components/share/actioncomponent/actionform/index.jsx
+++ b/src/menu/components/share/actioncomponent/actionform/index.jsx
@@ -1,25 +1,28 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { fromJS } from 'immutable'
-import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip, InputNumber, Cascader } from 'antd'
-import { btnIcons, btnCustomClasses, formRule } from '@/utils/option.js'
+import { Form, Row, Col, Input, Select, Radio, notification, Tooltip, InputNumber, Cascader } from 'antd'
+import { QuestionCircleOutlined } from '@ant-design/icons'
+import { btnCustomClasses, formRule } from '@/utils/option.js'
 
+import asyncComponent from '@/utils/asyncComponent'
 import './index.scss'
 
 const { TextArea } = Input
+const MkIcon = asyncComponent(() => import('@/components/mkIcon'))
 const actionTypeOptions = {
-  pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'syncComponent', 'width'],
-  prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'syncComponent', 'width'],
-  exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'syncComponent', 'width'],
-  excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'icon', 'class', 'sheet', 'execSuccess', 'execError', 'syncComponent', 'width'],
-  excelOut: ['label', 'OpenType', 'intertype', 'show', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search', 'width'],
-  popview: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'popClose', 'width'],
+  pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'switchTab', 'width', 'openmenu', 'open', 'output', 'refreshTab', 'reload'],
+  prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'switchTab', 'width', 'openmenu', 'open', 'output', 'refreshTab', 'reload'],
+  exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'switchTab', 'width', 'openmenu', 'open', 'output', 'refreshTab', 'reload'],
+  excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'icon', 'class', 'sheet', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'switchTab', 'width'],
+  excelOut: ['label', 'OpenType', 'intertype', 'show', 'icon', 'class', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'resetPageIndex', 'pagination', 'search', 'width'],
+  popview: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'popClose', 'resetPageIndex', 'width', 'display', 'ratio', 'placement'],
   tab: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'linkmenu', 'width'],
-  innerpage: ['label', 'Ot', 'OpenType', 'pageTemplate', 'show', 'icon', 'class', 'width'],
+  innerpage: ['label', 'Ot', 'OpenType', 'pageTemplate', 'show', 'icon', 'class', 'width', 'open'],
   funcbutton: ['label', 'OpenType', 'funcType', 'show', 'icon', 'class', 'width']
 }
 
-class MainSearch extends Component {
+class ActionForm extends Component {
   static propTpyes = {
     dict: PropTypes.object,      // 瀛楀吀椤�
     type: PropTypes.any,         // type涓�"card"鏃讹紝鍙彲閫夊崟琛屾垨涓嶉�夎
@@ -34,6 +37,10 @@
     openType: null,  // 鎵撳紑鏂瑰紡
     interType: null, // 鎺ュ彛绫诲瀷锛氬唴閮ㄣ�佸閮�
     funcType: null,  // 鍔熻兘绫诲瀷
+    procMode: null,  // 鍙傛暟鏂瑰紡
+    pageTemplate: null,
+    appType: sessionStorage.getItem('appType'),
+    Ot: null,
     requireOptions: [{
       value: 'notRequired',
       text: this.props.dict['header.form.notRequired']
@@ -66,6 +73,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: '鑷畾涔�'
     }]
   }
 
@@ -75,32 +95,49 @@
 
     let _opentype = card.OpenType                // 鎵撳紑鏂瑰紡
     let _intertype = card.intertype || 'system'  // 鎺ュ彛绫诲瀷
-    let _funcType = card.funcType || 'print'     // 鍔熻兘鎸夐挳榛樿绫诲瀷
-    
-    if (card.execMode) {                         // 杞崲鎵撳嵃鏃舵墦寮�鏂瑰紡
-      _opentype = 'funcbutton'
-    }
+    let _funcType = card.funcType || ''          // 鍔熻兘鎸夐挳榛樿绫诲瀷
+    let _procMode = card.procMode || 'system'
+    let _Ot = card.Ot || 'requiredSgl'
+    let _pageTemplate = card.pageTemplate || ''
 
-    let _options = this.getOptions(_opentype, _intertype, _funcType, card.pageTemplate)
+    let _options = this.getOptions(_opentype, _intertype, _funcType, _pageTemplate, _procMode, _Ot)
 
     this.setState({
+      Ot: _Ot,
       openType: _opentype,
       interType: _intertype,
+      procMode: _procMode,
       funcType: _funcType,
+      pageTemplate: _pageTemplate,
       formlist: this.props.formlist.map(item => {
         if (item.key === 'class') {
           item.options = btnCustomClasses
-        } else if (item.key === 'icon') {
-          item.options = btnIcons
+        } else if (item.key === 'innerFunc' && _procMode === 'inner') {
+          item.required = true
+        } else if (item.key === 'linkmenu') {
+          if (_opentype === 'funcbutton' && _funcType === 'scan') {
+            item.required = false
+            item.tooltip = '浣跨敤鎵爜鐧诲綍鍔熻兘鎴栬彍鍗曡烦杞姛鑳芥椂锛岄渶閫夋嫨璺宠浆鐨勮彍鍗曘��'
+          } else {
+            item.tooltip = ''
+            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 === 'Ot') {
           if (type === 'card') {
-            item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value))
-          } else if (card.pageTemplate === 'pay') { // 琛岀骇鎸夐挳銆佹敮浠樻寜閽紝鍙兘閫夊崟琛�
+            if (card.sqlType === 'insert') {
+              item.options = this.state.requireOptions.filter(op => ['notRequired'].includes(op.value))
+            } else {
+              item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value))
+            }
+          } else if (_pageTemplate === 'pay') { // 琛岀骇鎸夐挳銆佹敮浠樻寜閽紝鍙兘閫夊崟琛�
             item.options = this.state.requireOptions.filter(op => ['requiredSgl'].includes(op.value))
-          } else if (['innerpage', 'blank', 'tab', 'popview', 'excelIn'].includes(_opentype)) {
+          } else if (['innerpage', 'tab', 'popview', 'excelIn'].includes(_opentype)) {
             item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value))
           } else if (card.sqlType === 'insert') {
-            item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl', 'required'].includes(op.value))
+            item.options = this.state.requireOptions.filter(op => ['notRequired'].includes(op.value))
           } else {
             item.options = this.state.requireOptions
           }
@@ -120,41 +157,69 @@
     })
   }
 
-  getOptions = (_opentype, _intertype, _funcType, _pageTemplate) => {
-    let _options = fromJS(actionTypeOptions[_opentype]).toJS() // 閫夐」鍒楄〃
-    
+  getOptions = (_opentype, _intertype, _funcType, _pageTemplate, _procMode, _Ot) => {
+    let _options = actionTypeOptions[_opentype] ? fromJS(actionTypeOptions[_opentype]).toJS() : [] // 閫夐」鍒楄〃
+
     if (_opentype === 'innerpage') {         // 鏂伴〉闈紝鍙�夋ā鏉�(鑷畾涔夋椂锛屽彲濉叆澶栭儴閾炬帴)
       if (_pageTemplate === 'custom') {
         _options.push('url', 'joint')
+      } else if (_pageTemplate === 'page') {
+        _options.push('copyMenuId', 'joint')
+      } else if (_pageTemplate === 'linkpage') {
+        _options.push('linkmenu', 'joint')
       }
     } else if (_opentype === 'excelOut') {    // 瀵煎叆瀵煎嚭
       if (_intertype === 'outer') {
-        _options.push('innerFunc', 'sysInterface', 'interface', 'outerFunc')
+        _options.push('innerFunc', 'sysInterface', 'interface', 'proInterface', 'outerFunc')
       } else if (_intertype === 'inner') {
         _options.push('innerFunc')
       }
     } else if (_opentype === 'excelIn') {    // 瀵煎叆瀵煎嚭
       if (_intertype === 'outer') {
-        _options.push('innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc')
+        _options.push('innerFunc', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackFunc')
       } else if (_intertype === 'inner') {
         _options.push('innerFunc')
       }
     } else if (_opentype === 'funcbutton') {
       if (_funcType === 'print') {
+        _options.push('execMode', 'intertype', 'Ot', 'execSuccess', 'execError', 'resetPageIndex', 'controlField', 'controlVal')
         if (_intertype === 'outer') {
-          _options.push('execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'execSuccess', 'execError')
+          _options.push('innerFunc', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackFunc')
         } else if (_intertype === 'inner') {
-          _options.push('execMode', 'intertype', 'innerFunc', 'Ot', 'execSuccess', 'execError')
+          _options.push('innerFunc')
         }
+      } else if (_funcType === 'mkBinding' || _funcType === 'mkUnBinding') {
+        _options.push('execSuccess', 'execError')
+      } else if (_funcType === 'closetab') {
+        _options.push('refreshTab')
+      } else if (_funcType === 'scan') {
+        _options.push('linkmenu')
+      } else if (_funcType === 'goBack') {
+        _options.push('reload')
       }
     } else if (_opentype !== 'popview' && _opentype !== 'tab') {
-      if (_intertype === 'outer') {
-        _options.push('innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc')
+      if (_intertype === 'custom') {
+        _options = _options.filter(m => m !== 'output')
+        _options.push('procMode', 'interface', 'callbackType', 'cbTable', 'proInterface', 'method', 'cross')
+        if (_procMode === 'system') {
+          _options.push('sql', 'sqlType')
+        } else {
+          _options.push('innerFunc')
+        }
+      } else if (_intertype === 'outer') {
+        _options.push('innerFunc', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackFunc')
       } else if (_intertype === 'inner') {
         _options.push('innerFunc')
       } else {
         _options.push('sql', 'sqlType')
       }
+    }
+
+    if (_Ot !== 'notRequired' && _opentype !== 'excelOut' && _opentype !== 'funcbutton') {
+      _options.push('controlField', 'controlVal')
+    }
+    if (_Ot === 'requiredSgl' && ['pop', 'prompt', 'exec'].includes(_opentype)) {
+      _options.push('swipe')
     }
 
     return _options
@@ -167,7 +232,7 @@
       try {
         let _form = document.getElementById('label')
         _form && _form.select()
-      } catch {
+      } catch (e) {
         console.warn('琛ㄥ崟focus澶辫触锛�')
       }
     }
@@ -179,25 +244,30 @@
    * 2銆佹樉绀轰綅缃垏鎹紝閲嶇疆閫夋嫨琛�
    * 3銆佸垏鎹㈡爣绛剧被鍨嬶紝閲嶇疆鍙�夋爣绛�
    */
-  openTypeChange = (key, value) => {
+  optionChange = (key, value) => {
     const { card, type } = this.props
+    const { openType, procMode, Ot, pageTemplate } = 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, '', 'system', Ot)
 
       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))
-          } else if (['innerpage', 'blank', 'tab', 'popview'].includes(value)) {
+          } else if (['innerpage', 'tab', 'popview'].includes(value)) {
             item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value))
             _fieldval.Ot = 'requiredSgl'
           } else if (value === 'excelIn') {
@@ -213,6 +283,16 @@
             item.options = this.state.insertUpdateOptions
           }
           _fieldval.sqlType = ''
+        } else if (item.key === 'pageTemplate') {
+          item.initVal = ''
+        } else if (item.key === 'linkmenu') {
+          if (value === 'funcbutton' && this.state.funcType === 'scan') {
+            item.required = false
+            item.tooltip = '浣跨敤鎵爜鐧诲綍鍔熻兘鎴栬彍鍗曡烦杞姛鑳芥椂锛岄渶閫夋嫨璺宠浆鐨勮彍鍗曘��'
+          } else {
+            item.tooltip = ''
+            item.required = true
+          }
         }
 
         return item
@@ -220,11 +300,14 @@
 
       this.setState({
         openType: value,
+        intertype: 'system',
+        procMode: 'system',
+        pageTemplate: '',
         formlist: _formlist
       }, () => {
         if (value === 'excelIn') {
           _fieldval.label = this.props.dict['model.form.excelIn']
-          _fieldval.class = 'border-dgreen'
+          _fieldval.class = 'dgreen'
         } else if (value === 'excelOut') {
           _fieldval.label = this.props.dict['model.form.excelOut']
           _fieldval.class = 'dgreen'
@@ -233,10 +316,17 @@
         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(openType, this.state.interType, value, pageTemplate, procMode, Ot)
       let _fieldval = {}
 
+      if (value === 'print') {
+        _fieldval.label = '鎵撳嵃'
+      } else if (value === 'closetab') {
+        _fieldval.label = '鍏抽棴'
+      }
+
       this.setState({
+        funcType: value,
         formlist: this.state.formlist.map(item => {
           item.hidden = !_options.includes(item.key)
 
@@ -250,6 +340,14 @@
             } else {
               item.options = this.state.requireOptions
             }
+          } else if (item.key === 'linkmenu') {
+            if (value === 'scan') {
+              item.required = false
+              item.tooltip = '浣跨敤鎵爜鐧诲綍鍔熻兘鎴栬彍鍗曡烦杞姛鑳芥椂锛岄渶閫夋嫨璺宠浆鐨勮彍鍗曘��'
+            } else {
+              item.tooltip = ''
+              item.required = true
+            }
           }
 
           return item
@@ -262,9 +360,13 @@
       this.setState({
         formlist: this.state.formlist.map(item => {
           if (item.key === 'Ot' && type === 'card') {
-            item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value))
+            if (value === 'insert') {
+              item.options = this.state.requireOptions.filter(op => ['notRequired'].includes(op.value))
+            } else {
+              item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value))
+            }
           } else if (item.key === 'Ot' && value === 'insert') {
-            item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl', 'required'].includes(op.value))
+            item.options = this.state.requireOptions.filter(op => ['notRequired'].includes(op.value))
           } else if (item.key === 'Ot') {
             item.options = this.state.requireOptions
           }
@@ -281,7 +383,7 @@
           _fieldval.Ot = 'requiredSgl'
         } else if (value === 'audit') {
           _fieldval.label = '瀹℃牳'
-          _fieldval.class = 'purple'
+          _fieldval.class = 'primary'
           _fieldval.Ot = 'requiredSgl'
         } else if (value === 'LogicDelete' || value === 'delete') {
           _fieldval.label = '鍒犻櫎'
@@ -297,10 +399,10 @@
       })
     } else if (key === 'pageTemplate') {
       let _fieldval = {}
-      let _options = this.getOptions(this.state.openType, this.state.interType, this.state.funcType, value)
+      let _options = this.getOptions(openType, this.state.interType, this.state.funcType, value, procMode, Ot)
 
       this.setState({
-        openType: value,
+        pageTemplate: value,
         formlist: this.state.formlist.map(item => {
           item.hidden = !_options.includes(item.key)
 
@@ -320,16 +422,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, pageTemplate, procMode, Ot)
 
       this.setState({
         interType: value,
@@ -349,10 +443,30 @@
           }
           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, pageTemplate, value, Ot)
+
+      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 === 'Ot') {
+      let _options = this.getOptions(openType, this.state.interType, this.state.funcType, pageTemplate, procMode, value)
+
+      this.setState({
+        Ot: value,
+        formlist: this.state.formlist.map(item => {
+          item.hidden = !_options.includes(item.key)
+          return item
+        })
       })
     } else if (key === 'sysInterface') {
       if (value === 'true') {
@@ -419,7 +533,7 @@
           <Col span={12} key={index}>
             <Form.Item label={item.tooltip ?
               <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}>
-                <Icon type="question-circle" />
+                <QuestionCircleOutlined className="mk-form-tip" />
                 {item.label}
               </Tooltip> : item.label
             }>
@@ -436,12 +550,20 @@
             </Form.Item>
           </Col>
         )
+      } else if (item.type === 'tip') {
+        fields.push(
+          <Col span={12} key={index}>
+            <Form.Item label={item.label}>
+              {item}
+            </Form.Item>
+          </Col>
+        )
       } else if (item.type === 'number') {
         fields.push(
           <Col span={12} key={index}>
             <Form.Item label={item.tooltip ?
               <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}>
-                <Icon type="question-circle" />
+                <QuestionCircleOutlined className="mk-form-tip" />
                 {item.label}
               </Tooltip> : item.label
             }>
@@ -457,12 +579,12 @@
             </Form.Item>
           </Col>
         )
-      } else if (item.type === 'select') { // 涓嬫媺鎼滅储
+      } else if (item.type === 'select') {
         fields.push(
           <Col span={12} key={index}>
             <Form.Item label={item.tooltip ?
               <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}>
-                <Icon type="question-circle" />
+                <QuestionCircleOutlined className="mk-form-tip" />
                 {item.label}
               </Tooltip> : item.label
             }>
@@ -477,13 +599,14 @@
               })(
                 <Select
                   showSearch
-                  filterOption={(input, option) => option.props.children[2].toLowerCase().indexOf(input.toLowerCase()) >= 0}
-                  onChange={(value) => {this.openTypeChange(item.key, value)}}
+                  allowClear={item.allowClear === true}
+                  filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
+                  onChange={(value) => {this.optionChange(item.key, value)}}
                   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 key={index} value={(option.value || option.field)}>
+                      {(option.text || option.label)}
                     </Select.Option>
                   )}
                 </Select>
@@ -494,7 +617,12 @@
       } else if (item.type === 'radio') {
         fields.push(
           <Col span={12} key={index}>
-            <Form.Item label={item.label}>
+            <Form.Item label={item.tooltip ?
+              <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}>
+                <QuestionCircleOutlined className="mk-form-tip" />
+                {item.label}
+              </Tooltip> : item.label
+            }>
               {getFieldDecorator(item.key, {
                 initialValue: item.initVal,
                 rules: [
@@ -504,7 +632,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 (
@@ -522,15 +650,26 @@
           <Col span={24} key={index}>
             <Form.Item label={item.label} className="textarea">
               {getFieldDecorator(item.key, {
-                initialValue: item.initVal
-              })(<TextArea rows={4} />)}
+                initialValue: item.initVal,
+                rules: [
+                  {
+                    required: item.readonly ? false : !!item.required,
+                    message: this.props.dict['form.required.input'] + item.label + '!'
+                  }
+                ]
+              })(<TextArea rows={2} readOnly={item.readonly}/>)}
             </Form.Item>
           </Col>
         )
-      } else if (item.type === 'cascader') { // 澶氶��
+      } else if (item.type === 'cascader') {
         fields.push(
           <Col span={12} key={index}>
-            <Form.Item label={item.label}>
+            <Form.Item label={item.tooltip ?
+              <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}>
+                <QuestionCircleOutlined className="mk-form-tip" />
+                {item.label}
+              </Tooltip> : item.label
+            }>
               {getFieldDecorator(item.key, {
                 initialValue: item.initVal || [],
                 rules: [
@@ -540,19 +679,25 @@
                   }
                 ]
               })(
-                <Cascader options={item.options || []} placeholder=""/>
+                <Cascader options={item.options || []} expandTrigger="hover" placeholder=""/>
               )}
             </Form.Item>
           </Col>
         )
-      } else if (item.type === 'mcascader') {
+      } else if (item.type === 'icon') {
         fields.push(
           <Col span={12} key={index}>
             <Form.Item label={item.label}>
               {getFieldDecorator(item.key, {
-                initialValue: item.initVal
+                initialValue: item.initVal,
+                rules: [
+                  {
+                    required: !!item.required,
+                    message: this.props.dict['form.required.select'] + item.label + '!'
+                  }
+                ]
               })(
-                <Cascader options={item.options} expandTrigger="hover" placeholder="" />
+                <MkIcon allowClear/>
               )}
             </Form.Item>
           </Col>
@@ -563,13 +708,14 @@
   }
 
   handleConfirm = () => {
-    const { setting } = this.props
+    const { setting, card } = this.props
     // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭�
     return new Promise((resolve, reject) => {
       this.props.form.validateFieldsAndScroll((err, values) => {
         if (!err) {
-          values.uuid = this.props.card.uuid
-          values.verify = this.props.card.verify || null
+          values.uuid = card.uuid
+          values.verify = card.verify || null
+          values.modal = card.modal || null
 
           if (values.show === 'icon' && !values.icon) {
             notification.warning({
@@ -589,14 +735,57 @@
             }
             
             values.Ot = 'notRequired'
-          } else if (values.OpenType === 'funcbutton') { // 杞崲鎵撳嵃鏃舵墦寮�鏂瑰紡
-            if (values.funcType === 'print') {
-              values.OpenType = values.execMode
-            }
           } else if (['pop', 'prompt', 'exec'].includes(values.OpenType) && values.verify) {
-            if ((values.Ot === 'requiredOnce' || this.props.card.Ot === 'requiredOnce') && this.props.card.Ot !== values.Ot) {
+            if ((values.Ot === 'requiredOnce' || card.Ot === 'requiredOnce') && card.Ot !== values.Ot) {
               values.verify.uniques = []
             }
+            if (card.Ot !== values.Ot) {
+              if (values.Ot === 'notRequired') {
+                values.verify.invalid = 'false'
+              } else if (card.Ot === 'notRequired' && values.Ot !== 'notRequired') {
+                values.verify.invalid = 'true'
+              }
+            }
+          } else if (values.OpenType === 'tab' && values.linkmenu) {
+            if (sessionStorage.getItem('thdMenuList')) {
+              let list = null
+              try {
+                list = JSON.parse(sessionStorage.getItem('thdMenuList')) || []
+              } catch (e) {
+                list = []
+              }
+        
+              let id = values.linkmenu[values.linkmenu.length - 1]
+        
+              list.forEach(item => {
+                if (item.MenuID === id) {
+                  values.MenuID = id
+                  values.MenuName = item.MenuName
+                  values.MenuNo = item.MenuNo
+                  values.tabType = item.type
+                }
+              })
+            }
+          }
+
+          if (values.openmenu && Array.isArray(values.openmenu) && values.openmenu.length > 0) {
+            let list = null
+            try {
+              list = JSON.parse(sessionStorage.getItem('thdMenuList')) || []
+            } catch (e) {
+              list = []
+            }
+
+            let id = values.openmenu[values.openmenu.length - 1]
+
+            list.forEach(item => {
+              if (item.MenuID === id) {
+                values.MenuID = id
+                values.MenuName = item.MenuName
+                values.MenuNo = item.MenuNo
+                values.tabType = item.type
+              }
+            })
           }
           
           resolve(values)
@@ -619,11 +808,11 @@
       }
     }
     return (
-      <Form {...formItemLayout} className="ant-advanced-search-form commontable-action-form" id="winter">
+      <Form {...formItemLayout} className="menu-action-list-form" id="winter">
         <Row gutter={24}>{this.getFields()}</Row>
       </Form>
     )
   }
 }
 
-export default Form.create()(MainSearch)
\ No newline at end of file
+export default Form.create()(ActionForm)
\ No newline at end of file

--
Gitblit v1.8.0