| | |
| | | fields.forEach(item => { |
| | | if (item.type !== 'text' && item.type !== 'number') return |
| | | |
| | | resets.push({ |
| | | value: item.field, |
| | | text: item.label |
| | | }) |
| | | if (item.label !== item.field) { |
| | | resets.push({ |
| | | value: item.field, |
| | | text: item.label + ' (' + item.field + ')' |
| | | }) |
| | | } else { |
| | | resets.push({ |
| | | value: item.field, |
| | | text: item.label |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | return [ |
| | |
| | | |
| | | let _group = _config.subcards[0] |
| | | |
| | | if (_config.wrap.refocus) { |
| | | _group.setting.refocus = _config.wrap.refocus |
| | | } |
| | | |
| | | if (_group.subButton.enable === 'false' && (!_group.closeButton || _group.closeButton.enable !== 'true') && (!_group.resetButton || _group.resetButton.enable !== 'true')) { |
| | | _group.subButton.style.display = 'none' |
| | | _group.$button = 'no-button' |
| | |
| | | |
| | | /** |
| | | * @description 按钮执行完成后页面刷新 |
| | | * @param {*} menuId // 菜单Id |
| | | * @param {*} position // 刷新位置 |
| | | * @param {*} btn // 执行的按钮 |
| | | */ |
| | | refreshByButtonResult = (menuId, position, btn, id) => { |
| | | refreshByButtonResult = (menuId, position, btn, id, lines, res) => { |
| | | const { config, group, BID } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | if (position === 'resetData') { |
| | | let _data = fromJS(this.state.data || {}).toJS() |
| | | |
| | | Object.keys(_data).forEach(key => { |
| | | let _key = key.toLowerCase() |
| | | if (typeof(res[_key]) !== 'undefined') { |
| | | _data[key] = res[_key] |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | data: _data |
| | | }) |
| | | return |
| | | } |
| | | if (position === 'grid' && config.wrap.refocus) { |
| | | let _group = fromJS(group).toJS() |
| | | _group.setting.focus = config.wrap.refocus |
| | |
| | | const { autoMatic } = this.state |
| | | |
| | | if (btn.resetForms) { |
| | | MKEmitter.emit('resetForms', btn.uuid) |
| | | let data = {} |
| | | |
| | | Object.keys(res).forEach(key => { |
| | | data[key.toLowerCase()] = res[key] |
| | | }) |
| | | |
| | | delete data.errcode |
| | | delete data.errmesg |
| | | delete data.message |
| | | delete data.status |
| | | |
| | | MKEmitter.emit('resetForms', btn.uuid, data) |
| | | MKEmitter.emit('refreshByButtonResult', btn.$menuId, 'resetData', btn, null, null, data) |
| | | } |
| | | |
| | | if (this.preCallback) { |
| | |
| | | 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) |
| | | } |
| | | } |
| | | |