king
2023-02-14 3620d67cfd2f2af19ef4d656734badd4445c90b8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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