Browse Source
- 新增 src/layout/components/todo.vue:顶部「待办」按钮 + 数量徽标,数量取 GET /flowable/task/todoList 的 total(我的流程待办),点击跳转隐患台账; created 拉取 + 每 60s 轮询 + 路由变化刷新(后端未推送待办消息时的前端兜底) - store 新增 todoNum / SET_TODO_NUM(含 getter),Navbar 在「消息」按钮旁挂载 - 临时下线:该接口不传 businessType 时返回全部流程待办,实测 admin 的 2 条待办 属于积分申诉(businessType=points_appeal 命中),而徽标点击进的是隐患台账, 只申诉待办时点进去看不到条目;隐患流程的 businessType 取值待后端确认。 已在 Navbar 的模板 <Todo />、import、组件注册三处注释并留 TODO(待办红点) - 同步更新 CURRENT_TASK / CURRENT_STATUS / DEVELOPMENT_LOG - unused-files.json 为构建工具输出:todo.vue 暂停引用后被记入未使用清单master
8 changed files with 134 additions and 1 deletions
@ -0,0 +1,69 @@
@@ -0,0 +1,69 @@
|
||||
<template> |
||||
<el-tooltip content="我的待办任务(隐患审核、积分申诉等)" placement="bottom"> |
||||
<el-badge :value="$store.getters.todoNum" :hidden="!$store.getters.todoNum" :max="99" class="right-menu-todo"> |
||||
<el-button size="small" icon="el-icon-s-check" type="info" round plain @click="goTodo">待办</el-button> |
||||
</el-badge> |
||||
</el-tooltip> |
||||
</template> |
||||
|
||||
<script> |
||||
import { todoList } from '@/api/flowable/todo' |
||||
|
||||
/** 顶部待办徽标:拉取「我的流程待办」总数,点击进入隐患台账处理待审核任务。 */ |
||||
export default { |
||||
name: 'Todo', |
||||
data() { |
||||
return { timer: null } |
||||
}, |
||||
created() { |
||||
this.refresh() |
||||
// 前端兜底:后端暂未推送待办消息,这里用轮询 + 路由变化刷新待办数 |
||||
this.timer = setInterval(this.refresh, 60000) |
||||
}, |
||||
beforeDestroy() { |
||||
if (this.timer) { |
||||
clearInterval(this.timer) |
||||
this.timer = null |
||||
} |
||||
}, |
||||
watch: { |
||||
// 审批完/切页后立刻刷新,避免红点数字滞后 |
||||
$route() { |
||||
this.refresh() |
||||
} |
||||
}, |
||||
methods: { |
||||
async refresh() { |
||||
try { |
||||
const response = await todoList({ pageNum: 1, pageSize: 1 }) |
||||
const page = response.data || response |
||||
this.$store.commit('SET_TODO_NUM', Number(page.total || page.totalCount || 0)) |
||||
} catch (error) { |
||||
this.$store.commit('SET_TODO_NUM', 0) |
||||
} |
||||
}, |
||||
goTodo() { |
||||
if (this.$route.path !== '/hazard/ledger') this.$router.push({ path: '/hazard/ledger' }) |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.right-menu-todo { |
||||
display: inline-flex; |
||||
align-items: center; |
||||
margin-right: 12px; |
||||
|
||||
::v-deep .el-button { |
||||
padding: 5px 10px; |
||||
border-color: #e5e7eb; |
||||
color: #5a5a72; |
||||
background: #fafbfc; |
||||
} |
||||
|
||||
::v-deep .el-badge__content { |
||||
line-height: 15px; |
||||
} |
||||
} |
||||
</style> |
||||
Loading…
Reference in new issue