fix
This commit is contained in:
@@ -167,6 +167,27 @@ function itemStatus(item: Task | TaskTransfer) {
|
||||
return isTaskTransfer(item) ? item.status : item.get_status || item.status;
|
||||
}
|
||||
|
||||
function itemStatusClass(item: Task | TaskTransfer) {
|
||||
const statusClass = isTaskTransfer(item) ? item.task.status : item.get_status_class;
|
||||
return statusClass || "status-default";
|
||||
}
|
||||
|
||||
function itemStatusType(item: Task | TaskTransfer) {
|
||||
const statusClass = itemStatusClass(item);
|
||||
|
||||
if (/success|done|complete|green/i.test(statusClass)) {
|
||||
return "success";
|
||||
}
|
||||
if (/warning|pending|wait|yellow|orange/i.test(statusClass)) {
|
||||
return "warning";
|
||||
}
|
||||
if (/danger|error|red|fail/i.test(statusClass)) {
|
||||
return "danger";
|
||||
}
|
||||
|
||||
return "primary";
|
||||
}
|
||||
|
||||
function itemPath(item: Task | TaskTransfer) {
|
||||
return isTaskTransfer(item) ? `/tasks/${item.task.id}` : `/tasks/${item.id}`;
|
||||
}
|
||||
@@ -462,7 +483,9 @@ onMounted(async () => {
|
||||
{{ itemLabel(item) }}
|
||||
</template>
|
||||
<template #right-icon>
|
||||
<van-tag plain type="primary">{{ itemStatus(item) }}</van-tag>
|
||||
<van-tag plain :type="itemStatusType(item)" :class="itemStatusClass(item)">
|
||||
{{ itemStatus(item) }}
|
||||
</van-tag>
|
||||
</template>
|
||||
</van-cell>
|
||||
</van-cell-group>
|
||||
|
||||
Reference in New Issue
Block a user