调差单条保存的优化

This commit is contained in:
黎永顺 2022-12-29 16:40:53 +08:00
parent 992bba159d
commit c7b28eb2e2
1 changed files with 16 additions and 5 deletions

View File

@ -276,7 +276,14 @@ class AdjustTable extends Component {
);
};
handleChangeCom = (dataSource) => {
this.setState({ dataSource });
this.setState({
dataSource: _.map(dataSource, (item, index) => {
return {
...item,
uuid: new Date().getTime() + index
};
})
});
};
handleChangeTableItem = (filedItemkey, value, index) => {
const { dataSource, targetOptions } = this.state;
@ -335,11 +342,15 @@ class AdjustTable extends Component {
if (status) {
message.success(data || "撤回成功");
this.setState({
dataSource: _.map(this.state.dataSource, it => {
dataSource: _.map(this.state.dataSource, (it, idx) => {
if (id === it.id) {
return { ...it, status: false };
return {
...it,
status: false,
uuid: new Date().getTime() + idx
};
}
return { ...it };
return { ...it, uuid: new Date().getTime() + idx };
})
});
} else {
@ -393,7 +404,7 @@ class AdjustTable extends Component {
if (_.isEmpty(errorMessage)) {
this.setState({
dataSource: _.map(this.state.dataSource, it => {
if (record.target === it.target) {
if (record.target === it.target && record.uuid === it.uuid) {
return { ...it, status: true, id: successIds[0] };
}
return { ...it };