diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index 8e2f8ba..90a486a 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -33,6 +33,9 @@ + + {{alarmTip?'关闭报警':'打开报警'}} + 退出登录 @@ -64,6 +67,12 @@ export default { Search, NotifyMessage }, + props:{ + alarmTip:{ + type: Boolean, + default: false, + }, + }, computed: { ...mapGetters([ 'sidebar', @@ -89,7 +98,7 @@ export default { }, data() { return { - nickname: '' + nickname: '', }; }, created() { @@ -101,6 +110,9 @@ export default { toggleSideBar() { this.$store.dispatch('app/toggleSideBar') }, + alarmSet(){ + this.$emit('refreshAlarm'); + }, async logout() { this.$modal.confirm('确定注销并退出系统吗?', '提示').then(() => { this.$store.dispatch('LogOut').then(() => { diff --git a/src/layout/index.vue b/src/layout/index.vue index 55a672d..1803791 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -12,7 +12,7 @@ :class="{ hasTagsView: needTagsView, sidebarHide: sidebar.hide }" class="main-container">
- +
@@ -82,6 +82,8 @@ export default { instance: { closed: true, }, // 通知弹窗实例 + timer: null, + alarmTip: true, }; }, created() { @@ -89,7 +91,6 @@ export default { axios .post('http://172.22.22.190/wcs-njlm/business/wcsTask/isonline') .then((res) => { - console.log(res); if (res.data.code == 500) { this.$notify({ title: '设备异常', @@ -102,7 +103,6 @@ export default { } }) .catch((error) => { - console.error('There was an error!', error); this.$notify({ title: '通知', message: '设备不在线,请稍后重试', @@ -112,11 +112,22 @@ export default { }); }, methods: { + refreshAlarm() { + if (this.alarmTip) { + clearInterval(this.timer); + this.timer = null; + } else { + this.startFun(); + } + this.alarmTip = !this.alarmTip; + }, handleClickOutside() { this.$store.dispatch('app/closeSideBar', { withoutAnimation: false }); }, startFun() { - setInterval(() => { + clearInterval(this.timer); + this.timer = null; + this.timer = setInterval(() => { this.getRealAlarm(); }, 10000); }, @@ -149,6 +160,34 @@ export default { .catch((error) => { console.error('There was an error!', error); }); + axios + .post('http://172.22.22.14:8080/wcs-njlm/business/wcsTask/isAlarm') + .then((res) => { + res.data.forEach((item, index) => { + if (index < 4) { + if (item.code !== 0) { + this.$notify({ + title: '异常', + message: item.msg, + type: 'warning', + duration: 8000, + }); + } + } else { + if (item.code > 30) { + this.$notify({ + title: '异常', + message: item.msg, + type: 'warning', + duration: 9000, + }); + } + } + }); + }) + .catch((error) => { + console.error('There was an error!', error); + }); }, }, }; diff --git a/src/views/asrs/delivery/add-or-updatab.vue b/src/views/asrs/delivery/add-or-updatab.vue index a4e12d7..012777b 100644 --- a/src/views/asrs/delivery/add-or-updatab.vue +++ b/src/views/asrs/delivery/add-or-updatab.vue @@ -2,7 +2,7 @@ * @Author: zwq * @Date: 2021-11-18 14:16:25 * @LastEditors: zwq - * @LastEditTime: 2024-12-26 11:20:46 + * @LastEditTime: 2025-01-07 15:48:54 * @Description: -->