Эх сурвалжийг харах

fix(upgrade): select the target device only once

Casper Dai 3 жил өмнө
parent
commit
86ccd6d929

+ 20 - 16
src/views/realm/upgrade/deploy/index.vue

@@ -223,24 +223,28 @@ export default {
       this.version.fileId = id
     },
     chooseDevices () {
+      this.getTopGroups().then(({ data }) => {
+        if (data.length) {
+          this.choosingDevice = true
+          this.groups = data
+          this.group = this.groups[0]
+          this.$slectedDevices = []
+          this.$nextTick(() => {
+            this.$refs.tree.setCurrentKey(this.group.path)
+          })
+        } else {
+          this.$message({
+            type: 'warning',
+            message: '请先添加租户'
+          })
+        }
+      })
+    },
+    getTopGroups () {
       if (this.groups.length === 0) {
-        getTopGroups().then(({ data }) => {
-          if (data.length) {
-            this.choosingDevice = true
-            this.groups = data
-            this.group = this.groups[0]
-            this.$slectedDevices = []
-            this.$nextTick(() => {
-              this.$refs.tree.setCurrentKey(this.group.path)
-            })
-          } else {
-            this.$message({
-              type: 'warning',
-              message: '请先添加租户'
-            })
-          }
-        })
+        return getTopGroups()
       }
+      return Promise.resolve({ data: this.groups })
     },
     onGroupTreeClick (group) {
       if (!this.group || this.group.id !== group.id) {