king
2022-11-21 f6626b05f1275cc2f8ca77f773d4f6a6af1b0a89
src/menu/components/table/edit-table/columns/index.jsx
@@ -59,8 +59,14 @@
      </th>
    )
    let style = {cursor: 'move', textAlign: align}
    if (column.Width) {
      style.width = column.Width
      style.minWidth = column.Width
    }
    return connectDragSource(
      connectDropTarget(<th {...restProps} index={index} style={{ cursor: 'move', textAlign: align }} onDoubleClick={() => this.props.editColumn(column)}>
      connectDropTarget(<th {...restProps} index={index} style={style} onDoubleClick={() => this.props.editColumn(column)}>
        <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
          <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}>
            {['custom', 'action'].includes(column.type) ?
@@ -136,13 +142,13 @@
    if (column && column.type === 'custom') {
      return (
        <td style={{padding: 0, minWidth: column.Width || 100, ...(column.style || {})}} className={className}>
        <td style={{padding: 0, ...(column.style || {})}} className={className}>
          <CardCellComponent cards={config} cardCell={column} elements={column.elements} updateElement={this.updateCard}/>
        </td>
      )
    } else if (column && column.type === 'action') {
      return (
        <td style={{padding: '0 5px', textAlign: column.Align, minWidth: column.Width || 100}} className={'action-column ' + className}>
        <td style={{padding: '0 5px', textAlign: column.Align}} className={'action-column ' + className}>
          <CardCellComponent cards={config} cardCell={column} elements={column.elements} updateElement={this.updateCard}/>
        </td>
      )
@@ -158,7 +164,7 @@
        }
      }
      return (
        <td style={{...style, minWidth: column.Width || 100}} className={className}>
        <td style={style} className={className}>
          {column.field ? <Paragraph className="col-copy" copyable={{ text: column.field }}>{val}</Paragraph> : val}
          {column.marks && column.marks.length ? <AntDesignOutlined className="profile"/> : null}
          {column.Hide === 'true' ? <CloseCircleOutlined className="close-col"/> : null}
@@ -181,7 +187,6 @@
  }
  state = {
    appType: sessionStorage.getItem('appType'),
    tableId: '',
    data: [{uuid: Utils.getuuid()}],
    refresh: false,    // 强制刷新
@@ -262,11 +267,16 @@
    let _columns = fromJS(this.state.columns).toJS()
    let type = item.subType
    if (item.subType === 'link' || item.subType === 'colspan' || item.subType === 'picture') {
    if (!['text', 'number', 'textarea', 'custom', 'action', 'formula', 'index'].includes(item.subType)) {
      type = 'text'
    }
    let col = { focus: true, uuid: Utils.getuuid(), label: 'label', field: '', type: type, elements: [] }
    if (col.type === 'action') {
      col.label = '操作'
    } else if (col.type === 'index') {
      col.label = '序号'
    }
    _columns.splice(hoverIndex, 0, col)
@@ -292,6 +302,10 @@
      let config = {...this.props.config, cols: _columns}
      if (btn) {
        config.action = config.action.filter(item => item.uuid !== btn.uuid)
        setTimeout(() => {
          MKEmitter.emit('revert', config.uuid)
        }, 200)
      }
      this.props.updatecolumn(config)
@@ -395,7 +409,6 @@
  }
  deleteCol = (col) => {
    const { appType } = this.state
    let _columns = fromJS(this.state.columns).toJS()
    _columns = _columns.filter(column => column.uuid !== col.uuid)
@@ -405,19 +418,6 @@
    }, () => {
      this.props.updatecolumn({...this.props.config, cols: _columns})
    })
    if (col.type !== 'action' || appType === 'mob') return
    let uuids = []
    col.elements && col.elements.forEach(c => {
      if (appType === 'pc' && c.OpenType !== 'popview') return
      uuids.push(c.uuid)
    })
    if (uuids.length === 0) return
    MKEmitter.emit('delButtons', uuids)
  }
  updateLineMarks = (vals) => {
@@ -611,7 +611,6 @@
          <Table
            rowKey="uuid"
            size={config.wrap.size || 'middle'}
            rowClassName="editable-row"
            bordered={config.wrap.bordered !== 'false'}
            rowSelection={rowSelection}
            components={components}