TaskResultNotice.vue 1.4 KB

123456789101112131415161718192021222324252627282930
  1. <script setup lang="ts">
  2. import { computed } from 'vue'
  3. import SystemMessageNotice from '@/components/messages/SystemMessageNotice.vue'
  4. const props = defineProps<{
  5. content: string
  6. taskReference: { conversationId: string; taskId: string }
  7. }>()
  8. const lines = computed(() => props.content
  9. .split(/\r?\n/)
  10. .map(line => line.trim())
  11. .filter(line => line && !/^\[打开任务\]\(/.test(line)))
  12. const waitingForReview = computed(() => props.content.includes('等待管理员复核'))
  13. const title = computed(() => waitingForReview.value ? '任务已有新结果' : props.content.includes('已完成') ? '任务已完成' : '任务状态已更新')
  14. const context = computed(() => {
  15. const match = lines.value[0]?.match(/^「([^」]+)」的任务「([^」]+)」/)
  16. return match ? `${match[1]} · ${match[2]}` : lines.value[0] || '团队交付任务'
  17. })
  18. const supporting = computed(() => {
  19. if (waitingForReview.value) return '等待管理员复核后继续'
  20. return lines.value.slice(1).join(' ') || '打开任务查看完整交付与验收状态'
  21. })
  22. const href = computed(() => `/conversations/${encodeURIComponent(props.taskReference.conversationId)}?taskId=${encodeURIComponent(props.taskReference.taskId)}`)
  23. </script>
  24. <template>
  25. <SystemMessageNotice class="task-result-notice" :title="title" :icon="waitingForReview ? 'file' : 'check'" :href="href" :accessible-label="`${title},${context},${supporting},打开任务`" />
  26. </template>