From f9697383bc9097be8a444558e09ae21b27f1e831 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 31 十二月 2019 09:27:21 +0800
Subject: [PATCH] 2019-12-31

---
 src/templates/comtableconfig/actionform/index.jsx |  117 +++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 87 insertions(+), 30 deletions(-)

diff --git a/src/templates/comtableconfig/actionform/index.jsx b/src/templates/comtableconfig/actionform/index.jsx
index 55b860f..48dc10b 100644
--- a/src/templates/comtableconfig/actionform/index.jsx
+++ b/src/templates/comtableconfig/actionform/index.jsx
@@ -2,65 +2,67 @@
 import PropTypes from 'prop-types'
 import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip, InputNumber, Button, Modal, message } from 'antd'
 import { btnIcons, btnClasses } from '@/utils/option.js'
+import Utils from '@/utils/utils.js'
 import './index.scss'
 
 const { TextArea } = Input
 
 class MainSearch extends Component {
   static propTpyes = {
-    dict: PropTypes.object, // 瀛楀吀椤�
-    formlist: PropTypes.any,
-    card: PropTypes.any
+    dict: PropTypes.object,  // 瀛楀吀椤�
+    formlist: PropTypes.any, // 琛ㄥ崟淇℃伅
+    card: PropTypes.any,     // 鎸夐挳淇℃伅
+    tabs: PropTypes.array    // 鎵�鏈夋爣绛鹃〉
   }
 
   state = {
-    formlist: null,
-    openType: null,
-    errorType: 'E',
-    interType: null,
-    position: null,
+    formlist: null,  // 琛ㄥ崟淇℃伅
+    openType: null,  // 鎵撳紑鏂瑰紡
+    errorType: 'E',  // 鎶ラ敊绫诲瀷
+    interType: null, // 鎺ュ彛绫诲瀷锛氬唴閮ㄣ�佸閮�
+    position: null,  // 鎸夐挳浣嶇疆
     reqOptionSgl: [{
-      MenuID: 'requiredSgl',
+      value: 'requiredSgl',
       text: this.props.dict['header.form.requiredSgl']
     }],
     reqOptions: [{
-      MenuID: 'notRequired',
+      value: 'notRequired',
       text: this.props.dict['header.form.notRequired']
     }, {
-      MenuID: 'requiredSgl',
+      value: 'requiredSgl',
       text: this.props.dict['header.form.requiredSgl']
     }],
     reqOptionsMutil: [{
-      MenuID: 'notRequired',
+      value: 'notRequired',
       text: this.props.dict['header.form.notRequired']
     }, {
-      MenuID: 'requiredSgl',
+      value: 'requiredSgl',
       text: this.props.dict['header.form.requiredSgl']
     }, {
-      MenuID: 'required',
+      value: 'required',
       text: this.props.dict['header.form.required']
     }, {
-      MenuID: 'requiredOnce',
+      value: 'requiredOnce',
       text: this.props.dict['header.form.requiredOnce']
     }],
     insertUpdateOptions: [{
-      MenuID: '',
+      value: '',
       text: this.props.dict['header.form.empty']
     }, {
-      MenuID: 'insert',
+      value: 'insert',
       text: this.props.dict['header.form.action.insert']
     }, {
-      MenuID: 'update',
+      value: 'update',
       text: this.props.dict['header.form.action.update']
     }],
     deleteOptions: [{
-      MenuID: '',
+      value: '',
       text: this.props.dict['header.form.empty']
     }, {
-      MenuID: 'LogicDelete',
+      value: 'LogicDelete',
       text: this.props.dict['header.form.action.LogicDelete']
     }, {
-      MenuID: 'delete',
+      value: 'delete',
       text: this.props.dict['header.form.action.delete']
     }]
   }
@@ -71,6 +73,8 @@
     let _intertype = ''
     let _position = ''
     let _errorType = ''
+    let _tabType = ''
+    let _linkTab = ''
     let _options = null
 
     this.props.formlist.forEach(form => {
@@ -82,16 +86,25 @@
         _position = form.initVal
       } else if (form.key === 'errorTip') {
         _errorType = form.initVal
+      } else if (form.key === 'tabType') {
+        _tabType = form.initVal
+      } else if (form.key === 'linkTab') {
+        _linkTab = form.initVal
       }
     })
 
