fix
This commit is contained in:
@@ -15,23 +15,14 @@ const emit = defineEmits<{
|
||||
<template>
|
||||
<van-cell
|
||||
:title="
|
||||
'employee_from' in props.item
|
||||
? props.item.task.text?.trim() || `Задача #${props.item.task.id}`
|
||||
: props.item.text?.trim() ||
|
||||
props.item.result?.trim() ||
|
||||
`Задача #${props.item.id}`
|
||||
props.item.text?.trim() ||
|
||||
props.item.result?.trim() ||
|
||||
`Задача #${props.item.id}`
|
||||
"
|
||||
center
|
||||
is-link
|
||||
:class="`task-row task-row-${/success|done|complete|green/i.test('employee_from' in props.item ? props.item.task.status : props.item.get_status_class || 'status-default') ? 'success' : /warning|pending|wait|yellow|orange/i.test('employee_from' in props.item ? props.item.task.status : props.item.get_status_class || 'status-default') ? 'warning' : /danger|error|red|fail/i.test('employee_from' in props.item ? props.item.task.status : props.item.get_status_class || 'status-default') ? 'danger' : 'primary'}`"
|
||||
@click="
|
||||
emit(
|
||||
'open',
|
||||
'employee_from' in props.item
|
||||
? `/tasks/${props.item.task.id}`
|
||||
: `/tasks/${props.item.id}`,
|
||||
)
|
||||
"
|
||||
:class="`task-row task-row-${/success|done|complete|green/i.test(props.item.get_status_class || 'status-default') ? 'success' : /warning|pending|wait|yellow|orange/i.test(props.item.get_status_class || 'status-default') ? 'warning' : /danger|error|red|fail/i.test(props.item.get_status_class || 'status-default') ? 'danger' : 'primary'}`"
|
||||
@click="emit('open', `/tasks/${props.item.id}`)"
|
||||
>
|
||||
<template #icon>
|
||||
<van-image
|
||||
@@ -52,38 +43,24 @@ const emit = defineEmits<{
|
||||
{{ props.item.author?.short_name }}
|
||||
</div>
|
||||
|
||||
<div>объект строительства: {{ props.item.project_id }}</div>
|
||||
<div>объект строительства: {{ props.item.project }}</div>
|
||||
</template>
|
||||
<template #right-icon>
|
||||
<van-tag
|
||||
plain
|
||||
:type="
|
||||
/success|done|complete|green/i.test(
|
||||
'employee_from' in props.item
|
||||
? props.item.task.status
|
||||
: props.item.get_status_class || 'status-default',
|
||||
)
|
||||
/success|done|complete|green/i.test(props.item.get_status_class)
|
||||
? 'success'
|
||||
: /warning|pending|wait|yellow|orange/i.test(
|
||||
'employee_from' in props.item
|
||||
? props.item.task.status
|
||||
: props.item.get_status_class || 'status-default',
|
||||
props.item.get_status_class,
|
||||
)
|
||||
? 'warning'
|
||||
: /danger|error|red|fail/i.test(
|
||||
'employee_from' in props.item
|
||||
? props.item.task.status
|
||||
: props.item.get_status_class || 'status-default',
|
||||
)
|
||||
: /danger|error|red|fail/i.test(props.item.get_status_class)
|
||||
? 'danger'
|
||||
: 'primary'
|
||||
"
|
||||
>
|
||||
{{
|
||||
"employee_from" in props.item
|
||||
? props.item.task.deadline
|
||||
: props.item.deadline
|
||||
}}
|
||||
{{ props.item.deadline }}
|
||||
</van-tag>
|
||||
</template>
|
||||
</van-cell>
|
||||
|
||||
@@ -70,8 +70,8 @@ const {
|
||||
});
|
||||
|
||||
const {
|
||||
items: taskTransfers,
|
||||
loading: taskTransferLoading,
|
||||
// items: taskTransfers,
|
||||
// loading: taskTransferLoading,
|
||||
error: taskTransferError,
|
||||
load: loadTaskTransfers,
|
||||
} = useModelApi<
|
||||
@@ -103,12 +103,8 @@ const docTabs = [
|
||||
{ key: "outgoing_letter", label: "Исходящие письма" },
|
||||
] as const;
|
||||
|
||||
const visibleItems = computed(() =>
|
||||
mainTab.value === "transfer" ? taskTransfers.value : tasks.value,
|
||||
);
|
||||
const activeLoading = computed(() =>
|
||||
mainTab.value === "transfer" ? taskTransferLoading.value : taskLoading.value,
|
||||
);
|
||||
const visibleItems = computed(() => tasks.value);
|
||||
const activeLoading = computed(() => taskLoading.value);
|
||||
const showLoading = computed(() => activeLoading.value || refreshing.value);
|
||||
const showEmployeeLoading = computed(
|
||||
() =>
|
||||
@@ -130,7 +126,6 @@ function badgeValue(count: number) {
|
||||
return count > 0 ? count : undefined;
|
||||
}
|
||||
|
||||
|
||||
function buildTaskParams(
|
||||
tab: MainTabKey,
|
||||
doc: DocTabKey,
|
||||
@@ -177,7 +172,9 @@ function taskParams(): TaskListParams | TaskTransferListParams | null {
|
||||
return buildTaskParams(mainTab.value, docTab.value, employee.value.id);
|
||||
}
|
||||
|
||||
function taskCountParams(tab: MainTabKey): TaskListParams | TaskTransferListParams | null {
|
||||
function taskCountParams(
|
||||
tab: MainTabKey,
|
||||
): TaskListParams | TaskTransferListParams | null {
|
||||
if (!employee.value) {
|
||||
return null;
|
||||
}
|
||||
@@ -190,7 +187,11 @@ function docCountParams(doc: DocTabKey): TaskListParams | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
return buildTaskParams(mainTab.value, doc, employee.value.id) as TaskListParams;
|
||||
return buildTaskParams(
|
||||
mainTab.value,
|
||||
doc,
|
||||
employee.value.id,
|
||||
) as TaskListParams;
|
||||
}
|
||||
|
||||
async function loadCurrentEmployee() {
|
||||
@@ -228,7 +229,9 @@ async function reloadList() {
|
||||
await loadTasks(params as TaskListParams);
|
||||
}
|
||||
|
||||
async function countTaskItems(params: TaskListParams | TaskTransferListParams | null) {
|
||||
async function countTaskItems(
|
||||
params: TaskListParams | TaskTransferListParams | null,
|
||||
) {
|
||||
if (!params) {
|
||||
return 0;
|
||||
}
|
||||
@@ -248,7 +251,10 @@ async function reloadCounts() {
|
||||
}
|
||||
|
||||
const mainCounts = await Promise.allSettled(
|
||||
mainTabs.map(async (tab) => [tab.key, await countTaskItems(taskCountParams(tab.key))] as const),
|
||||
mainTabs.map(
|
||||
async (tab) =>
|
||||
[tab.key, await countTaskItems(taskCountParams(tab.key))] as const,
|
||||
),
|
||||
);
|
||||
mainTabCounts.value = {
|
||||
...mainTabCounts.value,
|
||||
@@ -274,7 +280,10 @@ async function reloadCounts() {
|
||||
}
|
||||
|
||||
const docCounts = await Promise.allSettled(
|
||||
docTabs.map(async (tab) => [tab.key, await countTaskItems(docCountParams(tab.key))] as const),
|
||||
docTabs.map(
|
||||
async (tab) =>
|
||||
[tab.key, await countTaskItems(docCountParams(tab.key))] as const,
|
||||
),
|
||||
);
|
||||
docTabCounts.value = {
|
||||
...docTabCounts.value,
|
||||
|
||||
Reference in New Issue
Block a user