From 5423c7caa9723e0b232ea6c5ef4aaf90bd7a3334 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 21 十月 2020 14:46:25 +0800
Subject: [PATCH] 2020-10-21

---
 src/templates/zshare/createinterface/mutilform/index.jsx |   32 ++++++++++++++++++++++++--------
 1 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/src/templates/zshare/createinterface/mutilform/index.jsx b/src/templates/zshare/createinterface/mutilform/index.jsx
index 8914e65..9d53447 100644
--- a/src/templates/zshare/createinterface/mutilform/index.jsx
+++ b/src/templates/zshare/createinterface/mutilform/index.jsx
@@ -1,6 +1,6 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { Form, Row, Col, Input, Radio, Select } from 'antd'
+import { Form, Row, Col, Input, Radio, Select, Tooltip, Icon } from 'antd'
 import './index.scss'
 
 class MainSearch extends Component {
@@ -10,23 +10,34 @@
   }
 
   state = {
-
+    requireArr: true
   }
 
-  UNSAFE_componentWillMount () {
-
+  onChange = (value, key) => {
+    if (key === 'TryType' && value === 'N') {
+      this.setState({requireArr: false})
+    } else if (key === 'TryType' && value === 'Y') {
+      this.setState({requireArr: true})
+    }
   }
 
   getFields() {
     const { getFieldDecorator } = this.props.form
-
+    const { requireArr } = this.state
     const fields = []
 
     this.props.formlist.forEach((item, index) => {
+      if (!requireArr && item.key === 'array_name') return
+
       if (item.type === 'text') {
         fields.push(
           <Col span={24} key={index}>
-            <Form.Item label={item.label}>
+            <Form.Item label={item.tooltip ?
+              <Tooltip placement="topLeft" title={item.tooltip}>
+                <Icon type="question-circle" />
+                {item.label}
+              </Tooltip> : item.label
+            }>
               {getFieldDecorator(item.key, {
                 initialValue: item.initval,
                 rules: [
@@ -67,7 +78,12 @@
       } else if (item.type === 'radio') {
         fields.push(
           <Col span={24} key={index}>
-            <Form.Item label={item.label}>
+            <Form.Item label={item.tooltip ?
+              <Tooltip placement="topLeft" title={item.tooltip}>
+                <Icon type="question-circle" />
+                {item.label}
+              </Tooltip> : item.label
+            }>
               {getFieldDecorator(item.key, {
                 initialValue: item.initval,
                 rules: [
@@ -77,7 +93,7 @@
                   }
                 ]
               })(
-                <Radio.Group>
+                <Radio.Group onChange={(e) => this.onChange(e.target.value, item.key)}>
                   {item.options.map(op => {
                     return <Radio key={op.value} value={op.value}>{op.text}</Radio>
                   })}

--
Gitblit v1.8.0