支持统计筛选
This commit is contained in:
+74
@@ -0,0 +1,74 @@
|
||||
package com.banben.modules.resource.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.banben.common.Result;
|
||||
import com.banben.modules.resource.entity.ResourceSource;
|
||||
import com.banben.modules.resource.mapper.ResourceSourceMapper;
|
||||
import com.banben.modules.resource.entity.VersionResource;
|
||||
import com.banben.modules.resource.mapper.VersionResourceMapper;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 版本资源多来源管理接口。
|
||||
*
|
||||
* <p>对应检索概览页「一条结果可有多个来源,点击可下载」的能力:
|
||||
* 一条文献可挂载到多个资源库 / 来源馆,概览页据此渲染多个来源并分别下载。</p>
|
||||
*/
|
||||
@Tag(name = "版本资源-多来源管理", description = "文献多来源(资源库)的增删改查")
|
||||
@RestController
|
||||
@RequestMapping("/api/resource")
|
||||
@RequiredArgsConstructor
|
||||
public class ResourceSourceController {
|
||||
|
||||
private final ResourceSourceMapper sourceMapper;
|
||||
private final VersionResourceMapper resourceMapper;
|
||||
|
||||
@Operation(summary = "查询某条文献的全部来源(按展示顺序)")
|
||||
@GetMapping("/{id}/sources")
|
||||
public Result<List<ResourceSource>> list(@PathVariable Long id) {
|
||||
QueryWrapper<ResourceSource> w = new QueryWrapper<>();
|
||||
w.eq("resource_id", id).eq("deleted", 0).orderByAsc("sort_no");
|
||||
return Result.success(sourceMapper.selectList(w));
|
||||
}
|
||||
|
||||
@Operation(summary = "为某条文献新增一个来源")
|
||||
@PostMapping("/{id}/sources")
|
||||
public Result<Long> add(@PathVariable Long id, @RequestBody ResourceSource source) {
|
||||
VersionResource r = resourceMapper.selectById(id);
|
||||
if (r == null) {
|
||||
return Result.failed("文献不存在:" + id);
|
||||
}
|
||||
source.setId(null);
|
||||
source.setResourceId(id);
|
||||
sourceMapper.insert(source);
|
||||
return Result.success(source.getId());
|
||||
}
|
||||
|
||||
@Operation(summary = "更新某个来源")
|
||||
@PutMapping("/sources/{sourceId}")
|
||||
public Result<Void> update(@PathVariable Long sourceId, @RequestBody ResourceSource source) {
|
||||
source.setId(sourceId);
|
||||
source.setResourceId(null); // 不允许跨文献改归属
|
||||
sourceMapper.updateById(source);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@Operation(summary = "删除某个来源(逻辑删除)")
|
||||
@DeleteMapping("/sources/{sourceId}")
|
||||
public Result<Void> remove(@PathVariable Long sourceId) {
|
||||
sourceMapper.deleteById(sourceId);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.banben.modules.resource.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 版本资源多来源(一条文献可来自多个资源库 / 来源馆)。
|
||||
*
|
||||
* <p>对应招标文件检索结果概览页要求:「一条结果可有多个来源,按资源库图标+名称展示,点击可下载」。
|
||||
* 主表 {@link VersionResource} 上的 source_library / source_repo / fulltext_url 等字段作为
|
||||
* 「主来源」兜底;本表保存该文献的全部来源,概览页据此渲染多个可分别下载的来源。</p>
|
||||
*/
|
||||
@Data
|
||||
@TableName("resource_source")
|
||||
@Schema(description = "版本资源多来源")
|
||||
public class ResourceSource implements Serializable {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
@Schema(description = "来源记录主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "关联版本资源主记录ID(version_resource.id)")
|
||||
private Long resourceId;
|
||||
|
||||
@Schema(description = "来源资源库名")
|
||||
private String sourceRepo;
|
||||
|
||||
@Schema(description = "来源馆")
|
||||
private String sourceLibrary;
|
||||
|
||||
@Schema(description = "来源馆地址(IP:端口或域名)")
|
||||
private String sourceLibraryAddr;
|
||||
|
||||
@Schema(description = "全文地址(下载地址)")
|
||||
private String fulltextUrl;
|
||||
|
||||
@Schema(description = "加工编号(该来源库内的编号)")
|
||||
private String processNo;
|
||||
|
||||
@Schema(description = "媒体类型(纸质/电子,可选,便于概览页区分)")
|
||||
private String mediaType;
|
||||
|
||||
@Schema(description = "展示顺序,数值小的靠前")
|
||||
private Integer sortNo;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@TableLogic
|
||||
@Schema(description = "逻辑删除:0未删 1已删")
|
||||
private Integer deleted;
|
||||
}
|
||||
@@ -153,9 +153,17 @@ public class VersionResource implements Serializable {
|
||||
@Schema(description = "作者单位(责任者所属机构)")
|
||||
private String authorOrg;
|
||||
|
||||
@Schema(description = "来源资源库名")
|
||||
@Schema(description = "来源资源库名(主来源兜底,多来源详见 sources)")
|
||||
private String sourceRepo;
|
||||
|
||||
/**
|
||||
* 多来源列表(一条文献可来自多个资源库)。
|
||||
* 非数据库字段,由检索/细览接口按 resource_id 批量挂载,供概览页按来源展示并分别下载。
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
@Schema(description = "多来源列表:一条文献可来自多个资源库,概览页按来源图标+名称展示并可分别下载")
|
||||
private java.util.List<ResourceSource> sources;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.banben.modules.resource.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.banben.modules.resource.entity.ResourceSource;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 版本资源多来源 Mapper。
|
||||
*/
|
||||
@Mapper
|
||||
public interface ResourceSourceMapper extends BaseMapper<ResourceSource> {
|
||||
}
|
||||
+60
-3
@@ -7,7 +7,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.banben.common.PageResult;
|
||||
import com.banben.modules.admin.entity.SensitiveWord;
|
||||
import com.banben.modules.admin.mapper.SensitiveWordMapper;
|
||||
import com.banben.modules.resource.entity.ResourceSource;
|
||||
import com.banben.modules.resource.entity.VersionResource;
|
||||
import com.banben.modules.resource.mapper.ResourceSourceMapper;
|
||||
import com.banben.modules.resource.mapper.VersionResourceMapper;
|
||||
import com.banben.modules.search.dto.SearchQuery;
|
||||
import com.banben.modules.search.entity.ClcCategory;
|
||||
@@ -26,8 +28,11 @@ import org.springframework.stereotype.Service;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 检索发现服务实现。
|
||||
@@ -45,6 +50,7 @@ public class SearchServiceImpl implements SearchService {
|
||||
private static final int FACET_TOP = 20;
|
||||
|
||||
private final VersionResourceMapper resourceMapper;
|
||||
private final ResourceSourceMapper sourceMapper;
|
||||
private final SearchLogMapper searchLogMapper;
|
||||
private final ClcCategoryMapper clcCategoryMapper;
|
||||
private final SensitiveWordMapper sensitiveWordMapper;
|
||||
@@ -74,6 +80,7 @@ public class SearchServiceImpl implements SearchService {
|
||||
Page.of(query.getCurrent(), query.getSize()), wrapper);
|
||||
|
||||
SearchResultVO vo = new SearchResultVO();
|
||||
attachSources(page.getRecords());
|
||||
vo.setPage(PageResult.of(page.getRecords(), page.getTotal(), page.getCurrent(), page.getSize()));
|
||||
|
||||
// 命中但被屏蔽/下架而不展示的记录数(含管理状态口径的总数 - 实际可见总数)。
|
||||
@@ -110,7 +117,11 @@ public class SearchServiceImpl implements SearchService {
|
||||
|
||||
@Override
|
||||
public VersionResource detail(Long id) {
|
||||
return resourceMapper.selectById(id);
|
||||
VersionResource r = resourceMapper.selectById(id);
|
||||
if (r != null) {
|
||||
attachSources(List.of(r));
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -141,7 +152,9 @@ public class SearchServiceImpl implements SearchService {
|
||||
});
|
||||
}
|
||||
wrapper.orderByDesc("publish_year").last("limit " + Math.max(1, limit));
|
||||
return resourceMapper.selectList(wrapper);
|
||||
List<VersionResource> list = resourceMapper.selectList(wrapper);
|
||||
attachSources(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -149,7 +162,51 @@ public class SearchServiceImpl implements SearchService {
|
||||
QueryWrapper<VersionResource> wrapper = buildWrapper(query);
|
||||
applyOrder(wrapper, query);
|
||||
wrapper.last("limit " + Math.max(1, limit));
|
||||
return resourceMapper.selectList(wrapper);
|
||||
List<VersionResource> list = resourceMapper.selectList(wrapper);
|
||||
attachSources(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量挂载多来源:按主记录 ID 一次查出全部来源,挂到各 {@link VersionResource#sources} 上。
|
||||
*
|
||||
* <p>来源为空(旧数据未维护多来源)时,{@code sources} 保持为空列表,
|
||||
* 前端会回退到主表单来源字段展示与下载。</p>
|
||||
*/
|
||||
private void attachSources(List<VersionResource> records) {
|
||||
if (records == null || records.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
List<Long> ids = records.stream()
|
||||
.map(VersionResource::getId)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.toList();
|
||||
if (ids.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
List<ResourceSource> all = sourceMapper.selectList(
|
||||
new QueryWrapper<ResourceSource>()
|
||||
.in("resource_id", ids)
|
||||
.eq("deleted", 0)
|
||||
.orderByAsc("sort_no"));
|
||||
Map<Long, List<ResourceSource>> byRes = all.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
ResourceSource::getResourceId,
|
||||
LinkedHashMap::new,
|
||||
Collectors.toList()));
|
||||
for (VersionResource r : records) {
|
||||
r.setSources(byRes.getOrDefault(r.getId(), List.of()));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("批量挂载多来源失败(不影响主结果返回):{}", e.getMessage());
|
||||
for (VersionResource r : records) {
|
||||
if (r.getSources() == null) {
|
||||
r.setSources(List.of());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ==================== 内部方法 ====================
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
-- =====================================================================
|
||||
-- 版本资源多来源表
|
||||
-- 支持「一条文献可有多个来源,概览页按来源图标+名称展示并可分别下载」
|
||||
-- 兼容 PostgreSQL / 瀚高(HighGo)
|
||||
-- =====================================================================
|
||||
|
||||
CREATE TABLE IF NOT EXISTS resource_source
|
||||
(
|
||||
id BIGSERIAL NOT NULL PRIMARY KEY,
|
||||
resource_id BIGINT NOT NULL,
|
||||
source_repo VARCHAR(256),
|
||||
source_library VARCHAR(256),
|
||||
source_library_addr VARCHAR(256),
|
||||
fulltext_url VARCHAR(1024),
|
||||
process_no VARCHAR(128),
|
||||
media_type VARCHAR(32),
|
||||
sort_no INT DEFAULT 0,
|
||||
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted SMALLINT DEFAULT 0
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_rs_resource_id ON resource_source (resource_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_rs_deleted ON resource_source (deleted);
|
||||
|
||||
COMMENT ON TABLE resource_source IS '版本资源多来源表(一条文献可来自多个资源库/来源馆)';
|
||||
COMMENT ON COLUMN resource_source.resource_id IS '关联版本资源主记录ID';
|
||||
COMMENT ON COLUMN resource_source.source_repo IS '来源资源库名';
|
||||
COMMENT ON COLUMN resource_source.fulltext_url IS '全文下载地址';
|
||||
|
||||
-- 仅在无来源数据时为样例文献补全多来源(演示用,可重复执行)
|
||||
INSERT INTO resource_source (resource_id, source_repo, source_library, source_library_addr, fulltext_url, process_no, media_type, sort_no)
|
||||
SELECT v.id, '版本资源总库', v.source_library, v.source_library_addr, v.fulltext_url, v.process_no, v.media_type, 1
|
||||
FROM version_resource v
|
||||
WHERE v.id IN (1, 2)
|
||||
AND v.deleted = 0
|
||||
AND NOT EXISTS (SELECT 1 FROM resource_source s WHERE s.resource_id = v.id AND s.deleted = 0);
|
||||
@@ -110,6 +110,31 @@ CREATE TABLE IF NOT EXISTS list_field_config
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_lfc_scene ON list_field_config (scene, sort_no);
|
||||
|
||||
-- 版本资源多来源表(一条文献可来自多个资源库/来源馆,概览页按来源展示并可分别下载)
|
||||
CREATE TABLE IF NOT EXISTS resource_source
|
||||
(
|
||||
id BIGSERIAL NOT NULL PRIMARY KEY,
|
||||
resource_id BIGINT NOT NULL, -- 关联 version_resource.id
|
||||
source_repo VARCHAR(256), -- 来源资源库名
|
||||
source_library VARCHAR(256), -- 来源馆
|
||||
source_library_addr VARCHAR(256), -- 来源馆地址 IP:端口/域名
|
||||
fulltext_url VARCHAR(1024), -- 全文地址(下载地址)
|
||||
process_no VARCHAR(128), -- 加工编号(来源库内编号)
|
||||
media_type VARCHAR(32), -- 媒体类型:纸质/电子
|
||||
sort_no INT DEFAULT 0, -- 展示顺序(小在前)
|
||||
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted SMALLINT DEFAULT 0 -- 逻辑删除 0未删 1已删
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_rs_resource_id ON resource_source (resource_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_rs_deleted ON resource_source (deleted);
|
||||
|
||||
COMMENT ON TABLE resource_source IS '版本资源多来源表(一条文献可来自多个资源库/来源馆)';
|
||||
COMMENT ON COLUMN resource_source.resource_id IS '关联版本资源主记录ID';
|
||||
COMMENT ON COLUMN resource_source.source_repo IS '来源资源库名';
|
||||
COMMENT ON COLUMN resource_source.fulltext_url IS '全文下载地址';
|
||||
|
||||
-- 样例数据
|
||||
INSERT INTO version_resource
|
||||
(id, process_no, title, clc_code, keywords, summary, publish_year, process_date,
|
||||
@@ -132,3 +157,13 @@ ON CONFLICT (id) DO NOTHING;
|
||||
-- 同步自增序列起点,避免与样例数据主键冲突
|
||||
SELECT setval('version_resource_id_seq', GREATEST(COALESCE((SELECT MAX(id) FROM version_resource), 0), 1), true);
|
||||
SELECT setval('special_resource_id_seq', GREATEST(COALESCE((SELECT MAX(id) FROM special_resource), 0), 1), true);
|
||||
|
||||
-- 多来源演示数据:每条文献可归属多个资源库,概览页按来源图标+名称展示并可分别下载
|
||||
INSERT INTO resource_source (resource_id, source_repo, source_library, source_library_addr, fulltext_url, process_no, media_type, sort_no)
|
||||
VALUES
|
||||
(1, '版本资源总库', '陆军步兵学院图书馆', '10.0.0.11:8080', 'http://cdio.example.org/fulltext/BB-2026-0001', 'BB-2026-0001', '纸质', 1),
|
||||
(1, '军事理论特色库', '国防大学图书馆', '10.0.0.31:8080', 'http://cdio.example.org/fulltext/BB-2026-0001-dx', 'BB-2026-0001-DX', '电子', 2),
|
||||
(2, '版本资源总库', '南京某院校图书馆', '10.0.0.21:8080', 'http://cdio.example.org/fulltext/BB-2026-0002', 'BB-2026-0002', '电子', 1),
|
||||
(2, '电子图书镜像库', '西安某院校图书馆', '10.0.0.41:8080', 'http://cdio.example.org/fulltext/BB-2026-0002-mirror', 'BB-2026-0002-MIRROR', '电子', 2);
|
||||
|
||||
SELECT setval('resource_source_id_seq', GREATEST(COALESCE((SELECT MAX(id) FROM resource_source), 0), 1), true);
|
||||
|
||||
@@ -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