From 265102e3b6c9865f0e9f1e035e7b1aba281dc8c1 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 03 十二月 2019 15:33:16 +0800
Subject: [PATCH] 2019-12-03

---
 src/templates/comtableconfig/actionform/index.jsx |   67 +++++++++++++++++++++++++++++++--
 1 files changed, 62 insertions(+), 5 deletions(-)

diff --git a/src/templates/comtableconfig/actionform/index.jsx b/src/templates/comtableconfig/actionform/index.jsx
index c9c3d81..3ab322e 100644
--- a/src/templates/comtableconfig/actionform/index.jsx
+++ b/src/templates/comtableconfig/actionform/index.jsx
@@ -68,6 +68,7 @@
     formlist: null,
     openType: null,
     interType: null,
+    position: null,
     reqOptionSgl: [{
       MenuID: 'requiredSgl',
       text: this.props.dict['header.form.requiredSgl']
@@ -91,13 +92,21 @@
     }, {
       MenuID: 'requiredOnce',
       text: this.props.dict['header.form.requiredOnce']
-    }]
+    }],
+    // [{
+    //   MenuID: 'toolbar',
+    //   text: this.state.dict['header.form.toolbar']
+    // }, {
+    //   MenuID: 'grid',
+    //   text: this.state.dict['header.form.grid']
+    // }]
   }
 
   
   UNSAFE_componentWillMount () {
     let _opentype = this.props.formlist.filter(form => form.key === 'OpenType')[0].initVal
     let _intertype = this.props.formlist.filter(form => form.key === 'intertype')[0].initVal
+    let _position = this.props.formlist.filter(form => form.key === 'position')[0].initVal
     let _options = null
     if (_opentype === 'innerpage') { // 鏂伴〉闈紙鍐呴儴锛夛紝鍙�夋ā鏉�
       _options = ['label', 'Ot', 'OpenType', 'pageTemplate', 'icon', 'class', 'position']
@@ -105,9 +114,15 @@
       _options = ['label', 'Ot', 'OpenType', 'url', 'icon', 'class', 'position']
     } else if (_opentype === 'blank' || _opentype === 'tab' || _opentype === 'popview') {
       _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position']
+    } else if (_opentype === 'excelIn' || _opentype === 'excelOut') {
+      if (_intertype === 'outer') {
+        _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError', 'method']
+      } else {
+        _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sql']
+      }
     } else {
       if (_intertype === 'outer') {
-      _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'method']
+        _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'method']
       } else {
         _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql']
       }
@@ -115,13 +130,14 @@
     this.setState({
       openType: _opentype,
       interType: _intertype,
+      position: _position,
       formlist: this.props.formlist.map(item => {
         if (item.key === 'class') {
           item.options = btnClasses
         } else if (item.key === 'icon') {
           item.options = btnIcons
         } else if (item.key === 'Ot') {
-          if (_opentype === 'innerpage') {
+          if (_opentype === 'innerpage' || _position === 'grid') {
             item.options = this.state.reqOptionSgl
           } else if (['outerpage', 'blank', 'tab', 'pop', 'popview'].includes(_opentype)) {
             item.options = this.state.reqOptions
@@ -135,6 +151,7 @@
     })
   }
 
+  // 鎵撳紑鏂瑰紡鎴栨樉绀轰綅缃彉鍖�
   openTypeChange = (key, value) => {
     if (key === 'OpenType') {
       let _options = null
@@ -144,6 +161,12 @@
         _options = ['label', 'Ot', 'OpenType', 'url', 'icon', 'class', 'position']
       } else if (value === 'blank' || value === 'tab' || value === 'popview') {
         _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position']
+      } else if (value === 'excelIn' || value === 'excelOut') {
+        if (this.state.interType === 'outer') {
+          _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError', 'method']
+        } else {
+          _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sql']
+        }
       } else {
         if (this.state.interType === 'inner') {
           _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql']
@@ -161,7 +184,7 @@
             }
           }
           if (item.key === 'Ot') {
-            if (value === 'innerpage') {
+            if (value === 'innerpage' || this.state.position === 'grid') {
               item.options = this.state.reqOptionSgl
               item.initVal = 'requiredSgl'
               item.hidden = true
@@ -176,8 +199,37 @@
           return item
         })
       }, () => {
-        if (!['innerpage', 'outerpage', 'blank', 'tab', 'pop', 'popview'].includes(value)) return
+        if (['excelIn', 'excelOut'].includes(value)) return
 
+        this.setState({
+          formlist: this.state.formlist.map(item => {
+            if (item.key === 'Ot') {
+              item.hidden = false
+            }
+            return item
+          })
+        })
+      })
+    } else if (key === 'position') {
+      this.setState({
+        position: value,
+        formlist: this.state.formlist.map(item => {
+          if (item.key === 'Ot') {
+            if (this.state.openType === 'innerpage' || value === 'grid') {
+              item.options = this.state.reqOptionSgl
+              item.initVal = 'requiredSgl'
+              item.hidden = true
+            } else if (['outerpage', 'blank', 'tab', 'pop', 'popview'].includes(this.state.openType)) {
+              item.options = this.state.reqOptions
+              item.initVal = 'requiredSgl'
+              item.hidden = true
+            } else {
+              item.options = this.state.reqOptionsMutil
+            }
+          }
+          return item
+        })
+      }, () => {
         this.setState({
           formlist: this.state.formlist.map(item => {
             if (item.key === 'Ot') {
@@ -309,6 +361,11 @@
           values.id = this.props.card.id
           values.uuid = this.props.card.uuid
 
+          if (values.OpenType === 'excelIn' || values.OpenType === 'excelOut') {
+            values.position = 'toolbar'
+            values.Ot = 'notRequired'
+          }
+
           if (values.innerFunc === '' && values.sql === '') {
             notification.warning({
               top: 92,

--
Gitblit v1.8.0