king
2021-10-10 8cdfdd9914d1c4f6cd59176d61869522f51f39e4
src/menu/components/table/edit-table/columns/index.jsx
@@ -2,7 +2,7 @@
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'
@@ -14,6 +14,7 @@
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'))
@@ -219,6 +220,7 @@
    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
@@ -294,10 +296,6 @@
  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 || []) : []
@@ -449,6 +447,18 @@
    })
  }
  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)
  }
@@ -465,7 +475,7 @@
  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
@@ -513,6 +523,13 @@
    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} />
@@ -539,6 +556,24 @@
          />
        </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>
    )
  }