king
2022-01-21 46f79b491173d284a4900d19e7aecf7509481438
src/templates/zshare/editTable/index.jsx
@@ -2,7 +2,8 @@
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import { DndProvider, DragSource, DropTarget } from 'react-dnd'
import { Table, Input, InputNumber, Popconfirm, Form, Icon, Select, Radio, Cascader, notification, message, Modal, Typography } from 'antd'
import { Table, Input, InputNumber, Popconfirm, Form, Select, Radio, Cascader, notification, message, Modal, Typography } from 'antd'
import { CopyOutlined, EditOutlined, DeleteOutlined, SnippetsOutlined } from '@ant-design/icons'
import Utils from '@/utils/utils.js'
import ColorSketch from '@/mob/colorsketch'
@@ -13,7 +14,7 @@
import enUS from '@/locales/en-US/model.js'
import './index.scss'
const MkIcon = asyncComponent(() => import('@/components/mkIcon'))
const MkEditIcon = asyncComponent(() => import('@/components/mkIcon'))
let eTDict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS
const EditableContext = React.createContext()
const { confirm } = Modal
@@ -88,7 +89,7 @@
    } else if (inputType === 'color') {
      return <ColorSketch />
    } else if (inputType === 'icon') {
      return <MkIcon allowClear/>
      return <MkEditIcon allowClear/>
    } else if (inputType === 'switch') {
      return <CusSwitch />
    } else if (inputType === 'select') {
@@ -191,9 +192,9 @@
        title: (<div>
          {eTDict['model.operation']}
          <span className="copy-control">
            {actions.includes('copy') ? <Icon type="copy" title="复制" onClick={() => this.copy()} /> : null}
            {actions.includes('copy') ? <Icon type="snippets" title="粘贴" onClick={this.paste} /> : null}
            {actions.includes('clear') ? <Icon type="delete" title="清空" onClick={this.clear} /> : null}
            {actions.includes('copy') ? <CopyOutlined title="复制" onClick={() => this.copy()} /> : null}
            {actions.includes('copy') ? <SnippetsOutlined title="粘贴" onClick={this.paste} /> : null}
            {actions.includes('clear') ? <DeleteOutlined title="清空" onClick={this.clear} /> : null}
          </span>
        </div>),
        dataIndex: 'operation',
@@ -213,17 +214,17 @@
              <span style={{ color: '#1890ff', cursor: 'pointer'}} onClick={() => this.cancel(record.uuid)}>{eTDict['model.cancel']}</span>
            </div>
          ) : (
            <div className={'edit-operation-btn' + (editingKey !== '' ? ' disabled' : '')} style={{minWidth: '110px'}}>
              {actions.includes('edit') ? <span className="primary" onClick={() => {editingKey === '' && this.edit(record.uuid)}}><Icon type="edit" /></span> : null}
              {actions.includes('copy') ? <span className="copy" onClick={() => {editingKey === '' && this.copy(record)}}><Icon type="copy" /></span> : null}
            <div className={'edit-operation-btn' + (editingKey !== '' ? ' disabled' : '')} style={{minWidth: '110px', whiteSpace: 'nowrap'}}>
              {actions.includes('edit') ? <span className="primary" onClick={() => {editingKey === '' && this.edit(record.uuid)}}><EditOutlined /></span> : null}
              {actions.includes('copy') ? <span className="copy" onClick={() => {editingKey === '' && this.copy(record)}}><CopyOutlined /></span> : null}
              {actions.includes('del') && editingKey === '' ? <Popconfirm
                overlayClassName="popover-confirm"
                title={eTDict['model.query.delete']}
                onConfirm={() => this.handleDelete(record.uuid)
              }>
                <span className="danger"><Icon type="delete" /></span>
                <span className="danger"><DeleteOutlined /></span>
              </Popconfirm> : null}
              {actions.includes('del') && editingKey !== '' ? <span className="danger"><Icon type="delete" /></span> : null}
              {actions.includes('del') && editingKey !== '' ? <span className="danger"><DeleteOutlined /></span> : null}
            </div>
          )
        }
@@ -506,7 +507,7 @@
  }
  render() {
    const { actions } = this.props
    const { actions, indexShow } = this.props
    let components = {
      body: {
@@ -544,12 +545,14 @@
      }
    })
    columns.unshift({
      title: '序号',
      dataIndex: '$index',
      className: 'mk-index',
      width: '60px',
    })
    if (indexShow !== false) {
      columns.unshift({
        title: '序号',
        dataIndex: '$index',
        className: 'mk-index',
        width: '60px',
      })
    }
    const data = this.state.data.map((item, index) => {
      item.$index = index + 1