| | |
| | | import PasteForm from '@/templates/zshare/pasteform' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import CusSwitch from './cusSwitch' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import './index.scss' |
| | | |
| | | const MkEditIcon = asyncComponent(() => import('@/components/mkIcon')) |
| | | let eTDict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | const EditableContext = React.createContext() |
| | | const { confirm } = Modal |
| | | let dragingIndex = -1 |
| | |
| | | rules: [ |
| | | { |
| | | required: required, |
| | | message: ['number', 'text', 'input'].includes(inputType) ? `${eTDict['form.required.input']} ${title}!` : `${eTDict['form.required.select']} ${title}!`, |
| | | message: ['number', 'text', 'input'].includes(inputType) ? `请输入${title}!` : `请选择${title}!`, |
| | | }, |
| | | ...rules |
| | | ], |
| | |
| | | |
| | | operation = { |
| | | title: (<div> |
| | | {eTDict['model.operation']} |
| | | 操作 |
| | | <span className="copy-control"> |
| | | {actions.includes('copy') ? <CopyOutlined title="复制" onClick={() => this.copy()} /> : null} |
| | | {actions.includes('copy') ? <SnippetsOutlined title="粘贴" onClick={this.paste} /> : null} |
| | |
| | | <EditableContext.Consumer> |
| | | {form => ( |
| | | <span onClick={() => this.save(form, record.uuid)} style={{ marginRight: 8 , color: '#1890ff', cursor: 'pointer'}}> |
| | | {eTDict['model.save']} |
| | | 保存 |
| | | </span> |
| | | )} |
| | | </EditableContext.Consumer> |
| | | <span style={{ color: '#1890ff', cursor: 'pointer'}} onClick={() => this.cancel(record.uuid)}>{eTDict['model.cancel']}</span> |
| | | <span style={{ color: '#1890ff', cursor: 'pointer'}} onClick={() => this.cancel(record.uuid)}>取消</span> |
| | | </div> |
| | | ) : ( |
| | | <div className={'edit-operation-btn' + (editingKey !== '' ? ' disabled' : '')} style={{minWidth: '110px', whiteSpace: 'nowrap'}}> |
| | |
| | | {actions.includes('status') ? <span className="status" onClick={() => {editingKey === '' && this.handleStatus(record)}}><SwapOutlined /></span> : null} |
| | | {actions.includes('del') && editingKey === '' ? <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={eTDict['model.query.delete']} |
| | | title="确定删除吗?" |
| | | onConfirm={() => this.handleDelete(record.uuid) |
| | | }> |
| | | <span className="danger"><DeleteOutlined /></span> |
| | |
| | | uuid: Utils.getuuid() |
| | | }) |
| | | } |
| | | |
| | | }) |
| | | } else if (res.key !== type) { |
| | | message.warning('配置信息格式错误!') |
| | |
| | | </DndProvider> |
| | | {/* 信息粘贴 */} |
| | | <Modal |
| | | title={eTDict['header.form.paste']} |
| | | title="粘贴" |
| | | visible={this.state.visible} |
| | | width={600} |
| | | maskClosable={false} |
| | |
| | | onCancel={() => {this.setState({visible: false})}} |
| | | destroyOnClose |
| | | > |
| | | <PasteForm dict={eTDict} wrappedComponentRef={(inst) => this.pasteFormRef = inst} inputSubmit={this.pasteSubmit}/> |
| | | <PasteForm wrappedComponentRef={(inst) => this.pasteFormRef = inst} inputSubmit={this.pasteSubmit}/> |
| | | </Modal> |
| | | </div> |
| | | </EditableContext.Provider> |