fix: 修复两个问题
1. 已完成任务卡片添加点击事件 - 点击卡片可打开详情抽屉 - 显示交付路径和商品ID功能 2. 修复标签页数量初始化问题 - loadAllTabCounts并行加载所有Tab数量统计 - 包括:可接任务、进行中、待审核、已完成、我发起的 - 页面加载时自动显示正确数量
This commit is contained in:
parent
571388f414
commit
2687906aa1
@ -1115,6 +1115,8 @@
|
||||
v-for="task in completedTaskList"
|
||||
:key="task.id"
|
||||
class="task-card chart-card completed"
|
||||
@click="handleTaskClick(task)"
|
||||
style="cursor: pointer;"
|
||||
>
|
||||
<!-- 任务标题 -->
|
||||
<div class="task-header">
|
||||
@ -3945,33 +3947,74 @@ const getTaskStatusText = (status: string, task?: any) => {
|
||||
// 加载所有Tab的数量统计
|
||||
const loadAllTabCounts = async () => {
|
||||
try {
|
||||
// 加载进行中任务数量
|
||||
const inProgressRes = await taskApi.getTasks({
|
||||
status: 'in_progress',
|
||||
role: 'receiver',
|
||||
page: 1,
|
||||
pageSize: 1
|
||||
})
|
||||
if (inProgressRes.data && inProgressRes.data.total !== undefined) {
|
||||
inProgressTotal.value = inProgressRes.data.total
|
||||
}
|
||||
|
||||
// 加载待审核任务数量
|
||||
const reviewRes = await taskApi.getAllPendingApprovalTasks({
|
||||
page: 1,
|
||||
pageSize: 1
|
||||
})
|
||||
if (reviewRes.data && reviewRes.data.total !== undefined) {
|
||||
reviewTotal.value = reviewRes.data.total
|
||||
}
|
||||
|
||||
// 加载待我审核任务数量(仅部门负责人)
|
||||
// 并行加载所有Tab的数量统计
|
||||
const promises: Promise<any>[] = []
|
||||
|
||||
// 1. 可接任务数量
|
||||
promises.push(
|
||||
taskApi.getTaskHall({ page: 1, pageSize: 1 }).then(res => {
|
||||
if (res.data && res.data.total !== undefined) {
|
||||
total.value = res.data.total
|
||||
}
|
||||
}).catch(() => {})
|
||||
)
|
||||
|
||||
// 2. 进行中任务数量
|
||||
promises.push(
|
||||
taskApi.getTasks({
|
||||
status: 'in_progress',
|
||||
role: 'receiver',
|
||||
page: 1,
|
||||
pageSize: 1
|
||||
}).then(res => {
|
||||
if (res.data && res.data.total !== undefined) {
|
||||
inProgressTotal.value = res.data.total
|
||||
}
|
||||
}).catch(() => {})
|
||||
)
|
||||
|
||||
// 3. 待审核任务数量(所有人可见)
|
||||
promises.push(
|
||||
taskApi.getAllPendingApprovalTasks({
|
||||
page: 1,
|
||||
pageSize: 1
|
||||
}).then(res => {
|
||||
if (res.data && res.data.total !== undefined) {
|
||||
reviewTotal.value = res.data.total
|
||||
}
|
||||
}).catch(() => {})
|
||||
)
|
||||
|
||||
// 4. 已完成任务数量
|
||||
promises.push(
|
||||
taskApi.getCompletedTasks({ page: 1, pageSize: 1 }).then(res => {
|
||||
if (res.data && res.data.total !== undefined) {
|
||||
completedTotal.value = res.data.total
|
||||
}
|
||||
}).catch(() => {})
|
||||
)
|
||||
|
||||
// 5. 我发起的任务数量
|
||||
promises.push(
|
||||
taskApi.getMyTasks({ role: 'publisher', page: 1, pageSize: 1 }).then(res => {
|
||||
if (res.code === 200 && res.data && res.data.total !== undefined) {
|
||||
publishedTotal.value = res.data.total
|
||||
}
|
||||
}).catch(() => {})
|
||||
)
|
||||
|
||||
// 6. 待我审核任务数量(仅部门负责人)
|
||||
if (isDepartmentLeader.value) {
|
||||
const pendingApprovalRes = await taskApi.getPendingApprovalTasks()
|
||||
if (pendingApprovalRes.code === 200) {
|
||||
pendingApprovalTotal.value = (pendingApprovalRes.data || []).length
|
||||
}
|
||||
promises.push(
|
||||
taskApi.getPendingApprovalTasks().then(res => {
|
||||
if (res.code === 200) {
|
||||
pendingApprovalTotal.value = (res.data || []).length
|
||||
}
|
||||
}).catch(() => {})
|
||||
)
|
||||
}
|
||||
|
||||
await Promise.all(promises)
|
||||
} catch (error) {
|
||||
console.error('加载Tab数量统计失败:', error)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user