import React, {Component} from 'react'
|
import { Button, Modal } from 'antd'
|
|
import './index.scss'
|
|
class LoadFromTemp extends Component {
|
state = {
|
visible: false,
|
tempId: '',
|
}
|
|
submit = () => {
|
const { name, typeChar, typeName } = this.state
|
|
this.setState({visible: false})
|
this.props.onChange(name, typeChar, typeName)
|
}
|
|
trigger = () => {
|
this.setState({visible: true, tempId: ''})
|
}
|
|
render() {
|
const { tempTypes } = this.props
|
const { visible, tempId } = this.state
|
|
return (
|
<>
|
<Button onClick={() => this.trigger()}>从模板中加载</Button>
|
<Modal
|
title="从模板中加载"
|
wrapClassName="mk-temp-list-wrap"
|
visible={visible}
|
width={600}
|
maskClosable={false}
|
onOk={this.submit}
|
onCancel={() => { this.setState({ visible: false })}}
|
destroyOnClose
|
>
|
{visible ? <div className="document-wrap">
|
<div className="document-title">
|
<div className="folder-box">文件夹</div>
|
<div className="folder">
|
<span>文件</span>
|
</div>
|
</div>
|
<div className="document-body">
|
<div className="file-wrap">
|
{tempTypes.map(doc => {
|
return <div className="file-item" key={doc.id}>
|
<span onClick={() => this.checkItem(doc.id)} className={'square-select' + (tempId === doc.id ? ' active' : '')}></span>
|
<span className="file-name">{doc.attachments_title}</span>
|
</div>
|
})}
|
</div>
|
</div>
|
</div> : null}
|
</Modal>
|
</>
|
)
|
}
|
}
|
|
export default LoadFromTemp
|