diff --git a/src/components/task/content/TaskContent.vue b/src/components/task/content/TaskContent.vue
index ad7acaa5..d15ff506 100644
--- a/src/components/task/content/TaskContent.vue
+++ b/src/components/task/content/TaskContent.vue
@@ -45,7 +45,6 @@
-
@@ -94,18 +93,18 @@
/>
-
-
-
-
-
+
+
-
@@ -121,6 +120,7 @@ import { mapActions } from 'vuex'
import taskTypes from '@/store/modules/task/content/types'
import TaskFormula from './formula/TaskFormula'
import { v4 as uuid } from 'uuid'
+import StatusBar from './status/statusBar.vue'
// import music from '@/assets/Beep_high_normal.aac'
// TODO change chart data tag format
@@ -132,6 +132,7 @@ export default {
// TaskDevices,
TaskDevicesNew,
TaskFormula,
+ StatusBar,
},
computed: {
...mapFields('taskContent', [
@@ -159,13 +160,18 @@ export default {
chartAreaClass: ['flex', 'xs12', 'sm12', 'md12', 'xl8', 'pa-0'],
getParmDone: false,
batteryInterval: {},
+ toasts: [
+ ],
}
},
mqtt: {
async '+/play_sound/+' (data, topic) {
- if (this.showWanrningModal === false) {
- this.showWanrningModal = true
- await this.playSound()
+ const device = JSON.parse(String.fromCharCode.apply(null, data)).data
+ if (device) {
+ if (!this.toasts.find((toast) => toast.device === device)) {
+ this.toasts.push({ device: device, message: `Device ${device} Alert` })
+ await this.playSound()
+ }
}
},
async '+/device_battery/+' (data, topic) {
@@ -176,7 +182,6 @@ export default {
async '+/get_device_info_all/+' (data, topic) {
// console.log('get_device_info_all', String.fromCharCode.apply(null, data))
this.deviceListNew = JSON.parse(String.fromCharCode.apply(null, data)).data
-
// console.log(this.deviceListNew)
for (let i = 0; i < this.deviceListNew.length; i++) {
@@ -650,12 +655,18 @@ export default {
},
playSound: async function () {
const a = document.getElementById('alert')
- setTimeout(async () => {
- await this.closeAlert()
- }, 30000)
+ // setTimeout(async () => {
+ // await this.closeAlert()
+ // }, 30000)
a.loop = true
await a.play()
},
+ removeToast: function (index) {
+ this.toasts.splice(index, 1)
+ if (this.toasts.length === 0) {
+ this.closeAlert()
+ }
+ },
closeAlert: async function () {
this.showWanrningModal = false
const a = document.getElementById('alert')
diff --git a/src/components/task/content/status/statusBar.vue b/src/components/task/content/status/statusBar.vue
new file mode 100644
index 00000000..616ade6e
--- /dev/null
+++ b/src/components/task/content/status/statusBar.vue
@@ -0,0 +1,67 @@
+
+
+
+ {{ message }}
+ ✕
+
+
+
+
+
+
+