king
2022-10-28 aa41be24e83653077d85860cb70882551912af24
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
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
// import { Modal, Button, notification } from 'antd'
import { Modal, Button } from 'antd'
import { ArrowUpOutlined } from '@ant-design/icons'
// import moment from 'moment'
 
// import Api from '@/api'
// import Utils from '@/utils/utils.js'
import './index.scss'
 
const { confirm } = Modal
 
class UpdateTable extends Component {
  static propTpyes = {
    config: PropTypes.object
  }
 
  state = {}
 
  shouldComponentUpdate (nextProps, nextState) {
    return !is(fromJS(this.state), fromJS(nextState))
  }
 
  trigger = () => {
    const _this = this
    confirm({
      title: '确定升级当前菜单吗?',
      content: '',
      onOk() {
        return new Promise(resolve => {
          _this.execUpdate(resolve)
        })
      },
      onCancel() {}
    })
  }
 
  execUpdate = (_resolve) => {
    // const { config } = this.props
    setTimeout(() => {
      _resolve()
    }, 5000)
  }
 
  render() {
    return (
      <div style={{display: 'inline-block'}}>
        <Button className="mk-border-purple" onClick={this.trigger}><ArrowUpOutlined /> 升级</Button>
      </div>
    )
  }
}
 
export default UpdateTable