| | |
| | | timer = null |
| | | focusId = '' |
| | | blurId = '' |
| | | colId = '' |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { setting, fields, columns, BID, colsCtrls } = this.props |
| | |
| | | }, 150) |
| | | } |
| | | |
| | | colFocus = (lineId) => { |
| | | colFocus = (lineId, colId) => { |
| | | this.focusId = lineId |
| | | this.colId = colId |
| | | } |
| | | |
| | | checkLine = () => { |
| | |
| | | } |
| | | |
| | | transferData = (data, type) => { |
| | | const { edData } = this.state |
| | | const { edData, tableId } = this.state |
| | | |
| | | if (type === 'line') { |
| | | if (type === 'delete') { |
| | | |
| | | } else if (type === 'line') { |
| | | let value = '' |
| | | Object.keys(data).sort().forEach(key => { |
| | | if (/^\$/.test(key)) return |
| | |
| | | }) |
| | | } |
| | | |
| | | if (type !== 'line') { |
| | | let index = edData.findIndex(item => !item.$origin && !item.$forbid) |
| | | if (type === 'delete') { |
| | | let _edData = this.state.edData.filter(item => item.$$uuid !== data) |
| | | |
| | | if (index > -1) { |
| | | this.setState({visible: true, midData: data}) |
| | | } else { |
| | | this.updateMutil(data) |
| | | this.setState({edData: _edData, reseting: true}, () => { |
| | | this.setState({reseting: false}) |
| | | |
| | | if (this.focusId) { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('setFocus' + tableId, this.focusId, this.colId) |
| | | }, 10) |
| | | } |
| | | }) |
| | | } else if (type === 'line') { |
| | | let _edData = this.state.edData.map(item => { |
| | | if (item.$$uuid === data.$$uuid) { |
| | |
| | | |
| | | this.setState({edData: _edData, reseting: true}, () => { |
| | | this.setState({reseting: false}) |
| | | |
| | | if (this.focusId) { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('setFocus' + tableId, this.focusId, this.colId) |
| | | }, 10) |
| | | } |
| | | }) |
| | | } else { |
| | | let index = edData.findIndex(item => !item.$origin && !item.$forbid) |
| | | |
| | | if (index > -1) { |
| | | this.setState({visible: true, midData: data}) |
| | | } else { |
| | | this.updateMutil(data) |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | setTimeout(() => { |
| | | this.plusLine(colId) |
| | | }, 10) |
| | | } else if (edData[index] && setting.commit !== 'change') { |
| | | } else if (edData[index] && (setting.commit === 'all' || setting.commit === 'amend')) { |
| | | setTimeout(() => { |
| | | this.submit() |
| | | }, 10) |
| | |
| | | |
| | | checkData = () => { |
| | | const { setting } = this.props |
| | | const { edData, forms, checkForms } = this.state |
| | | const { edData, forms, checkForms, selectedRowKeys } = this.state |
| | | |
| | | let data = fromJS(edData).toJS() |
| | | |
| | |
| | | |
| | | if (setting.commit === 'amend') { |
| | | data = data.filter(item => !item.$origin) |
| | | } else if (setting.commit === 'check') { |
| | | data = data.filter(item => selectedRowKeys.includes(item.$$uuid)) |
| | | |
| | | if (data.length === 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请选择需要提交的数据!', |
| | | duration: 5 |
| | | }) |
| | | return null |
| | | } |
| | | } |
| | | |
| | | if (data.length === 0) { |
| | |
| | | |
| | | Api.genericInterface(param).then((res) => { |
| | | if (res.status) { |
| | | this.execSuccess(res) |
| | | this.execSuccess(res, record) |
| | | } else { |
| | | this.execError(res) |
| | | this.execError(res, record) |
| | | } |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | |
| | | |
| | | Api.genericInterface(param).then((res) => { |
| | | if (res.status) { |
| | | this.execSuccess(res) |
| | | this.execSuccess(res, record) |
| | | } else { |
| | | this.execError(res) |
| | | this.execError(res, record) |
| | | } |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | |
| | | } |
| | | } |
| | | |
| | | execSuccess = (res) => { |
| | | execSuccess = (res, record) => { |
| | | const { submit } = this.props |
| | | const { edData } = this.state |
| | | |
| | |
| | | } |
| | | |
| | | if (submit.execSuccess !== 'never') { |
| | | MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execSuccess, submit) |
| | | MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execSuccess, submit, '', record ? [record] : null) |
| | | } |
| | | |
| | | submit.syncComponentId && MKEmitter.emit('reloadData', submit.syncComponentId) |
| | | } |
| | | |
| | | execError = (res) => { |
| | | execError = (res, record) => { |
| | | const { submit } = this.props |
| | | |
| | | if (res.ErrCode === 'E') { |
| | |
| | | }) |
| | | |
| | | if (submit.execError !== 'never') { |
| | | MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execError, submit) |
| | | MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execError, submit, '', record ? [record] : null) |
| | | } |
| | | } |
| | | |