|
@@ -352,26 +352,55 @@
|
|
|
let maxCount = 100;//落点数超过这个数的资源不落点
|
|
|
let list = res.data;
|
|
|
let counts = [];
|
|
|
+ let points = [];
|
|
|
let types = [];
|
|
|
- for(let i = 0; i < list.length; i++){
|
|
|
+ for(let i = 0; i < list.length; i++){//获取符合要求的类型及数量
|
|
|
if(list[i].num <= maxCount){
|
|
|
counts.push(list[i].num);
|
|
|
+ points.push({
|
|
|
+ "type": list[i].type,
|
|
|
+ "count": list[i].num
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
- for(let i = 0; i < list.length; i++){
|
|
|
- if(list[i].num == Math.max(...counts)){
|
|
|
- types.push(list[i].type);
|
|
|
- let tail = counts.splice(i+1, counts.length);
|
|
|
- counts = counts.splice(0, i);
|
|
|
- counts.push(tail);
|
|
|
+ // alert(counts)//5,1,2,2,3,3,24,17,3
|
|
|
+ for(let i = 0; i < points.length; i++){
|
|
|
+ if(points[i].count == Math.max(...counts)){
|
|
|
+ // alert(points[i].count +"==Math.max(...counts)==" + Math.max(...counts))
|
|
|
+ types.push(points[i].type);
|
|
|
+ let countsTemp = [];
|
|
|
+ let pointsTemp = [];
|
|
|
+ for (let j = 0; j < counts.length; j++) {
|
|
|
+ // alert("aaa="+counts[j] +"=="+ Math.max(...counts))
|
|
|
+ if(counts[j] != Math.max(...counts)){
|
|
|
+ countsTemp.push(counts[j]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // for (let j = 0; j < points.length && points[i].count != counts[j]; j++) {
|
|
|
+ // pointsTemp.push({
|
|
|
+ // "type": list[i].type,
|
|
|
+ // "count": list[i].num
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // alert(countsTemp)//5,1,2,2,3,3,24,17,3
|
|
|
+ // alert(pointsTemp)
|
|
|
+ // return
|
|
|
+ counts = countsTemp;
|
|
|
+ // points = pointsTemp;
|
|
|
+ // let tail = counts.splice(i+1, counts.length);
|
|
|
+ // counts = counts.splice(0, i);
|
|
|
+ // counts.push(tail);
|
|
|
+ // alert(Math.max(...countsTemp)+"max")
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
- for(let i = 0; i < list.length; i++){
|
|
|
- if(list[i].num == Math.max(...counts)){
|
|
|
- types.push(list[i].type);
|
|
|
+ for(let i = 0; i < points.length; i++){
|
|
|
+ // alert(points[i].count +"=="+ Math.max(...counts))
|
|
|
+ if(points[i].count == Math.max(...counts)){
|
|
|
+ types.push(points[i].type);
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
- // alert(Math.max(...counts))
|
|
|
for(let i = 0; i < types.length; i++){
|
|
|
// console.log("if(i < 5){types[i]=", types[i])
|
|
|
that.indentleftSetMarkers(types[i], '所有');
|