-    if (_opentype === 'innerpage') { // 鏂伴〉闈紙鍐呴儴锛夛紝鍙�夋ā鏉�
+    let _tabs = this.props.tabs.filter(tab => tab.type === _tabType)
+    let initTab = _tabs.filter(tab => tab.uuid === _linkTab)[0]
+
+    if (_opentype === 'innerpage') {                                     // 鏂伴〉闈紙鍐呴儴锛夛紝鍙�夋ā鏉�
       _options = ['label', 'Ot', 'OpenType', 'pageTemplate', 'icon', 'class', 'position']
-    } else if (_opentype === 'outerpage') { // 鏂伴〉闈紙澶栭儴锛夛紝闇�瑕侀〉闈㈠湴鍧�
+    } else if (_opentype === 'outerpage') {                              // 鏂伴〉闈紙澶栭儴锛夛紝闇�瑕侀〉闈㈠湴鍧�
       _options = ['label', 'Ot', 'OpenType', 'url', 'icon', 'class', 'position']
-    } else if (_opentype === 'blank' || _opentype === 'tab' || _opentype === 'popview') {
+    } else if (_opentype === 'blank' || _opentype === 'tab') {           // 鏂版爣绛炬垨褰撳墠椤甸潰鏇挎崲
       _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position']
-    } else if (_opentype === 'excelIn' || _opentype === 'excelOut') {
+    } else if (_opentype === 'popview') {                                // 妯℃�佹鏍囩椤�
+      _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose']
+    } else if (_opentype === 'excelIn' || _opentype === 'excelOut') {    // 瀵煎叆瀵煎嚭
       if (_intertype === 'outer') {
         _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError', 'method']
       } else {
@@ -128,6 +141,17 @@
           } else {
             item.options = this.state.insertUpdateOptions
           }
+        } else if (item.key === 'linkTab') {
+          item.options = [
+            {
+              value: '',
+              text: '鏂板缓'
+            },
+            ..._tabs
+          ]
+          if (!initTab) {
+            item.initVal = ''
+          }
         }
         item.hidden = !_options.includes(item.key)
         return item
@@ -143,8 +167,10 @@
         _options = ['label', 'Ot', 'OpenType', 'pageTemplate', 'icon', 'class', 'position']
       } else if (value === 'outerpage') {
         _options = ['label', 'Ot', 'OpenType', 'url', 'icon', 'class', 'position']
-      } else if (value === 'blank' || value === 'tab' || value === 'popview') {
+      } else if (value === 'blank' || value === 'tab') {
         _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position']
+      } else if (value === 'popview') {
+        _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose']
       } else if (value === 'excelIn' || value === 'excelOut') {
         if (this.state.interType === 'outer') {
           _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError', 'method']
@@ -236,6 +262,34 @@
       this.setState({
         errorType: value
       })
+    } else if (key === 'tabType') {
+      let _tabs = this.props.tabs.filter(tab => tab.type === value)
+
+      this.setState({
+        formlist: this.state.formlist.map(item => {
+          if (item.key === 'linkTab') {
+            item.options = [
+              {
+                value: '',
+                text: '鏂板缓'
+              },
+              ..._tabs
+            ]
+            item.initVal = ''
+            item.hidden = true
+          }
+          return item
+        })
+      }, () => {
+        this.setState({
+          formlist: this.state.formlist.map(item => {
+            if (item.key === 'linkTab') {
+              item.hidden = false
+            }
+            return item
+          })
+        })
+      })
     }
   }
 
@@ -295,6 +349,7 @@
   getFields() {
     const { getFieldDecorator } = this.props.form
     const fields = []
+
     this.state.formlist.forEach((item, index) => {
       if (item.hidden) return
 
@@ -371,9 +426,9 @@
                   onChange={(value) => {this.openTypeChange(item.key, value)}}
                   getPopupContainer={() => document.getElementById('winter')}
                 >
-                  {item.options.map(option =>
-                    <Select.Option id={option.MenuID} title={option.text} key={option.MenuID} value={option.MenuID}>
-                      {item.key === 'icon' && option.MenuID && <Icon type={option.MenuID} />} {option.text}
+                  {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>
                   )}
                 </Select>
@@ -399,7 +454,7 @@
                   {
                     item.options.map(option => {
                       return (
-                        <Radio key={option.MenuID} value={option.MenuID}>{option.text}</Radio>
+                        <Radio key={option.value} value={option.value}>{option.text}</Radio>
                       )
                     })
                   }
@@ -434,6 +489,8 @@
           if (values.OpenType === 'excelIn' || values.OpenType === 'excelOut') {
             values.position = 'toolbar'
             values.Ot = 'notRequired'
+          } else if (values.OpenType === 'popview' && !values.linkTab) { // 娌℃湁鍏宠仈鏍囩锛堟柊寤烘椂锛夛紝鍒涘缓鏂版爣绛綢d
+            values.linkTab = Utils.getuuid()
           }
 
           if (values.innerFunc === '' && values.sql === '') {

--
Gitblit v1.8.0