king
2023-07-02 8bc1c1f8cf628efb149f0331ddd491b4c000009d
src/tabviews/zshare/mutilform/mkSwitch/index.jsx
@@ -2,6 +2,8 @@
import PropTypes from 'prop-types'
import { Switch } from 'antd'
import MKEmitter from '@/utils/events.js'
class MKSwitch extends Component {
  static propTpyes = {
    config: PropTypes.object,
@@ -15,10 +17,21 @@
  onChange = (val) => {
    const { config } = this.props
    
    let other = {}
    if (config.subFields) {
      let _val = val ? config.openText : config.closeText
      config.subFields.forEach((n, i) => {
        other[n.field] = _val || ''
        setTimeout(() => {
          MKEmitter.emit('mkFC', 'input', n.uuid, _val || '')
        }, i * 5)
      })
    }
    if (val) {
      this.props.onChange(config.openVal)
      this.props.onChange(config.openVal, other)
    } else {
      this.props.onChange(config.closeVal)
      this.props.onChange(config.closeVal, other)
    }
  }