import React, {Component} from 'react'
|
import PropTypes from 'prop-types'
|
import { is, fromJS } from 'immutable'
|
import { Button } from 'antd'
|
|
// import MKEmitter from '@/utils/events.js'
|
import './index.scss'
|
|
class AutoMatic extends Component {
|
static propTpyes = {
|
autoMatic: PropTypes.object,
|
config: PropTypes.object
|
}
|
|
state = {
|
running: false,
|
line: 0
|
}
|
|
shouldComponentUpdate (nextProps, nextState) {
|
return !is(fromJS(this.state), fromJS(nextState))
|
}
|
|
/**
|
* @description 组件销毁,清除state更新
|
*/
|
componentWillUnmount () {
|
this.setState = () => {
|
return
|
}
|
}
|
|
trigger = () => {
|
// const { config } = this.props
|
let running = !this.state.running
|
|
// MKEmitter.emit('autoQueryData', config.MenuID, 0)
|
|
this.setState({running: running})
|
}
|
|
render() {
|
const { running } = this.state
|
|
return (
|
<Button
|
icon={running ? 'pause' : 'forward'}
|
shape="circle"
|
className={'auto-matic ' + (window.GLOB.systemType === 'production' ? 'low' : '')}
|
onClick={this.trigger}
|
/>
|
)
|
}
|
}
|
|
export default AutoMatic
|