| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Button, Modal, notification, message, Progress } from 'antd' |
| | | import { Button, Modal, notification, message } from 'antd' |
| | | import JSZip from 'jszip' |
| | | import { saveAs } from 'file-saver' |
| | | |
| | |
| | | import MKEmitter from '@/utils/events.js' |
| | | import MkIcon from '@/components/mk-icon' |
| | | |
| | | import './index.scss' |
| | | // import './index.scss' |
| | | |
| | | class FuncZip extends Component { |
| | | static propTpyes = { |
| | |
| | | state = { |
| | | loading: false, |
| | | disabled: false, |
| | | loadingNumber: '', |
| | | loadingTotal: '', |
| | | hidden: false, |
| | | visible: false |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | const { btn } = this.props |
| | | |
| | | this.setState({ |
| | | loading: false, |
| | | loadingNumber: '', |
| | | loadingTotal: '' |
| | | loading: false |
| | | }) |
| | | |
| | | if (btn.execSuccess !== 'never') { |
| | |
| | | const { btn } = this.props |
| | | |
| | | this.setState({ |
| | | loading: false, |
| | | loadingNumber: '', |
| | | loadingTotal: '' |
| | | loading: false |
| | | }) |
| | | |
| | | if (res.ErrCode === '01') { |
| | |
| | | |
| | | render() { |
| | | const { btn } = this.props |
| | | const { loading, disabled, hidden, loadingNumber, loadingTotal } = this.state |
| | | const { loading, disabled, hidden } = this.state |
| | | |
| | | if (hidden) return null |
| | | |
| | |
| | | className = 'mk-btn mk-' + btn.class |
| | | } |
| | | |
| | | if (loadingNumber && !loadingTotal && btn.$toolbtn && (!btn.show || btn.show === 'button')) { |
| | | label = (loadingNumber && !loadingTotal ? `(${loadingNumber})` : '') + btn.label |
| | | } |
| | | |
| | | return ( |
| | | <> |
| | | <Button |
| | |
| | | className={className} |
| | | onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} |
| | | >{label}</Button> |
| | | {loadingTotal ? <Progress className="mk-button-progress" percent={(loadingTotal - loadingNumber) / loadingTotal * 100} size="small" showInfo={false} /> : null} |
| | | </> |
| | | ) |
| | | } |