From c7aece35a62b6e91fd98a625bf0e53f64bfbd18d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 17 八月 2023 16:22:15 +0800 Subject: [PATCH] 2023-08-17 --- src/templates/sharecomponent/chartgroupcomponent/chartform/index.jsx | 110 +++++++++++++----------------------------------------- 1 files changed, 27 insertions(+), 83 deletions(-) diff --git a/src/templates/sharecomponent/chartgroupcomponent/chartform/index.jsx b/src/templates/sharecomponent/chartgroupcomponent/chartform/index.jsx index 6d1a5b7..59cdc1c 100644 --- a/src/templates/sharecomponent/chartgroupcomponent/chartform/index.jsx +++ b/src/templates/sharecomponent/chartgroupcomponent/chartform/index.jsx @@ -1,6 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Icon } from 'antd' +import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip } from 'antd' +import { QuestionCircleOutlined } from '@ant-design/icons' import { formRule } from '@/utils/option.js' import line1 from '@/assets/img/line1.png' @@ -158,7 +159,6 @@ class ChartForm extends Component { static propTpyes = { - dict: PropTypes.object, // 瀛楀吀椤� MenuID: PropTypes.any, formlist: PropTypes.any, card: PropTypes.any, @@ -214,17 +214,13 @@ item.hidden = true } else if (item.key === 'height' && ['table', 'card'].includes(_type)) { item.hidden = true - } else if (item.key === 'widthType' && _type === 'card') { - item.hidden = false } else if (item.key === 'cardWidth' && _type === 'card') { - item.hidden = false - } else if (item.key === 'over' && _type === 'card') { item.hidden = false } else if (item.key === 'border' && _type === 'card') { item.hidden = false } else if (item.key === 'switch' && _type === 'card') { item.hidden = false - } else if (item.key === 'insert') { + } else if (item.key === 'extraAction') { item.hidden = _type !== 'card' } else if (item.key === 'bgfield') { item.hidden = _type !== 'card' @@ -241,7 +237,7 @@ try { let _form = document.getElementById('title') _form.select() - } catch { + } catch (e) { console.warn('琛ㄥ崟focus澶辫触锛�') } } @@ -256,7 +252,6 @@ } typeChange = (key, value) => { - const { card } = this.props let formlist = JSON.parse(JSON.stringify(this.props.formlist)) if (key === 'chartType') { @@ -268,71 +263,17 @@ item.hidden = true } else if (item.key === 'height' && ['table', 'card'].includes(value)) { item.hidden = true - } else if (item.key === 'widthType' && value === 'card') { - item.hidden = false } else if (item.key === 'cardWidth' && value === 'card') { - item.min = card.widthType === 'absolute' ? 50 : 1 - item.max = card.widthType === 'absolute' ? 1000 : 24 - item.hidden = false - } else if (item.key === 'over' && value === 'card') { item.hidden = false } else if (item.key === 'border' && value === 'card') { item.hidden = false } else if (item.key === 'switch' && value === 'card') { item.hidden = false - } else if (item.key === 'insert') { + } else if (item.key === 'extraAction') { item.hidden = value !== 'card' } else if (item.key === 'bgfield') { item.hidden = value !== 'card' } - return item - }) - }) - } - } - - radioChange = (val, key) => { - const { formlist } = this.state - - if (key === 'widthType') { - this.setState({ - formlist: formlist.map(item => { - if (item.key === 'cardWidth') { - item.min = val === 'absolute' ? 50 : 1 - item.max = val === 'absolute' ? 1000 : 24 - } - - return item - }) - }) - if (val === 'absolute') { - this.props.form.setFieldsValue({cardWidth: 250}) - } else { - this.props.form.setFieldsValue({cardWidth: 6}) - } - } else if (key === 'over' && val === 'roll') { - this.setState({ - formlist: formlist.map(item => { - if (item.key === 'cardWidth') { - item.min = 50 - item.max = 1000 - } else if (item.key === 'widthType') { - item.readonly = true - } - - return item - }) - }) - if (this.props.form.getFieldValue('widthType') !== undefined) { - this.props.form.setFieldsValue({widthType: 'absolute', cardWidth: 250}) - } - } else if (key === 'over' && val === 'whole') { - this.setState({ - formlist: formlist.map(item => { - if (item.key === 'widthType') { - item.readonly = false - } - return item }) }) @@ -352,12 +293,12 @@ this.state.formlist.forEach((item, index) => { if (item.hidden) return - if (item.type === 'text') { // 鏂囨湰鎼滅储 + if (item.type === 'text') { fields.push( <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 }> @@ -366,7 +307,7 @@ rules: [ { required: !!item.required, - message: this.props.dict['form.required.input'] + item.label + '!' + message: '璇疯緭鍏�' + item.label + '!' }, { max: formRule.input.max, @@ -382,7 +323,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 }> @@ -391,7 +332,7 @@ rules: [ { required: !!item.required, - message: this.props.dict['form.required.input'] + item.label + '!' + message: '璇疯緭鍏�' + item.label + '!' } ] })(<InputNumber min={item.min} max={item.max} precision={item.decimal} />)} @@ -401,13 +342,18 @@ } else if (item.type === 'select') { // 涓嬫媺鎼滅储 fields.push( <Col span={12} key={index}> - <Form.Item label={item.label}> + <Form.Item 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.select'] + item.label + '!' + message: '璇烽�夋嫨' + item.label + '!' } ] })( @@ -433,7 +379,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 }> @@ -442,11 +388,11 @@ rules: [ { required: !!item.required, - message: this.props.dict['form.required.select'] + item.label + '!' + message: '璇烽�夋嫨' + item.label + '!' } ] })( - <Radio.Group onChange={(e) => this.radioChange(e.target.value, item.key)} disabled={item.readonly}> + <Radio.Group disabled={item.readonly}> { item.options.map(option => { return ( @@ -462,7 +408,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" overlayClassName={item.tooltipClass} title={item.tooltip}> + <QuestionCircleOutlined className="mk-form-tip" /> + {item.label} + </Tooltip> : item.label + }> {getFieldDecorator(item.key, { initialValue: item.initVal || [] })( @@ -500,7 +451,7 @@ card: 'credit-card' } - if (result.chartType === 'line' || result.chartType === 'bar' || result.chartType === 'line') { + if (result.chartType === 'line' || result.chartType === 'bar' || result.chartType === 'pie') { if (selectlegend && this.props.card.modelId !== selectlegend.uuid) { result = {...result, ...selectlegend.options} } @@ -517,11 +468,6 @@ } else if (result.chartType === 'card') { if (selectlegend) { result.subelement = selectlegend.subelement - } - - if (result.widthType === 'ratio' && result.avatar && result.avatar.widthType !== 'ratio') { - result.avatar.widthType = 'ratio' - result.avatar.width = 32 } if (!result.details) { @@ -547,9 +493,7 @@ type: 'picture', field: '', size: 14, - widthType: 'ratio', width: 32, - avatarWidth: 32, radius: 'true', display: 'inline' } -- Gitblit v1.8.0