From 057ce688e9fe904c1a74b2505531d5afc7acf43e Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期三, 10 九月 2025 23:03:56 +0800
Subject: [PATCH] 修复bug
---
src/page/index/top/top-menu.vue | 134 +++++++++++++++++++++++++++++++++++++-------
1 files changed, 112 insertions(+), 22 deletions(-)
diff --git a/src/page/index/top/top-menu.vue b/src/page/index/top/top-menu.vue
index 37f8bfa..9f84e01 100644
--- a/src/page/index/top/top-menu.vue
+++ b/src/page/index/top/top-menu.vue
@@ -6,24 +6,47 @@
<span>{{ itemHome.name }}</span>
</template>
</el-menu-item>
+
<el-menu-item index="0" @click="openTodo(itemHome)">
<template #title>
- <el-badge :value="logsLen" :max="99" :offset="[10, 15]" class="todoItems">
- <el-tooltip
- class="box-item"
- effect="dark"
- :content="`鎮ㄦ湁${logsLen}鏉′换鍔¢渶瑕佸鐞哷"
- placement="top-start"
- >
- {{ itemTodo.name }}
- </el-tooltip>
- </el-badge>
- <!-- <span >{{ itemTodo.name }}</span>-->
-
-
+
+ <el-dropdown>
+ <span class="el-dropdown-link">
+ <el-badge ref="topbadge" :value="remindCount" :max="99" :offset="[10, 0]" :class="{'blink-badge':this.remindCount>0}">
+ <el-tooltip
+ class="box-item"
+ effect="dark"
+ :content="`鎮ㄦ湁${remindCount}鏉′换鍔¢渶瑕佸鐞哷"
+ placement="top-start"
+ >
+ {{ itemTodo.name }}
+ </el-tooltip>
+ </el-badge>
+ </span>
+ <template #dropdown>
+ <el-dropdown-menu>
+
+ <el-dropdown-item v-for="item in remindItems" @click.native="handleRemindClick(item)">{{item.text}}</el-dropdown-item>
+
+ </el-dropdown-menu>
+ </template>
+
+ </el-dropdown>
</template>
+ <!--
+ <el-dropdown>
+ <template #dropdown>
+ <el-dropdown-menu>
+ <el-dropdown-item>Action 1</el-dropdown-item>
+ <el-dropdown-item>Action 2</el-dropdown-item>
+ </el-dropdown-menu>
+ </template>
+ </el-dropdown>
+ -->
+
+
</el-menu-item>
<template v-for="(item, index) in items" :key="index">
@@ -44,7 +67,7 @@
</style>
<script>
import { mapGetters } from 'vuex';
-import { getList } from '@/api/flow/todolist'; //浠诲姟鎻愰啋
+//import { getList } from '@/api/flow/todolist'; //浠诲姟鎻愰啋
export default {
name: 'top-menu',
data() {
@@ -60,17 +83,26 @@
activeIndex: '0',
items: [],
- logsLen: 0,//浠诲姟鎻愰啋鏁伴噺
+ todoCount:0,
+ exportCount:0,
+ remindCount:0, //鎻愰啋鎬绘暟閲�
+ remindItems:[{text:'娴佺▼浠诲姟',id:"todo"},{text:'瀵煎嚭宸ユ帶缃�',id:"todo1"},],
+ intervalId : undefined
};
},
inject: ['index'],
+
created() {
this.getMenu();
- this.getCount()
- setInterval(() => {
+ this.getCount();
+
+ window.remindIntervalId = setInterval(() => {
this.getCount();
- }, 2*60*1000);
+ }, 2*60*1000)//
+ window.myemitter.on('todochange', (data)=>{
+ this.getCount();
+ });
},
computed: {
@@ -89,16 +121,74 @@
this.items = res;
});
},
+ handleRemindClick(item){
+ console.log(item)
+ if(item.id == 'todo'){
+ this.$router.push({ path: '/flow/todoindex' });
+ }else{
+ this.$router.push({ path: '/flowmgr/programexport' });
+ }
+ },
openTodo() {
this.$router.push({ path: '/flow/todoindex' });
//this.box = false;
},
+
getCount() {
- getList(1,10).then((res) => {
- this.logsLen = res.data.data.total;
- this.dataList = res.data.data.records;
- });
+ axios({
+ url: '/blade-mdm/remind/task-count',
+ method: 'get',
+ params: {},
+ }).then(
+ res => {
+ if(res.data.code == 200){
+ this.todoCount = res.data.data.todoCount;
+ this.exportCount = res.data.data.exportCount;
+ this.remindCount = this.todoCount + this.exportCount;
+ this.setRemindItems();
+
+ }
+ },
+ error => {
+ console.log(error);
+ }
+ );
+ /*
+ try{
+ getList(1,1).then((res) => {
+ this.todoCount = res.data.data.total;
+ this.remindCount = this.todoCount + this.exportCount;
+ this.setRemindItems();
+ this.dataList = res.data.data.records;
+
+ }).catch(e=>{
+
+ clearInterval(this.intervalId);
+ });
+ }catch(e2){
+ console.log('e2',e2);
+ }*/
+ },
+
+ setRemindItems(){
+ this.remindItems=[];
+ if(this.todoCount>0){
+ this.remindItems.push({text:'娴佺▼浠诲姟('+this.todoCount+")",id:'todo'})
+ }
+ if(this.exportCount>0){
+ this.remindItems.push({text:'宸ユ帶缃戝鍑�('+this.exportCount+")",id:'export'})
+ }
}
},
};
</script>
+<style lang="css">
+@keyframes blink {
+ 0% { opacity: 1; }
+ 50% { opacity: 0.3; }
+ 100% { opacity: 1; }
+}
+.blink-badge .el-badge__content {
+ animation: blink 2s infinite;
+}
+</style>
--
Gitblit v1.9.3