| | |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { DndProvider, DragSource, DropTarget } from 'react-dnd' |
| | | import { Table, Popover, Icon, Modal, message } from 'antd' |
| | | import { Table, Popover, Icon, Modal, message, Button } from 'antd' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import asyncIconComponent from '@/utils/asyncIconComponent' |
| | |
| | | |
| | | const { confirm } = Modal |
| | | const EditColumn = asyncComponent(() => import('./editColumn')) |
| | | const TableVerify = asyncComponent(() => import('./tableIn')) |
| | | const MarkColumn = asyncIconComponent(() => import('@/menu/components/share/markcomponent')) |
| | | const CardCellComponent = asyncComponent(() => import('@/menu/components/card/cardcellcomponent')) |
| | | |
| | |
| | | |
| | | return !is(fromJS(this.state), fromJS(nextState)) || |
| | | !is(fromJS(config.wrap), fromJS(nextProps.config.wrap)) || |
| | | !is(fromJS(config.submit), fromJS(nextProps.config.submit)) || |
| | | !is(fromJS(config.search), fromJS(nextProps.config.search)) || |
| | | !is(fromJS(config.action), fromJS(nextProps.config.action)) || |
| | | config.setting.laypage !== nextProps.config.setting.laypage |
| | |
| | | |
| | | submitCol = (col) => { |
| | | const { card } = this.state |
| | | |
| | | col.uuid = card.uuid |
| | | col.isSub = card.isSub === true |
| | | col.marks = card.marks || [] |
| | | |
| | | if (col.type === 'custom') { |
| | | col.elements = card.type === 'custom' ? (card.elements || []) : [] |
| | |
| | | }) |
| | | } |
| | | |
| | | verifySubmit = () => { |
| | | const { config } = this.props |
| | | |
| | | this.verifyRef.handleConfirm().then(res => { |
| | | this.setState({ |
| | | visible: false |
| | | }, () => { |
| | | this.props.updatecolumn({...config, submit: res}) |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('submitStyle', this.getStyle) |
| | | } |
| | |
| | | |
| | | render() { |
| | | const { config } = this.props |
| | | const { fields, card, lineMarks, dict, tableId } = this.state |
| | | const { fields, card, lineMarks, dict, tableId, visible } = this.state |
| | | const components = { |
| | | header: { |
| | | cell: DragableHeaderCol |
| | |
| | | return ( |
| | | <div className={`edit-table-columns ${config.setting.laypage} ${config.wrap.mode || ''}`} id={tableId}> |
| | | <div className="col-control"> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <Icon className="edit" title="编辑" type="edit" onClick={() => this.setState({visible: true})} /> |
| | | </div> |
| | | } trigger="hover"> |
| | | <Button style={{height: '24px', marginRight: '10px', backgroundColor: '#1890ff'}} onDoubleClick={() => this.setState({visible: true})} type="primary">提交</Button> |
| | | </Popover> |
| | | <Icon title="复制显示列" type="copy" onClick={this.copycolumn} /> |
| | | <MarkColumn columns={fields} type="line" marks={lineMarks} onSubmit={this.updateLineMarks} /> |
| | | <Icon title="同步字段集" type="file-sync" onClick={this.syncfield} /> |
| | |
| | | /> |
| | | </DndProvider> |
| | | <EditColumn column={card} dict={dict} columns={this.state.columns} fields={fields} submitCol={this.submitCol} cancelCol={this.cancelCol}/> |
| | | <Modal |
| | | wrapClassName="model-table-action-verify-modal" |
| | | title={'编辑'} |
| | | visible={visible} |
| | | width={'75vw'} |
| | | maskClosable={false} |
| | | onOk={this.verifySubmit} |
| | | onCancel={() => { this.setState({ visible: false }) }} |
| | | destroyOnClose |
| | | > |
| | | <TableVerify |
| | | card={config.submit} |
| | | dict={dict} |
| | | cols={config.cols} |
| | | columns={config.columns} |
| | | wrappedComponentRef={(inst) => this.verifyRef = inst} |
| | | /> |
| | | </Modal> |
| | | </div> |
| | | ) |
| | | } |