fix: 修复待办数据解析,调整字段显示(jobName/flowName/code),优化点击跳转

This commit is contained in:
吴红兵
2026-03-04 12:41:20 +08:00
parent e24211cd42
commit f60840bcb8

View File

@@ -46,10 +46,11 @@
@click="handleTodoClick(item)" @click="handleTodoClick(item)"
> >
<div class="todo-item-left"> <div class="todo-item-left">
<el-tag size="small" :type="getTodoType(item.priority)"> <el-tag size="small" type="primary">
{{ getPriorityText(item.priority) }} {{ item.flowName || '流程' }}
</el-tag> </el-tag>
<span class="todo-title">{{ item.title || item.taskName }}</span> <span class="todo-title">{{ item.jobName }}</span>
<span class="todo-code" v-if="item.code">({{ item.code }})</span>
</div> </div>
<div class="todo-item-right"> <div class="todo-item-right">
<span class="todo-time">{{ formatTime(item.createTime) }}</span> <span class="todo-time">{{ formatTime(item.createTime) }}</span>
@@ -185,33 +186,13 @@ const formatTime = (time: string) => {
} }
} }
// 获取待办工作优先级文本
const getPriorityText = (priority?: number) => {
const map: Record<number, string> = {
0: '普通',
1: '重要',
2: '紧急'
}
return map[priority || 0] || '普通'
}
// 获取待办工作优先级类型
const getTodoType = (priority?: number) => {
const map: Record<number, string> = {
0: 'info',
1: 'warning',
2: 'danger'
}
return map[priority || 0] || 'info'
}
// 加载待办工作 // 加载待办工作
const loadTodoList = async () => { const loadTodoList = async () => {
try { try {
todoLoading.value = true todoLoading.value = true
const res = await fetchTodoPage({ current: 1, size: 10 }) const res = await fetchTodoPage({ current: 1, size: 10 })
if (res.code === 0 && res.data) { if (res.code === 0 && res.data) {
todoList.value = res.data.rows || res.data || [] todoList.value = res.data.records || res.data.rows || res.data || []
} }
} catch (e) { } catch (e) {
console.error('加载待办工作失败:', e) console.error('加载待办工作失败:', e)
@@ -254,13 +235,15 @@ const loadMessageList = async () => {
// 点击待办项 // 点击待办项
const handleTodoClick = (item: any) => { const handleTodoClick = (item: any) => {
// 根据待办类型跳转到对应页面 // 跳转到流程处理页面
if (item.businessType) {
router.push({ router.push({
path: '/stuwork/pendingwork', path: '/jsonflow/run-job/do-job',
query: { id: item.id } query: {
}) flowInstId: item.flowInstId,
id: item.id,
runNodeId: item.runNodeId
} }
})
} }
// 点击通知公告 // 点击通知公告
@@ -435,6 +418,12 @@ onUnmounted(() => {
color: var(--el-text-color-primary); color: var(--el-text-color-primary);
} }
.todo-code {
font-size: 12px;
color: var(--el-text-color-secondary);
margin-left: 4px;
}
.todo-item-right { .todo-item-right {
display: flex; display: flex;
align-items: center; align-items: center;