فهرست منبع

feat: power open time sync

Casper Dai 2 سال پیش
والد
کامیت
9f3eff9f5b

+ 1 - 1
src/utils/cache/screenshot.js

@@ -75,7 +75,7 @@ export function screenshot (deviceId, silence) {
         if (!silence) {
           Message({
             type: 'warning',
-            message: '正在连接,请稍后试'
+            message: '正在连接,请稍后试'
           })
         }
       }

+ 1 - 1
src/views/device/detail/components/DeviceInfo/components/Power.vue

@@ -192,7 +192,7 @@ export default {
         () => {
           this.$message({
             type: 'warning',
-            message: '正在连接,请稍后试'
+            message: '正在连接,请稍后试'
           })
           return Promise.reject()
         }

+ 2 - 2
src/views/device/detail/components/DeviceInvoke/DeviceNetwork/index.vue

@@ -103,7 +103,7 @@ export default {
         }
         this.$message({
           type: 'warning',
-          message: '未发现设备网口,请稍后试'
+          message: '未发现设备网口,请稍后试'
         })
       }
     },
@@ -111,7 +111,7 @@ export default {
       this.sendTopic(
         'network',
         [],
-        '未获取到设备网络状态,请稍后试'
+        '未获取到设备网络状态,请稍后试'
       )
     },
     showNetwork (eths) {

+ 1 - 1
src/views/device/detail/components/DeviceInvoke/DeviceReboot.vue

@@ -50,7 +50,7 @@ export default {
           () => {
             this.$message({
               type: 'warning',
-              message: '正在连接,请稍后试'
+              message: '正在连接,请稍后试'
             })
           }
         )

+ 1 - 1
src/views/device/detail/components/DeviceInvoke/mixins/base.js

@@ -61,7 +61,7 @@ export default {
         () => {
           this.$message({
             type: 'warning',
-            message: '正在连接,请稍后试'
+            message: '正在连接,请稍后试'
           })
           return Promise.reject()
         }

+ 1 - 4
src/views/external/box/settings/components/DeviceConfig/components/AdConfigDialog.vue

@@ -1,7 +1,7 @@
 <template>
   <confirm-dialog
     ref="configDialog"
-    :title="title"
+    title="广告属性配置"
     @confirm="onSave"
   >
     <div class="c-grid-form auto u-align-self--center">
@@ -155,9 +155,6 @@ export default {
     }
   },
   computed: {
-    title () {
-      return `${this.isAdd ? '新增' : '更新'}广告属性`
-    },
     price () {
       const price = this.attributes.price || 0
       return `5秒 x ${this.attributes.minCount}次 = ${(price / 100).toFixed(2)}元`

+ 115 - 0
src/views/external/box/settings/components/DeviceConfig/components/PowerTimeSyncDialog.vue

@@ -0,0 +1,115 @@
+<template>
+  <confirm-dialog
+    ref="configDialog"
+    title="电源开启时长配置"
+    @confirm="onSave"
+  >
+    <template #default>
+      <div class="c-grid-form auto u-align-self--center">
+        <span class="c-grid-form__label">端口1</span>
+        <el-input-number
+          v-model="millis[0]"
+          controls-position="right"
+          :min="0"
+          step-strictly
+        />
+        <span class="c-grid-form__label">端口2</span>
+        <el-input-number
+          v-model="millis[1]"
+          controls-position="right"
+          :min="0"
+          step-strictly
+        />
+        <span class="c-grid-form__label">端口3</span>
+        <el-input-number
+          v-model="millis[2]"
+          controls-position="right"
+          :min="0"
+          step-strictly
+        />
+        <span class="c-grid-form__label">端口4</span>
+        <el-input-number
+          v-model="millis[3]"
+          controls-position="right"
+          :min="0"
+          step-strictly
+        />
+        <span class="c-grid-form__label">端口5</span>
+        <el-input-number
+          v-model="millis[4]"
+          controls-position="right"
+          :min="0"
+          step-strictly
+        />
+        <span class="c-grid-form__label">端口6</span>
+        <el-input-number
+          v-model="millis[5]"
+          controls-position="right"
+          :min="0"
+          step-strictly
+        />
+        <span class="c-grid-form__label">端口7</span>
+        <el-input-number
+          v-model="millis[6]"
+          controls-position="right"
+          :min="0"
+          step-strictly
+        />
+        <span class="c-grid-form__label">端口8</span>
+        <el-input-number
+          v-model="millis[7]"
+          controls-position="right"
+          :min="0"
+          step-strictly
+        />
+      </div>
+    </template>
+  </confirm-dialog>
+</template>
+
+<script>
+import { publish } from '@/utils/mqtt'
+
+export default {
+  name: 'PowerTimeSyncDialog',
+  data () {
+    return {
+      millis: [0, 0, 0, 0, 0, 0, 0, 0]
+    }
+  },
+  methods: {
+    show ({ productId, id }) {
+      this.$productId = productId
+      this.$deviceId = id
+      this.millis = [0, 0, 0, 0, 0, 0, 0, 0]
+      this.$refs.configDialog.show()
+    },
+    onSave (done) {
+      const timestamp = `${Date.now()}`
+      publish(
+        `${this.$productId}/${this.$deviceId}/setting/update`,
+        JSON.stringify({
+          messageId: `frontend_${this.$deviceId}_${timestamp}`,
+          timestamp,
+          powerOpenMillis: [...this.millis]
+        }),
+        true
+      ).then(
+        () => {
+          this.$message({
+            type: 'success',
+            message: '配置下发中...'
+          })
+          done()
+        },
+        () => {
+          this.$message({
+            type: 'warning',
+            message: '正在连接,请稍后重试'
+          })
+        }
+      )
+    }
+  }
+}
+</script>

+ 16 - 4
src/views/external/box/settings/components/DeviceConfig/index.vue

@@ -24,6 +24,12 @@
         >
           广告属性
         </button>
+        <button
+          class="o-button"
+          @click="onPowerTimeSync"
+        >
+          电源开启时长
+        </button>
       </div>
     </template>
     <div class="c-sibling-item--v u-font-size--sm u-bold">播控器配置</div>
@@ -53,6 +59,7 @@
     <attribute-config-dialog ref="attributeConfigDialog" />
     <content-protection-config-dialog ref="contentProtectionConfigDialog" />
     <ad-config-dialog ref="adConfigDialog" />
+    <power-time-sync-dialog ref="powerTimeSyncDialog" />
     <record-config-dialog ref="recordConfigDialog" />
     <spacer-config-dialog ref="spacerConfigDialog" />
     <dataset-config-dialog ref="datasetConfigDialog" />
@@ -65,6 +72,7 @@ import AttributeConfigDialog from './components/AttributeConfigDialog.vue'
 import ContentProtectionConfigDialog from './components/ContentProtectionConfigDialog.vue'
 import AdConfigDialog from './components/AdConfigDialog.vue'
 import RecordConfigDialog from './components/RecordConfigDialog.vue'
+import PowerTimeSyncDialog from './components/PowerTimeSyncDialog.vue'
 
 export default {
   name: 'DeviceNormalConfig',
@@ -72,7 +80,8 @@ export default {
     AttributeConfigDialog,
     ContentProtectionConfigDialog,
     AdConfigDialog,
-    RecordConfigDialog
+    RecordConfigDialog,
+    PowerTimeSyncDialog
   },
   props: {
     device: {
@@ -84,15 +93,18 @@ export default {
     ...mapGetters(['isSuperAdmin'])
   },
   methods: {
-    onAttributeConfig () {
-      this.$refs.attributeConfigDialog.show(this.device)
-    },
     onContentProtectionConfig () {
       this.$refs.contentProtectionConfigDialog.show(this.device)
     },
+    onAttributeConfig () {
+      this.$refs.attributeConfigDialog.show(this.device)
+    },
     onAdConfig () {
       this.$refs.adConfigDialog.show(this.device)
     },
+    onPowerTimeSync () {
+      this.$refs.powerTimeSyncDialog.show(this.device)
+    },
     onRecordConfig () {
       this.$refs.recordConfigDialog.show(this.device)
     },

+ 2 - 2
src/views/external/box/settings/components/DeviceShadow.vue

@@ -139,7 +139,7 @@ export default {
         () => {
           this.$message({
             type: 'warning',
-            message: '正在连接,请稍后试'
+            message: '正在连接,请稍后试'
           })
         }
       )
@@ -168,7 +168,7 @@ export default {
           () => {
             this.$message({
               type: 'warning',
-              message: '正在连接,请稍后试'
+              message: '正在连接,请稍后试'
             })
           }
         )

+ 1 - 1
src/views/platform/settings/components/PowerBoxConfigDialog.vue

@@ -144,7 +144,7 @@ export default {
           } else {
             this.$message({
               type: 'warning',
-              message: '模式同步中,请稍后试'
+              message: '模式同步中,请稍后试'
             })
             this.mode = ''
           }

+ 1 - 1
src/views/platform/settings/components/TimingControlDialog.vue

@@ -202,7 +202,7 @@ export default {
           } else {
             this.$message({
               type: 'warning',
-              message: '模式同步中,请稍后试'
+              message: '模式同步中,请稍后试'
             })
             this.mode = ''
           }

+ 1 - 1
src/views/visualization/device/DeviceInfo.vue

@@ -124,7 +124,7 @@ export default {
           () => {
             this.$message({
               type: 'warning',
-              message: '正在连接,请稍后试'
+              message: '正在连接,请稍后试'
             })
           }
         )

+ 3 - 3
src/views/visualization/v0/DeviceInfo.vue

@@ -121,7 +121,7 @@ export default {
       if (!this.online) {
         this.$message({
           type: 'warning',
-          message: '设备未上线,请稍后再试'
+          message: '设备未上线'
         })
         return
       }
@@ -146,7 +146,7 @@ export default {
           () => {
             this.$message({
               type: 'warning',
-              message: '正在连接,请稍后试'
+              message: '正在连接,请稍后试'
             })
           }
         )
@@ -171,7 +171,7 @@ export default {
         () => {
           this.$message({
             type: 'warning',
-            message: '正在连接,请稍后试'
+            message: '正在连接,请稍后试'
           })
         }
       )