From da64ab0923bf8817fc8599a6e37b953ce38f64c8 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 27 八月 2023 18:37:36 +0800 Subject: [PATCH] 2023-08-27 --- src/tabviews/zshare/mutilform/mkCheckCard/index.jsx | 26 +++++++++++++++++++++++++- 1 files changed, 25 insertions(+), 1 deletions(-) diff --git a/src/tabviews/zshare/mutilform/mkCheckCard/index.jsx b/src/tabviews/zshare/mutilform/mkCheckCard/index.jsx index 9d9cb2c..a7dc070 100644 --- a/src/tabviews/zshare/mutilform/mkCheckCard/index.jsx +++ b/src/tabviews/zshare/mutilform/mkCheckCard/index.jsx @@ -1,7 +1,7 @@ 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' @@ -281,6 +281,29 @@ } } + 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 @@ -295,6 +318,7 @@ 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> ) -- Gitblit v1.8.0