diff --git a/ruoyi-ui/src/api/business/warning/apiwarning.js b/ruoyi-ui/src/api/business/warning/apiwarning.js index d8ee9597..4a71aa49 100644 --- a/ruoyi-ui/src/api/business/warning/apiwarning.js +++ b/ruoyi-ui/src/api/business/warning/apiwarning.js @@ -52,3 +52,11 @@ export function clearAll() { method: 'delete', }) } + +// 全部标记已读 +export function AllHaveRead() { + return request({ + url: '/warning/apiwarning/handleAll', + method: 'put', + }) +} diff --git a/ruoyi-ui/src/layout/components/Navbar.vue b/ruoyi-ui/src/layout/components/Navbar.vue index de5ec376..1d70a328 100644 --- a/ruoyi-ui/src/layout/components/Navbar.vue +++ b/ruoyi-ui/src/layout/components/Navbar.vue @@ -122,9 +122,17 @@ export default { "apiWarning", this.getData ); + + this.$bus.$on('clearCount', this.clearCount) }, methods: { + //小红点清零 + clearCount(data) { + if (data) { + this.warnData.count = 0 + } + }, //已读操作 haveRead() { @@ -143,18 +151,15 @@ export default { } } } - - }, append() { let str = this.warnData.data; if (str != null) { var json = eval("(" + str + ")"); - if (json.apiName !== undefined && json.warningMessage !== undefined) { - let data = json.apiName + "-" + json.warningMessage; + if (json.warningMessage !== undefined) { // this.visible = true - return data + return json.warningMessage } } }, diff --git a/ruoyi-ui/src/main.js b/ruoyi-ui/src/main.js index a8f845e0..e91ccca0 100644 --- a/ruoyi-ui/src/main.js +++ b/ruoyi-ui/src/main.js @@ -86,5 +86,10 @@ new Vue({ el: '#app', router, store, + + beforeCreate() { + Vue.prototype.$bus = this //安装全局事件总线,$bus就是当前应用的vm + }, + render: h => h(App) }) diff --git a/ruoyi-ui/src/views/business/warning/apiwarning/index.vue b/ruoyi-ui/src/views/business/warning/apiwarning/index.vue index 87be68f0..481d9042 100644 --- a/ruoyi-ui/src/views/business/warning/apiwarning/index.vue +++ b/ruoyi-ui/src/views/business/warning/apiwarning/index.vue @@ -35,10 +35,22 @@ icon="el-icon-delete-solid" size="mini" @click="clearAll" + v-hasPermi="['warning:warning:remove']" >清空 + + 全部标记已读 + + @@ -84,7 +96,7 @@