| | |
| | | if (action.subButton && action.subButton.resetForms) { |
| | | MKEmitter.addListener('resetForms', this.resetForms) |
| | | } |
| | | MKEmitter.addListener('resetFocus', this.resetFocus) |
| | | } |
| | | |
| | | componentWillUnmount () { |
| | |
| | | return |
| | | } |
| | | MKEmitter.removeListener('resetForms', this.resetForms) |
| | | MKEmitter.removeListener('resetFocus', this.resetFocus) |
| | | } |
| | | |
| | | resetFocus = (id, field) => { |
| | | const { action } = this.props |
| | | |
| | | if (id !== action.uuid) return |
| | | |
| | | let focusId = '' |
| | | |
| | | this.state.formlist.forEach(item => { |
| | | if (item.field === field) { |
| | | focusId = item.uuid |
| | | } |
| | | }) |
| | | |
| | | if (!focusId) return |
| | | |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkFC', 'focus', focusId) |
| | | }, 20) |
| | | } |
| | | |
| | | resetForms = (id, data) => { |