Explorar o código

数据中心temp

wangzhe %!s(int64=2) %!d(string=hai) anos
pai
achega
e3a497f990
Modificáronse 1 ficheiros con 33 adicións e 4 borrados
  1. 33 4
      src/views/datacenter.vue

+ 33 - 4
src/views/datacenter.vue

@@ -342,12 +342,41 @@
             let icon ='sj' + '-' + 'icon' + '-' + data.type.replaceAll("_", "-").replaceAll("@", "-");
             console.log("icon_" + (index + 1) + "=", icon);
             that.$set(that.resourcesList[index], 'icon', icon);
-            if(index < 5){
-              // that.fireControlViewPoint(data.type, 'undefined');
-              that.indentleftSetMarkers(data.type, '所有');
-            }
+            // if(index < 5){
+            //   // that.fireControlViewPoint(data.type, 'undefined');
+            //   that.indentleftSetMarkers(data.type, '所有');
+            // }
           })
 
+          //数据自动落点开始
+          let maxCount = 100;//落点数超过这个数的资源不落点
+          let list = res.data;
+          let counts = [];
+          let types = [];
+          for(let i = 0; i < list.length; i++){
+            if(list[i].num <= maxCount){
+              counts.push(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);
+            }
+          }
+          for(let i = 0; i < list.length; i++){
+            if(list[i].num == Math.max(...counts)){
+              types.push(list[i].type);
+            }
+          }
+          // 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], '所有');
+          }
+          //数据自动落点结束
         })
       },
       indentleftSetMarkers(resourceTable, name) {