From ac1d52c46ff9019fcc93cf3d5e7ab17cf850824e Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 10 八月 2023 16:05:24 +0800 Subject: [PATCH] 2023-08-10 --- src/menu/components/chart/antv-dashboard/chartcompile/index.jsx | 65 +++++++++++--------------------- 1 files changed, 22 insertions(+), 43 deletions(-) diff --git a/src/menu/components/chart/antv-dashboard/chartcompile/index.jsx b/src/menu/components/chart/antv-dashboard/chartcompile/index.jsx index 051a639..dd69b91 100644 --- a/src/menu/components/chart/antv-dashboard/chartcompile/index.jsx +++ b/src/menu/components/chart/antv-dashboard/chartcompile/index.jsx @@ -1,10 +1,11 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { fromJS } from 'immutable' -import { Modal, Form, Row, Col, Select, Icon, Radio, Tooltip, Input, InputNumber, Tabs, Button } from 'antd' +import { Modal, Form, Row, Col, Select, Radio, Tooltip, Input, InputNumber, Tabs, Button } from 'antd' +import { QuestionCircleOutlined, EditOutlined } from '@ant-design/icons' import Utils from '@/utils/utils.js' -import { getBaseForm, getOptionForm } from './formconfig' +import { getBaseForm, getOptionForm, getRadioOptionForm } from './formconfig' import asyncComponent from '@/utils/asyncComponent' import ColorSketch from '@/mob/colorsketch' import './index.scss' @@ -16,7 +17,6 @@ class LineChartDrawerForm extends Component { static propTpyes = { - dict: PropTypes.object, plot: PropTypes.object, config: PropTypes.object, plotchange: PropTypes.func @@ -32,7 +32,7 @@ { title: '鎸囨爣', dataIndex: 'tick', - inputType: 'number', + inputType: this.props.config.subtype === 'ratioboard' ? 'text' : 'number', editable: true, width: '40%' }, @@ -57,30 +57,8 @@ view: 'normal', plot: fromJS(config.plot).toJS(), baseFormlist: getBaseForm(config.plot), - formlist: getOptionForm(config.plot, config.columns) + formlist: config.subtype === 'ratioboard' ? getRadioOptionForm(config.plot, config.columns) : getOptionForm(config.plot, config.columns) }) - } - - radioChange = (e, key) => { - const { formlist } = this.state - let val = e.target.value - - if (key === 'shape') { - this.setState({ - formlist: formlist.map(item => { - if (item.key === 'innerRadius') { - item.hidden = val === 'pie' - } - return item - }) - }, () => { - if (val === 'ring') { - this.props.form.setFieldsValue({innerRadius: 50}) - } else if (val === 'nightingale') { - this.props.form.setFieldsValue({innerRadius: 0}) - } - }) - } } getFields() { @@ -100,7 +78,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 }> @@ -109,7 +87,7 @@ rules: [ { required: !!item.required, - message: this.props.dict['form.required.input'] + item.label + '!' + message: '璇疯緭鍏�' + item.label + '!' } ] })(<Input placeholder="" autoComplete="off" disabled={item.readonly} onPressEnter={this.onSubmit}/>)} @@ -121,7 +99,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 }> @@ -130,7 +108,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} onPressEnter={this.onSubmit}/>)} @@ -142,7 +120,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 }> @@ -151,7 +129,7 @@ rules: [ { required: !!item.required, - message: this.props.dict['form.required.select'] + item.label + '!' + message: '璇烽�夋嫨' + item.label + '!' } ] })( @@ -171,7 +149,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 }> @@ -180,11 +158,11 @@ rules: [ { required: !!item.required, - message: this.props.dict['form.required.select'] + item.label + '!' + message: '璇烽�夋嫨' + item.label + '!' } ] })( - <Radio.Group disabled={item.readonly} onChange={(e) => this.radioChange(e, item.key)}> + <Radio.Group disabled={item.readonly}> {item.options.map(option => { return ( <Radio key={option.value} value={option.value}>{option.text}</Radio> @@ -197,10 +175,10 @@ ) } else if (item.type === 'color') { fields.push( - <Col span={12} key={index}> + <Col span={12} key={index} className="color-col"> <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,6 +282,7 @@ } render() { + const { config } = this.props const { visible, plot, colorColumns, view, baseFormlist } = this.state const formItemLayout = { labelCol: { @@ -318,10 +297,9 @@ return ( <div className="line-chart-drawer-form"> - <Icon type="edit" title="缂栬緫" onClick={this.showDrawer} /> + <EditOutlined title="缂栬緫" onClick={this.showDrawer} /> <Modal - wrapClassName="popview-modal menu-chart-edit-modal" - title="鍥捐〃缂栬緫" + wrapClassName="mk-pop-modal" visible={visible} width={850} maskClosable={false} @@ -329,9 +307,10 @@ onCancel={() => { this.setState({ visible: false }) }} destroyOnClose > + {config.name ? <div className="mk-com-name">{config.name} - 缂栬緫</div> : null} <Tabs activeKey={view} className="menu-chart-edit-box" onChange={this.changeTab}> <TabPane tab="缁勪欢璁剧疆" key="base"> - <NormalForm dict={this.props.dict} formlist={baseFormlist} inputSubmit={this.onSubmit} wrappedComponentRef={(inst) => this.baseRef = inst}/> + <NormalForm formlist={baseFormlist} inputSubmit={this.onSubmit} wrappedComponentRef={(inst) => this.baseRef = inst}/> </TabPane> <TabPane tab="鍥捐〃璁剧疆" key="normal"> <Form {...formItemLayout}> @@ -340,7 +319,7 @@ </TabPane> {plot ? <TabPane tab="棰滆壊璁剧疆" key="color"> <div> - <Button className="color-add mk-green" onClick={this.addColor}>{this.props.dict['model.add']}</Button> + <Button className="color-add mk-green" onClick={this.addColor}>娣诲姞</Button> <EditTable actions={['edit', 'move', 'del']} data={plot.colors || []} columns={colorColumns} onChange={this.changeColor}/> </div> </TabPane> : null} -- Gitblit v1.8.0