From f6626b05f1275cc2f8ca77f773d4f6a6af1b0a89 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 21 十一月 2022 16:11:55 +0800 Subject: [PATCH] 2022-11-21 --- src/menu/components/table/normal-table/columns/editColumn/index.jsx | 74 +++++++++++++++++++++---------------- 1 files changed, 42 insertions(+), 32 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 bf74079..a186e6e 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,8 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Icon, Cascader, Modal } from 'antd' +import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Cascader, Modal } from 'antd' +import { QuestionCircleOutlined } from '@ant-design/icons' import { getColumnForm } from './formconfig' import { formRule } from '@/utils/option.js' @@ -13,16 +14,17 @@ number: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'blacklist', 'perspective', 'sum', 'rowspan'], link: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'joint', 'Width', 'blacklist', 'nameField'], textarea: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'blacklist'], - picture: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'blacklist', 'scale', 'lenWidRadio', 'picSort'], + picture: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'blacklist', 'scale', 'lenWidRadio', 'span'], + video: ['label', 'field', 'type', 'Align', 'Hide', 'startTime', 'Width', 'blacklist', 'aspectRatio'], colspan: ['label', 'type', 'Align', 'Hide', 'blacklist'], custom: ['label', 'type', 'Align', 'Hide', 'Width', 'blacklist'], action: ['label', 'type', 'Align', 'Width'], + formula: ['label', 'type', 'Align', 'Hide', 'Width', 'prefix', 'postfix', 'eval', 'formula', 'blacklist'], index: ['label', 'type', 'Align', 'Width'] } -class MainSearch extends Component { +class NormalTableColumn extends Component { static propTpyes = { - dict: PropTypes.object, // 瀛楀吀椤� visible: PropTypes.bool, column: PropTypes.object, fields: PropTypes.array, @@ -42,7 +44,14 @@ } editColumn = (column) => { - let formlist = getColumnForm(column, this.props.fields) + let fields = fromJS(this.props.fields).toJS().map(item => { + if (item.label.toLowerCase() !== item.field.toLowerCase()) { + item.text = item.label + '锛�' + item.field + '锛�' + } + return item + }) + + let formlist = getColumnForm(column, fields) let _options = fromJS(columnTypeOptions[column.type]).toJS() if (column.type === 'text' || column.type === 'number') { if (column.perspective === 'linkmenu') { @@ -60,16 +69,17 @@ return item }) - }, () => { - if (column.focus) { + }) + if (column.focus) { + setTimeout(() => { try { let _form = document.getElementById('label') _form && _form.select() - } catch { + } catch (e) { console.warn('琛ㄥ崟focus澶辫触锛�') } - } - }) + }, 200) + } } typeChange = (key, value, option) => { @@ -93,7 +103,7 @@ } }) } else if (key === 'field') { - let values = {label: option.props.children} + let values = {label: option.props.label || option.props.children} if (/Decimal|int/ig.test(option.props.datatype)) { let decimal = 0 if (/Decimal/ig.test(option.props.datatype)) { @@ -101,7 +111,7 @@ } values.type = 'number' values.decimal = decimal - } else if (/nvarchar/ig.test(option.props.datatype)) { + } else { values.type = 'text' } @@ -155,9 +165,9 @@ if (!formlist) return null formlist.forEach((item, index) => { - if (item.hidden || item.forbidden) return + if (item.hidden || item.forbid) return - if (item.type === 'text') { // 鏂囨湰鎼滅储 + if (item.type === 'text') { let rules = [] if (item.key !== 'linkurl') { rules = [{ @@ -168,8 +178,8 @@ 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" /> + <Tooltip placement="topLeft" title={item.tooltip}> + <QuestionCircleOutlined className="mk-form-tip" /> {item.label} </Tooltip> : item.label }> @@ -178,7 +188,7 @@ rules: [ { required: !!item.required, - message: this.props.dict['form.required.input'] + item.label + '!' + message: '璇疯緭鍏�' + item.label + '!' }, ...rules ] @@ -190,8 +200,8 @@ 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" /> + <Tooltip placement="topLeft" title={item.tooltip}> + <QuestionCircleOutlined className="mk-form-tip" /> {item.label} </Tooltip> : item.label }> @@ -200,7 +210,7 @@ rules: [ { required: !!item.required, - message: this.props.dict['form.required.input'] + item.label + '!' + message: '璇疯緭鍏�' + item.label + '!' } ] })(item.unlimit ? <InputNumber onPressEnter={this.handleSubmit}/> : @@ -217,7 +227,7 @@ rules: [ { required: !!item.required, - message: this.props.dict['form.required.select'] + item.label + '!' + message: '璇烽�夋嫨' + item.label + '!' } ] })( @@ -228,7 +238,7 @@ getPopupContainer={() => document.getElementById('columnwinter')} > {item.options.map((option, index) => - <Select.Option key={index} datatype={option.datatype || ''} value={(option.value || option.field || option.MenuID)}> + <Select.Option key={index} datatype={option.datatype || ''} label={option.label || ''} value={(option.value || option.field || option.MenuID)}> {(option.text || option.label || option.MenuName)} </Select.Option> )} @@ -241,8 +251,8 @@ 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" /> + <Tooltip placement="topLeft" title={item.tooltip}> + <QuestionCircleOutlined className="mk-form-tip" /> {item.label} </Tooltip> : item.label }> @@ -251,7 +261,7 @@ rules: [ { required: !!item.required, - message: this.props.dict['form.required.select'] + item.label + '!' + message: '璇烽�夋嫨' + item.label + '!' } ] })( @@ -297,7 +307,7 @@ rules: [ { required: !!item.required, - message: this.props.dict['form.required.select'] + item.label + '!' + message: '璇烽�夋嫨' + item.label + '!' } ] })( @@ -310,12 +320,12 @@ </Form.Item> </Col> ) - } else if (item.type === 'textarea') { // 鏂囨湰鎼滅储 + } 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}> - <Icon type="question-circle" /> + <QuestionCircleOutlined className="mk-form-tip" /> {item.label} </Tooltip> : item.label }> @@ -324,10 +334,10 @@ rules: [ { required: !!item.required, - message: this.props.dict['form.required.input'] + item.label + '!' + message: '璇疯緭鍏�' + item.label + '!' } ] - })(<TextArea rows={2} disabled={item.readonly} onPressEnter={this.handleSubmit} />)} + })(<TextArea rows={2} disabled={item.readonly} placeholder={item.placeholder || ''}/>)} </Form.Item> </Col> ) @@ -370,7 +380,7 @@ <Modal title="鏄剧ず鍒楃紪杈�" visible={visible} - width={800} + width={850} maskClosable={false} onOk={this.handleSubmit} onCancel={this.editModalCancel} @@ -385,4 +395,4 @@ } } -export default Form.create()(MainSearch) \ No newline at end of file +export default Form.create()(NormalTableColumn) \ No newline at end of file -- Gitblit v1.8.0