| | |
| | | componentDidMount () { |
| | | const { config } = this.state |
| | | |
| | | if (config.multiple !== 'true' && config.linkField) { |
| | | if (config.linkField) { |
| | | MKEmitter.addListener('mkFP', this.mkFormHandle) |
| | | } |
| | | } |
| | |
| | | const { config } = this.state |
| | | |
| | | let options = config.oriOptions.filter(option => option.ParentID === parentId) |
| | | let _option = options[0] && !options[0].$disabled ? options[0] : null |
| | | let val = _option ? _option.$value : '' |
| | | |
| | | this.setState({ |
| | | options, |
| | | value: val |
| | | }) |
| | | |
| | | let other = {} |
| | | |
| | | if (config.subFields && _option) { |
| | | config.subFields.forEach((n, i) => { |
| | | other[n.field] = _option[n.field] |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkFC', 'input', n.uuid, _option[n.field]) |
| | | }, i * 5) |
| | | if (config.multiple === 'true') { |
| | | this.setState({ |
| | | options, |
| | | selectKeys: [] |
| | | }) |
| | | } |
| | | this.props.onChange('') |
| | | } else { |
| | | let _option = options[0] && !options[0].$disabled ? options[0] : null |
| | | let val = _option ? _option.$value : '' |
| | | |
| | | this.props.onChange(val, other) |
| | | |
| | | if (level < 7 && config.linkFields) { |
| | | config.linkFields.forEach((m, i) => { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkFP', m.uuid, val, level + 1) |
| | | }, (i + 1) * 70) |
| | | this.setState({ |
| | | options, |
| | | selectKeys: val |
| | | }) |
| | | |
| | | let other = {} |
| | | |
| | | if (config.subFields && _option) { |
| | | config.subFields.forEach((n, i) => { |
| | | other[n.field] = _option[n.field] |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkFC', 'input', n.uuid, _option[n.field]) |
| | | }, i * 5) |
| | | }) |
| | | } |
| | | |
| | | this.props.onChange(val, other) |
| | | |
| | | if (level < 7 && config.linkFields) { |
| | | config.linkFields.forEach((m, i) => { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkFP', m.uuid, val, level + 1) |
| | | }, (i + 1) * 70) |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |