feat: 09 => add sorting functionality for task status in order and receive views
This commit is contained in:
parent
d6dcc71931
commit
199a008095
2 changed files with 58 additions and 7 deletions
|
|
@ -313,6 +313,35 @@ function taskStatusCount(index: number, id: string) {
|
|||
}
|
||||
}
|
||||
|
||||
function sortList(
|
||||
list: (RequestWork & {
|
||||
_template?: {
|
||||
id: string;
|
||||
templateName: string;
|
||||
templateStepName: string;
|
||||
step: number;
|
||||
} | null;
|
||||
taskStatus?: TaskStatus;
|
||||
})[],
|
||||
) {
|
||||
const prioritizedStatuses = new Set([
|
||||
TaskStatus.Failed,
|
||||
TaskStatus.Success,
|
||||
TaskStatus.Complete,
|
||||
TaskStatus.Redo,
|
||||
TaskStatus.Validate,
|
||||
TaskStatus.Canceled,
|
||||
]);
|
||||
|
||||
return list.sort((a, b) => {
|
||||
const aPriority =
|
||||
a.taskStatus && prioritizedStatuses.has(a.taskStatus) ? 1 : 0;
|
||||
const bPriority =
|
||||
b.taskStatus && prioritizedStatuses.has(b.taskStatus) ? 1 : 0;
|
||||
return aPriority - bPriority;
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
initTheme();
|
||||
initLang();
|
||||
|
|
@ -607,7 +636,7 @@ watch([currentFormData.value.taskStatus], () => {
|
|||
)
|
||||
"
|
||||
step-on
|
||||
:rows="list"
|
||||
:rows="sortList(list)"
|
||||
@change-all-status="(v) => handleChangeStatus(v, i)"
|
||||
v-model:selected-employee="selectedEmployee[i]"
|
||||
>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue