From 0eb129a9beddbb86ae74d7106a8e60823206b8d5 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 14 十二月 2023 11:29:15 +0800 Subject: [PATCH] 2023-12-14 --- src/tabviews/custom/components/table/edit-table/normalTable/index.jsx | 73 ++++++++++++++++++++++++++---------- 1 files changed, 53 insertions(+), 20 deletions(-) diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx index 4c039a7..9a9d454 100644 --- a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx @@ -1345,6 +1345,7 @@ timer = null focusId = '' blurId = '' + colId = '' UNSAFE_componentWillMount () { const { setting, fields, columns, BID, colsCtrls } = this.props @@ -1562,8 +1563,9 @@ }, 150) } - colFocus = (lineId) => { + colFocus = (lineId, colId) => { this.focusId = lineId + this.colId = colId } checkLine = () => { @@ -1705,9 +1707,11 @@ } 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 @@ -1725,14 +1729,18 @@ }) } - 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) { @@ -1744,7 +1752,21 @@ 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) + } } } @@ -1995,7 +2017,7 @@ 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) @@ -2136,7 +2158,7 @@ checkData = () => { const { setting } = this.props - const { edData, forms, checkForms } = this.state + const { edData, forms, checkForms, selectedRowKeys } = this.state let data = fromJS(edData).toJS() @@ -2144,6 +2166,17 @@ 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) { @@ -2298,9 +2331,9 @@ 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 @@ -2317,9 +2350,9 @@ 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 @@ -2329,7 +2362,7 @@ } } - execSuccess = (res) => { + execSuccess = (res, record) => { const { submit } = this.props const { edData } = this.state @@ -2379,13 +2412,13 @@ } 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') { @@ -2414,7 +2447,7 @@ }) if (submit.execError !== 'never') { - MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execError, submit) + MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execError, submit, '', record ? [record] : null) } } -- Gitblit v1.8.0