feat: 新增呈缴管理功能与检索筛选优化
This commit is contained in:
@@ -20,6 +20,8 @@ export interface VersionResource {
|
||||
taskYear?: string
|
||||
sourceLibrary?: string
|
||||
sourceLibraryAddr?: string
|
||||
/** 来源资源库名 */
|
||||
sourceRepo?: string
|
||||
fulltextUrl?: string
|
||||
otherTitle?: string
|
||||
author?: string
|
||||
|
||||
@@ -19,7 +19,11 @@ export interface SearchQuery extends ResourceQuery {
|
||||
cdoi?: string
|
||||
/** 多个中图分类号,前方一致,任一命中即可(中图法树导航点选部类时传其下所有大类) */
|
||||
clcCodes?: string[]
|
||||
/** 语种分组:chi 中文文献 / foreign 外文文献(首页前置筛选用) */
|
||||
languageGroup?: 'chi' | 'foreign'
|
||||
sourceLibraries?: string[]
|
||||
/** 来源馆(单选,左侧「来源院校」分面点选用) */
|
||||
sourceLibrary?: string
|
||||
publishYearStart?: string
|
||||
publishYearEnd?: string
|
||||
matchType?: 'EQ' | 'LEFT' | 'RIGHT' | 'LIKE'
|
||||
@@ -47,6 +51,10 @@ export interface SearchResultVO {
|
||||
clcFacets: FacetItem[]
|
||||
yearStats: YearStat[]
|
||||
costMs: number
|
||||
/** 检索词命中敏感词库,结果已被屏蔽 */
|
||||
sensitiveBlocked?: boolean
|
||||
/** 命中但被屏蔽/下架而不展示的记录数 */
|
||||
maskedCount?: number
|
||||
}
|
||||
|
||||
/** 统一检索(初级检索) */
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import request from './request'
|
||||
import type { PageResult } from './types'
|
||||
|
||||
/**
|
||||
* 特藏推荐展示项
|
||||
@@ -32,6 +33,16 @@ export function getRecommend(limit = 8) {
|
||||
return request.get<never, SpecialRecommendItem[]>('/special/recommend', { params: { limit } })
|
||||
}
|
||||
|
||||
/** 特藏推荐分页列表 */
|
||||
export function pageRecommend(params: { current: number; size: number }) {
|
||||
return request.get<never, PageResult<SpecialRecommendItem>>('/special/recommend/page', { params })
|
||||
}
|
||||
|
||||
/** 特藏细览(special_resource 手工特藏表,查不到时 data 为 null) */
|
||||
export function getSpecialDetail(id: number) {
|
||||
return request.get<never, SpecialResource | null>(`/special/${id}`)
|
||||
}
|
||||
|
||||
export interface SpecialResource {
|
||||
id?: number
|
||||
name: string
|
||||
|
||||
@@ -106,11 +106,21 @@ const fieldToSearchField: Record<string, string> = {
|
||||
出版机构: '出版社'
|
||||
}
|
||||
|
||||
/** 前置筛选 → 检索参数:纸质/电子单勾才限媒体类型,中文/外文单勾才限语种组(同时勾选 = 不限) */
|
||||
function doSearch() {
|
||||
router.push({
|
||||
path: '/search',
|
||||
query: { keyword: keyword.value, field: fieldToSearchField[field.value] || '综合' }
|
||||
})
|
||||
const q: Record<string, string> = {
|
||||
keyword: keyword.value,
|
||||
field: fieldToSearchField[field.value] || '综合'
|
||||
}
|
||||
const media = types.value.filter((t) => t === '纸质图书' || t === '电子图书')
|
||||
if (media.length === 1) {
|
||||
q.mediaType = media[0] === '纸质图书' ? '纸质' : '电子'
|
||||
}
|
||||
const lang = types.value.filter((t) => t === '中文文献' || t === '外文文献')
|
||||
if (lang.length === 1) {
|
||||
q.languageGroup = lang[0] === '中文文献' ? 'chi' : 'foreign'
|
||||
}
|
||||
router.push({ path: '/search', query: q })
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
@@ -26,6 +26,13 @@ import {
|
||||
type SensitiveHit,
|
||||
type SensitiveWord,
|
||||
} from '@/api/admin'
|
||||
import {
|
||||
acceptDeposit,
|
||||
pageDeposit,
|
||||
rejectDeposit,
|
||||
type DepositQuery,
|
||||
type DepositRecord
|
||||
} from '@/api/deposit'
|
||||
|
||||
// ==================== 敏感词库 ====================
|
||||
const wordQuery = reactive({ current: 1, size: 10, keyword: '' })
|
||||
@@ -370,12 +377,57 @@ async function resetFields() {
|
||||
ElMessage.success('已恢复默认配置')
|
||||
}
|
||||
|
||||
// ==================== 呈缴管理 ====================
|
||||
const depositLoading = ref(false)
|
||||
const depositList = ref<DepositRecord[]>([])
|
||||
const depositTotal = ref(0)
|
||||
const depositQuery = reactive<DepositQuery>({ current: 1, size: 20, orgName: '', status: '' })
|
||||
|
||||
async function fetchDeposits() {
|
||||
depositLoading.value = true
|
||||
try {
|
||||
const res = await pageDeposit(depositQuery)
|
||||
depositList.value = res.records || []
|
||||
depositTotal.value = res.total || 0
|
||||
} finally {
|
||||
depositLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDepositAudit(row: DepositRecord, accepted: boolean) {
|
||||
const { value } = await ElMessageBox.prompt(
|
||||
accepted ? '确认接收该呈缴?' : '请输入退回原因',
|
||||
accepted ? '接收确认' : '退回',
|
||||
{ inputPlaceholder: '审核意见(可选)', confirmButtonText: '确定', cancelButtonText: '取消' }
|
||||
)
|
||||
if (accepted) {
|
||||
await acceptDeposit(row.id as number, value)
|
||||
} else {
|
||||
await rejectDeposit(row.id as number, value)
|
||||
}
|
||||
ElMessage.success('操作成功')
|
||||
fetchDeposits()
|
||||
}
|
||||
|
||||
function depositStatusTag(status?: string) {
|
||||
if (status === 'ACCEPTED') return 'success'
|
||||
if (status === 'REJECTED') return 'danger'
|
||||
return 'warning'
|
||||
}
|
||||
|
||||
function depositStatusText(status?: string) {
|
||||
if (status === 'ACCEPTED') return '已接收'
|
||||
if (status === 'REJECTED') return '已退回'
|
||||
return '待审核'
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchWords()
|
||||
fetchHits()
|
||||
fetchNodes()
|
||||
fetchStats()
|
||||
fetchFields()
|
||||
fetchDeposits()
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -627,6 +679,68 @@ onMounted(() => {
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
|
||||
<!-- ==================== 呈缴管理 ==================== -->
|
||||
<el-tab-pane label="呈缴管理" name="deposit">
|
||||
<div class="toolbar">
|
||||
<el-input
|
||||
v-model="depositQuery.orgName"
|
||||
placeholder="呈缴单位名称"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
@keyup.enter="fetchDeposits"
|
||||
@clear="fetchDeposits"
|
||||
/>
|
||||
<el-select
|
||||
v-model="depositQuery.status"
|
||||
placeholder="全部状态"
|
||||
clearable
|
||||
style="width: 140px"
|
||||
@change="fetchDeposits"
|
||||
>
|
||||
<el-option label="待审核" value="PENDING" />
|
||||
<el-option label="已接收" value="ACCEPTED" />
|
||||
<el-option label="已退回" value="REJECTED" />
|
||||
</el-select>
|
||||
<el-button type="primary" @click="fetchDeposits">查询</el-button>
|
||||
</div>
|
||||
|
||||
<el-table v-loading="depositLoading" :data="depositList" border stripe>
|
||||
<el-table-column type="index" label="#" width="50" />
|
||||
<el-table-column prop="orgName" label="呈缴单位" min-width="160" show-overflow-tooltip />
|
||||
<el-table-column prop="contact" label="联系人" width="100" />
|
||||
<el-table-column prop="phone" label="联系方式" width="140" />
|
||||
<el-table-column prop="resourceTitle" label="资源名称" min-width="200" show-overflow-tooltip />
|
||||
<el-table-column prop="mediaType" label="类型" width="80" />
|
||||
<el-table-column label="状态" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="depositStatusTag(row.status)" size="small">
|
||||
{{ depositStatusText(row.status) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="提交时间" width="170" />
|
||||
<el-table-column label="操作" width="150" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<template v-if="row.status === 'PENDING'">
|
||||
<el-button link type="success" size="small" @click="handleDepositAudit(row, true)">接收</el-button>
|
||||
<el-button link type="danger" size="small" @click="handleDepositAudit(row, false)">退回</el-button>
|
||||
</template>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-pagination
|
||||
class="pager"
|
||||
background
|
||||
layout="total, prev, pager, next"
|
||||
:total="depositTotal"
|
||||
v-model:current-page="depositQuery.current"
|
||||
v-model:page-size="depositQuery.size"
|
||||
@current-change="fetchDeposits"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
<!-- 敏感词 新增/编辑 弹窗 -->
|
||||
|
||||
@@ -1,18 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage, ElMessageBox, type FormInstance, type FormRules } from 'element-plus'
|
||||
import {
|
||||
acceptDeposit,
|
||||
pageDeposit,
|
||||
rejectDeposit,
|
||||
submitDeposit,
|
||||
type DepositQuery,
|
||||
type DepositRecord
|
||||
} from '@/api/deposit'
|
||||
import { reactive, ref } from 'vue'
|
||||
import { ElMessage, type FormInstance, type FormRules } from 'element-plus'
|
||||
import { submitDeposit, type DepositRecord } from '@/api/deposit'
|
||||
|
||||
const activeTab = ref('submit')
|
||||
|
||||
// ---------------- 提交呈缴 ----------------
|
||||
const formRef = ref<FormInstance>()
|
||||
const submitting = ref(false)
|
||||
const form = reactive<DepositRecord>({
|
||||
@@ -44,167 +34,54 @@ async function handleSubmit() {
|
||||
submitting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------- 管理端 ----------------
|
||||
const loading = ref(false)
|
||||
const list = ref<DepositRecord[]>([])
|
||||
const total = ref(0)
|
||||
const query = reactive<DepositQuery>({ current: 1, size: 20, orgName: '', status: '' })
|
||||
|
||||
async function fetchList() {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await pageDeposit(query)
|
||||
list.value = res.records || []
|
||||
total.value = res.total || 0
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleAudit(row: DepositRecord, accepted: boolean) {
|
||||
const { value } = await ElMessageBox.prompt(
|
||||
accepted ? '确认接收该呈缴?' : '请输入退回原因',
|
||||
accepted ? '接收确认' : '退回',
|
||||
{ inputPlaceholder: '审核意见(可选)', confirmButtonText: '确定', cancelButtonText: '取消' }
|
||||
)
|
||||
if (accepted) {
|
||||
await acceptDeposit(row.id as number, value)
|
||||
} else {
|
||||
await rejectDeposit(row.id as number, value)
|
||||
}
|
||||
ElMessage.success('操作成功')
|
||||
fetchList()
|
||||
}
|
||||
|
||||
function statusTag(status?: string) {
|
||||
if (status === 'ACCEPTED') return 'success'
|
||||
if (status === 'REJECTED') return 'danger'
|
||||
return 'warning'
|
||||
}
|
||||
|
||||
function statusText(status?: string) {
|
||||
if (status === 'ACCEPTED') return '已接收'
|
||||
if (status === 'REJECTED') return '已退回'
|
||||
return '待审核'
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page-card">
|
||||
<el-tabs v-model="activeTab">
|
||||
<!-- 提交 -->
|
||||
<el-tab-pane label="提交呈缴" name="submit">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-width="110px"
|
||||
style="max-width: 720px"
|
||||
>
|
||||
<p class="section-kicker">呈缴单位</p>
|
||||
<el-form-item label="单位名称" prop="orgName">
|
||||
<el-input v-model="form.orgName" placeholder="请输入呈缴单位名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="联系人" prop="contact">
|
||||
<el-input v-model="form.contact" placeholder="请输入联系人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="联系方式" prop="phone">
|
||||
<el-input v-model="form.phone" placeholder="请输入联系电话/邮箱" />
|
||||
</el-form-item>
|
||||
<el-form-item label="邮箱">
|
||||
<el-input v-model="form.email" placeholder="请输入邮箱" />
|
||||
</el-form-item>
|
||||
<p class="section-kicker">资源信息</p>
|
||||
<el-form-item label="资源名称" prop="resourceTitle">
|
||||
<el-input v-model="form.resourceTitle" placeholder="请输入版本资源名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="媒体类型">
|
||||
<el-radio-group v-model="form.mediaType">
|
||||
<el-radio label="纸质">纸质</el-radio>
|
||||
<el-radio label="电子">电子</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="数字版文件">
|
||||
<el-upload action="#" :auto-upload="false" :limit="1">
|
||||
<el-button type="primary" plain>选择文件</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item label="简介">
|
||||
<el-input v-model="form.summary" type="textarea" :rows="3" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.remark" type="textarea" :rows="2" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" :loading="submitting" @click="handleSubmit">提交呈缴</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-tab-pane>
|
||||
|
||||
<!-- 管理 -->
|
||||
<el-tab-pane label="呈缴管理" name="admin">
|
||||
<el-form :inline="true" class="mb-16" @submit.prevent>
|
||||
<el-form-item label="单位名称">
|
||||
<el-input v-model="query.orgName" placeholder="单位名称" clearable style="width: 180px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-select v-model="query.status" placeholder="全部" clearable style="width: 130px">
|
||||
<el-option label="待审核" value="PENDING" />
|
||||
<el-option label="已接收" value="ACCEPTED" />
|
||||
<el-option label="已退回" value="REJECTED" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="fetchList">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table v-loading="loading" :data="list" border stripe>
|
||||
<el-table-column type="index" label="#" width="50" />
|
||||
<el-table-column prop="orgName" label="呈缴单位" min-width="160" show-overflow-tooltip />
|
||||
<el-table-column prop="contact" label="联系人" width="100" />
|
||||
<el-table-column prop="phone" label="联系方式" width="140" />
|
||||
<el-table-column prop="resourceTitle" label="资源名称" min-width="200" show-overflow-tooltip />
|
||||
<el-table-column prop="mediaType" label="类型" width="80" />
|
||||
<el-table-column label="状态" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="statusTag(row.status)" size="small">{{ statusText(row.status) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="提交时间" width="170" />
|
||||
<el-table-column label="操作" width="150" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<template v-if="row.status === 'PENDING'">
|
||||
<el-button link type="success" size="small" @click="handleAudit(row, true)">接收</el-button>
|
||||
<el-button link type="danger" size="small" @click="handleAudit(row, false)">退回</el-button>
|
||||
</template>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-pagination
|
||||
class="pager"
|
||||
background
|
||||
layout="total, prev, pager, next"
|
||||
:total="total"
|
||||
v-model:current-page="query.current"
|
||||
v-model:page-size="query.size"
|
||||
@current-change="fetchList"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-width="110px"
|
||||
style="max-width: 720px"
|
||||
>
|
||||
<p class="section-kicker">呈缴单位</p>
|
||||
<el-form-item label="单位名称" prop="orgName">
|
||||
<el-input v-model="form.orgName" placeholder="请输入呈缴单位名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="联系人" prop="contact">
|
||||
<el-input v-model="form.contact" placeholder="请输入联系人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="联系方式" prop="phone">
|
||||
<el-input v-model="form.phone" placeholder="请输入联系电话/邮箱" />
|
||||
</el-form-item>
|
||||
<el-form-item label="邮箱">
|
||||
<el-input v-model="form.email" placeholder="请输入邮箱" />
|
||||
</el-form-item>
|
||||
<p class="section-kicker">资源信息</p>
|
||||
<el-form-item label="资源名称" prop="resourceTitle">
|
||||
<el-input v-model="form.resourceTitle" placeholder="请输入版本资源名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="媒体类型">
|
||||
<el-radio-group v-model="form.mediaType">
|
||||
<el-radio label="纸质">纸质</el-radio>
|
||||
<el-radio label="电子">电子</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="数字版文件">
|
||||
<el-upload action="#" :auto-upload="false" :limit="1">
|
||||
<el-button type="primary" plain>选择文件</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item label="简介">
|
||||
<el-input v-model="form.summary" type="textarea" :rows="3" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.remark" type="textarea" :rows="2" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" :loading="submitting" @click="handleSubmit">提交呈缴</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.pager {
|
||||
margin-top: 16px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -9,44 +9,17 @@ const router = useRouter()
|
||||
const loading = ref(false)
|
||||
const list = ref<FacetItem[]>([])
|
||||
|
||||
/** 书籍类补充热词(value 即词云权重,数值越大字号越大) */
|
||||
const bookWords: FacetItem[] = [
|
||||
{ name: '雕版印刷', value: 80 },
|
||||
{ name: '活字本', value: 70 },
|
||||
{ name: '四库全书', value: 65 },
|
||||
{ name: '永乐大典', value: 60 },
|
||||
{ name: '稿抄校本', value: 55 },
|
||||
{ name: '家谱方志', value: 50 },
|
||||
{ name: '中华再造善本', value: 45 },
|
||||
{ name: '敦煌遗书', value: 40 },
|
||||
{ name: '版本鉴定', value: 38 },
|
||||
{ name: '金石拓片', value: 36 },
|
||||
{ name: '丛书集成', value: 34 },
|
||||
{ name: '汲古阁', value: 32 },
|
||||
{ name: '诗文集', value: 30 },
|
||||
{ name: '线装书', value: 28 },
|
||||
{ name: '藏书楼', value: 26 },
|
||||
{ name: '批校本', value: 24 },
|
||||
{ name: '蝴蝶装', value: 22 },
|
||||
{ name: '藏书印', value: 20 },
|
||||
{ name: '经折装', value: 18 },
|
||||
{ name: '孤本', value: 16 },
|
||||
{ name: '天一阁', value: 16 },
|
||||
{ name: '政书', value: 14 },
|
||||
{ name: '舆图', value: 14 },
|
||||
{ name: '题跋', value: 12 },
|
||||
{ name: '珍本', value: 12 },
|
||||
{ name: '类书', value: 10 },
|
||||
{ name: '书院', value: 10 }
|
||||
]
|
||||
/** 词云数据:全部来自后端真实统计(检索日志 + 元数据关键词),value 为热度 */
|
||||
const cloudWords = computed<[string, number][]>(() =>
|
||||
list.value.map((k) => [k.name, Number(k.value) || 1])
|
||||
)
|
||||
|
||||
/** 真实热词权重最高(版本、古籍等),其后接书籍类热词 */
|
||||
const cloudWords = computed<[string, number][]>(() => {
|
||||
const api = [...list.value].sort((a, b) => b.value - a.value)
|
||||
const seen = new Set(api.map((k) => k.name))
|
||||
const out: [string, number][] = api.map((k, i) => [k.name, Math.max(80, 120 - i * 10)])
|
||||
bookWords.filter((w) => !seen.has(w.name)).forEach((w) => out.push([w.name, w.value]))
|
||||
return out
|
||||
/** 热度值域(字号归一化用) */
|
||||
const weightRange = computed(() => {
|
||||
const vals = cloudWords.value.map((w) => w[1])
|
||||
const max = Math.max(...vals, 1)
|
||||
const min = Math.min(...vals, max)
|
||||
return { min, max }
|
||||
})
|
||||
|
||||
const totalCount = computed(() =>
|
||||
@@ -58,7 +31,6 @@ const cloudRef = ref<HTMLDivElement | null>(null)
|
||||
const stageRef = ref<HTMLDivElement | null>(null)
|
||||
|
||||
const FONT_FAMILY = '"Microsoft YaHei", "PingFang SC", sans-serif'
|
||||
const MAX_WEIGHT = 120
|
||||
|
||||
function render() {
|
||||
const host = cloudRef.value
|
||||
@@ -68,12 +40,13 @@ function render() {
|
||||
// 重新生成:先清空上一次渲染出的 span
|
||||
host.innerHTML = ''
|
||||
|
||||
// 字号按真实热度归一化:最高热度约 61px,最低约 18px
|
||||
const { min, max } = weightRange.value
|
||||
WordCloud.stop()
|
||||
WordCloud(host, {
|
||||
list: cloudWords.value.slice(),
|
||||
gridSize: 9,
|
||||
// 权重 120 → 约 61px,权重 10 → 约 20px
|
||||
weightFactor: (size: number) => 17 + 44 * (size / MAX_WEIGHT),
|
||||
weightFactor: (size: number) => (min === max ? 32 : 18 + 43 * ((size - min) / (max - min))),
|
||||
fontFamily: FONT_FAMILY,
|
||||
fontWeight: 'bold',
|
||||
color: (word: string) => cloudColor(word),
|
||||
@@ -152,7 +125,7 @@ function go(keyword: string) {
|
||||
<div v-if="cloudWords.length" class="stat">
|
||||
<span class="num">{{ cloudWords.length }}</span>
|
||||
<span class="unit">个热词</span>
|
||||
<em>累计检索 {{ totalCount }} 次</em>
|
||||
<em>累计热度 {{ totalCount }}</em>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ const costMs = ref(0)
|
||||
const mediaFacets = ref<FacetItem[]>([])
|
||||
const libraryFacets = ref<FacetItem[]>([])
|
||||
const clcFacets = ref<FacetItem[]>([])
|
||||
/** 命中但被屏蔽/下架而不展示的记录数 */
|
||||
const maskedCount = ref(0)
|
||||
|
||||
/** 中图法分类树(部类 -> 大类 -> 类目),带当前检索条件下的命中数量 */
|
||||
const clcNodes = ref<ClcNode[]>([])
|
||||
@@ -138,9 +140,13 @@ async function doSearch() {
|
||||
rows.value = res.page?.records || []
|
||||
total.value = res.page?.total || 0
|
||||
costMs.value = res.costMs || 0
|
||||
maskedCount.value = res.maskedCount || 0
|
||||
mediaFacets.value = res.mediaTypeFacets || []
|
||||
libraryFacets.value = res.sourceLibraryFacets || []
|
||||
clcFacets.value = res.clcFacets || []
|
||||
if (res.sensitiveBlocked) {
|
||||
ElMessage.warning('检索词命中敏感词库,结果已被屏蔽')
|
||||
}
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
@@ -176,6 +182,13 @@ function clearClc() {
|
||||
doSearch()
|
||||
}
|
||||
|
||||
/** 清除前置筛选条件(媒体类型 / 语种分组) */
|
||||
function clearCond(key: 'mediaType' | 'languageGroup') {
|
||||
query[key] = undefined
|
||||
query.current = 1
|
||||
doSearch()
|
||||
}
|
||||
|
||||
/** 点选中图法节点:部类传其下所有大类号,大类/类目传自身号(前方一致) */
|
||||
function pickClc(node: ClcNode, codes: string[]) {
|
||||
const same = selectedClc.value === node.code
|
||||
@@ -344,6 +357,19 @@ async function openDetail(row: VersionResource) {
|
||||
similar.value = await getSimilar(row.id as number, 6)
|
||||
}
|
||||
|
||||
/**
|
||||
* 来源资源库原始细览页地址:按来源库地址 + 加工编号拼接。
|
||||
* 演示规则为 http://{来源库地址}/resource/{加工编号},无来源库地址时回退全文地址。
|
||||
*/
|
||||
function originalUrl(r: VersionResource): string {
|
||||
if (r.sourceLibraryAddr && r.processNo) {
|
||||
const addr = r.sourceLibraryAddr.trim()
|
||||
const base = addr.startsWith('http') ? addr : `http://${addr}`
|
||||
return `${base}/resource/${encodeURIComponent(r.processNo.trim())}`
|
||||
}
|
||||
return r.fulltextUrl || ''
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
const kw = route.query.keyword as string
|
||||
const f = route.query.field as string
|
||||
@@ -351,6 +377,15 @@ onMounted(() => {
|
||||
if (f && fields.includes(f)) {
|
||||
field.value = f
|
||||
}
|
||||
// 主页「前置筛选」勾选带来的条件:媒体类型 + 语种分组
|
||||
const mt = route.query.mediaType as string
|
||||
if (mt === '纸质' || mt === '电子') {
|
||||
query.mediaType = mt
|
||||
}
|
||||
const lg = route.query.languageGroup as string
|
||||
if (lg === 'chi' || lg === 'foreign') {
|
||||
query.languageGroup = lg
|
||||
}
|
||||
// 检索条件为空时也执行检索 → 后端返回全部版本资源
|
||||
input.value = kw || ''
|
||||
fetchListFields()
|
||||
@@ -405,7 +440,16 @@ watch(
|
||||
|
||||
<section class="list">
|
||||
<div class="toolbar">
|
||||
<div class="count">共 <b>{{ total }}</b> 条,耗时 {{ costMs }} ms<template v-if="selectedCount">,已勾选 <b>{{ selectedCount }}</b> 条</template></div>
|
||||
<div class="count">
|
||||
共 <b>{{ total }}</b> 条,耗时 {{ costMs }} ms<template v-if="selectedCount">,已勾选 <b>{{ selectedCount }}</b> 条</template>
|
||||
<el-tag v-if="maskedCount" type="warning" effect="plain" size="small" class="cond-tag">
|
||||
已隐藏 {{ maskedCount }} 条被屏蔽/下架的记录
|
||||
</el-tag>
|
||||
<el-tag v-if="query.mediaType" class="cond-tag" size="small" closable @close="clearCond('mediaType')">{{ query.mediaType }}</el-tag>
|
||||
<el-tag v-if="query.languageGroup" class="cond-tag" size="small" closable @close="clearCond('languageGroup')">
|
||||
{{ query.languageGroup === 'chi' ? '中文文献' : '外文文献' }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<div class="ops">
|
||||
<el-checkbox
|
||||
:model-value="rows.length > 0 && rows.every((r) => selectedIds.has(r.id as number))"
|
||||
@@ -491,16 +535,34 @@ watch(
|
||||
<el-descriptions-item label="媒体类型">{{ detail.mediaType || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="中图分类">{{ detail.clcCode || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="来源院校">{{ detail.sourceLibrary || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="来源资源库">{{ detail.sourceRepo || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="关键词">{{ detail.keywords || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="摘要">{{ detail.summary || '-' }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<!-- 原始细览页跳转 + 文献直接下载 -->
|
||||
<div style="margin: 14px 0">
|
||||
<el-button
|
||||
v-if="originalUrl(detail)"
|
||||
tag="a"
|
||||
:href="originalUrl(detail)"
|
||||
target="_blank"
|
||||
>
|
||||
{{ detail.sourceRepo ? `进入${detail.sourceRepo}原始页` : '查看来源库原始页' }}
|
||||
</el-button>
|
||||
<el-button v-else disabled>暂无来源库地址</el-button>
|
||||
<el-button v-if="detail.fulltextUrl" type="primary" tag="a" :href="detail.fulltextUrl" target="_blank">下载全文</el-button>
|
||||
<el-button v-else type="primary" disabled>暂无全文地址</el-button>
|
||||
</div>
|
||||
|
||||
<!-- 相似文献推荐:点击切换到该文献的细览 -->
|
||||
<div v-if="similar.length" class="sim">
|
||||
<div class="side-title">相似文献推荐</div>
|
||||
<div v-for="s in similar" :key="s.id" class="sim-item" @click="openDetail(s)">{{ s.title }}</div>
|
||||
<div v-for="s in similar" :key="s.id" class="sim-item" @click="openDetail(s)">
|
||||
<span class="sim-t">{{ s.title }}</span>
|
||||
<span v-if="s.author" class="sim-meta">{{ s.author }}</span>
|
||||
<span v-if="s.publishYear" class="sim-meta">{{ s.publishYear }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-drawer>
|
||||
@@ -587,6 +649,7 @@ watch(
|
||||
margin-bottom: 10px;
|
||||
|
||||
.count { font-size: 13px; color: #6b7280; }
|
||||
.cond-tag { margin-left: 8px; }
|
||||
.ops { display: flex; align-items: center; gap: 10px; }
|
||||
}
|
||||
|
||||
@@ -695,5 +758,36 @@ watch(
|
||||
:deep(.el-pagination__jump) { margin-left: 12px; }
|
||||
}
|
||||
.dt { margin: 0 0 12px; font-size: 17px; }
|
||||
.sim-item { font-size: 13px; padding: 6px 0; border-bottom: 1px dashed #eee; cursor: pointer; }
|
||||
/* 相似文献推荐条目:题名 + 责任者/年份,整行可点 */
|
||||
.sim-item {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 10px;
|
||||
font-size: 13px;
|
||||
padding: 7px 4px;
|
||||
border-bottom: 1px dashed #eee;
|
||||
cursor: pointer;
|
||||
border-radius: 4px;
|
||||
transition: background 0.2s;
|
||||
|
||||
&:hover {
|
||||
background: var(--brand-light, #f3f7f4);
|
||||
.sim-t { color: var(--brand-primary); }
|
||||
}
|
||||
|
||||
.sim-t {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.sim-meta {
|
||||
flex: none;
|
||||
color: #8b93a1;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,16 +1,26 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { Download } from '@element-plus/icons-vue'
|
||||
import { getResource, updateSpecialFlag } from '@/api/resource'
|
||||
import { getRecommend, removeSpecial as removeSpecialResource, type SpecialRecommendItem } from '@/api/special'
|
||||
import {
|
||||
getSpecialDetail,
|
||||
pageRecommend,
|
||||
removeSpecial as removeSpecialResource,
|
||||
type SpecialRecommendItem
|
||||
} from '@/api/special'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const loading = ref(false)
|
||||
const list = ref<SpecialRecommendItem[]>([])
|
||||
|
||||
/** 分页参数与总数 */
|
||||
const query = reactive({ current: 1, size: 5 })
|
||||
const total = ref(0)
|
||||
|
||||
interface Detail {
|
||||
title: string
|
||||
note?: string
|
||||
@@ -41,7 +51,14 @@ function urlOf(it: SpecialRecommendItem) {
|
||||
async function fetchList() {
|
||||
loading.value = true
|
||||
try {
|
||||
list.value = (await getRecommend(20)) || []
|
||||
const res = await pageRecommend({ current: query.current, size: query.size })
|
||||
list.value = res.records || []
|
||||
total.value = res.total || 0
|
||||
// 删除/翻页后当前页可能为空,回退到前一页
|
||||
if (!list.value.length && query.current > 1) {
|
||||
query.current--
|
||||
await fetchList()
|
||||
}
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
@@ -112,11 +129,61 @@ onMounted(async () => {
|
||||
await fetchList()
|
||||
// 从首页书架点书进来:自动打开对应特藏的详情
|
||||
const id = route.query.id
|
||||
if (id) {
|
||||
const target = list.value.find((it) => String(it.id) === String(id))
|
||||
if (target) openDetail(target)
|
||||
if (!id) return
|
||||
const target = list.value.find((it) => String(it.id) === String(id))
|
||||
if (target) {
|
||||
openDetail(target)
|
||||
} else {
|
||||
// 目标可能在其它分页:按 id 直接补拉详情弹窗
|
||||
await openDetailById(String(id))
|
||||
}
|
||||
// 清掉 URL 参数,避免刷新时重复弹窗
|
||||
router.replace({ query: { ...route.query, id: undefined } })
|
||||
})
|
||||
|
||||
/**
|
||||
* 按 id 补拉特藏详情(当前分页找不到时兜底):
|
||||
* 先查 special_resource 手工特藏表,查不到再按 version_resource 处理。
|
||||
*/
|
||||
async function openDetailById(id: string) {
|
||||
if (!id) return
|
||||
// 1) special_resource 手工维护的特藏(/special/{id} 查不到时 data 为 null)
|
||||
try {
|
||||
const s = await getSpecialDetail(Number(id))
|
||||
if (s && s.name) {
|
||||
openDetail({
|
||||
id: s.id,
|
||||
name: s.name,
|
||||
summary: s.summary,
|
||||
coverUrl: s.coverUrl,
|
||||
ebookUrl: s.ebookUrl,
|
||||
source: 'MANUAL'
|
||||
})
|
||||
return
|
||||
}
|
||||
} catch {
|
||||
/* 继续按 version_resource 尝试 */
|
||||
}
|
||||
// 2) version_resource 中标记为特藏的资源
|
||||
try {
|
||||
const r = await getResource(id)
|
||||
if (r && r.title) {
|
||||
openDetail({
|
||||
id: Number(id),
|
||||
title: r.title,
|
||||
note: r.note,
|
||||
author: r.author,
|
||||
publishYear: r.publishYear,
|
||||
fulltextUrl: r.fulltextUrl,
|
||||
source: 'VERSION'
|
||||
})
|
||||
return
|
||||
}
|
||||
} catch {
|
||||
/* 忽略 */
|
||||
}
|
||||
ElMessage.warning('未找到对应特藏资源')
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -157,6 +224,18 @@ onMounted(async () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 分页 -->
|
||||
<el-pagination
|
||||
v-if="total > query.size"
|
||||
class="pager"
|
||||
background
|
||||
layout="total, prev, pager, next"
|
||||
:total="total"
|
||||
:page-size="query.size"
|
||||
v-model:current-page="query.current"
|
||||
@current-change="fetchList"
|
||||
/>
|
||||
|
||||
<!-- 细览弹窗 -->
|
||||
<el-dialog v-model="dialogVisible" :title="current?.title || '特藏细览'" width="620px">
|
||||
<template v-if="current">
|
||||
@@ -209,6 +288,12 @@ onMounted(async () => {
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
/* 分页条 */
|
||||
.pager {
|
||||
margin-top: 20px;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.special-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
Reference in New Issue
Block a user