| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Col, Row } from 'antd' |
| | | import { Col, Row, Switch } from 'antd' |
| | | import { CheckOutlined } from '@ant-design/icons' |
| | | |
| | | import MKEmitter from '@/utils/events.js' |
| | |
| | | } |
| | | } |
| | | |
| | | onChange = (val) => { |
| | | if (val) { |
| | | let keys = [] |
| | | this.state.options.forEach(item => { |
| | | if (item.$disabled) return |
| | | |
| | | keys.push(item.$value) |
| | | }) |
| | | |
| | | this.setState({ |
| | | selectKeys: keys |
| | | }, () => { |
| | | this.props.onChange(keys.join(',')) |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | selectKeys: [] |
| | | }, () => { |
| | | this.props.onChange('') |
| | | }) |
| | | } |
| | | } |
| | | |
| | | render() { |
| | | const { config, options } = this.state |
| | | |
| | |
| | | |
| | | return ( |
| | | <div className={'check-card-form-box ' + extend}> |
| | | {config.checkAll === 'show' && options.length > 3 ? <Switch size="small" onChange={this.onChange}/> : null} |
| | | <Row gutter={12}>{this.getCards()}</Row> |
| | | </div> |
| | | ) |