支持统计筛选
This commit is contained in:
@@ -40,6 +40,28 @@ export interface VersionResource {
|
||||
isSpecial?: number
|
||||
/** 附注 */
|
||||
note?: string
|
||||
/** 多来源列表:一条文献可来自多个资源库,概览页按来源图标+名称展示并可分别下载 */
|
||||
sources?: ResourceSource[]
|
||||
}
|
||||
|
||||
/** 版本资源多来源(一条文献可来自多个资源库/来源馆) */
|
||||
export interface ResourceSource {
|
||||
id?: number
|
||||
resourceId?: number
|
||||
/** 来源资源库名 */
|
||||
sourceRepo?: string
|
||||
/** 来源馆 */
|
||||
sourceLibrary?: string
|
||||
/** 来源馆地址(IP:端口或域名) */
|
||||
sourceLibraryAddr?: string
|
||||
/** 全文下载地址 */
|
||||
fulltextUrl?: string
|
||||
/** 加工编号(来源库内编号) */
|
||||
processNo?: string
|
||||
/** 媒体类型:纸质/电子 */
|
||||
mediaType?: string
|
||||
/** 展示顺序,数值小的靠前 */
|
||||
sortNo?: number
|
||||
}
|
||||
|
||||
export interface ResourceQuery {
|
||||
|
||||
@@ -5,7 +5,7 @@ import { ElMessage } from 'element-plus'
|
||||
import * as XLSX from 'xlsx'
|
||||
import { listFields, type ListFieldConfig } from '@/api/admin'
|
||||
import { getSearchDetail, getSimilar, unifiedSearch, searchList, clcTree, type ClcNode, type FacetItem, type SearchQuery } from '@/api/search'
|
||||
import type { VersionResource } from '@/api/resource'
|
||||
import type { VersionResource, ResourceSource } from '@/api/resource'
|
||||
import ClcTree from './ClcTree.vue'
|
||||
|
||||
const route = useRoute()
|
||||
@@ -398,6 +398,44 @@ function originalUrl(r: VersionResource): string {
|
||||
return r.fulltextUrl || ''
|
||||
}
|
||||
|
||||
/**
|
||||
* 取某条文献的来源列表。
|
||||
* 优先用后端挂载的多来源 sources;旧数据未维护多来源时,
|
||||
* 用主表单的单个来源字段兜底成一条,保证概览页始终能展示与下载。
|
||||
*/
|
||||
function toSources(row?: VersionResource): ResourceSource[] {
|
||||
if (!row) return []
|
||||
if (row.sources && row.sources.length) return row.sources
|
||||
if (row.sourceRepo || row.sourceLibrary || row.fulltextUrl) {
|
||||
return [
|
||||
{
|
||||
sourceRepo: row.sourceRepo,
|
||||
sourceLibrary: row.sourceLibrary,
|
||||
sourceLibraryAddr: row.sourceLibraryAddr,
|
||||
fulltextUrl: row.fulltextUrl,
|
||||
processNo: row.processNo,
|
||||
mediaType: row.mediaType
|
||||
} as ResourceSource
|
||||
]
|
||||
}
|
||||
return []
|
||||
}
|
||||
|
||||
/** 单来源的原始细览页地址(按来源馆地址 + 加工编号拼接) */
|
||||
function sourceOriginalUrl(src?: ResourceSource): string {
|
||||
if (src?.sourceLibraryAddr && src.processNo) {
|
||||
const addr = src.sourceLibraryAddr.trim()
|
||||
const base = addr.startsWith('http') ? addr : `http://${addr}`
|
||||
return `${base}/resource/${encodeURIComponent(src.processNo.trim())}`
|
||||
}
|
||||
return src?.fulltextUrl || ''
|
||||
}
|
||||
|
||||
/** 下拉「选择来源下载」:新开标签打开对应来源全文地址 */
|
||||
function openSource(u?: string) {
|
||||
if (u) window.open(u, '_blank')
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
const kw = route.query.keyword as string
|
||||
const f = route.query.field as string
|
||||
@@ -550,6 +588,44 @@ watch(
|
||||
<span class="snippet-label">{{ s.label }}:</span>
|
||||
<span v-html="s.html"></span>
|
||||
</div>
|
||||
<!-- 多来源:按资源库图标+名称展示,点击可下载;多个来源时提供「选择来源下载」 -->
|
||||
<div v-if="toSources(r).length" class="srcs" @click.stop>
|
||||
<span class="srcs-k">来源</span>
|
||||
<a
|
||||
v-for="(src, i) in toSources(r)"
|
||||
:key="src.id || src.fulltextUrl || i"
|
||||
class="src-chip"
|
||||
:href="src.fulltextUrl"
|
||||
target="_blank"
|
||||
:title="`下载全文 · ${src.sourceLibrary || src.sourceRepo || '未知来源'}`"
|
||||
>
|
||||
<el-icon :size="13"><Reading /></el-icon>
|
||||
<span class="src-name">{{ src.sourceRepo || src.sourceLibrary || '未知来源' }}</span>
|
||||
<span v-if="src.mediaType" class="src-mt">{{ src.mediaType }}</span>
|
||||
</a>
|
||||
<el-dropdown
|
||||
v-if="toSources(r).length > 1"
|
||||
trigger="click"
|
||||
class="src-dd"
|
||||
@command="openSource"
|
||||
>
|
||||
<el-button size="small" type="primary" plain>
|
||||
选择来源下载<el-icon><ArrowDown /></el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item
|
||||
v-for="(src, i) in toSources(r)"
|
||||
:key="src.id || src.fulltextUrl || i"
|
||||
:command="src.fulltextUrl"
|
||||
>
|
||||
{{ src.sourceRepo || src.sourceLibrary || '未知来源' }}
|
||||
<span v-if="src.mediaType">({{ src.mediaType }})</span>
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -611,19 +687,25 @@ watch(
|
||||
<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 class="src-list-title">
|
||||
来源({{ toSources(detail).length }})<span class="src-list-sub">可分别选择来源下载</span>
|
||||
</div>
|
||||
<div v-for="(src, i) in toSources(detail)" :key="src.id || src.fulltextUrl || i" class="src-row">
|
||||
<span class="src-row-name">
|
||||
<el-icon :size="15"><Reading /></el-icon>
|
||||
{{ src.sourceRepo || src.sourceLibrary || '未知来源' }}
|
||||
<span v-if="src.sourceLibrary && src.sourceRepo" class="src-row-lib">· {{ src.sourceLibrary }}</span>
|
||||
<span v-if="src.mediaType" class="src-row-mt">{{ src.mediaType }}</span>
|
||||
</span>
|
||||
<span class="src-row-ops">
|
||||
<el-button v-if="sourceOriginalUrl(src)" link type="primary" tag="a" :href="sourceOriginalUrl(src)" target="_blank">原始页</el-button>
|
||||
<el-button v-if="src.fulltextUrl" type="primary" tag="a" :href="src.fulltextUrl" target="_blank">下载全文</el-button>
|
||||
<span v-else class="src-none">无全文</span>
|
||||
</span>
|
||||
</div>
|
||||
<el-empty v-if="!toSources(detail).length" description="暂无来源与全文" :image-size="56" />
|
||||
</div>
|
||||
|
||||
<!-- 相似文献推荐:点击切换到该文献的细览 -->
|
||||
@@ -891,4 +973,117 @@ watch(
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 概览页卡片多来源:资源库图标 + 名称,点击可下载 */
|
||||
.srcs {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin-top: 8px;
|
||||
|
||||
.srcs-k {
|
||||
flex: none;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: #8b93a1;
|
||||
}
|
||||
|
||||
.src-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
max-width: 240px;
|
||||
padding: 2px 9px;
|
||||
border: 1px solid var(--card-border);
|
||||
border-radius: 12px;
|
||||
background: var(--brand-light, #f3f7f4);
|
||||
color: var(--brand-primary, #2f6b4f);
|
||||
font-size: 12px;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
transition: background 0.15s, box-shadow 0.15s;
|
||||
|
||||
&:hover {
|
||||
background: #e6f0ea;
|
||||
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
|
||||
}
|
||||
|
||||
.src-name {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.src-mt {
|
||||
flex: none;
|
||||
color: #9aa3b2;
|
||||
font-size: 11px;
|
||||
}
|
||||
}
|
||||
|
||||
.src-dd {
|
||||
flex: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* 细览页来源列表 */
|
||||
.src-list-title {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #5b6472;
|
||||
margin-bottom: 8px;
|
||||
|
||||
.src-list-sub {
|
||||
margin-left: 6px;
|
||||
font-weight: 400;
|
||||
font-size: 12px;
|
||||
color: #9aa3b2;
|
||||
}
|
||||
}
|
||||
|
||||
.src-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
padding: 8px 10px;
|
||||
border: 1px solid var(--card-border);
|
||||
border-radius: var(--radius-sm);
|
||||
margin-bottom: 8px;
|
||||
|
||||
.src-row-name {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
min-width: 0;
|
||||
font-size: 13px;
|
||||
color: #1f2937;
|
||||
font-weight: 600;
|
||||
|
||||
.src-row-lib {
|
||||
color: #8b93a1;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.src-row-mt {
|
||||
flex: none;
|
||||
color: #9aa3b2;
|
||||
font-size: 11px;
|
||||
font-weight: 400;
|
||||
}
|
||||
}
|
||||
|
||||
.src-row-ops {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex: none;
|
||||
}
|
||||
|
||||
.src-none {
|
||||
font-size: 12px;
|
||||
color: #b6bcc7;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user