|
|
@ -38,6 +38,7 @@ |
|
|
<t-button size="small" variant="text" theme="primary" @click="createFaqFromRow(row)" v-if="row.feedbackType === 'THUMBS_UP'">生成 FAQ</t-button> |
|
|
<t-button size="small" variant="text" theme="primary" @click="createFaqFromRow(row)" v-if="row.feedbackType === 'THUMBS_UP'">生成 FAQ</t-button> |
|
|
<t-button size="small" variant="text" theme="warning" @click="openFaqAction(row)" v-if="row.feedbackType === 'THUMBS_DOWN'">关联 FAQ</t-button> |
|
|
<t-button size="small" variant="text" theme="warning" @click="openFaqAction(row)" v-if="row.feedbackType === 'THUMBS_DOWN'">关联 FAQ</t-button> |
|
|
<t-button size="small" variant="text" v-if="!row.processed" @click="markHandled(row)">标记已处理</t-button> |
|
|
<t-button size="small" variant="text" v-if="!row.processed" @click="markHandled(row)">标记已处理</t-button> |
|
|
|
|
|
<t-button size="small" variant="text" theme="danger" @click="removeFeedback(row)">删除</t-button> |
|
|
</t-space> |
|
|
</t-space> |
|
|
</template> |
|
|
</template> |
|
|
</t-table> |
|
|
</t-table> |
|
|
@ -83,12 +84,15 @@ |
|
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
<script setup lang="ts"> |
|
|
import { ref, onMounted, computed } from 'vue' |
|
|
import { ref, onMounted, computed } from 'vue' |
|
|
import { listFeedbackConversations, getFeedbackMessages, markFeedbackProcessed } from '@/api/feedback' |
|
|
|
|
|
|
|
|
import { listFeedbackConversations, getFeedbackMessages, markFeedbackProcessed, deleteFeedback } from '@/api/feedback' |
|
|
import { listFaqs, createFaqFromFeedback, appendFaqFromFeedback, editFaqFromFeedback } from '@/api/faq' |
|
|
import { listFaqs, createFaqFromFeedback, appendFaqFromFeedback, editFaqFromFeedback } from '@/api/faq' |
|
|
import { getCategoryTree } from '@/api/category' |
|
|
import { getCategoryTree } from '@/api/category' |
|
|
|
|
|
import { useConfirm } from '@/composables/useConfirm' |
|
|
import { toast } from '@/utils/toast' |
|
|
import { toast } from '@/utils/toast' |
|
|
import { renderMarkdown } from '@/utils/markdown' |
|
|
import { renderMarkdown } from '@/utils/markdown' |
|
|
|
|
|
|
|
|
|
|
|
const { confirm } = useConfirm() |
|
|
|
|
|
|
|
|
const filterFeedbackType = ref(''); const filterReasonCategory = ref(''); const filterProcessed = ref(''); const filterDate = ref('') |
|
|
const filterFeedbackType = ref(''); const filterReasonCategory = ref(''); const filterProcessed = ref(''); const filterDate = ref('') |
|
|
const feedbacks = ref<any[]>([]); const loading = ref(false) |
|
|
const feedbacks = ref<any[]>([]); const loading = ref(false) |
|
|
const page = ref(1); const pageSize = ref(20); const total = ref(0) |
|
|
const page = ref(1); const pageSize = ref(20); const total = ref(0) |
|
|
@ -227,6 +231,17 @@ async function markHandled(row: any) { |
|
|
} catch (e: any) { toast('操作失败:' + e.message, 'error') } |
|
|
} catch (e: any) { toast('操作失败:' + e.message, 'error') } |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async function removeFeedback(row: any) { |
|
|
|
|
|
const fbId = row.feedbackId || row.feedback_id |
|
|
|
|
|
if (!fbId) { toast('未找到反馈记录', 'error'); return } |
|
|
|
|
|
if (!await confirm('确认删除该反馈记录?')) return |
|
|
|
|
|
try { |
|
|
|
|
|
const r = await deleteFeedback(fbId) |
|
|
|
|
|
if (r.success) { toast('删除成功', 'success'); loadList(page.value) } |
|
|
|
|
|
else toast(r.message || '删除失败', 'error') |
|
|
|
|
|
} catch (e: any) { toast('删除失败:' + e.message, 'error') } |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
function createFaqFromRow(row: any) { |
|
|
function createFaqFromRow(row: any) { |
|
|
// 预填问题来自后端 SQL 中的 user_question / userQuestion 字段名 |
|
|
// 预填问题来自后端 SQL 中的 user_question / userQuestion 字段名 |
|
|
faqModal.value = { |
|
|
faqModal.value = { |
|
|
|