From 9cf5fc474d2159aad973e3208fbef670f325307f Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 25 十一月 2020 17:57:41 +0800
Subject: [PATCH] 2020-11-25

---
 src/menu/components/share/normalform/index.jsx |   29 ++++++++++++++++++++++++++---
 1 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/src/menu/components/share/normalform/index.jsx b/src/menu/components/share/normalform/index.jsx
index 0a52226..eec77c9 100644
--- a/src/menu/components/share/normalform/index.jsx
+++ b/src/menu/components/share/normalform/index.jsx
@@ -1,6 +1,6 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { Form, Row, Col, Input, Tooltip, Icon, InputNumber, Select, Radio } from 'antd'
+import { Form, Row, Col, Input, Tooltip, Icon, InputNumber, Select, Radio, Cascader } from 'antd'
 
 import './index.scss'
 
@@ -104,8 +104,8 @@
               })(
                 <Select mode={item.multi ? 'multiple' : ''}>
                   {item.options.map((option, index) =>
-                    <Select.Option key={index} value={option.field}>
-                      {option.label}
+                    <Select.Option key={index} value={option.field || option.value}>
+                      {option.label || option.text}
                     </Select.Option>
                   )}
                 </Select>
@@ -142,6 +142,29 @@
             </Form.Item>
           </Col>
         )
+      } else if (item.type === 'cascader') {
+        fields.push(
+          <Col span={12} key={index}>
+            <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: [
+                  {
+                    required: !!item.required,
+                    message: this.props.dict['form.required.select'] + item.label + '!'
+                  }
+                ]
+              })(
+                <Cascader options={item.options} placeholder=""/>
+              )}
+            </Form.Item>
+          </Col>
+        )
       }
     })
     return fields

--
Gitblit v1.8.0