浏览代码

feat(device): supports refresh the current page

Casper Dai 3 年之前
父节点
当前提交
b61c5cd8e7
共有 2 个文件被更改,包括 55 次插入7 次删除
  1. 10 0
      src/scss/bem/_object.scss
  2. 45 7
      src/views/device/index.vue

+ 10 - 0
src/scss/bem/_object.scss

@@ -256,3 +256,13 @@
     font-weight: normal;
   }
 }
+
+.o-refresh {
+  color: $gray;
+  font-size: 24px;
+  @extend .u-pointer;
+
+  &:hover {
+    color: $blue;
+  }
+}

+ 45 - 7
src/views/device/index.vue

@@ -51,6 +51,12 @@
         width="50"
         align="center"
       >
+        <template #header>
+          <i
+            class="o-refresh el-icon-refresh"
+            @click="getList"
+          />
+        </template>
         <template v-slot="scope">
           <i
             v-if="scope.row.isMaster"
@@ -153,19 +159,27 @@
             >
               编辑
             </div>
+            <permission v-if="scope.row.isMaster">
+              <div
+                class="c-table__btn u-pointer"
+                @click.stop="toAddSubDevice(scope.row)"
+              >
+                添加备份设备
+              </div>
+            </permission>
             <div
-              v-if="scope.row.activate > 0"
+              v-if="scope.row.activate > 1"
               class="c-table__btn u-pointer"
               @click.stop="onProgress(scope.row)"
             >
               下载状态
             </div>
-            <permission v-if="scope.row.isMaster">
+            <permission v-if="scope.row.isMaster && scope.row.activate > 1">
               <div
                 class="c-table__btn u-pointer"
-                @click.stop="toAddSubDevice(scope.row)"
+                @click.stop="setDefaultProgram(scope.row)"
               >
-                添加备份设备
+                默认节目
               </div>
             </permission>
             <permission>
@@ -272,6 +286,18 @@
         :device="device"
       />
     </el-dialog>
+    <el-dialog
+      :visible.sync="choosing"
+      title="选择节目"
+      custom-class="c-dialog hidden-footer"
+      append-to-body
+    >
+      <program-choose
+        v-if="choosing"
+        :ratio="ratio"
+        @choose="toChoose"
+      />
+    </el-dialog>
   </div>
 </template>
 
@@ -291,11 +317,13 @@ import {
 import { createListOptions } from '@/utils'
 import mixin from './mixins'
 import DownloadProgress from '@/components/DownloadProgress'
+import ProgramChoose from '@/components/Schedule/components/ProgramChoose'
 
 export default {
   name: 'Device',
   components: {
-    DownloadProgress
+    DownloadProgress,
+    ProgramChoose
   },
   mixins: [mixin],
   data () {
@@ -319,13 +347,15 @@ export default {
       show: false,
       showProgress: false,
       isSub: false,
-      device: null
+      device: null,
+      choosing: false,
+      ratio: null
     }
   },
   computed: {
     ...mapGetters(['isAdmin']),
     operationColumnWidth () {
-      return this.isAdmin ? 300 : 200
+      return this.isAdmin ? 360 : 200
     },
     type () {
       return this.isSub ? '备份设备' : '设备'
@@ -560,6 +590,14 @@ export default {
       if (this.device) {
         this.device = null
       }
+    },
+    setDefaultProgram (device) {
+      this.ratio = device.resolutionRatio
+      this.choosing = true
+    },
+    toChoose (program) {
+      console.log(program)
+      this.choosing = false
     }
   }
 }