Jelajahi Sumber

fix(spacer): multiple data and pictures are invalid

the device only supports a single video
Casper Dai 2 tahun lalu
induk
melakukan
e75892d9c2
1 mengubah file dengan 20 tambahan dan 1 penghapusan
  1. 20 1
      src/components/dialog/SpacerConfigDialog/index.vue

+ 20 - 1
src/components/dialog/SpacerConfigDialog/index.vue

@@ -30,7 +30,7 @@ export default {
         nonPagination: true,
         list: this.getSpacers,
         buttons: [
-          { type: 'add', label: '新增图片', on: this.onAddImage },
+          // { type: 'add', label: '新增图片', on: this.onAddImage },
           { type: 'add', label: '新增视频', on: this.onAddVideo }
         ],
         cols: [
@@ -62,6 +62,21 @@ export default {
       )
     },
     onAddVideo () {
+      const { error, totalCount } = this.$refs.dialog.getTable().info()
+      if (error) {
+        this.$message({
+          type: 'warning',
+          message: '请先获取数据'
+        })
+        return
+      }
+      if (totalCount >= 1) {
+        this.$message({
+          type: 'warning',
+          message: '暂仅支持单个垫片'
+        })
+        return
+      }
       this.$refs.assetDialog.show(
         AssetType.VIDEO,
         this.directoryOption
@@ -81,6 +96,10 @@ export default {
         ]
       }).then(() => {
         this.$refs.dialog.getTable().pageTo(1)
+        this.$message({
+          type: 'success',
+          message: '设置将在设备重启后生效'
+        })
       })
     },
     onDel (spacer) {