|
@@ -1531,11 +1531,18 @@ function getValuedLabels(arr){
|
|
|
|
|
|
//对象数组去重
|
|
|
function removeRepeat(arr1,arr2){ //arr1被完全保留的数组
|
|
|
- const arr = arr2.reduce(function(newArr,item){
|
|
|
+ const arr = arr2.reduce(function(newArr,item,inx){
|
|
|
const it = newArr.findIndex((i)=>i.id===item.id);
|
|
|
+ const firstInx = arr2.findIndex((i)=>i.id===item.id);
|
|
|
//旧体征标签比新体征标签多出的标签,已填值的保留,未填值的舍弃
|
|
|
if(it!==-1){
|
|
|
- newArr.splice(it,1,item);
|
|
|
+ //多个相同标签,保留已填值的
|
|
|
+ if(firstInx!==inx&&(item.value!==undefined||(item.tagType=='3'&&item.questionMapping.findIndex((i)=>i.value!==undefined)!==-1))){ //重复的已填值标签
|
|
|
+ newArr.splice(inx-firstInx+it,0,item);
|
|
|
+ }
|
|
|
+ if(firstInx===inx){
|
|
|
+ newArr.splice(it,1,item);
|
|
|
+ }
|
|
|
}else if(item.value!==undefined||(it.tagType=='3'&&it.questionMapping.findIndex((i)=>i.value!==undefined)!==-1)){
|
|
|
newArr.push(item);
|
|
|
}
|