czh-20260709-增加进行中逾期任务数量显示

This commit is contained in:
zhihao
2026-07-09 11:12:00 +08:00
parent cb882df5bc
commit 178748c899
3 changed files with 18 additions and 7 deletions
@@ -97,7 +97,7 @@
</template> </template>
<template v-else> <template v-else>
<a-tag class="feedback-expand-count" color="warning">未开始 {{ getFeedbackStatusCount(record).notStarted }}</a-tag> <a-tag class="feedback-expand-count" color="warning">未开始 {{ getFeedbackStatusCount(record).notStarted }}</a-tag>
<a-tag class="feedback-expand-count" color="error">进行中 {{ getFeedbackStatusCount(record).inProgress }}</a-tag> <a-tag class="feedback-expand-count" color="error">进行中 {{ getFeedbackStatusCount(record).inProgress }}已逾期 {{ getFeedbackStatusCount(record).overdue }}</a-tag>
<a-tag class="feedback-expand-count" color="success">已完成 {{ getFeedbackStatusCount(record).completed }}</a-tag> <a-tag class="feedback-expand-count" color="success">已完成 {{ getFeedbackStatusCount(record).completed }}</a-tag>
<a-tag class="feedback-expand-count">( {{ getFeedbackStatusCount(record).total }} )</a-tag> <a-tag class="feedback-expand-count">( {{ getFeedbackStatusCount(record).total }} )</a-tag>
</template> </template>
@@ -327,7 +327,7 @@
} }
function getFeedbackStatusCount(record: Recordable) { function getFeedbackStatusCount(record: Recordable) {
return countFeedbackStatus(getFeedbackTableData(record), 'bpmStatus'); return countFeedbackStatus(getFeedbackTableData(record), 'bpmStatus', 'planTime');
} }
function clearFeedbackTableData() { function clearFeedbackTableData() {
+2 -2
View File
@@ -97,7 +97,7 @@
</template> </template>
<template v-else> <template v-else>
<a-tag class="feedback-expand-count" color="warning">未开始 {{ getFeedbackStatusCount(record).notStarted }}</a-tag> <a-tag class="feedback-expand-count" color="warning">未开始 {{ getFeedbackStatusCount(record).notStarted }}</a-tag>
<a-tag class="feedback-expand-count" color="error">进行中 {{ getFeedbackStatusCount(record).inProgress }}</a-tag> <a-tag class="feedback-expand-count" color="error">进行中 {{ getFeedbackStatusCount(record).inProgress }}已逾期 {{ getFeedbackStatusCount(record).overdue }}</a-tag>
<a-tag class="feedback-expand-count" color="success">已完成 {{ getFeedbackStatusCount(record).completed }}</a-tag> <a-tag class="feedback-expand-count" color="success">已完成 {{ getFeedbackStatusCount(record).completed }}</a-tag>
<a-tag class="feedback-expand-count">( {{ getFeedbackStatusCount(record).total }} )</a-tag> <a-tag class="feedback-expand-count">( {{ getFeedbackStatusCount(record).total }} )</a-tag>
</template> </template>
@@ -275,7 +275,7 @@
} }
function getFeedbackStatusCount(record: Recordable) { function getFeedbackStatusCount(record: Recordable) {
return countFeedbackStatus(getFeedbackTableData(record), 'bpmStatus'); return countFeedbackStatus(getFeedbackTableData(record), 'bpmStatus', 'planTime');
} }
function clearFeedbackTableData() { function clearFeedbackTableData() {
+14 -3
View File
@@ -3,20 +3,31 @@ export interface FeedbackStatusCount {
inProgress: number; inProgress: number;
completed: number; completed: number;
total: number; total: number;
overdue: number;
} }
export function countFeedbackStatus( export function countFeedbackStatus(
list: Recordable[] | undefined | null, list: Recordable[] | undefined | null,
statusField: string, statusField: string,
dateField?: string,
): FeedbackStatusCount { ): FeedbackStatusCount {
const result: FeedbackStatusCount = { notStarted: 0, inProgress: 0, completed: 0, total: 0 }; const result: FeedbackStatusCount = { notStarted: 0, inProgress: 0, completed: 0, total: 0, overdue: 0 };
if (!Array.isArray(list)) return result; if (!Array.isArray(list)) return result;
result.total = list.length; result.total = list.length;
const today = new Date();
today.setHours(0, 0, 0, 0);
for (const item of list) { for (const item of list) {
const v = String(item?.[statusField] ?? ''); const v = String(item?.[statusField] ?? '');
if (v === '1') result.notStarted++; if (v === '1') result.notStarted++;
else if (v === '2') result.inProgress++; else if (v === '2') {
else if (v === '3') result.completed++; result.inProgress++;
if (dateField) {
const planTime = item?.[dateField];
if (planTime && new Date(planTime) < today) {
result.overdue++;
}
}
} else if (v === '3') result.completed++;
} }
return result; return result;
} }