From 7ef49600cea8b57873b35a3edf019bad603c869d Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期四, 18 九月 2025 09:11:09 +0800
Subject: [PATCH] 首页下载问题修复

---
 src/page/index/top/top-menu.vue |  138 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 137 insertions(+), 1 deletions(-)

diff --git a/src/page/index/top/top-menu.vue b/src/page/index/top/top-menu.vue
index bd351a6..9f84e01 100644
--- a/src/page/index/top/top-menu.vue
+++ b/src/page/index/top/top-menu.vue
@@ -7,6 +7,48 @@
       </template>
     </el-menu-item>
 
+    <el-menu-item index="0" @click="openTodo(itemHome)">
+      
+      <template #title>
+           
+               
+           <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">
       <el-menu-item :index="item.id + ''" @click="openMenu(item)">
         <template #title>
@@ -18,9 +60,14 @@
   </el-menu>
 </template>
 
+<style lang="scss" scoped>
+.todoItems {
+  margin-left:15px;
+}
+</style>
 <script>
 import { mapGetters } from 'vuex';
-
+//import { getList } from '@/api/flow/todolist'; //浠诲姟鎻愰啋
 export default {
   name: 'top-menu',
   data() {
@@ -29,14 +76,35 @@
         name: '棣栭〉',
         source: 'iconfont iconicon_work',
       },
+      itemTodo: {
+        name: '浠诲姟鎻愰啋',
+        source: 'iconfont iconicon_work',
+      },
       activeIndex: '0',
       items: [],
+
+      todoCount:0,
+      exportCount:0,
+      remindCount:0, //鎻愰啋鎬绘暟閲�
+      remindItems:[{text:'娴佺▼浠诲姟',id:"todo"},{text:'瀵煎嚭宸ユ帶缃�',id:"todo1"},],
+      intervalId : undefined
     };
   },
   inject: ['index'],
+  
   created() {
     this.getMenu();
+
+    this.getCount();
+    
+    window.remindIntervalId = setInterval(() => {
+      this.getCount();
+    }, 2*60*1000)//
+    window.myemitter.on('todochange', (data)=>{
+      this.getCount();
+    });
   },
+  
   computed: {
     ...mapGetters(['tagCurrent', 'menu', 'tagWel']),
   },
@@ -53,6 +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() {
+      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