Commit 294531f6 authored by XieZhiXiong's avatar XieZhiXiong

fix: 过滤掉取消勾选的数据

parent 700178c7
......@@ -544,7 +544,8 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
};
value.push(atom);
});
const concated = [...value, ...preValues];
// 先过滤掉 value 中没有,preValues 中有的数据
const concated = [...value, ...preValues.filter(item => value.find(val => val.extraData.id === item.extraData.id))];
const newData = concated.filter((item, index) => findLastIndex(concated, val => val.extraData.id === item.extraData.id) === index);
if (preValues.length) {
newData.reverse();
......
......@@ -364,7 +364,8 @@ const RepairForm: React.FC<BillsFormProps> = ({
};
value.push(atom);
});
const concated = [...value, ...preValues];
// 先过滤掉 value 中没有,preValues 中有的数据
const concated = [...value, ...preValues.filter(item => value.find(val => val.extraData.id === item.extraData.id))];
const newData = concated.filter((item, index) => findLastIndex(concated, val => val.extraData.id === item.extraData.id) === index);
if (preValues.length) {
newData.reverse();
......
......@@ -550,7 +550,8 @@ const ReturnForm: React.FC<BillsFormProps> = ({
};
value.push(atom);
});
const concated = [...value, ...preValues];
// 先过滤掉 value 中没有,preValues 中有的数据
const concated = [...value, ...preValues.filter(item => value.find(val => val.extraData.id === item.extraData.id))];
const newData = concated.filter((item, index) => findLastIndex(concated, val => val.extraData.id === item.extraData.id) === index);
if (preValues.length) {
newData.reverse();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment