Selaa lähdekoodia

fix: the data is not filtered when scheduling selection is opened for the first time

Casper Dai 3 vuotta sitten
vanhempi
sitoutus
eadaaaf0c8
1 muutettua tiedostoa jossa 15 lisäystä ja 8 poistoa
  1. 15 8
      src/views/schedule/deploy/index.vue

+ 15 - 8
src/views/schedule/deploy/index.vue

@@ -241,21 +241,28 @@ export default {
     },
     refreshSchedules () {
       const options = this.scheduleOptions
+      options.list = []
+      options.totalCount = 0
       options.params.pageNum = 1
-      options.params.resolutionRatio = this.isFilterSchedules ? this.resolutionRatio : void 0
       this.getSchedules()
     },
     getSchedules () {
       const options = this.scheduleOptions
       options.error = false
       options.loading = true
-      getSchedules(options.params).then(({ data, totalCount }) => {
-        options.list = data.map(this.transform)
-        options.totalCount = totalCount
-      }, () => {
-        options.error = true
-        options.list = []
-      }).finally(() => {
+      getSchedules({
+        ...options.params,
+        resolutionRatio: this.isFilterSchedules ? this.resolutionRatio : void 0
+      }).then(
+        ({ data, totalCount }) => {
+          options.list = data.map(this.transform)
+          options.totalCount = totalCount
+        },
+        () => {
+          options.error = true
+          options.list = []
+        }
+      ).finally(() => {
         options.loading = false
       })
     },