From 0c84df247914f893ef5e41d57a422e10a2dc814c Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 12 十一月 2021 17:02:06 +0800
Subject: [PATCH] 2021-11-12

---
 src/templates/zshare/modalform/index.jsx |  413 +++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 319 insertions(+), 94 deletions(-)

diff --git a/src/templates/zshare/modalform/index.jsx b/src/templates/zshare/modalform/index.jsx
index 689c1f2..a210a4b 100644
--- a/src/templates/zshare/modalform/index.jsx
+++ b/src/templates/zshare/modalform/index.jsx
@@ -2,37 +2,49 @@
 import PropTypes from 'prop-types'
 import { fromJS } from 'immutable'
 import { Form, Row, Col, Input, Select, Icon, Radio, notification, InputNumber, Tooltip } from 'antd'
+import { QuestionCircleOutlined } from '@ant-design/icons'
+
 import { formRule } from '@/utils/option.js'
 import { dateOptions } from '@/utils/option.js'
 import Utils from '@/utils/utils.js'
 import EditTable from './modaleditable'
+import asyncComponent from '@/utils/asyncComponent'
 import CodeMirror from '@/templates/zshare/codemirror'
 import './index.scss'
 
+const { TextArea } = Input
+const ColorSketch = asyncComponent(() => import('@/mob/colorsketch'))
+const FieldsTable = asyncComponent(() => import('./fieldtable'))
+const DataTable = asyncComponent(() => import('./datatable'))
+
 const modalTypeOptions = {
-  text: ['initval', 'readonly', 'required', 'hidden', 'readin', 'fieldlength', 'regular', 'interception', 'entireLine'],
-  number: ['initval', 'readonly', 'hidden', 'decimal', 'min', 'max', 'readin', 'entireLine'],
-  select: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'setAll', 'linkSubField', 'entireLine'],
-  checkbox: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'linkSubField', 'entireLine'],
-  radio: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'linkSubField', 'entireLine'],
-  checkcard: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'linkSubField', 'display'],
-  multiselect: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'entireLine'],
-  link: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'setAll', 'linkField', 'entireLine'],
-  fileupload: ['readonly', 'required', 'readin', 'fieldlength', 'maxfile', 'fileType', 'entireLine'],
-  switch: ['initval', 'openVal', 'closeVal', 'readonly', 'required', 'hidden', 'readin', 'entireLine'],
-  date: ['initval', 'readonly', 'required', 'hidden', 'readin', 'entireLine'],
-  datemonth: ['initval', 'readonly', 'required', 'hidden', 'readin', 'entireLine'],
-  datetime: ['initval', 'readonly', 'required', 'hidden', 'readin', 'entireLine'],
-  textarea: ['initval', 'readonly', 'required', 'hidden', 'readin', 'fieldlength', 'maxRows', 'encryption', 'interception'],
-  color: ['readonly', 'required', 'hidden', 'readin', 'entireLine'],
-  funcvar: ['hidden'],
-  linkMain: ['readonly', 'required', 'hidden', 'fieldlength', 'entireLine']
+  text: ['initval', 'readonly', 'required', 'hidden', 'readin', 'fieldlength', 'regular', 'interception', 'span', 'labelwidth', 'tooltip', 'extra', 'enter', 'cursor', 'scan', 'splitline', 'placeholder', 'place', 'marginTop', 'marginBottom'],
+  number: ['initval', 'readonly', 'hidden', 'decimal', 'min', 'max', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'enter', 'cursor', 'splitline', 'place', 'marginTop', 'marginBottom'],
+  select: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'setAll', 'linkSubField', 'span', 'labelwidth', 'tooltip', 'extra', 'emptyText', 'enter', 'splitline', 'dropdown', 'marginTop', 'marginBottom'],
+  checkbox: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'span', 'labelwidth', 'tooltip', 'extra', 'splitline', 'arrange', 'marginTop', 'marginBottom'],
+  radio: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'linkSubField', 'span', 'labelwidth', 'tooltip', 'extra', 'setAll', 'emptyText', 'splitline', 'arrange', 'marginTop', 'marginBottom'],
+  checkcard: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'linkSubField', 'fieldlength', 'span', 'labelwidth', 'display', 'tooltip', 'extra', 'width', 'multiple', 'borderColor', 'splitline', 'marginTop', 'marginBottom'],
+  multiselect: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra', 'marginTop', 'marginBottom'],
+  link: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'setAll', 'linkField', 'linkSubField', 'span', 'labelwidth', 'tooltip', 'extra', 'emptyText', 'enter', 'splitline', 'dropdown', 'marginTop', 'marginBottom'],
+  fileupload: ['readonly', 'required', 'readin', 'fieldlength', 'maxfile', 'fileType', 'span', 'labelwidth', 'tooltip', 'extra', 'compress', 'splitline', 'marginTop', 'marginBottom'],
+  switch: ['initval', 'openVal', 'closeVal', 'openText', 'closeText', 'readonly', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'splitline', 'marginTop', 'marginBottom'],
+  date: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'mode', 'splitline', 'marginTop', 'marginBottom', 'minDate', 'maxDate'],
+  datemonth: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'splitline', 'marginTop', 'marginBottom'],
+  datetime: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'mode', 'splitline', 'marginTop', 'marginBottom', 'minDate', 'maxDate'],
+  textarea: ['initval', 'readonly', 'required', 'hidden', 'readin', 'fieldlength', 'span', 'labelwidth', 'maxRows', 'encryption', 'interception', 'tooltip', 'extra', 'count', 'placeholder', 'marginTop', 'marginBottom'],
+  color: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'marginTop', 'marginBottom'],
+  hint: ['label', 'type', 'blacklist', 'message', 'span', 'labelwidth', 'splitline', 'marginTop', 'marginBottom'],
+  split: ['label', 'type', 'marginTop', 'marginBottom'],
+  brafteditor: ['required', 'hidelabel', 'hidden', 'readin', 'fieldlength', 'readonly', 'span', 'labelwidth', 'tooltip', 'extra', 'encryption', 'marginTop', 'marginBottom'],
+  funcvar: ['span', 'labelwidth', 'splitline', 'marginTop', 'marginBottom'],
+  linkMain: ['readonly', 'required', 'hidden', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra', 'marginTop', 'marginBottom']
 }
 
 class MainSearch extends Component {
   static propTpyes = {
     dict: PropTypes.object,    // 瀛楀吀椤�
     formlist: PropTypes.any,
+    standardform: PropTypes.any,
     card: PropTypes.object,
     inputSubmit: PropTypes.any
   }
@@ -41,21 +53,36 @@
     openType: null,
     resourceType: null,
     supField: '',
+    compress: 'false',
+    display: 'text',
+    enter: '',
+    cFields: [],
     formlist: null,
     linkSubFields: null
   }
 
   UNSAFE_componentWillMount () {
     let formlist = fromJS(this.props.formlist).toJS()
-
     let type = ''
     let resourceType = ''
     let supField = ''
+    let display = ''
+    let compress = 'false'
+    let enter = ''
+    let cFields = []
     let linkSubFields = []
 
     formlist.forEach(cell => {
       if (cell.key === 'type') {
         type = cell.initVal
+      } else if (cell.key === 'compress') {
+        compress = cell.initVal
+      } else if (cell.key === 'display') {
+        display = cell.initVal
+      } else if (cell.key === 'enter') {
+        enter = cell.initVal
+      } else if (cell.key === 'fields') {
+        cFields = cell.initVal
       } else if (cell.key === 'resourceType') {
         resourceType = cell.initVal
       } else if (cell.key === 'linkSubField') {
@@ -73,11 +100,15 @@
       }
     })
     
-    let _options = this.getOptions(type, resourceType, supField)
+    let _options = this.getOptions(type, resourceType, supField, display, enter, compress)
 
     this.setState({
+      enter: enter,
+      compress: compress,
       openType: type,
       supField: supField,
+      display: display,
+      cFields: cFields,
       resourceType: resourceType,
       linkSubFields: linkSubFields,
       formlist: formlist.map(form => {
@@ -95,6 +126,11 @@
           form.type = 'number'
           form.initVal = form.initVal || 0
           form.required = true
+        } else if (form.key === 'label') {
+          form.required = true
+          if (type === 'hint') {
+            form.required = false
+          }
         }
 
         form.show = _options.includes(form.key)
@@ -110,20 +146,54 @@
       try {
         let _form = document.getElementById('label')
         _form.select()
-      } catch {
+      } catch (e) {
         console.warn('琛ㄥ崟focus澶辫触锛�')
       }
     }
   }
 
-  getOptions = (type, resourceType, supField) => {
+  getOptions = (type, resourceType, supField, display, enter, compress) => {
     let _options = ['label', 'field', 'type', 'blacklist', 'writein', ...fromJS(modalTypeOptions[type]).toJS()]
 
-    if (['multiselect', 'select', 'link', 'radio', 'checkbox', 'checkcard'].includes(type)) {
+    if (type === 'hint') {
+      _options = fromJS(modalTypeOptions[type]).toJS()
+    } else if (type === 'split') {
+      return fromJS(modalTypeOptions[type]).toJS()
+    } else if (['multiselect', 'select', 'link', 'radio', 'checkbox'].includes(type)) {
       if (resourceType === '0') {        // 鑷畾涔夎祫婧�
-        _options = [..._options, 'options']
+        _options.push('options')
       } else if (resourceType === '1') { // 鏁版嵁婧�
-        _options = [..._options, 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database']
+        _options.push('dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'disableField', 'database')
+      }
+    } else if (type === 'checkcard') {
+      if (display === 'picture') {
+        if (resourceType === '0') {        // 鑷畾涔夎祫婧�
+          _options.push('options', 'ratio')
+        } else if (resourceType === '1') { // 鏁版嵁婧�
+          _options.push('dataSource', 'cardValField', 'urlField', 'orderBy', 'orderType', 'disableField', 'database', 'ratio')
+        }
+      } else {
+        if (resourceType === '0') {        // 鑷畾涔夎祫婧�
+          _options.push('options', 'fields', 'backgroundColor')
+        } else if (resourceType === '1') { // 鏁版嵁婧�
+          _options.push('dataSource', 'cardValField', 'fields', 'orderBy', 'orderType', 'disableField', 'database', 'backgroundColor')
+        }
+      }
+
+      if (sessionStorage.getItem('appType') === 'mob') {
+        _options.push('hidelabel')
+      }
+    } else if (type === 'fileupload') {
+      if (compress === 'true') {
+        _options.push('limit', 'rduri', 'proRduri')
+      } else {
+        _options.push('suffix')
+      }
+    }
+
+    if (type === 'text' || type === 'number' || type === 'select' || type === 'link') {
+      if (enter === 'tab' || enter === 'sub') {
+        _options.push('tabField')
       }
     }
 
@@ -140,11 +210,21 @@
 
   openTypeChange = (key, value) => {
     if (key === 'type') {
-      let _options = this.getOptions(value, this.state.resourceType, this.state.supField)
+      let enter = 'false'
       let fieldValue = {}
+
+      if (value === 'text' || value === 'number') {
+        enter = 'sub'
+        fieldValue.enter = 'sub'
+      } else if (value === 'select' || value === 'link') {
+        fieldValue.enter = 'false'
+      }
+
+      let _options = this.getOptions(value, this.state.resourceType, this.state.supField, this.state.display, enter, this.state.compress)
       
       this.setState({
         openType: value,
+        enter: enter,
         formlist: this.state.formlist.map(form => {
           form.show = _options.includes(form.key)
           if (form.key === 'initval') {
@@ -173,7 +253,9 @@
             }
           } else if (form.key === 'fieldlength') {
             form.initVal = 50
-            if (value === 'textarea' || value === 'fileupload' || value === 'multiselect' || value === 'checkbox') {
+            if (value === 'textarea' || value === 'brafteditor') {
+              form.initVal = 8000
+            } else if (value === 'fileupload' || value === 'multiselect' || value === 'checkbox') {
               form.initVal = 512
             }
 
@@ -192,7 +274,21 @@
             if (form.show) {
               fieldValue.linkSubField = form.initVal
             }
+          } else if (form.key === 'label') {
+            form.required = true
+            if (value === 'hint') {
+              form.required = false
+            }
+          } else if (form.key === 'encryption') {
+            if (value === 'brafteditor') {
+              fieldValue.encryption = 'true'
+            }
+          } else if (form.key === 'hidden') {
+            if (value === 'linkMain') {
+              fieldValue.hidden = 'true'
+            }
           }
+
           return form
         })
       }, () => {
@@ -237,10 +333,10 @@
   }
 
   onChange = (e, key) => {
-    const { openType } = this.state
+    const { openType, compress } = this.state
     let value = e.target.value
     if (key === 'resourceType') {
-      let _options = this.getOptions(openType, value, this.state.supField)
+      let _options = this.getOptions(openType, value, this.state.supField, this.state.display, this.state.enter, compress)
       
       this.setState({
         resourceType: value,
@@ -249,6 +345,98 @@
           return form
         })
       })
+    } else if (key === 'display') {
+      let _options = this.getOptions(openType, this.state.resourceType, this.state.supField, value, this.state.enter, compress)
+      
+      this.setState({
+        display: value,
+        formlist: this.state.formlist.map(form => {
+          form.show = _options.includes(form.key)
+          return form
+        })
+      })
+    } else if (key === 'compress') {
+      let _options = this.getOptions(openType, this.state.resourceType, this.state.supField, this.state.display, this.state.enter, value)
+      
+      this.setState({
+        compress: value,
+        formlist: this.state.formlist.map(form => {
+          form.show = _options.includes(form.key)
+          return form
+        })
+      })
+    } else if (key === 'enter') {
+      let _options = this.getOptions(openType, this.state.resourceType, this.state.supField, this.state.display, value, compress)
+      
+      this.setState({
+        enter: value,
+        formlist: this.state.formlist.map(form => {
+          form.show = _options.includes(form.key)
+          return form
+        })
+      })
+    } else if (key === 'multiple') {
+      if (value === 'true') {
+        this.props.form.setFieldsValue({fieldlength: 512})
+      } else {
+        this.props.form.setFieldsValue({fieldlength: 50})
+      }
+    }
+  }
+
+  changeField = (data) => {
+    this.setState({
+      cFields: data,
+      formlist: this.state.formlist.map(form => {
+        if (form.key === 'fields') {
+          form.initVal = data
+        }
+        return form
+      })
+    })
+  }
+
+  changeVal = (val, type) => {
+    if (type !== 'span' || ![24, 12, 8, 6].includes(val)) return
+
+    const { standardform } = this.props
+
+    if (!standardform || ![24, 12, 8, 6].includes(standardform.span) || !standardform.labelwidth) return
+
+    let labelwidth = null
+
+    if (standardform.span === val) {
+      labelwidth = standardform.labelwidth
+    } else if (standardform.span > val) {
+      labelwidth = 33.3
+    } else {
+      switch(standardform.span) {
+        case 12:
+          labelwidth = 16.2
+          break;
+        case 8:
+          if (val === 12) {
+            labelwidth = 21.6
+          } else {
+            labelwidth = 10.5
+          }
+          break;
+        case 6:
+          if (val === 8) {
+            labelwidth = 24.3
+          } else if (val === 12) {
+            labelwidth = 15.8
+          } else {
+            labelwidth = 7.7
+          }
+          break;
+        default:
+      }
+    } 
+
+
+    if (labelwidth) {
+      this.props.form.setFieldsValue({labelwidth})
     }
   }
 
@@ -262,10 +450,11 @@
 
   getFields() {
     const { getFieldDecorator } = this.props.form
+    const { openType } = this.state
     const fields = []
 
     this.state.formlist.forEach((item, index) => {
-      if (!item.show) return
+      if (!item.show || item.forbid) return null
 
       if (item.type === 'text') { // 鏂囨湰鎼滅储
         let rules = []
@@ -289,7 +478,7 @@
           <Col span={12} key={index}>
             <Form.Item label={item.tooltip ?
               <Tooltip placement="topLeft" title={item.tooltip}>
-                <Icon type="question-circle" />
+                <QuestionCircleOutlined className="mk-form-tip" />
                 {item.label}
               </Tooltip> : item.label
             }>
@@ -307,10 +496,15 @@
           </Col>
         )
       } else if (item.type === 'number') {
-        if (item.key === 'decimal') {
+        if (item.max) {
           fields.push(
             <Col span={12} key={index}>
-              <Form.Item label={item.label}>
+              <Form.Item label={item.tooltip ?
+                <Tooltip placement="topLeft" title={item.tooltip}>
+                  <QuestionCircleOutlined className="mk-form-tip" />
+                  {item.label}
+                </Tooltip> : item.label
+              }>
                 {getFieldDecorator(item.key, {
                   initialValue: item.initVal || 0,
                   rules: [
@@ -319,46 +513,19 @@
                       message: this.props.dict['form.required.input'] + item.label + '!'
                     }
                   ]
-                })(<InputNumber min={0} max={18} precision={0} />)}
-              </Form.Item>
-            </Col>
-          )
-        } else if (item.key === 'fieldlength' || item.key === 'maxfile') {
-          fields.push(
-            <Col span={12} key={index}>
-              <Form.Item label={item.label}>
-                {getFieldDecorator(item.key, {
-                  initialValue: item.initVal,
-                  rules: [
-                    {
-                      required: !!item.required,
-                      message: this.props.dict['form.required.input'] + item.label + '!'
-                    }
-                  ]
-                })(<InputNumber min={1} precision={0} />)}
-              </Form.Item>
-            </Col>
-          )
-        } else if (item.key === 'maxRows') {
-          fields.push(
-            <Col span={12} key={index}>
-              <Form.Item label={item.label}>
-                {getFieldDecorator(item.key, {
-                  initialValue: item.initVal,
-                  rules: [
-                    {
-                      required: !!item.required,
-                      message: this.props.dict['form.required.input'] + item.label + '!'
-                    }
-                  ]
-                })(<InputNumber min={2} max={100} precision={0} />)}
+                })(<InputNumber onChange={(value) => this.changeVal(value, item.key)} min={item.min} max={item.max} precision={item.precision} onPressEnter={this.handleSubmit}/>)}
               </Form.Item>
             </Col>
           )
         } else {
           fields.push(
             <Col span={12} key={index}>
-              <Form.Item label={item.label}>
+              <Form.Item label={item.tooltip ?
+                <Tooltip placement="topLeft" title={item.tooltip}>
+                  <QuestionCircleOutlined className="mk-form-tip" />
+                  {item.label}
+                </Tooltip> : item.label
+              }>
                 {getFieldDecorator(item.key, {
                   initialValue: item.initVal,
                   rules: [
@@ -367,7 +534,7 @@
                       message: this.props.dict['form.required.input'] + item.label + '!'
                     }
                   ]
-                })(<InputNumber />)}
+                })(<InputNumber onPressEnter={this.handleSubmit}/>)}
               </Form.Item>
             </Col>
           )
@@ -377,7 +544,7 @@
           <Col span={12} key={index}>
             <Form.Item label={item.tooltip ?
               <Tooltip placement="topLeft" title={item.tooltip}>
-                <Icon type="question-circle" />
+                <QuestionCircleOutlined className="mk-form-tip" />
                 {item.label}
               </Tooltip> : item.label
             }>
@@ -396,9 +563,9 @@
                   onChange={(value) => {this.openTypeChange(item.key, value)}}
                   getPopupContainer={() => document.getElementById('modal-fields-form-box')}
                 >
-                  {item.options.map(option =>
-                    <Select.Option id={option.value} title={option.text} key={option.value} value={option.value}>
-                      {item.key === 'icon' && <Icon type={option.text} />} {option.text}
+                  {item.options.map((option, i) =>
+                    <Select.Option key={`${i}`} value={option.value || option.field || ''}>
+                      {item.key === 'icon' && <Icon type={option.text} />} {option.text || option.label}
                     </Select.Option>
                   )}
                 </Select>
@@ -409,7 +576,12 @@
       } else if (item.type === 'multiselect') { // 澶氶��
         fields.push(
           <Col span={12} key={index}>
-            <Form.Item label={item.label}>
+            <Form.Item label={item.tooltip ?
+              <Tooltip placement="topLeft" title={item.tooltip}>
+                <QuestionCircleOutlined className="mk-form-tip" />
+                {item.label}
+              </Tooltip> : item.label
+            }>
               {getFieldDecorator(item.key, {
                 initialValue: item.initVal
               })(
@@ -419,8 +591,8 @@
                   filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                   onChange={(value) => this.multiselectChange(item.key, value, item.options)}
                 >
-                  {item.options.map(option =>
-                    <Select.Option id={option.uuid} key={option.uuid} value={option.field}>{option.label}</Select.Option>
+                  {item.options.map((option, i) =>
+                    <Select.Option key={i} value={option.field}>{option.label}</Select.Option>
                   )}
                 </Select>
               )}
@@ -432,7 +604,7 @@
           <Col span={12} key={index}>
             <Form.Item label={item.tooltip ?
               <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}>
-                <Icon type="question-circle" />
+                <QuestionCircleOutlined className="mk-form-tip" />
                 {item.label}
               </Tooltip> : item.label
             }>
@@ -446,22 +618,20 @@
                 ]
               })(
                 <Radio.Group onChange={(e) => {this.onChange(e, item.key)}}>
-                  {
-                    item.options.map(option => {
-                      return (
-                        <Radio key={option.value} value={option.value}>{option.text}</Radio>
-                      )
-                    })
-                  }
-                </Radio.Group>,
+                  {item.options.map(option => {
+                    return (
+                      <Radio key={option.value} value={option.value}>{option.text}</Radio>
+                    )
+                  })}
+                </Radio.Group>
               )}
             </Form.Item>
           </Col>
         )
-      } else if (item.type === 'textarea') {
+      } else if (item.type === 'codemirror') {
         fields.push(
-          <Col span={20} offset={4} key={index}>
-            <Form.Item className="text-area">
+          <Col span={24} key={index}>
+            <Form.Item className="text-area" label={item.label}>
               {getFieldDecorator(item.key, {
                 initialValue: item.initVal,
                 rules: [
@@ -474,15 +644,67 @@
             </Form.Item>
           </Col>
         )
-      } else if (item.type === 'options') {
+      } else if (item.type === 'textarea') {
         fields.push(
-          <Col span={20} offset={4} key={index}>
-            <Form.Item className="text-area">
+          <Col span={24} key={index}>
+            <Form.Item className="text-msg" label={item.tooltip ?
+              <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}>
+                <QuestionCircleOutlined className="mk-form-tip" />
+                {item.label}
+              </Tooltip> : item.label
+            }>
+              {getFieldDecorator(item.key, {
+                initialValue: item.initVal,
+                rules: [
+                  {
+                    required: !!item.required,
+                    message: this.props.dict['form.required.input'] + item.label + '!'
+                  }
+                ]
+              })(<TextArea rows={item.rows || 4} />)}
+            </Form.Item>
+          </Col>
+        )
+      } else if (item.type === 'options') {
+        if (openType !== 'checkcard') {
+          fields.push(
+            <Col span={24} key={index}>
+              <Form.Item label={item.label} className="text-area">
+                {getFieldDecorator(item.key, {
+                  initialValue: item.initVal
+                })(<EditTable dict={this.props.dict} type={openType} linkSubFields={this.state.linkSubFields}/>)}
+              </Form.Item>
+            </Col>
+          )
+        } else {
+          fields.push(
+            <Col span={24} key={index}>
+              <Form.Item label={item.label} className="text-area">
+                {getFieldDecorator(item.key, {
+                  initialValue: item.initVal
+                })(<DataTable dict={this.props.dict} type={this.state.display} fields={this.state.cFields}/>)}
+              </Form.Item>
+            </Col>
+          )
+        }
+      } else if (item.type === 'fields') {
+        fields.push(
+          <Col span={24} key={index}>
+            <Form.Item label={item.label} className="text-area">
               {getFieldDecorator(item.key, {
                 initialValue: item.initVal
-              })(<EditTable dict={this.props.dict} type={this.state.openType} linkSubFields={this.state.linkSubFields}/>)}
+              })(<FieldsTable dict={this.props.dict} onChange={this.changeField}/>)}
             </Form.Item>
-            {/* <EditTable data={item.initVal} dict={this.props.dict} type={this.state.openType} linkSubFields={this.state.linkSubFields} ref="editTable"/> */}
+          </Col>
+        )
+      } else if (item.type === 'color') {
+        fields.push(
+          <Col span={12} key={index}>
+            <Form.Item label={item.label} className="color-form-item">
+              {getFieldDecorator(item.key, {
+                initialValue: item.initVal
+              })(<ColorSketch allowClear={true}/>)}
+            </Form.Item>
           </Col>
         )
       }
@@ -525,8 +747,9 @@
             }
           } else if (values.type === 'funcvar') { // 鍑芥暟鍙橀噺涓哄彧璇诲厓绱�
             values.readonly = 'true'
-          } else if (values.type === 'number' && (values.min || values.min === 0) && (values.max || values.max === 0)) { // 鏁板�煎瀷楠岃瘉鏈�灏忔渶澶у��
-            if (values.min > values.max) {
+          } else if (values.type === 'number') {  // 鏁板�煎瀷楠岃瘉鏈�灏忔渶澶у��
+            values.required = 'true'
+            if ((values.min || values.min === 0) && (values.max || values.max === 0) && values.min > values.max) {
               notification.warning({
                 top: 92,
                 message: '鏈�灏忓�间笉鍙ぇ浜庢渶澶у�硷紒',
@@ -536,6 +759,8 @@
             }
           } else if (values.type === 'linkMain') {
             values.initval = ''
+          } else if (values.type === 'split') {
+            values.span = 24
           }
 
           ['linkField', 'valueField', 'valueText', 'orderBy'].forEach(item => {
@@ -575,7 +800,7 @@
       }
     }
     return (
-      <Form {...formItemLayout} className="ant-advanced-search-form modal-fields-form" id="modal-fields-form-box">
+      <Form {...formItemLayout} className="modal-fields-form" id="modal-fields-form-box">
         <Row gutter={24}>{this.getFields()}</Row>
       </Form>
     )

--
Gitblit v1.8.0