From ded0a522a7747fb841719c13c8c35f13cf5cda4c Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 15 十一月 2021 17:28:13 +0800
Subject: [PATCH] 2021-11-15

---
 src/menu/components/table/edit-table/columns/editColumn/index.jsx |   66 +++++++++++++++++++++++++-------
 1 files changed, 51 insertions(+), 15 deletions(-)

diff --git a/src/menu/components/table/edit-table/columns/editColumn/index.jsx b/src/menu/components/table/edit-table/columns/editColumn/index.jsx
index 17cfbda..b8e9de9 100644
--- a/src/menu/components/table/edit-table/columns/editColumn/index.jsx
+++ b/src/menu/components/table/edit-table/columns/editColumn/index.jsx
@@ -1,18 +1,21 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Icon, Modal } from 'antd'
+import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Modal, notification } from 'antd'
+import { QuestionCircleOutlined } from '@ant-design/icons'
 
 import { getColumnForm } from './formconfig'
 import { formRule } from '@/utils/option.js'
 import './index.scss'
 
+const { TextArea } = Input
 const columnTypeOptions = {
-  text: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'textFormat', 'editable', 'blacklist'],
-  number: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'editable', 'sum', 'blacklist'],
-  textarea: ['label', 'field', 'type', 'Align', 'Hide', 'Width', 'prefix', 'postfix', 'blacklist'],
+  text: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'textFormat', 'editable', 'initval', 'blacklist'],
+  number: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'editable', 'initval', 'sum', 'blacklist'],
+  textarea: ['label', 'field', 'type', 'Align', 'Hide', 'Width', 'prefix', 'initval', 'postfix', 'blacklist'],
   custom: ['label', 'type', 'Align', 'Hide', 'Width', 'blacklist'],
   action: ['label', 'type', 'Align', 'Width'],
+  formula: ['label', 'type', 'Align', 'Hide', 'Width', 'prefix', 'postfix', 'eval', 'formula', 'blacklist'],
   index: ['label', 'type', 'Align', 'Width']
 }
 
@@ -44,9 +47,9 @@
 
     if (column.editable === 'true') {
       if (column.type === 'text') {
-        _options.push('required', 'initval', 'enter', 'footEnter')
+        _options.push('required', 'enter', 'footEnter')
       } else if (column.type === 'number') {
-        _options.push('max', 'min', 'initval', 'enter', 'footEnter')
+        _options.push('max', 'min', 'enter', 'footEnter')
       }
     }
 
@@ -78,9 +81,9 @@
 
       if (editable === 'true') {
         if (value === 'text') {
-          _options.push('required', 'initval', 'enter', 'footEnter')
+          _options.push('required', 'enter', 'footEnter')
         } else if (value === 'number') {
-          _options.push('max', 'min', 'initval', 'enter', 'footEnter')
+          _options.push('max', 'min', 'enter', 'footEnter')
         }
       }
 
@@ -117,9 +120,9 @@
 
         if (editable === 'true') {
           if (values.type === 'text') {
-            _options.push('required', 'initval', 'enter', 'footEnter')
+            _options.push('required', 'enter', 'footEnter')
           } else if (values.type === 'number') {
-            _options.push('max', 'min', 'initval', 'enter', 'footEnter')
+            _options.push('max', 'min', 'enter', 'footEnter')
           }
         }
 
@@ -146,9 +149,9 @@
 
       if (value === 'true') {
         if (type === 'text') {
-          _options.push('required', 'initval', 'enter', 'footEnter')
+          _options.push('required', 'enter', 'footEnter')
         } else if (type === 'number') {
-          _options.push('max', 'min', 'initval', 'enter', 'footEnter')
+          _options.push('max', 'min', 'enter', 'footEnter')
         }
       }
 
@@ -185,7 +188,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
             }>
@@ -207,7 +210,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
             }>
@@ -258,7 +261,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
             }>
@@ -304,15 +307,48 @@
             </Form.Item>
           </Col>
         )
+      } else if (item.type === 'textarea') { // 鏂囨湰鎼滅储
+        fields.push(
+          <Col span={24} key={index} className="textarea">
+            <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: [
+                  {
+                    required: !!item.required,
+                    message: this.props.dict['form.required.input'] + item.label + '!'
+                  }
+                ]
+              })(<TextArea rows={2} disabled={item.readonly} placeholder={item.placeholder || ''} />)}
+            </Form.Item>
+          </Col>
+        )
       }
     })
     return fields
   }
 
   handleSubmit = () => {
+    const { columns, column } = this.props
     // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭�
     this.props.form.validateFieldsAndScroll((err, values) => {
       if (!err) {
+        values.uuid = column.uuid
+        values.marks = column.marks || []
+        
+        if (values.field && columns.filter(col => col.field && col.uuid !== values.uuid && col.field === values.field).length > 0) {
+          notification.warning({
+            top: 92,
+            message: '瀛楁宸叉坊鍔狅紒',
+            duration: 5
+          })
+          return
+        }
         this.setState({visible: false, formlist: null})
         this.props.submitCol(values)
       }

--
Gitblit v1.8.0