From 46aa44856bcb0e262d98918e06b4f83d2c11777a Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 15 四月 2023 14:32:02 +0800 Subject: [PATCH] 2023-04-15 --- src/menu/components/card/cardcellcomponent/elementform/index.jsx | 104 +++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 82 insertions(+), 22 deletions(-) diff --git a/src/menu/components/card/cardcellcomponent/elementform/index.jsx b/src/menu/components/card/cardcellcomponent/elementform/index.jsx index e21fc1f..b6badfd 100644 --- a/src/menu/components/card/cardcellcomponent/elementform/index.jsx +++ b/src/menu/components/card/cardcellcomponent/elementform/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { fromJS } from 'immutable' -import { Form, Row, Col, Input, Select, Radio, Tooltip, InputNumber, Cascader } from 'antd' +import { Form, Row, Col, Input, Select, Radio, Tooltip, InputNumber, Cascader, Popover } from 'antd' import { QuestionCircleOutlined } from '@ant-design/icons' import { formRule } from '@/utils/option.js' @@ -15,7 +15,7 @@ const cardTypeOptions = { sequence: ['eleType', 'width'], - text: ['eleType', 'datatype', 'format', 'width', 'height', 'prefix', 'postfix', 'link', 'anchors', 'noValue', 'bgImage', 'fixStyle', 'copyable', 'alignItems'], + text: ['eleType', 'datatype', 'format', 'width', 'height', 'prefix', 'postfix', 'link', 'anchors', 'noValue', 'bgImage', 'fixStyle', 'copyable', 'alignItems', 'sortField'], number: ['eleType', 'datatype', 'width', 'height', 'prefix', 'postfix', 'noValue', 'fixStyle', 'alignItems'], picture: ['eleType', 'datatype', 'width', 'lenWidRadio', 'maxWidth', 'link', 'noValue'], video: ['eleType', 'datatype', 'width', 'aspectRatio', 'autoPlay', 'loop', 'startTime', 'noValue', 'posterType'], @@ -96,9 +96,43 @@ } }) } + } else if (item.key === 'sortField' && !item.forbid) { + item.options = [] + + config.columns.forEach(col => { + let label = `${col.field}锛�${col.label}锛塦 + item.options.push({ + value: col.field, + text: label + }) + }) + + if (config.subColumns) { + config.subColumns.forEach(col => { + let label = `${col.field}锛�${col.label}锛塦 + item.options.push({ + value: col.field, + text: label + }) + }) + } } else if (item.key === 'value' && card.eleType === 'slider') { item.type = 'number' item.label = '鍊�' + } else if (item.key === 'formula') { + item.fields = [] + + config.columns.forEach(col => { + item.fields.push(col.field) + }) + + if (config.subColumns) { + config.subColumns.forEach(col => { + item.fields.push(col.field) + }) + } + + item.fields = item.fields.join(', ') } else if (item.key === 'value' && card.eleType === 'text') { item.type = 'textarea' item.label = '鍐呭' @@ -409,26 +443,52 @@ </Col> ) } else if (item.type === 'textarea') { - 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.readonly ? false : !!item.required, - message: '璇疯緭鍏�' + item.label + '!' - } - ] - })(<TextArea autoSize={{minRows: 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.readonly ? false : !!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} 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.readonly ? false : !!item.required, + message: '璇疯緭鍏�' + item.label + '!' + } + ] + })(<TextArea autoSize={{minRows: 2}} disabled={item.readonly} placeholder={item.placeholder || ''} />)} + </Form.Item> + </Col> + ) + } } else if (item.type === 'number') { fields.push( <Col span={12} key={index}> -- Gitblit v1.8.0