From bd1dfc9e6c9b9f8076ca2783ce598e0936b4c664 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 22 十二月 2021 14:36:03 +0800
Subject: [PATCH] 2021-12-22

---
 src/templates/sharecomponent/actioncomponent/actionform/index.jsx |   73 +++++++++++++++++++-----------------
 1 files changed, 38 insertions(+), 35 deletions(-)

diff --git a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx
index 8f1d740..20d48f2 100644
--- a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx
+++ b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx
@@ -1,10 +1,11 @@
 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 { Form, Row, Col, Input, Select, Radio, notification, Tooltip, InputNumber, Cascader } from 'antd'
 import { QuestionCircleOutlined } from '@ant-design/icons'
 
 import { btnIcons, btnClasses, formRule } from '@/utils/option.js'
+import MkIcon from '@/components/mk-icon'
 import Utils from '@/utils/utils.js'
 import './index.scss'
 
@@ -15,8 +16,8 @@
   exec: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'openmenu', 'output'],
   excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'icon', 'class', 'sheet', 'execSuccess', 'execError'],
   excelOut: ['label', 'OpenType', 'intertype', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search'],
-  popview: ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose', 'display', 'ratio', 'placement'],
-  tab: ['label', 'Ot', 'OpenType', 'tabTemplate', 'icon', 'class', 'position'],
+  popview: ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose', 'display', 'ratio', 'placement', 'clickouter'],
+  tab: ['label', 'Ot', 'OpenType', 'icon', 'class', 'position'],
   innerpage: ['label', 'Ot', 'OpenType', 'pageTemplate', 'icon', 'class', 'position'],
   funcbutton: ['label', 'OpenType', 'funcType', 'icon', 'class']
 }
@@ -38,6 +39,7 @@
     funcType: null,  // 鍔熻兘绫诲瀷
     position: null,  // 鎸夐挳浣嶇疆
     procMode: null,  // 澶栭儴鎺ュ彛鍙傛暟澶勭悊鏂瑰紡
