Browse Source

feat: add scheduling filter

Casper Dai 3 years ago
parent
commit
0373ab18e1
2 changed files with 65 additions and 2 deletions
  1. 44 2
      src/views/schedule/deploy/index.vue
  2. 21 0
      src/views/schedule/index.vue

+ 44 - 2
src/views/schedule/deploy/index.vue

@@ -70,6 +70,32 @@
         @pagination="getSchedules"
         @row-dblclick="choose"
       >
+        <template #header>
+          <div class="l-flex__auto" />
+          <div class="l-flex__none l-flex--row c-sibling-item">
+            <span>分辨率过滤:</span>
+            <el-switch
+              v-model="isFilterSchedules"
+              class="l-flex__none"
+              active-color="#13ce66"
+              inactive-color="#ff4949"
+              @change="refreshSchedules"
+            />
+          </div>
+          <el-select
+            v-model="scheduleOptions.params.type"
+            class="l-flex__none c-sibling-item o-select"
+            placeholder="请选择类型"
+            @change="refreshSchedules"
+          >
+            <el-option
+              v-for="item in scheduleTypes"
+              :key="item.label"
+              :label="item.label"
+              :value="item.value"
+            />
+          </el-select>
+        </template>
         <el-table-column
           prop="name"
           label="排期名称"
@@ -120,7 +146,13 @@ export default {
       scheduleOptions: null,
       schedule: null,
       startDateTime: null,
-      endDateTime: null
+      endDateTime: null,
+      scheduleTypes: [
+        { value: void 0, label: '全部类型' },
+        { value: ScheduleType.CALENDAR, label: '日程' },
+        { value: ScheduleType.RECUR, label: '轮播' }
+      ],
+      isFilterSchedules: true
     }
   },
   computed: {
@@ -206,6 +238,12 @@ export default {
       schedule.typeName = typeName
       return schedule
     },
+    refreshSchedules () {
+      const options = this.scheduleOptions
+      options.params.pageNum = 1
+      options.params.resolutionRatio = this.isFilterSchedules ? this.resolutionRatio : void 0
+      this.getSchedules()
+    },
     getSchedules () {
       const options = this.scheduleOptions
       options.error = false
@@ -224,7 +262,11 @@ export default {
       if (!this.isReady) {
         return
       }
-      this.scheduleOptions = createListOptions({ status: State.RESOLVED })
+      this.scheduleOptions = createListOptions({
+        status: State.RESOLVED,
+        type: void 0
+      })
+      this.isFilterSchedules = true
       this.getSchedules()
       this.choosing = true
     },

+ 21 - 0
src/views/schedule/index.vue

@@ -47,6 +47,21 @@
             :value="item.value"
           />
         </el-select>
+        <el-select
+          v-model="currObj.params.resolutionRatio"
+          class="l-flex__none c-sibling-item o-select"
+          placeholder="请选择分辨率"
+          :loading="fetching"
+          @change="search"
+          @visible-change="getRatios"
+        >
+          <el-option
+            v-for="item in resolutionRatios"
+            :key="item.label"
+            :label="item.label"
+            :value="item.value"
+          />
+        </el-select>
         <el-select
           v-if="hasEditPermission"
           v-model="currObj.params.status"
@@ -286,6 +301,7 @@ export default {
       normal: createListOptions({
         type: void 0,
         status: this.$store.getters.hasEditPermission ? void 0 : State.RESOLVED,
+        resolutionRatio: void 0,
         name: ''
       }),
       defaults: createListOptions(),
@@ -313,6 +329,11 @@ export default {
       } : {
         list: () => Promise.resolve({ data: [], totalCount: 0 })
       }
+    },
+    resolutionRatios () {
+      return [{ value: void 0, label: '全部分辨率' }].concat(this.ratios.map(({ value }) => {
+        return { value, label: value }
+      }))
     }
   },
   created () {