|
|
|
@ -80,3 +80,20 @@ export function multiplyDecimals(a, b) { |
|
|
|
result = result.replace(/\.?0+$/, '') || '0' |
|
|
|
return (isNegative ? '-' : '') + result |
|
|
|
} |
|
|
|
|
|
|
|
//模板物资去重
|
|
|
|
export function uniqeResource(oldList,newList) { |
|
|
|
for(var i=0;i<newList.length;i++){ |
|
|
|
let _index= _.findIndex(oldList,function(item){ |
|
|
|
return item.bh==newList[i].bh&&(item.type==newList[i].type||item.elnType==newList[i].type) |
|
|
|
}) |
|
|
|
if(_index>-1){ |
|
|
|
const { total, unit }=addTj([oldList[_index].syl,newList[i].syl],[oldList[_index].syldw,newList[i].syldw]) |
|
|
|
oldList[_index].syl=total |
|
|
|
oldList[_index].syldw=unit |
|
|
|
}else{ |
|
|
|
oldList.push(newList[i]) |
|
|
|
} |
|
|
|
} |
|
|
|
return oldList; |
|
|
|
} |