feat: 知识管理加更新时间列;趋势管理待补筛选+统计+AI批量补齐人话解读接口
This commit is contained in:
@@ -21,6 +21,9 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="viewCount" label="浏览" width="70" />
|
||||
<el-table-column label="更新时间" width="150">
|
||||
<template #default="{ row }">{{ fmt(row.updatedAt || row.createdAt) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" width="80">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.status === 'approved' ? 'success' : 'warning'" size="small">{{ STATUS[row.status] || row.status }}</el-tag>
|
||||
@@ -130,6 +133,7 @@ async function del(row) {
|
||||
try { await apiDelete(`/api/admin/knowledge/${row._id}`); ElMessage.success('已删除'); load() }
|
||||
catch (e) { ElMessage.error(e.message || '删除失败') }
|
||||
}
|
||||
function fmt(t) { return t ? new Date(t).toLocaleString('zh-CN', { hour12: false }) : '—' }
|
||||
onMounted(load)
|
||||
</script>
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
<div class="toolbar">
|
||||
<el-input v-model="q" placeholder="搜索标题" style="width: 220px" clearable @keyup.enter="search" />
|
||||
<el-button type="primary" @click="search">搜索</el-button>
|
||||
<el-button :type="missingOnly ? 'warning' : 'default'" @click="filterMissing">待补 {{ missingCount }}</el-button>
|
||||
<el-button type="success" :loading="filling" :disabled="!missingCount" @click="fillMissing">AI 补齐人话解读</el-button>
|
||||
<el-button type="success" @click="openEdit(null)">新增资讯</el-button>
|
||||
</div>
|
||||
<el-table :data="list" stripe v-loading="loading">
|
||||
@@ -18,7 +20,7 @@
|
||||
<el-table-column label="人话解读" min-width="170" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.plainExplain">{{ row.plainExplain }}<template v-if="row.takeAway"> | {{ row.takeAway }}</template></span>
|
||||
<el-tag v-else type="info" size="small">待补</el-tag>
|
||||
<el-tag v-else type="warning" size="small" style="cursor:pointer" @click="filterMissing">待补(点击筛选)</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="日期" width="110">
|
||||
@@ -65,12 +67,26 @@ const list = ref([]), total = ref(0), page = ref(1), pageSize = 20, q = ref(''),
|
||||
const dlg = ref(false)
|
||||
const form = ref({})
|
||||
function search() { page.value = 1; load() }
|
||||
const missingOnly = ref(false)
|
||||
const missingCount = ref(0)
|
||||
const filling = ref(false)
|
||||
function filterMissing() { missingOnly.value = !missingOnly.value; page.value = 1; load() }
|
||||
async function fillMissing() {
|
||||
if (!missingCount.value || filling.value) return
|
||||
filling.value = true
|
||||
try {
|
||||
const r = await apiPost('/api/admin/trends/fill-plain', {})
|
||||
ElMessage.success(`已补齐 ${r.filled || 0} 条人话解读`)
|
||||
load()
|
||||
} catch (e) { ElMessage.error(e.message || '补齐失败') } finally { filling.value = false }
|
||||
}
|
||||
async function load() {
|
||||
loading.value = true
|
||||
try {
|
||||
const r = await apiGet(`/api/admin/trends?page=${page.value}&limit=${pageSize}&keyword=${encodeURIComponent(q.value)}`)
|
||||
const r = await apiGet(`/api/admin/trends?page=${page.value}&limit=${pageSize}&keyword=${encodeURIComponent(q.value)}${missingOnly.value ? '&missing=1' : ''}`)
|
||||
list.value = r.items || []
|
||||
total.value = r.pagination?.total || 0
|
||||
missingCount.value = r.missingCount ?? 0
|
||||
} finally { loading.value = false }
|
||||
}
|
||||
function openEdit(row) {
|
||||
|
||||
Reference in New Issue
Block a user