| | |
| | | send_type: '', |
| | | timestamp: '', |
| | | n_id: '', |
| | | focusId: '' |
| | | focusId: '', |
| | | reFocusId: '' |
| | | } |
| | | |
| | | record = {} |
| | |
| | | focusItem = fieldMap.get(action.setting.focus) |
| | | } |
| | | |
| | | this.setState({ formlist, ID, focusId: focusItem ? focusItem.uuid : '' }, () => { |
| | | let reFocusItem = null |
| | | if (action.setting.refocus && fieldMap.has(action.setting.refocus)) { |
| | | reFocusItem = fieldMap.get(action.setting.refocus) |
| | | } |
| | | |
| | | this.setState({ |
| | | formlist, |
| | | ID, |
| | | focusId: focusItem ? focusItem.uuid : '', |
| | | reFocusId: reFocusItem ? reFocusItem.uuid : '' |
| | | }, () => { |
| | | if (unload) return |
| | | |
| | | if (focusItem) { |
| | | if (focusItem.type === 'text' || focusItem.type === 'number') { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkFC', 'focus', focusItem.uuid) |
| | | }, 50) |
| | | }, 20) |
| | | } else { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkFC', 'focus', focusItem.uuid) |
| | |
| | | MKEmitter.removeListener('resetForms', this.resetForms) |
| | | } |
| | | |
| | | resetForms = (id) => { |
| | | resetForms = (id, data) => { |
| | | const { action } = this.props |
| | | const { focusId } = this.state |
| | | const { focusId, reFocusId } = this.state |
| | | |
| | | if (id !== action.uuid) return |
| | | |
| | |
| | | if (item.type !== 'text' && item.type !== 'number') return item |
| | | |
| | | if (resetForms.includes(item.field)) { |
| | | item.initval = item.orgval |
| | | this.record[item.field] = item.orgval |
| | | let key = item.field.toLowerCase() |
| | | if (typeof(data[key]) !== 'undefined') { |
| | | item.initval = data[key] |
| | | this.record[item.field] = data[key] |
| | | } else { |
| | | item.initval = item.orgval |
| | | this.record[item.field] = item.orgval |
| | | } |
| | | } |
| | | |
| | | return item |
| | |
| | | }) |
| | | }) |
| | | |
| | | if (focusId || this.submitId) { |
| | | if (reFocusId || focusId || this.submitId) { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkFC', 'focus', this.submitId || focusId) |
| | | }, 50) |
| | | MKEmitter.emit('mkFC', 'focus', this.submitId || reFocusId || focusId) |
| | | }, 20) |
| | | } |
| | | } |
| | | |