From c98e45bfac25e9110ad0383faac54a54d98ea9d5 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 18 十一月 2021 20:47:04 +0800 Subject: [PATCH] 2021-11-18 --- src/menu/components/table/normal-table/columns/editColumn/index.jsx | 64 ++++++++++++++------------------ 1 files changed, 28 insertions(+), 36 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 3a18837..6222466 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' @@ -17,10 +18,11 @@ 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, @@ -42,24 +44,13 @@ } editColumn = (column) => { - let menulist = sessionStorage.getItem('fstMenuList') - if (menulist) { - try { - menulist = JSON.parse(menulist) - } catch { - menulist = [] - } - } else { - menulist = [] - } - - let formlist = getColumnForm(column, menulist, this.props.fields) + let formlist = getColumnForm(column, this.props.fields) let _options = fromJS(columnTypeOptions[column.type]).toJS() if (column.type === 'text' || column.type === 'number') { if (column.perspective === 'linkmenu') { - _options.push('linkmenu', 'linkfields') + _options.push('linkmenu', 'linkfields', 'open') } else if (column.perspective === 'linkurl') { - _options.push('linkurl', 'linkfields') + _options.push('linkurl', 'linkfields', 'open') } } @@ -71,16 +62,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) => { @@ -112,7 +104,7 @@ } values.type = 'number' values.decimal = decimal - } else if (/nvarchar/ig.test(option.props.datatype)) { + } else { values.type = 'text' } @@ -143,9 +135,9 @@ let _options = fromJS(columnTypeOptions[this.state.type]).toJS() if (value === 'linkmenu') { - _options.push('linkmenu', 'linkfields') + _options.push('linkmenu', 'linkfields', 'open') } else if (value === 'linkurl') { - _options.push('linkurl', 'linkfields') + _options.push('linkurl', 'linkfields', 'open') } this.setState({ @@ -179,8 +171,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 }> @@ -201,8 +193,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 }> @@ -219,7 +211,7 @@ </Form.Item> </Col> ) - } else if (item.type === 'select') { // 涓嬫媺鎼滅储 + } else if (item.type === 'select') { fields.push( <Col span={12} key={index}> <Form.Item label={item.label}> @@ -239,8 +231,8 @@ getPopupContainer={() => document.getElementById('columnwinter')} > {item.options.map((option, index) => - <Select.Option key={`${option.value || option.field}${index}`} datatype={option.datatype || ''} value={option.value || option.field}> - {option.text || option.label} + <Select.Option key={index} datatype={option.datatype || ''} value={(option.value || option.field || option.MenuID)}> + {(option.text || option.label || option.MenuName)} </Select.Option> )} </Select> @@ -252,8 +244,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 }> @@ -326,7 +318,7 @@ <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 }> @@ -338,7 +330,7 @@ message: this.props.dict['form.required.input'] + item.label + '!' } ] - })(<TextArea rows={2} disabled={item.readonly} onPressEnter={this.handleSubmit} />)} + })(<TextArea rows={2} disabled={item.readonly} placeholder={item.placeholder || ''}/>)} </Form.Item> </Col> ) @@ -396,4 +388,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