| | |
| | | value = [] |
| | | } |
| | | } else if (value) { |
| | | let option = null |
| | | if (config.setAll === 'true') { |
| | | option= config.oriOptions[1] |
| | | } else { |
| | | option= config.oriOptions[0] |
| | | } |
| | | if (typeof(value) === 'string' && option && typeof(option.value) === 'number') { |
| | | value = +value |
| | | if (isNaN(value)) { |
| | | value = config.initval |
| | | let option = config.oriOptions[0] |
| | | |
| | | if (option && typeof(option.value) !== typeof(value)) { |
| | | if (typeof(option.value) === 'number' && !isNaN(value)) { |
| | | value = +value |
| | | } |
| | | } |
| | | } |
| | |
| | | options: fromJS(nextProps.config.options).toJS() |
| | | }) |
| | | |
| | | if (typeof(config.initval) === 'string' && config.initval.indexOf('$first') > -1) { |
| | | let option = nextProps.config.oriOptions[0] |
| | | if (config.$first) { |
| | | this.setState({ |
| | | value: nextProps.config.initval, |
| | | }) |
| | | } else { |
| | | let option = null |
| | | if (config.setAll === 'true') { |
| | | option= nextProps.config.oriOptions[1] |
| | | } else { |
| | | option= nextProps.config.oriOptions[0] |
| | | if (config.linkFields && nextProps.config.initval) { |
| | | config.linkFields.forEach((m, i) => { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkFP', m.uuid, nextProps.config.initval, 0) |
| | | }, (i + 1) * 70) |
| | | }) |
| | | } |
| | | if (option && typeof(option.value) === 'number') { |
| | | let val = +value |
| | | if (!isNaN(val)) { |
| | | this.setState({ |
| | | value: val |
| | | }) |
| | | } |
| | | } else if (option && typeof(option.value) !== typeof(value)) { |
| | | if (typeof(option.value) === 'number' && !isNaN(value)) { |
| | | this.setState({ |
| | | value: +value |
| | | }) |
| | | } |
| | | } |
| | | } |
| | |
| | | MKEmitter.removeListener('mkFC', this.mkFormFocus) |
| | | } |
| | | |
| | | mkFormFocus = (type, uuid) => { |
| | | mkFormFocus = (type, uuid, val, level) => { |
| | | if (uuid !== this.props.config.uuid) return |
| | | if (type !== 'focus') return |
| | | |
| | | let _div = document.getElementById(uuid) |
| | | _div && _div.click && _div.click() |
| | | if (type === 'focus') { |
| | | let _div = document.getElementById(uuid) |
| | | _div && _div.click && _div.click() |
| | | } else if (type === 'input' && (!level || level < 10)) { |
| | | let _level = level || 1 |
| | | this.selectChange(val, _level++) |
| | | } |
| | | } |
| | | |
| | | mkFormHandle = (uuid, parentId, level) => { |
| | |
| | | } |
| | | } |
| | | |
| | | selectChange = (val) => { |
| | | selectChange = (val, level) => { |
| | | const { config } = this.state |
| | | let other = {} |
| | | |
| | |
| | | option && config.subFields.forEach((n, i) => { |
| | | other[n.field] = option[n.field] |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkFC', 'input', n.uuid, option[n.field]) |
| | | MKEmitter.emit('mkFC', 'input', n.uuid, option[n.field], level) |
| | | }, i * 5) |
| | | }) |
| | | } |
| | |
| | | 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() |
| | | this.props.onSubmit(config.tabUuid, config.errTabUuid) |
| | | }, 1000) |
| | | } else { |
| | | this.props.onSubmit() |
| | | this.props.onSubmit(config.tabUuid, config.errTabUuid) |
| | | } |
| | | } |
| | | }) |
| | |
| | | value={value} |
| | | dropdownMatchSelectWidth={config.dropdown !== 'false'} |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | onSelect={this.selectChange} |
| | | onSelect={(val) => this.selectChange(val)} |
| | | onChange={(val) => val === undefined && this.selectChange('')} |
| | | disabled={config.readonly} |
| | | > |
| | |
| | | id={config.uuid} |
| | | mode="multiple" |
| | | defaultValue={value} |
| | | dropdownMatchSelectWidth={config.dropdown !== 'false'} |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | onChange={this.mutilselectChange} |
| | | disabled={config.readonly} |