Ver código fonte

Merge remote-tracking branch 'origin/visu_traffic_01_siping_2.5d' into visu_traffic_01_siping_2.5d

彭宇 2 anos atrás
pai
commit
4af74e2ec4
1 arquivos alterados com 39 adições e 1 exclusões
  1. 39 1
      src/views/resources.vue

+ 39 - 1
src/views/resources.vue

@@ -179,13 +179,51 @@
             //   that.selectResourcesByLabel(data.type, '所有');
             // }
           })
+          //数据自动落点开始
+          let maxCount = 100;//落点数超过这个数的资源不落点
+          let list = res.data;
+          let counts = [];
+          let points = [];
+          let types = [];
+          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 < points.length; i++){
+            if(points[i].count == Math.max(...counts)){
+              types.push(points[i].type);
+              let countsTemp = [];
+              for (let j = 0; j < counts.length; j++) {
+                if(counts[j] != Math.max(...counts)){
+                  countsTemp.push(counts[j]);
+                }
+              }
+              counts = countsTemp;
+              break;
+            }
+          }
+          for(let i = 0; i < points.length; i++){
+            if(points[i].count == Math.max(...counts)){
+              types.push(points[i].type);
+              break;
+            }
+          }
+          for(let i = 0; i < types.length; i++){
+            that.selectResourcesByLabel(types[i], '所有');
+          }
+          //数据自动落点结束
         })
       },
       //初始化所有资源并落点
       selectResources(){
         selectResources(this.labelList).then(res => {
           this.resourcesList = res.data;
-          this.initMarkers(this.resourcesList);
+          // this.initMarkers(this.resourcesList);
         })
       },
       //点击左侧某资源,将该资源进行落点