From 8f6b3d26bde4e22773cc53386dfbae669a7472ed Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 13 十月 2020 09:16:21 +0800
Subject: [PATCH] 2020-10-13

---
 src/menu/actioncomponent/actionform/index.jsx |   32 +++++++++++++++++++++++++-------
 1 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/src/menu/actioncomponent/actionform/index.jsx b/src/menu/actioncomponent/actionform/index.jsx
index 45f53e9..f71386c 100644
--- a/src/menu/actioncomponent/actionform/index.jsx
+++ b/src/menu/actioncomponent/actionform/index.jsx
@@ -24,6 +24,7 @@
 class MainSearch extends Component {
   static propTpyes = {
     dict: PropTypes.object,      // 瀛楀吀椤�
+    type: PropTypes.any,         // type涓�"card"鏃讹紝鍙彲閫夊崟琛屾垨涓嶉�夎
     setting: PropTypes.object,   // 椤甸潰璁剧疆
     formlist: PropTypes.any,     // 琛ㄥ崟淇℃伅
     card: PropTypes.any,         // 鎸夐挳淇℃伅
@@ -78,7 +79,7 @@
 
   
   UNSAFE_componentWillMount () {
-    const { card } = this.props
+    const { card, type } = this.props
 
     let _menulist = this.props.formlist.filter(form => form.key === 'linkmenu')[0] || ''
     let _opentype = card.OpenType                // 鎵撳紑鏂瑰紡
@@ -102,7 +103,9 @@
         } else if (item.key === 'icon') {
           item.options = btnIcons
         } else if (item.key === 'Ot') {
-          if (card.pageTemplate === 'pay') { // 琛岀骇鎸夐挳銆佹敮浠樻寜閽紝鍙兘閫夊崟琛�
+          if (type === 'card') {
+            item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value))
+          } else if (card.pageTemplate === 'pay') { // 琛岀骇鎸夐挳銆佹敮浠樻寜閽紝鍙兘閫夊崟琛�
             item.options = this.state.requireOptions.filter(op => ['requiredSgl'].includes(op.value))
           } else if (['innerpage', 'blank', 'tab', 'popview', 'excelIn'].includes(_opentype)) {
             item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value))
@@ -187,7 +190,7 @@
    * 3銆佸垏鎹㈡爣绛剧被鍨嬶紝閲嶇疆鍙�夋爣绛�
    */
   openTypeChange = (key, value) => {
-    const { card } = this.props
+    const { card, type } = this.props
 
     if (key === 'OpenType') {
       let _options = this.getOptions(value, this.state.interType, this.state.funcType, card.pageTemplate)
@@ -202,7 +205,9 @@
         if (item.key === 'intertype') {
           _fieldval.intertype = this.state.interType
         } else if (item.key === 'Ot') {
-          if (['innerpage', 'blank', 'tab', 'popview'].includes(value)) {
+          if (type === 'card') {
+            item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value))
+          } else if (['innerpage', 'blank', 'tab', 'popview'].includes(value)) {
             item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value))
             _fieldval.Ot = 'requiredSgl'
           } else if (value === 'excelIn') {
@@ -257,7 +262,11 @@
           if (item.key === 'intertype') {
             _fieldval.intertype = this.state.interType
           } else if (item.key === 'Ot' && value === 'print') {
-            item.options = this.state.requireOptions
+            if (type === 'card') {
+              item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value))
+            } else {
+              item.options = this.state.requireOptions
+            }
           }
 
           return item
@@ -269,7 +278,9 @@
       let _fieldval = {}
       this.setState({
         formlist: this.state.formlist.map(item => {
-          if (item.key === 'Ot' && value === 'insert') {
+          if (item.key === 'Ot' && type === 'card') {
+            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))
           } else if (item.key === 'Ot') {
             item.options = this.state.requireOptions
@@ -313,6 +324,8 @@
             if (value === 'pay') {
               item.options = this.state.requireOptions.filter(op => ['requiredSgl'].includes(op.value))
               _fieldval.Ot = 'requiredSgl'
+            } else if (type === 'card') {
+              item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value))
             } else {
               item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value))
             }
@@ -327,6 +340,7 @@
   }
 
   onChange = (e, key) => {
+    const { type } = this.props
     const { openType } = this.state
     let value = e.target.value
 
@@ -343,7 +357,11 @@
           } else if (item.key === 'sysInterface') {
             item.initVal = 'false'
           } else if (item.key === 'Ot') {
-            item.options = this.state.requireOptions
+            if (type === 'card') {
+              item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value))
+            } else {
+              item.options = this.state.requireOptions
+            }
           }
           return item
         })

--
Gitblit v1.8.0