From 8cec010d47fa9cb9c7684f4c84dd31cfe20e7527 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 18 四月 2025 16:41:43 +0800 Subject: [PATCH] 2025-04-18 --- src/menu/components/card/cardcellcomponent/elementform/index.jsx | 168 +++++++++++++++++++++++++++++++------------------------ 1 files changed, 94 insertions(+), 74 deletions(-) diff --git a/src/menu/components/card/cardcellcomponent/elementform/index.jsx b/src/menu/components/card/cardcellcomponent/elementform/index.jsx index efc66b8..7db2122 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, Popover, message, AutoComplete } from 'antd' +import { Form, Row, Col, Input, Select, Radio, Checkbox, Tooltip, InputNumber, Cascader, Popover, message, AutoComplete } from 'antd' import { QuestionCircleOutlined } from '@ant-design/icons' import { formRule } from '@/utils/option.js' @@ -115,6 +115,26 @@ }) }) } + } else if (['tsField', 'noVField'].includes(item.key)) { + item.options = [] + + if (side === 'sub') { + config.subColumns.forEach(col => { + let label = `${col.field}锛�${col.label}锛塦 + item.options.push({ + value: col.field, + text: label + }) + }) + } else { + config.columns.forEach(col => { + let label = `${col.field}锛�${col.label}锛塦 + item.options.push({ + value: col.field, + text: label + }) + }) + } } else if (item.key === 'formula') { item.fields = [] @@ -181,6 +201,17 @@ _options.push('value') } + if (this.record.eleType === 'text' && this.record.noValue === 'hide') { + if (this.record.datatype === 'static') { + _options.push('noVField') + if (this.record.noVField) { + _options.push('noVExtra') + } + } else { + _options.push('noVExtra') + } + } + if (this.record.eleType === 'picture' && this.record.noValue === 'show') { _options.push('lostTip') } else if (this.record.eleType === 'video' && this.record.posterType) { @@ -194,14 +225,14 @@ if (['text', 'picture'].includes(this.record.eleType) && this.record.link) { _options.push('linkType') if (this.record.linkType === 'linkmenu') { - _options.push('open', 'joint') + _options.push('open', 'tsField') if (this.record.link === 'static') { _options.push('linkmenu') } else { _options.push('linkurl') } } else if (this.record.linkType === 'other') { - _options.push('linkurl', 'joint', 'open') + _options.push('linkurl', 'open') } else { _options.push('linkurl') } @@ -228,10 +259,25 @@ } } else if (this.record.eleType === 'formula') { if (this.record.eval !== 'func') { - _options.push('prefix', 'postfix', 'fixStyle', 'alignItems') + _options.push('link', 'prefix', 'postfix', 'fixStyle', 'alignItems', 'evalchars') } if (this.record.eval === 'true') { _options.push('decimal') + } + if (this.record.link && this.record.eval !== 'func') { + _options.push('linkType') + if (this.record.linkType === 'linkmenu') { + _options.push('open', 'tsField') + if (this.record.link === 'static') { + _options.push('linkmenu') + } else { + _options.push('linkurl') + } + } else if (this.record.linkType === 'other') { + _options.push('linkurl', 'open') + } else { + _options.push('linkurl') + } } } if (_options.includes('fixStyle') && this.record.fixStyle === 'alone') { @@ -371,7 +417,7 @@ return item }) }) - } else if (['datatype', 'showInfo', 'showType', 'fixStyle', 'posterType', 'eval', 'linkType', 'tipType', 'noValue'].includes(key)) { + } else if (['datatype', 'showInfo', 'showType', 'fixStyle', 'posterType', 'eval', 'linkType', 'tipType', 'noValue', 'noVField'].includes(key)) { let _options = this.getOptions() this.setState({ @@ -400,11 +446,21 @@ this.state.formlist.forEach((item, index) => { if (item.hidden || item.forbid) return + let label = item.label + if (item.tooltip) { + if (item.toolWidth) { + label = <Tooltip placement="topLeft" overlayStyle={{maxWidth: item.toolWidth}} title={<div onClick={(e) => e.stopPropagation()}>{item.tooltip}</div>}><QuestionCircleOutlined className="mk-form-tip" />{item.label}</Tooltip> + } else { + label = <Tooltip placement="topLeft" title={<div onClick={(e) => e.stopPropagation()}>{item.tooltip}</div>}><QuestionCircleOutlined className="mk-form-tip" />{item.label}</Tooltip> + } + } + if (item.type === 'text') { + let rules = item.rules || [] if (item.options && item.options.length > 0) { fields.push( <Col span={12} key={index}> - <Form.Item label={item.label}> + <Form.Item label={label}> {getFieldDecorator(item.key, { initialValue: item.initVal || '', rules: [ @@ -437,12 +493,7 @@ } else { fields.push( <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> + <Form.Item label={label}> {getFieldDecorator(item.key, { initialValue: item.initVal || '', rules: [ @@ -453,7 +504,8 @@ { max: formRule.input.max, message: formRule.input.message - } + }, + ...rules ] })(<Input placeholder="" autoComplete="off" disabled={item.readonly} onPressEnter={this.handleSubmit} />)} </Form.Item> @@ -463,12 +515,7 @@ } 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 - }> + <Form.Item label={label}> {getFieldDecorator(item.key, { initialValue: item.initVal || '', rules: [ @@ -485,12 +532,7 @@ if (item.help) { fields.push( <Col span={12} key={index}> - <Form.Item help={item.help} label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> + <Form.Item help={item.help} label={label}> {getFieldDecorator(item.key, { initialValue: item.initVal, rules: [{ @@ -504,12 +546,7 @@ } else { fields.push( <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> + <Form.Item label={label}> {getFieldDecorator(item.key, { initialValue: item.initVal, rules: [{ @@ -524,12 +561,7 @@ } else if (item.type === 'select') { // 涓嬫媺鎼滅储 fields.push( <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> + <Form.Item label={label}> {getFieldDecorator(item.key, { initialValue: item.initVal || '', rules: [{ @@ -557,12 +589,7 @@ } else if (item.type === 'icon') { fields.push( <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> + <Form.Item label={label}> {getFieldDecorator(item.key, { initialValue: item.initVal || '', rules: [{ @@ -578,12 +605,7 @@ } else if (item.type === 'radio') { fields.push( <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> + <Form.Item label={label}> {getFieldDecorator(item.key, { initialValue: item.initVal, rules: [{ @@ -602,10 +624,28 @@ </Form.Item> </Col> ) + } else if (item.type === 'checkbox') { + fields.push( + <Col span={12} key={index}> + <Form.Item label={label}> + {getFieldDecorator(item.key, { + initialValue: item.initVal, + rules: [{ + required: item.required, + message: '璇烽�夋嫨' + item.label + '!' + }] + })( + <Checkbox.Group style={{whiteSpace: 'nowrap'}}> + {item.options.map(option => <Checkbox key={option.value} value={option.value}>{option.text}</Checkbox>)} + </Checkbox.Group> + )} + </Form.Item> + </Col> + ) } else if (item.type === 'color') { fields.push( <Col span={12} key={index} className="color-form"> - <Form.Item label={item.label}> + <Form.Item label={label}> {getFieldDecorator(item.key, { initialValue: item.initVal, rules: [ @@ -628,12 +668,7 @@ fields.push( <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> + <Form.Item label={label}> {getFieldDecorator(item.key, { initialValue: item.initVal, rules: [ @@ -651,12 +686,7 @@ } else if (item.type === 'cascader') { fields.push( <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> + <Form.Item label={label}> {getFieldDecorator(item.key, { initialValue: item.initVal || [], rules: [ @@ -674,12 +704,7 @@ } else if (item.type === 'table') { 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 - }> + <Form.Item label={label}> {getFieldDecorator(item.key, { initialValue: item.initVal || '', rules: [ @@ -697,12 +722,7 @@ } else if (item.type === 'codemirror') { fields.push( <Col span={24} key={index} className="textarea"> - <Form.Item label={ - <Tooltip placement="topLeft" overlayStyle={{width: 500, maxWidth: 500}} title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> - }> + <Form.Item label={label}> {getFieldDecorator(item.key, { initialValue: item.initVal || '', rules: [ -- Gitblit v1.8.0