页面优化 数据采集 优化 / 提示 / 提纯

This commit is contained in:
lmy
2026-10-22 16:51:18 +08:00
parent 46be7346a2
commit 09b8a39ec5
43 changed files with 3027 additions and 362 deletions
+133 -11
View File
@@ -1,26 +1,50 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { computed, onMounted, ref } from 'vue'
import { ElMessage } from 'element-plus'
import {
listDataset,
listGovernanceJobs,
previewHints,
runHint,
runMerge,
runOptimize,
runPurify,
type DatasetItem,
type DefectItem,
type DuplicateItem,
type GovernanceHint,
type GovernanceJob
} from '@/api/governance'
import { governStatusLabel, governStatusTagType } from '@/constants/dict'
const loading = ref(false)
const running = ref('')
const jobs = ref<GovernanceJob[]>([])
const hintReport = ref<GovernanceHint>({
duplicateGroupCount: 0,
defectCount: 0,
duplicateGroups: [],
defects: []
})
const dataset = ref<DatasetItem[]>([])
const actions = [
{ type: 'MERGE', title: '聚同', desc: '将不同来源、不同媒体类型的同一文献元数据聚合为一条,并标注来源。', fn: runMerge },
{ type: 'OPTIMIZE', title: '优化', desc: '整合聚同文献的不同描述元数据,生成质量更高、要素更完整的元数据。', fn: runOptimize },
{ type: 'HINT', title: '提示', desc: '生成疑似同一文献提示清单、疑似元数据错漏提示清单。', fn: runHint },
{ type: 'PURIFY', title: '提纯', desc: '将相关纸电图书数据从全部图书数据中提取出来,形成版本资源数据集。', fn: runPurify }
{ type: 'MERGE', title: '聚同', desc: '将不同来源、不同媒体类型的同一文献元数据聚合为一条,并标注来源。' },
{ type: 'OPTIMIZE', title: '优化', desc: '整合聚同文献的不同描述元数据,生成质量更高、要素更完整的元数据。' },
{ type: 'HINT', title: '提示', desc: '生成疑似同一文献提示清单、疑似元数据错漏提示清单。' },
{ type: 'PURIFY', title: '提纯', desc: '将相关纸电图书数据从全部图书数据中提取出来,形成版本资源数据集。' }
]
const duplicateRows = computed(() => {
const rows: Array<DuplicateItem & { reason: string }> = []
for (const group of hintReport.value.duplicateGroups || []) {
for (const record of group.records || []) {
rows.push({ ...record, reason: group.reason })
}
}
return rows
})
async function fetchJobs() {
loading.value = true
try {
@@ -30,11 +54,33 @@ async function fetchJobs() {
}
}
async function loadHints() {
hintReport.value = await previewHints()
}
async function loadDataset() {
dataset.value = await listDataset()
}
async function handleRun(action: (typeof actions)[number]) {
running.value = action.type
try {
const job = await action.fn()
ElMessage.success(`${action.title}完成:${job.resultSummary || ''}`)
if (action.type === 'HINT') {
hintReport.value = await runHint()
ElMessage.success(hintReport.value.job?.resultSummary || '提示完成')
} else if (action.type === 'MERGE') {
const job = await runMerge()
ElMessage.success(`${action.title}完成:${job.resultSummary || ''}`)
await loadHints()
} else if (action.type === 'OPTIMIZE') {
const job = await runOptimize()
ElMessage.success(`${action.title}完成:${job.resultSummary || ''}`)
await loadHints()
} else {
const job = await runPurify()
ElMessage.success(`${action.title}完成:${job.resultSummary || ''}`)
await loadDataset()
}
fetchJobs()
} finally {
running.value = ''
@@ -48,14 +94,30 @@ function statusTag(status?: string) {
return 'info'
}
onMounted(fetchJobs)
function issueText(row: DefectItem) {
return (row.issues || []).join(';')
}
onMounted(async () => {
await fetchJobs()
try {
await loadHints()
} catch {
// 错误已由响应拦截器提示
}
try {
await loadDataset()
} catch {
// 错误已由响应拦截器提示
}
})
</script>
<template>
<div class="page-card">
<h3 class="page-title">数据治理</h3>
<el-alert
title="治理四动作:聚同 / 优化 / 提示 / 提纯"
title="建议顺序:先看提示清单,再对完全一致的重复文献执行聚同、优化,最后提纯。疑似同一文献只出清单,不自动合并。"
type="info"
:closable="false"
class="mb-16"
@@ -63,7 +125,7 @@ onMounted(fetchJobs)
<el-row :gutter="16">
<el-col v-for="a in actions" :key="a.type" :xs="24" :sm="12">
<el-card shadow="hover" class="gov-card">
<el-card shadow="hover" class="gov-card" :class="'tone-' + a.type">
<h4>{{ a.title }}</h4>
<p>{{ a.desc }}</p>
<el-button type="primary" :loading="running === a.type" @click="handleRun(a)">
@@ -73,6 +135,58 @@ onMounted(fetchJobs)
</el-col>
</el-row>
<h3 class="page-title" style="margin-top: 8px">
疑似同一文献提示清单({{ hintReport.duplicateGroupCount }} 组)
</h3>
<el-table :data="duplicateRows" border stripe empty-text="暂无疑似同一文献">
<el-table-column prop="reason" label="提示原因" min-width="280" show-overflow-tooltip />
<el-table-column prop="processNo" label="加工编号" width="140" />
<el-table-column prop="title" label="正题名" min-width="180" show-overflow-tooltip />
<el-table-column prop="author" label="责任者" width="100" />
<el-table-column prop="isbn" label="ISBN" width="170" show-overflow-tooltip />
<el-table-column prop="mediaType" label="媒体" width="80" />
<el-table-column prop="sourceLibrary" label="来源馆" min-width="160" show-overflow-tooltip />
<el-table-column label="治理状态" width="100">
<template #default="{ row }">
<el-tag :type="governStatusTagType(row.governStatus)" size="small">
{{ governStatusLabel(row.governStatus) }}
</el-tag>
</template>
</el-table-column>
</el-table>
<h3 class="page-title" style="margin-top: 20px">
疑似元数据错漏提示清单({{ hintReport.defectCount }} 条)
</h3>
<el-table :data="hintReport.defects" border stripe empty-text="暂无疑似错漏">
<el-table-column prop="processNo" label="加工编号" width="140" />
<el-table-column prop="title" label="正题名" min-width="180" show-overflow-tooltip />
<el-table-column prop="author" label="责任者" width="100" />
<el-table-column prop="sourceLibrary" label="来源馆" min-width="160" show-overflow-tooltip />
<el-table-column prop="mediaType" label="媒体" width="80" />
<el-table-column label="错漏说明" min-width="280" show-overflow-tooltip>
<template #default="{ row }">{{ issueText(row) }}</template>
</el-table-column>
</el-table>
<h3 class="page-title" style="margin-top: 20px">版本资源数据集({{ dataset.length }} 条)</h3>
<el-table :data="dataset" border stripe empty-text="尚未提纯">
<el-table-column prop="processNo" label="加工编号" width="140" />
<el-table-column prop="title" label="正题名" min-width="200" show-overflow-tooltip />
<el-table-column prop="author" label="责任者" width="100" />
<el-table-column prop="mediaType" label="媒体" width="80" />
<el-table-column prop="contentForm" label="内容形式" width="100" />
<el-table-column prop="sourceLibrary" label="来源馆" min-width="160" show-overflow-tooltip />
<el-table-column prop="publishYear" label="出版年份" width="100" />
<el-table-column label="治理状态" width="100">
<template #default="{ row }">
<el-tag :type="governStatusTagType(row.governStatus)" size="small">
{{ governStatusLabel(row.governStatus) }}
</el-tag>
</template>
</el-table-column>
</el-table>
<h3 class="page-title" style="margin-top: 20px">治理任务历史</h3>
<el-table v-loading="loading" :data="jobs" border stripe>
<el-table-column type="index" label="#" width="50" />
@@ -92,16 +206,24 @@ onMounted(fetchJobs)
<style scoped lang="scss">
.gov-card {
margin-bottom: 16px;
border-top: 3px solid var(--brand-primary);
h4 {
margin: 0 0 8px;
font-family: var(--font-serif);
letter-spacing: 1px;
}
p {
font-size: 13px;
color: #909399;
color: var(--text-muted);
min-height: 38px;
margin: 0 0 12px;
}
}
.tone-MERGE { border-top-color: var(--brand-primary-deep); }
.tone-OPTIMIZE { border-top-color: var(--brand-gold); }
.tone-HINT { border-top-color: var(--brand-primary); }
.tone-PURIFY { border-top-color: var(--brand-gold-deep); }
</style>