+    control: '',
     pageTemplate: null,
     Ot: null,
     requireOptions: [{
@@ -65,10 +67,10 @@
     }],
     deleteOptions: [{
       value: 'LogicDelete',
-      text: this.props.dict['header.form.action.LogicDelete']
+      text: '閫昏緫鍒犻櫎'
     }, {
       value: 'delete',
-      text: this.props.dict['header.form.action.delete']
+      text: '鐗╃悊鍒犻櫎'
     }, {
       value: 'custom',
       text: this.props.dict['header.form.custom']
@@ -97,9 +99,9 @@
     let _intertype = card.intertype || 'system' // 鎺ュ彛绫诲瀷
     let _procMode = card.procMode || 'system'   // 鍙傛暟澶勭悊鏂瑰紡
     let _funcType = card.funcType || ''         // 鍔熻兘鎸夐挳榛樿绫诲瀷
-    let _tabTemplate = card.tabTemplate         // 鎸夐挳涓烘爣绛鹃〉鏃讹紝鏍囩绫诲瀷锛氫笁绾ц彍鍗曟垨琛ㄥ崟鏍囩椤�
     let _pageTemplate = card.pageTemplate       // 鏂伴〉闈㈢被鍨�
     let _Ot = card.Ot || 'requiredSgl'
+    let control = card.control || ''
 
     if (_opentype === 'outerpage') {
       card.pageTemplate = 'custom'
@@ -107,9 +109,10 @@
     }
 
     let _tabs = this.props.tabs.filter(tab => tab.type === 'SubTable')
-    let _options = this.getOptions(_opentype, _intertype, _funcType, _pageTemplate, _tabTemplate, _procMode, _Ot)
+    let _options = this.getOptions(_opentype, _intertype, _funcType, _pageTemplate, _procMode, _Ot, control)
     
     this.setState({
+      control: control,
       Ot: _Ot,
       openType: _opentype,
       pageTemplate: _pageTemplate,
@@ -176,7 +179,7 @@
     }
   }
 
-  getOptions = (_opentype, _intertype, _funcType, _pageTemplate, _tabTemplate, _procMode, _Ot) => {
+  getOptions = (_opentype, _intertype, _funcType, _pageTemplate, _procMode, _Ot, _control) => {
     let _options = fromJS(actionTypeOptions[_opentype]).toJS() // 閫夐」鍒楄〃
     
     if (_opentype === 'innerpage') {         // 鏂伴〉闈紝鍙�夋ā鏉�(鑷畾涔夋椂锛屽彲濉叆澶栭儴閾炬帴)
@@ -186,7 +189,7 @@
         _options.push('printTemp')
       }
     } else if (_opentype === 'tab') {         // 鏍囩椤�
-      if (_tabTemplate === 'ThdMenu') {
+      if (this.props.card.tabTemplate !== 'FormTab') {
         _options.push('linkmenu')
       }
     } else if (_opentype === 'excelOut') {    // 瀵煎叆瀵煎嚭
@@ -203,7 +206,7 @@
       }
     } else if (_opentype === 'funcbutton') {
       if (_funcType === 'print') {
-        _options.push('execMode', 'intertype', 'Ot', 'execSuccess', 'execError', 'controlField', 'controlVal')
+        _options.push('execMode', 'intertype', 'Ot', 'execSuccess', 'execError')
         if (_intertype === 'outer') {
           _options.push('innerFunc', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackFunc')
         } else if (_intertype === 'inner') {
@@ -233,8 +236,11 @@
       _options.push('resetPageIndex')
     }
 
-    if (_Ot !== 'notRequired' && _opentype !== 'excelOut' && _opentype !== 'funcbutton') {
-      _options.push('controlField', 'controlVal')
+    if (_Ot !== 'notRequired' && _opentype !== 'excelOut') {
+      _options.push('control')
+      if (_control) {
+        _options.push('controlField', 'controlVal')
+      }
     }
 
     return _options
@@ -244,11 +250,11 @@
    * @description 鍒囨崲
    */
   optionChange = (key, value) => {
-    const { openType, funcType, procMode, Ot } = this.state
+    const { openType, funcType, procMode, Ot, control } = this.state
     const { card } = this.props
 
     if (key === 'OpenType') {
-      let _options = this.getOptions(value, 'system', '', this.state.pageTemplate, card.tabTemplate, 'system', Ot)
+      let _options = this.getOptions(value, 'system', '', this.state.pageTemplate, 'system', Ot, control)
       let _fieldval = {}
       let _formlist = this.state.formlist.map(item => {
         item.hidden = !_options.includes(item.key)
@@ -256,6 +262,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
@@ -333,7 +341,7 @@
         this.props.form.setFieldsValue(_fieldval)
       })
     } else if (key === 'funcType') {
-      let _options = this.getOptions('funcbutton', this.state.interType, value, card.pageTemplate, card.tabTemplate, procMode, Ot)
+      let _options = this.getOptions('funcbutton', this.state.interType, value, card.pageTemplate, procMode, Ot, control)
       let _fieldval = {}
 
       if (value === 'print') {
@@ -393,7 +401,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, Ot)
+      let _options = this.getOptions('innerpage', this.state.interType, this.state.funcType, value, procMode, Ot, control)
       let _fieldval = {}
 
       this.setState({
@@ -418,23 +426,8 @@
       }, () => {
         this.props.form.setFieldsValue(_fieldval)
       })
-    } else if (key === 'tabTemplate') {
-      let _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabTemplate']
-
-      if (value === 'ThdMenu') {
-        _options.push('linkmenu')
-      }
-
-      this.setState({
-        openType: value,
-        formlist: this.state.formlist.map(item => {
-          item.hidden = !_options.includes(item.key)
-  
-          return item
-        })
-      })
     } else if (key === 'intertype') {
-      let _options = this.getOptions(openType, value, funcType, '', '', procMode, Ot)
+      let _options = this.getOptions(openType, value, funcType, '', procMode, Ot, control)
 
       this.setState({
         interType: value,
@@ -454,7 +447,7 @@
         })
       })
     } else if (key === 'procMode') {
-      let _options = this.getOptions(openType, this.state.interType, funcType, '', '', value, Ot)
+      let _options = this.getOptions(openType, this.state.interType, funcType, '', value, Ot, control)
 
       this.setState({
         procMode: value,
@@ -468,10 +461,20 @@
         })
       })
     } else if (key === 'Ot') {
-      let _options = this.getOptions(openType, this.state.interType, funcType, this.state.pageTemplate, card.tabTemplate, procMode, value)
+      let _options = this.getOptions(openType, this.state.interType, funcType, this.state.pageTemplate, procMode, value, control)
 
       this.setState({
         Ot: value,
+        formlist: this.state.formlist.map(item => {
+          item.hidden = !_options.includes(item.key)
+          return item
+        })
+      })
+    } else if (key === 'control') {
+      let _options = this.getOptions(openType, this.state.interType, funcType, this.state.pageTemplate, procMode, Ot, value)
+
+      this.setState({
+        control: value,
         formlist: this.state.formlist.map(item => {
           item.hidden = !_options.includes(item.key)
           return item
@@ -607,7 +610,7 @@
                 >
                   {item.options.map((option, index) =>
                     <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}
+                      {item.key === 'icon' && option.value ? <MkIcon type={option.value} /> : null} {option.text || option.label}
                     </Select.Option>
                   )}
                 </Select>

--
Gitblit v1.8.0