fix
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
<script setup lang="ts">
|
||||
import type { Task } from "../../../generated/models";
|
||||
|
||||
type TaskItem = Task;
|
||||
|
||||
const props = defineProps<{
|
||||
item: TaskItem;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
open: [path: string];
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<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}`
|
||||
"
|
||||
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}`,
|
||||
)
|
||||
"
|
||||
>
|
||||
<template #icon>
|
||||
<van-image
|
||||
class="task-avatar"
|
||||
round
|
||||
width="36"
|
||||
height="36"
|
||||
:src="
|
||||
'employee_from' in props.item
|
||||
? ''
|
||||
: (props.item.author?.avatar_small ?? '')
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
<template #label>
|
||||
<div>
|
||||
Автор:
|
||||
{{ props.item.author?.short_name }}
|
||||
</div>
|
||||
|
||||
<div>объект строительства: {{ props.item.project_id }}</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'
|
||||
: /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'
|
||||
"
|
||||
>
|
||||
{{
|
||||
"employee_from" in props.item
|
||||
? props.item.task.deadline
|
||||
: props.item.deadline
|
||||
}}
|
||||
</van-tag>
|
||||
</template>
|
||||
</van-cell>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.task-avatar {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
:deep(.van-cell.task-row-success) {
|
||||
background: #f0fdf4;
|
||||
}
|
||||
|
||||
:deep(.van-cell.task-row-warning) {
|
||||
background: #fffbeb;
|
||||
}
|
||||
|
||||
:deep(.van-cell.task-row-danger) {
|
||||
background: #fef2f2;
|
||||
}
|
||||
|
||||
:deep(.van-cell.task-row-primary) {
|
||||
background: #eff6ff;
|
||||
}
|
||||
|
||||
:deep(.van-cell.task-row-default) {
|
||||
background: #f8fafc;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user