unis-oa/frontend/src/components/oa/TaskVanishedCard.vue

60 lines
2.4 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<!-- 点开一条已经不存在的待办:这一屏要说清"它怎么没的、现在归谁、还要不要我管",
而不是只丢一句"已被处理"。文案在 utils/taskVanished.ts,桌面与手机版式读同一份。 -->
<div class="rounded-lg border border-gray-200 bg-gray-50 px-4 py-4 dark:border-dark-700 dark:bg-dark-900/40">
<div class="flex items-start gap-3">
<span class="mt-0.5 flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg bg-white dark:bg-dark-800">
<Icon :name="notice.icon" class="h-4 w-4 text-gray-500 dark:text-dark-300" />
</span>
<div class="min-w-0 flex-1">
<h3 class="text-sm font-semibold text-gray-900 dark:text-dark-100">
{{ t(notice.titleKey, notice.titleParams || {}) }}
</h3>
<p class="mt-1 truncate text-xs text-gray-500 dark:text-dark-400">
{{ vanished.title }}<span v-if="vanished.serial"> · {{ vanished.serial }}</span>
</p>
<ul class="mt-2 space-y-1">
<li
v-for="(line, index) in notice.lines"
:key="index"
class="text-xs leading-relaxed text-gray-600 dark:text-dark-300"
>
{{ t(line.key, line.params || {}) }}
</li>
</ul>
<div class="mt-3 flex flex-wrap items-center gap-2">
<RouterLink
v-if="notice.openWork"
:to="`/work/${encodeURIComponent(vanished.job)}`"
class="btn btn-primary btn-sm"
>
<Icon name="document" class="mr-1 h-4 w-4" />{{ t('task.vanishedOpenWork') }}
</RouterLink>
<slot name="actions" />
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
import type { VanishedTask } from '@/types'
import { vanishedNotice } from '@/utils/taskVanished'
import Icon from '@/components/icons/Icon.vue'
const props = defineProps<{ vanished: VanishedTask }>()
const { t } = useI18n()
// 认不出这是哪一种下场(老数据、没见过的 processing_type)时退到"已被处理"那一句
const fallback = computed(() => ({
icon: 'inbox' as const,
titleKey: 'task.taskHandled',
titleParams: undefined,
lines: [] as { key: string; params?: Record<string, string | number> }[],
openWork: Boolean(props.vanished?.job)
}))
const notice = computed(() => vanishedNotice(props.vanished) || fallback.value)
</script>