Parcourir la source

feat(power): adjust operation log description

Casper Dai il y a 2 ans
Parent
commit
735577483b

+ 4 - 2
src/api/platform.js

@@ -60,7 +60,8 @@ export function savePowerLogger (data) {
       operTime: parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}'),
       ...data
     }),
-    custom: true
+    custom: true,
+    background: true
   })
 }
 
@@ -78,7 +79,8 @@ export function saveBoxLogger (data) {
       operTime: parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}'),
       ...data
     }),
-    custom: true
+    custom: true,
+    background: true
   })
 }
 

+ 1 - 1
src/utils/mqtt.js

@@ -31,7 +31,7 @@ const whiteList = [
     val: WillTopic
   }, {
     type: 'topic',
-    val: /^\d+\/\d+\/(status|screenshot|restart|plc)/
+    val: /^\d+\/\d+\/(screenshot|restart|plc)/
   }, {
     val: /messageId/
   }

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

@@ -953,7 +953,7 @@ export default {
         })
       })
       savePowerLogger({
-        description: `设置设备【${this.device.name}】的定时任务`,
+        description: `设置设备【${this.device.name}】的电源定时任务`,
         method: '电源定时任务设置',
         params: JSON.stringify({
           id: this.device.id,

+ 2 - 7
src/views/device/power/components/DevicePowerTask.vue

@@ -22,10 +22,6 @@ export default {
     task: {
       type: Object,
       required: true
-    },
-    info: {
-      type: String,
-      default: ''
     }
   },
   data () {
@@ -122,14 +118,13 @@ export default {
         taskInfo: data
       }).then(messageId => {
         this.$messageId = messageId
-        const { cron, startTime, endTime, executeTime, action, type } = this.task
         savePowerLogger({
-          description: `设备【${this.device.name}】 ${this.info || '新增定时任务'} ${this.tag}`,
+          description: `设备【${this.device.name}】 新增电源定时任务 ${this.tag}`,
           method: '电源定时任务设置',
           params: JSON.stringify({
             id: this.device.id,
             name: this.device.name,
-            cron, startTime, endTime, executeTime, action, type
+            ...this.task
           })
         })
       })

+ 9 - 6
src/views/device/power/index.vue

@@ -82,7 +82,7 @@
       <template #tip>
         <div class="has-bottom-padding--sm u-font-size--sm">
           <div class="c-sibling-item--v u-color--black u-bold">{{ taskInfo }}电源</div>
-          <div class="c-sibling-item--v nearest has-bottom-padding--sm u-color--error dark u-font-size--sm">同步中请勿关闭弹窗,否则将停止同步</div>
+          <div class="c-sibling-item--v nearest u-color--error dark u-font-size--sm">同步中请勿关闭弹窗,否则将停止同步</div>
         </div>
       </template>
     </table-dialog>
@@ -117,7 +117,7 @@ import DevicePowerTask from './components/DevicePowerTask.vue'
 const FOREVER = '4016-06-06'
 
 export default {
-  name: 'DeviceList',
+  name: 'BatchPowerOperation',
   data () {
     return {
       schema: {
@@ -212,6 +212,9 @@ export default {
       taskAction: 0,
       asyncSchema: {
         nonPagination: true,
+        props: {
+          size: 'small'
+        },
         list: this.getSyncDevices,
         cols: [
           { prop: 'name', label: '设备名称', 'min-width': 60 },
@@ -227,7 +230,7 @@ export default {
   },
   created () {
     this.$timer = -1
-    this.$deitalTimer = -1
+    this.$detailTimer = -1
     subscribe([
       '+/+/online',
       '+/+/offline'
@@ -235,7 +238,7 @@ export default {
   },
   beforeDestroy () {
     clearTimeout(this.$timer)
-    clearTimeout(this.$deitalTimer)
+    clearTimeout(this.$detailTimer)
     unsubscribe([
       '+/+/online',
       '+/+/offline'
@@ -357,10 +360,10 @@ export default {
       this.$refs.detailDialog.show()
     },
     getOperationResult () {
-      clearTimeout(this.$deitalTimer)
+      clearTimeout(this.$detailTimer)
       return getOperationResult(this.$taskId).then(({ data }) => {
         if (data.operationStatus === 0) {
-          this.$deitalTimer = setTimeout(() => {
+          this.$detailTimer = setTimeout(() => {
             this.$refs.detailDialog?.getTable()?.refreshCurrentPageOnBackground()
           }, 2000)
         }