Browse Source

fix(前端): 反馈看板时间列统一 formatDate 格式化

- 反馈看板「时间」列改用 formatDate 输出 YYYY-MM-DD HH:mm:ss,空值显示 -
- 提示词追踪移除重复的 fmtDateTime 内联实现,复用统一 formatDate
- 反馈看板新增「补充说明」列及消息详情补充说明展示
master
wanghanlin 6 days ago
parent
commit
60d336d384
  1. 12
      frontend/src/views/FeedbackOps.vue
  2. 9
      frontend/src/views/PromptTracePanel.vue

12
frontend/src/views/FeedbackOps.vue

@ -23,6 +23,10 @@
<t-tag v-if="row.reasonCategory" theme="warning" variant="light">{{ reasonLabel(row.reasonCategory) }}</t-tag>
<span v-else>-</span>
</template>
<template #reasonComment="{ row }">
<span v-if="row.reasonComment" :title="row.reasonComment" style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:inline-block;">{{ truncate(row.reasonComment, 40) }}</span>
<span v-else>-</span>
</template>
<template #processed="{ row }">
<t-tag :theme="row.processed ? 'success' : 'default'" variant="light">{{ row.processed ? '已处理' : '待处理' }}</t-tag>
</template>
@ -57,6 +61,9 @@
<span v-if="msg.feedback.reasonCategory"> · {{ reasonLabel(msg.feedback.reasonCategory) }}</span>
</t-tag>
</div>
<div v-if="msg.feedback && msg.feedback.reasonComment" class="msg-comment">
💬 补充说明{{ msg.feedback.reasonComment }}
</div>
<div class="msg-body" v-html="msg.messageType === 'ASSISTANT' ? renderMarkdown(msg.content) : msg.content"></div>
</div>
</div>
@ -90,6 +97,7 @@ import { getCategoryTree } from '@/api/category'
import { useConfirm } from '@/composables/useConfirm'
import { toast } from '@/utils/toast'
import { renderMarkdown } from '@/utils/markdown'
import { formatDate } from '@/utils/format'
const { confirm } = useConfirm()
@ -127,10 +135,11 @@ const processedOptions = [
const columns = [
{ colKey: 'feedbackType', title: '反馈', width: 90, cell: 'feedbackType' },
{ colKey: 'reasonCategory', title: '原因', width: 80, cell: 'reasonCategory' },
{ colKey: 'reasonComment', title: '补充说明', width: 160, ellipsis: true, cell: 'reasonComment' },
{ colKey: 'userQuestion', title: '用户问题', width: 200, ellipsis: true, cell: 'userQuestion' },
{ colKey: 'assistantAnswer', title: 'AI 回复', width: 200, ellipsis: true, cell: 'assistantAnswer' },
{ colKey: 'processed', title: '状态', width: 70, cell: 'processed' },
{ colKey: 'feedbackTime', title: '时间', width: 150 },
{ colKey: 'feedbackTime', title: '时间', width: 150, cell: (_: any, { row }: any) => formatDate(row.feedbackTime) },
{ colKey: 'op', title: '操作', width: 240, cell: 'op' },
]
@ -309,6 +318,7 @@ async function submitFaqAction() {
.msg-assistant { background: var(--color-bg-subtle); }
.msg-system { background: var(--color-warning-bg); }
.msg-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.msg-comment { font-size: 12px; color: var(--color-text-secondary, #666); background: var(--color-warning-bg); border-radius: 6px; padding: 6px 10px; margin-bottom: 6px; white-space: pre-wrap; word-break: break-word; }
.msg-body { font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.dialog-footer { margin-top: 16px; display: flex; justify-content: flex-end; gap: 8px; }
</style>

9
frontend/src/views/PromptTracePanel.vue

@ -594,20 +594,15 @@ function trendTimeRange(): { startTime?: string; endTime?: string } {
const end = new Date()
if (trendRange.value === '24h') {
const start = new Date(end.getTime() - 24 * 3600 * 1000)
return { startTime: fmtDateTime(start), endTime: fmtDateTime(end) }
return { startTime: formatDate(start), endTime: formatDate(end) }
}
if (trendRange.value === '7d') {
const start = new Date(end.getTime() - 7 * 24 * 3600 * 1000)
return { startTime: fmtDateTime(start), endTime: fmtDateTime(end) }
return { startTime: formatDate(start), endTime: formatDate(end) }
}
return {}
}
function fmtDateTime(d: Date): string {
const p = (n: number) => String(n).padStart(2, '0')
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}`
}
async function loadTrend() {
trendLoading.value = true
try {

Loading…
Cancel
Save