From 46f79b491173d284a4900d19e7aecf7509481438 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 21 一月 2022 17:21:25 +0800 Subject: [PATCH] 2022-01-21 --- src/templates/zshare/editTable/index.jsx | 39 +++++++++++++++++++++------------------ 1 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/templates/zshare/editTable/index.jsx b/src/templates/zshare/editTable/index.jsx index 14c3554..347b021 100644 --- a/src/templates/zshare/editTable/index.jsx +++ b/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 -- Gitblit v1.8.0