Quellcode durchsuchen

feat: the DeviceGroupTree component supports grouping by resolution

Casper Dai vor 3 Jahren
Ursprung
Commit
36a6260f63
1 geänderte Dateien mit 18 neuen und 21 gelöschten Zeilen
  1. 18 21
      src/components/tree/DeviceGroupTree/index.vue

+ 18 - 21
src/components/tree/DeviceGroupTree/index.vue

@@ -4,7 +4,6 @@
     class="l-flex--col c-tree"
   >
     <el-tabs
-      v-if="__STAGING__"
       v-model="active"
       class="c-tabs has-bottom-padding"
     >
@@ -250,28 +249,26 @@ export default {
       }
       return getDeviceTree().then(({ data }) => {
         this.$groupCache = data
-        if (__STAGING__) {
-          const map = {}
-          const cache = []
-          const ids = {}
-          data.forEach(({ list }) => {
-            list.forEach(device => {
-              const resolutionRatio = device.resolutionRatio
-              if (!ids[device.id]) {
-                if (!map[resolutionRatio]) {
-                  map[resolutionRatio] = []
-                  cache.push({
-                    name: resolutionRatio,
-                    list: map[resolutionRatio]
-                  })
-                }
-                ids[device.id] = 1
-                map[resolutionRatio].push(device)
+        const map = {}
+        const cache = []
+        const ids = {}
+        data.forEach(({ list }) => {
+          list.forEach(device => {
+            const resolutionRatio = device.resolutionRatio
+            if (!ids[device.id]) {
+              if (!map[resolutionRatio]) {
+                map[resolutionRatio] = []
+                cache.push({
+                  name: resolutionRatio,
+                  list: map[resolutionRatio]
+                })
               }
-            })
+              ids[device.id] = 1
+              map[resolutionRatio].push(device)
+            }
           })
-          this.$ratioCache = cache
-        }
+        })
+        this.$ratioCache = cache
         return this[key]
       })
     },