| | |
| | | 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' |
| | |
| | | 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 |
| | |
| | | } 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') { |
| | |
| | | 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', |
| | |
| | | <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> |
| | | ) |
| | | } |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { actions } = this.props |
| | | const { actions, indexShow } = this.props |
| | | |
| | | let components = { |
| | | body: { |
| | |
| | | } |
| | | }) |
| | | |
| | | 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 |