From a1e9b18a4dbfd21e1bf4d5cb60974ac2f0115efd Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 30 五月 2025 15:18:44 +0800 Subject: [PATCH] 2025-05-30 --- src/tabviews/zshare/mutilform/mkSwitch/index.jsx | 36 ++++++++++++++++++++++++++++++++---- 1 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/tabviews/zshare/mutilform/mkSwitch/index.jsx b/src/tabviews/zshare/mutilform/mkSwitch/index.jsx index 0601054..ad7c009 100644 --- a/src/tabviews/zshare/mutilform/mkSwitch/index.jsx +++ b/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,11 +17,37 @@ onChange = (val) => { const { config } = this.props - if (val) { - this.props.onChange(config.openVal) - } else { - this.props.onChange(config.closeVal) + 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, other) + } else { + this.props.onChange(config.closeVal, other) + } + + this.setState({}, () => { + if (config.enter === 'tab') { + MKEmitter.emit('mkFC', 'focus', config.tabUuid) + } else if (config.enter === 'sub') { + config.tabUuid && MKEmitter.emit('mkFC', 'focus', config.tabUuid) + if (config.linkFields || config.subFields || config.controlFields) { + setTimeout(() => { + this.props.onSubmit(config.tabUuid, config.errTabUuid) + }, 1000) + } else { + this.props.onSubmit(config.tabUuid, config.errTabUuid) + } + } + }) } componentWillUnmount () { -- Gitblit v1.8.0