From 7b0dbecd1d6155d26ec67be0a47a16264c738c85 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 09 五月 2023 14:48:10 +0800
Subject: [PATCH] 2023-05-09

---
 src/menu/components/table/normal-table/columns/editColumn/index.jsx |   79 ++++++++++++++++++++++++++++-----------
 1 files changed, 57 insertions(+), 22 deletions(-)

diff --git a/src/menu/components/table/normal-table/columns/editColumn/index.jsx b/src/menu/components/table/normal-table/columns/editColumn/index.jsx
index f855127..d971c8e 100644
--- a/src/menu/components/table/normal-table/columns/editColumn/index.jsx
+++ b/src/menu/components/table/normal-table/columns/editColumn/index.jsx
@@ -1,7 +1,7 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Cascader, Modal, Checkbox } from 'antd'
+import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Cascader, Modal, Checkbox, Popover } from 'antd'
 import { QuestionCircleOutlined } from '@ant-design/icons'
 
 import { getColumnForm } from './formconfig'
@@ -65,6 +65,11 @@
       formlist: formlist.map(item => {
         item.hidden = !_options.includes(item.key)
 
+        if (item.key === 'formula') {
+          item.fields = this.props.fields.map(col => col.field)
+          item.fields = item.fields.join(', ')
+        }
+
         return item
       })
     })
@@ -101,10 +106,14 @@
           this.props.form.setFieldsValue({IsSort: 'false'})
         } else if (value === 'text' || value === 'number') {
           this.props.form.setFieldsValue({perspective: ''})
-        } else if (value === 'action' || value === 'colspan') {
+        } else if (value === 'colspan') {
           this.props.form.setFieldsValue({Align: 'center'})
         } else if (value === 'formula' && _field) {
           this.props.form.setFieldsValue({formula: '@' + _field + '@'})
+        } else if (value === 'action') {
+          this.props.form.setFieldsValue({Align: 'center', label: '鎿嶄綔'})
+        } else if (value === 'index') {
+          this.props.form.setFieldsValue({label: '搴忓彿'})
         }
       })
     } else if (key === 'field') {
@@ -345,26 +354,52 @@
           </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: '璇疯緭鍏�' + item.label + '!'
-                  }
-                ]
-              })(<TextArea rows={2} disabled={item.readonly} placeholder={item.placeholder || ''}/>)}
-            </Form.Item>
-          </Col>
-        )
+        if (item.key === 'formula') {
+          fields.push(
+            <Col span={24} className="textarea" key={index}>
+              <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: '璇疯緭鍏�' + item.label + '!'
+                    }
+                  ]
+                })(<TextArea autoSize={{minRows: 2}} disabled={item.readonly} placeholder={item.placeholder || ''} />)}
+              </Form.Item>
+              <Popover overlayClassName="formula-fields" placement="topLeft" title="" content={<div>{item.fields}</div>} trigger="click">
+                <span className="formula-icon">瀛楁闆�</span>
+              </Popover>
+            </Col>
+          )
+        } else {
+          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: '璇疯緭鍏�' + item.label + '!'
+                    }
+                  ]
+                })(<TextArea rows={2} disabled={item.readonly} placeholder={item.placeholder || ''}/>)}
+              </Form.Item>
+            </Col>
+          )
+        }
       }
     })
     return fields

--
Gitblit v1.8.0