Compare commits
2 Commits
09b8a39ec5
...
b735c1465a
| Author | SHA1 | Date | |
|---|---|---|---|
| b735c1465a | |||
| 3626939ccb |
+50
@@ -0,0 +1,50 @@
|
|||||||
|
package com.banben.modules.admin.controller;
|
||||||
|
|
||||||
|
import com.banben.common.Result;
|
||||||
|
import com.banben.modules.admin.entity.ListFieldConfig;
|
||||||
|
import com.banben.modules.admin.service.ListFieldConfigService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
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 = "后台管理-列表字段配置")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/admin/list-fields")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class ListFieldConfigController {
|
||||||
|
|
||||||
|
private final ListFieldConfigService listFieldConfigService;
|
||||||
|
|
||||||
|
@Operation(summary = "查询场景的展示字段配置(为空时返回并写入默认配置)")
|
||||||
|
@GetMapping("/{scene}")
|
||||||
|
public Result<List<ListFieldConfig>> list(@PathVariable String scene) {
|
||||||
|
return Result.success(listFieldConfigService.listScene(scene));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "全量覆盖保存展示字段配置")
|
||||||
|
@PutMapping("/{scene}")
|
||||||
|
public Result<Void> save(@PathVariable String scene, @RequestBody List<ListFieldConfig> items) {
|
||||||
|
listFieldConfigService.saveScene(scene, items);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "恢复场景默认展示字段")
|
||||||
|
@PostMapping("/{scene}/reset")
|
||||||
|
public Result<List<ListFieldConfig>> reset(@PathVariable String scene) {
|
||||||
|
return Result.success(listFieldConfigService.resetScene(scene));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package com.banben.modules.admin.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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表显示字段配置(检索结果列表展示哪些字段、显示名与顺序)。
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("list_field_config")
|
||||||
|
@Schema(description = "列表显示字段配置")
|
||||||
|
public class ListFieldConfig implements Serializable {
|
||||||
|
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "配置场景:SEARCH 检索结果列表")
|
||||||
|
private String scene;
|
||||||
|
|
||||||
|
@Schema(description = "字段键,对应 VersionResource 的驼峰属性名")
|
||||||
|
private String fieldKey;
|
||||||
|
|
||||||
|
@Schema(description = "列表与导出时的显示名")
|
||||||
|
private String fieldLabel;
|
||||||
|
|
||||||
|
@Schema(description = "展示顺序,数值小的靠前")
|
||||||
|
private Integer sortNo;
|
||||||
|
|
||||||
|
@Schema(description = "是否显示:1显示 0隐藏")
|
||||||
|
private Integer visible;
|
||||||
|
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
@TableLogic
|
||||||
|
private Integer deleted;
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package com.banben.modules.admin.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.banben.modules.admin.entity.ListFieldConfig;
|
||||||
|
|
||||||
|
/** 列表显示字段配置 Mapper。 */
|
||||||
|
public interface ListFieldConfigMapper extends BaseMapper<ListFieldConfig> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.banben.modules.admin.service;
|
||||||
|
|
||||||
|
import com.banben.modules.admin.entity.ListFieldConfig;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表显示字段配置服务。
|
||||||
|
*
|
||||||
|
* <p>管理员可在后台调整检索结果列表展示的字段、显示名与顺序。</p>
|
||||||
|
*/
|
||||||
|
public interface ListFieldConfigService {
|
||||||
|
|
||||||
|
/** 查询场景配置(为空时自动写入默认字段),按 sort_no 升序 */
|
||||||
|
List<ListFieldConfig> listScene(String scene);
|
||||||
|
|
||||||
|
/** 全量覆盖保存场景配置 */
|
||||||
|
void saveScene(String scene, List<ListFieldConfig> items);
|
||||||
|
|
||||||
|
/** 恢复场景默认配置 */
|
||||||
|
List<ListFieldConfig> resetScene(String scene);
|
||||||
|
}
|
||||||
+94
@@ -0,0 +1,94 @@
|
|||||||
|
package com.banben.modules.admin.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.banben.modules.admin.entity.ListFieldConfig;
|
||||||
|
import com.banben.modules.admin.mapper.ListFieldConfigMapper;
|
||||||
|
import com.banben.modules.admin.service.ListFieldConfigService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表显示字段配置服务实现。
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class ListFieldConfigServiceImpl implements ListFieldConfigService {
|
||||||
|
|
||||||
|
private final ListFieldConfigMapper listFieldConfigMapper;
|
||||||
|
|
||||||
|
/** 默认展示字段:字段键 / 显示名 */
|
||||||
|
private static final List<String[]> DEFAULT_SEARCH_FIELDS = Arrays.asList(
|
||||||
|
new String[]{"title", "文献题名"},
|
||||||
|
new String[]{"publishYear", "发行时间"},
|
||||||
|
new String[]{"author", "作者"},
|
||||||
|
new String[]{"authorOrg", "作者单位"},
|
||||||
|
new String[]{"publisher", "来源刊名/出版社"},
|
||||||
|
new String[]{"mediaType", "资源类型"},
|
||||||
|
new String[]{"sourceLibrary", "来源院校"},
|
||||||
|
new String[]{"sourceRepo", "来源资源库名"}
|
||||||
|
);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ListFieldConfig> listScene(String scene) {
|
||||||
|
List<ListFieldConfig> list = queryScene(scene);
|
||||||
|
if (list.isEmpty()) {
|
||||||
|
return resetScene(scene);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void saveScene(String scene, List<ListFieldConfig> items) {
|
||||||
|
// 场景内全量覆盖:先删除旧配置(物理删除,避免历史脏数据堆积)
|
||||||
|
listFieldConfigMapper.delete(new LambdaQueryWrapper<ListFieldConfig>().eq(ListFieldConfig::getScene, scene));
|
||||||
|
if (items == null || items.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int no = 1;
|
||||||
|
for (ListFieldConfig item : items) {
|
||||||
|
ListFieldConfig cfg = new ListFieldConfig();
|
||||||
|
cfg.setScene(scene);
|
||||||
|
cfg.setFieldKey(item.getFieldKey());
|
||||||
|
cfg.setFieldLabel(item.getFieldLabel());
|
||||||
|
cfg.setSortNo(item.getSortNo() != null ? item.getSortNo() : no * 10);
|
||||||
|
cfg.setVisible(item.getVisible() == null ? 1 : item.getVisible());
|
||||||
|
listFieldConfigMapper.insert(cfg);
|
||||||
|
no++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public List<ListFieldConfig> resetScene(String scene) {
|
||||||
|
listFieldConfigMapper.delete(new LambdaQueryWrapper<ListFieldConfig>().eq(ListFieldConfig::getScene, scene));
|
||||||
|
List<ListFieldConfig> defaults = new ArrayList<>();
|
||||||
|
int no = 1;
|
||||||
|
for (String[] kv : DEFAULT_SEARCH_FIELDS) {
|
||||||
|
ListFieldConfig cfg = new ListFieldConfig();
|
||||||
|
cfg.setScene(scene);
|
||||||
|
cfg.setFieldKey(kv[0]);
|
||||||
|
cfg.setFieldLabel(kv[1]);
|
||||||
|
cfg.setSortNo(no * 10);
|
||||||
|
cfg.setVisible(1);
|
||||||
|
listFieldConfigMapper.insert(cfg);
|
||||||
|
defaults.add(cfg);
|
||||||
|
no++;
|
||||||
|
}
|
||||||
|
return defaults;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<ListFieldConfig> queryScene(String scene) {
|
||||||
|
return listFieldConfigMapper.selectList(
|
||||||
|
new LambdaQueryWrapper<ListFieldConfig>()
|
||||||
|
.eq(ListFieldConfig::getScene, scene)
|
||||||
|
.orderByAsc(ListFieldConfig::getSortNo)
|
||||||
|
.orderByAsc(ListFieldConfig::getId)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -149,6 +149,12 @@ public class VersionResource implements Serializable {
|
|||||||
@Schema(description = "管理状态:0正常 1屏蔽 2下架")
|
@Schema(description = "管理状态:0正常 1屏蔽 2下架")
|
||||||
private Integer manageStatus;
|
private Integer manageStatus;
|
||||||
|
|
||||||
|
@Schema(description = "作者单位(责任者所属机构)")
|
||||||
|
private String authorOrg;
|
||||||
|
|
||||||
|
@Schema(description = "来源资源库名")
|
||||||
|
private String sourceRepo;
|
||||||
|
|
||||||
@TableField(fill = FieldFill.INSERT)
|
@TableField(fill = FieldFill.INSERT)
|
||||||
@Schema(description = "创建时间")
|
@Schema(description = "创建时间")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|||||||
@@ -1,62 +1,86 @@
|
|||||||
-- =====================================================================
|
-- =====================================================================
|
||||||
-- 版本资源联合服务系统 - 扩展表结构(v7)
|
-- v7 增量脚本(幂等,可重复执行)
|
||||||
-- 主键改为「数据库自增序列」,废弃雪花 ID(IdType.ASSIGN_ID)
|
-- 1. version_resource 新增「作者单位」「来源资源库名」
|
||||||
--
|
-- 2. 新增 list_field_config(检索结果列表显示字段,管理员可增减)
|
||||||
-- 背景:雪花 ID 为 19 位(如 2112722202279440385),
|
-- 3. 初始化 SEARCH 场景默认展示字段
|
||||||
-- 超过 JS Number 安全整数上限 9007199254740991,
|
|
||||||
-- 前端拿到的 id 会发生精度丢失(…440385 变成 …440400),
|
|
||||||
-- 导致「查询单个资源 / 回填 / 编辑保存」时 id 对不上。
|
|
||||||
-- 改为序列自增后,id 为 1、2、3… 连续小整数,前端不再失真。
|
|
||||||
--
|
|
||||||
-- 幂等:全部使用 IF NOT EXISTS,可重复执行
|
|
||||||
-- =====================================================================
|
-- =====================================================================
|
||||||
|
|
||||||
-- 1. 为各表创建序列并设为主键默认值
|
ALTER TABLE version_resource ADD COLUMN IF NOT EXISTS author_org VARCHAR(256);
|
||||||
CREATE SEQUENCE IF NOT EXISTS version_resource_id_seq;
|
ALTER TABLE version_resource ADD COLUMN IF NOT EXISTS source_repo VARCHAR(256);
|
||||||
ALTER TABLE version_resource ALTER COLUMN id SET DEFAULT nextval('version_resource_id_seq');
|
CREATE INDEX IF NOT EXISTS idx_vr_source_repo ON version_resource (source_repo);
|
||||||
|
|
||||||
CREATE SEQUENCE IF NOT EXISTS special_resource_id_seq;
|
COMMENT ON COLUMN version_resource.author_org IS '作者单位(责任者所属机构)';
|
||||||
ALTER TABLE special_resource ALTER COLUMN id SET DEFAULT nextval('special_resource_id_seq');
|
COMMENT ON COLUMN version_resource.source_repo IS '来源资源库名';
|
||||||
|
|
||||||
CREATE SEQUENCE IF NOT EXISTS sensitive_word_id_seq;
|
CREATE TABLE IF NOT EXISTS list_field_config
|
||||||
ALTER TABLE sensitive_word ALTER COLUMN id SET DEFAULT nextval('sensitive_word_id_seq');
|
(
|
||||||
|
id BIGSERIAL NOT NULL PRIMARY KEY,
|
||||||
|
scene VARCHAR(64) NOT NULL, -- 配置场景:SEARCH 检索结果列表
|
||||||
|
field_key VARCHAR(64) NOT NULL, -- 字段键(VersionResource 驼峰属性名)
|
||||||
|
field_label VARCHAR(64) NOT NULL, -- 显示名
|
||||||
|
sort_no INT DEFAULT 0, -- 展示顺序(小在前)
|
||||||
|
visible SMALLINT DEFAULT 1, -- 1显示 0隐藏
|
||||||
|
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
deleted SMALLINT DEFAULT 0
|
||||||
|
);
|
||||||
|
|
||||||
CREATE SEQUENCE IF NOT EXISTS resource_node_id_seq;
|
CREATE INDEX IF NOT EXISTS idx_lfc_scene ON list_field_config (scene, sort_no);
|
||||||
ALTER TABLE resource_node ALTER COLUMN id SET DEFAULT nextval('resource_node_id_seq');
|
|
||||||
|
|
||||||
CREATE SEQUENCE IF NOT EXISTS governance_job_id_seq;
|
-- 修复 v6 遗留问题:sensitive_word / resource_node 主键无默认值(实体为 IdType.AUTO,插入会报 null)
|
||||||
ALTER TABLE governance_job ALTER COLUMN id SET DEFAULT nextval('governance_job_id_seq');
|
DO $$
|
||||||
|
BEGIN
|
||||||
|
IF NOT EXISTS (SELECT 1 FROM pg_class WHERE relkind = 'S' AND relname = 'seq_sensitive_word') THEN
|
||||||
|
CREATE SEQUENCE seq_sensitive_word START 1000;
|
||||||
|
END IF;
|
||||||
|
IF NOT EXISTS (SELECT 1 FROM pg_class WHERE relkind = 'S' AND relname = 'seq_resource_node') THEN
|
||||||
|
CREATE SEQUENCE seq_resource_node START 1000;
|
||||||
|
END IF;
|
||||||
|
END $$;
|
||||||
|
|
||||||
CREATE SEQUENCE IF NOT EXISTS search_log_id_seq;
|
ALTER TABLE sensitive_word ALTER COLUMN id SET DEFAULT nextval('seq_sensitive_word');
|
||||||
ALTER TABLE search_log ALTER COLUMN id SET DEFAULT nextval('search_log_id_seq');
|
ALTER TABLE resource_node ALTER COLUMN id SET DEFAULT nextval('seq_resource_node');
|
||||||
|
|
||||||
CREATE SEQUENCE IF NOT EXISTS collect_task_id_seq;
|
COMMENT ON TABLE list_field_config IS '列表显示字段配置表(管理员控制检索结果展示字段)';
|
||||||
ALTER TABLE collect_task ALTER COLUMN id SET DEFAULT nextval('collect_task_id_seq');
|
COMMENT ON COLUMN list_field_config.scene IS '配置场景:SEARCH 检索结果列表';
|
||||||
|
COMMENT ON COLUMN list_field_config.field_key IS '字段键,对应 VersionResource 的驼峰属性名';
|
||||||
|
COMMENT ON COLUMN list_field_config.field_label IS '列表与导出时的显示名';
|
||||||
|
COMMENT ON COLUMN list_field_config.sort_no IS '展示顺序,数值小的靠前';
|
||||||
|
COMMENT ON COLUMN list_field_config.visible IS '是否显示:1显示 0隐藏';
|
||||||
|
|
||||||
CREATE SEQUENCE IF NOT EXISTS deposit_record_id_seq;
|
-- 初始化 SEARCH 场景默认 8 个展示字段(按 sort_no 排序)
|
||||||
ALTER TABLE deposit_record ALTER COLUMN id SET DEFAULT nextval('deposit_record_id_seq');
|
INSERT INTO list_field_config (id, scene, field_key, field_label, sort_no, visible, deleted)
|
||||||
|
SELECT v.* FROM (
|
||||||
|
VALUES
|
||||||
|
(90001::bigint, 'SEARCH'::varchar, 'title'::varchar, '文献题名'::varchar, 10, 1::smallint, 0::smallint),
|
||||||
|
(90002::bigint, 'SEARCH'::varchar, 'publishYear'::varchar, '发行时间'::varchar, 20, 1::smallint, 0::smallint),
|
||||||
|
(90003::bigint, 'SEARCH'::varchar, 'author'::varchar, '作者'::varchar, 30, 1::smallint, 0::smallint),
|
||||||
|
(90004::bigint, 'SEARCH'::varchar, 'authorOrg'::varchar, '作者单位'::varchar, 40, 1::smallint, 0::smallint),
|
||||||
|
(90005::bigint, 'SEARCH'::varchar, 'publisher'::varchar, '来源刊名/出版社'::varchar, 50, 1::smallint, 0::smallint),
|
||||||
|
(90006::bigint, 'SEARCH'::varchar, 'mediaType'::varchar, '资源类型'::varchar, 60, 1::smallint, 0::smallint),
|
||||||
|
(90007::bigint, 'SEARCH'::varchar, 'sourceLibrary'::varchar, '来源院校'::varchar, 70, 1::smallint, 0::smallint),
|
||||||
|
(90008::bigint, 'SEARCH'::varchar, 'sourceRepo'::varchar, '来源资源库名'::varchar, 80, 1::smallint, 0::smallint)
|
||||||
|
) v
|
||||||
|
WHERE NOT EXISTS (SELECT 1 FROM list_field_config WHERE scene = 'SEARCH');
|
||||||
|
|
||||||
CREATE SEQUENCE IF NOT EXISTS sys_user_id_seq;
|
-- 样例数据补填「作者单位 / 来源资源库名」(军事样例 0101~0118)
|
||||||
ALTER TABLE sys_user ALTER COLUMN id SET DEFAULT nextval('sys_user_id_seq');
|
UPDATE version_resource SET author_org = '中国人民解放军军事科学院军事思想研究所', source_repo = '军事科学学位论文资源库'
|
||||||
|
WHERE process_no IN ('MIL-2026-0101', 'MIL-2026-0103', 'MIL-2026-0107', 'MIL-2026-0114');
|
||||||
|
|
||||||
-- 2. 序列起点对齐现有「小整数」主键,避免与已有数据冲突
|
UPDATE version_resource SET author_org = '国防大学研究生院', source_repo = '国防大学书目文献资源库'
|
||||||
SELECT setval('version_resource_id_seq', GREATEST(COALESCE((SELECT MAX(id) FROM version_resource WHERE id < 1000000000), 0), 1), true);
|
WHERE process_no IN ('MIL-2026-0102', 'MIL-2026-0108', 'MIL-2026-0115');
|
||||||
SELECT setval('special_resource_id_seq', GREATEST(COALESCE((SELECT MAX(id) FROM special_resource WHERE id < 1000000000), 0), 1), true);
|
|
||||||
SELECT setval('sensitive_word_id_seq', GREATEST(COALESCE((SELECT MAX(id) FROM sensitive_word WHERE id < 1000000000), 0), 1), true);
|
|
||||||
SELECT setval('resource_node_id_seq', GREATEST(COALESCE((SELECT MAX(id) FROM resource_node WHERE id < 1000000000), 0), 1), true);
|
|
||||||
SELECT setval('governance_job_id_seq', GREATEST(COALESCE((SELECT MAX(id) FROM governance_job WHERE id < 1000000000), 0), 1), true);
|
|
||||||
SELECT setval('search_log_id_seq', GREATEST(COALESCE((SELECT MAX(id) FROM search_log WHERE id < 1000000000), 0), 1), true);
|
|
||||||
SELECT setval('collect_task_id_seq', GREATEST(COALESCE((SELECT MAX(id) FROM collect_task WHERE id < 1000000000), 0), 1), true);
|
|
||||||
SELECT setval('deposit_record_id_seq', GREATEST(COALESCE((SELECT MAX(id) FROM deposit_record WHERE id < 1000000000), 0), 1), true);
|
|
||||||
SELECT setval('sys_user_id_seq', GREATEST(COALESCE((SELECT MAX(id) FROM sys_user WHERE id < 1000000000), 0), 1), true);
|
|
||||||
|
|
||||||
-- 3. 把历史上生成的超大雪花 ID 重编为连续小 ID(数据内容不变)
|
UPDATE version_resource SET author_org = '海军指挥学院战术研究中心', source_repo = '海军院校联合书目库'
|
||||||
UPDATE version_resource SET id = nextval('version_resource_id_seq') WHERE id > 1000000000;
|
WHERE process_no = 'MIL-2026-0104';
|
||||||
UPDATE special_resource SET id = nextval('special_resource_id_seq') WHERE id > 1000000000;
|
|
||||||
UPDATE sensitive_word SET id = nextval('sensitive_word_id_seq') WHERE id > 1000000000;
|
UPDATE version_resource SET author_org = '空军指挥学院空天防御研究组', source_repo = '空军院校资源联合库'
|
||||||
UPDATE resource_node SET id = nextval('resource_node_id_seq') WHERE id > 1000000000;
|
WHERE process_no IN ('MIL-2026-0105', 'MIL-2026-0118');
|
||||||
UPDATE governance_job SET id = nextval('governance_job_id_seq') WHERE id > 1000000000;
|
|
||||||
UPDATE search_log SET id = nextval('search_log_id_seq') WHERE id > 1000000000;
|
UPDATE version_resource SET author_org = '陆军装甲兵学院作战理论教研室', source_repo = '陆军院校联合书目库'
|
||||||
UPDATE collect_task SET id = nextval('collect_task_id_seq') WHERE id > 1000000000;
|
WHERE process_no IN ('MIL-2026-0106', 'MIL-2026-0112', 'MIL-2026-0113');
|
||||||
UPDATE deposit_record SET id = nextval('deposit_record_id_seq') WHERE id > 1000000000;
|
|
||||||
UPDATE sys_user SET id = nextval('sys_user_id_seq') WHERE id > 1000000000;
|
UPDATE version_resource SET author_org = '陆军步兵学院图书馆', source_repo = '陆军院校联合书目库'
|
||||||
|
WHERE process_no IN ('MIL-2026-0109', 'MIL-2026-0116');
|
||||||
|
|
||||||
|
UPDATE version_resource SET author_org = '国防科技大学国际关系研究所', source_repo = '国防科技大学知识资源库'
|
||||||
|
WHERE process_no IN ('MIL-2026-0110', 'MIL-2026-0111', 'MIL-2026-0117');
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ CREATE TABLE IF NOT EXISTS version_resource
|
|||||||
sensitive_flag SMALLINT DEFAULT 0, -- 敏感标记 0正常 1敏感
|
sensitive_flag SMALLINT DEFAULT 0, -- 敏感标记 0正常 1敏感
|
||||||
is_special SMALLINT DEFAULT 0, -- 是否特藏版本 0否 1是
|
is_special SMALLINT DEFAULT 0, -- 是否特藏版本 0否 1是
|
||||||
manage_status SMALLINT DEFAULT 0, -- 管理状态 0正常 1屏蔽 2下架
|
manage_status SMALLINT DEFAULT 0, -- 管理状态 0正常 1屏蔽 2下架
|
||||||
|
author_org VARCHAR(256), -- 作者单位(责任者所属机构)
|
||||||
|
source_repo VARCHAR(256), -- 来源资源库名
|
||||||
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
deleted SMALLINT DEFAULT 0 -- 逻辑删除 0未删 1已删
|
deleted SMALLINT DEFAULT 0 -- 逻辑删除 0未删 1已删
|
||||||
@@ -65,6 +67,10 @@ CREATE INDEX IF NOT EXISTS idx_vr_source_lib ON version_resource (source_libra
|
|||||||
CREATE INDEX IF NOT EXISTS idx_vr_publish_year ON version_resource (publish_year);
|
CREATE INDEX IF NOT EXISTS idx_vr_publish_year ON version_resource (publish_year);
|
||||||
CREATE INDEX IF NOT EXISTS idx_vr_cdoi ON version_resource (cdoi);
|
CREATE INDEX IF NOT EXISTS idx_vr_cdoi ON version_resource (cdoi);
|
||||||
CREATE INDEX IF NOT EXISTS idx_vr_manage_status ON version_resource (manage_status);
|
CREATE INDEX IF NOT EXISTS idx_vr_manage_status ON version_resource (manage_status);
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_vr_source_repo ON version_resource (source_repo);
|
||||||
|
|
||||||
|
COMMENT ON COLUMN version_resource.author_org IS '作者单位(责任者所属机构)';
|
||||||
|
COMMENT ON COLUMN version_resource.source_repo IS '来源资源库名';
|
||||||
|
|
||||||
COMMENT ON TABLE version_resource IS '版本资源元数据表';
|
COMMENT ON TABLE version_resource IS '版本资源元数据表';
|
||||||
COMMENT ON COLUMN version_resource.media_type IS '媒体类型:纸质/电子';
|
COMMENT ON COLUMN version_resource.media_type IS '媒体类型:纸质/电子';
|
||||||
@@ -123,3 +129,29 @@ COMMENT ON COLUMN resource_node.link_url IS '访问链接';
|
|||||||
COMMENT ON COLUMN resource_node.sort_no IS '展示顺序,数值小的靠前';
|
COMMENT ON COLUMN resource_node.sort_no IS '展示顺序,数值小的靠前';
|
||||||
COMMENT ON COLUMN resource_node.status IS '状态:1启用 0停用';
|
COMMENT ON COLUMN resource_node.status IS '状态:1启用 0停用';
|
||||||
COMMENT ON COLUMN resource_node.deleted IS '逻辑删除:0未删 1已删';
|
COMMENT ON COLUMN resource_node.deleted IS '逻辑删除:0未删 1已删';
|
||||||
|
|
||||||
|
-- =====================================================================
|
||||||
|
-- 列表显示字段配置
|
||||||
|
-- 检索结果列表 / 资源列表展示哪些字段、显示名与顺序,由管理员在此配置
|
||||||
|
-- =====================================================================
|
||||||
|
CREATE TABLE IF NOT EXISTS list_field_config
|
||||||
|
(
|
||||||
|
id BIGSERIAL NOT NULL PRIMARY KEY,
|
||||||
|
scene VARCHAR(64) NOT NULL, -- 配置场景:SEARCH 检索结果列表
|
||||||
|
field_key VARCHAR(64) NOT NULL, -- 字段键(VersionResource 的驼峰属性名)
|
||||||
|
field_label VARCHAR(64) NOT NULL, -- 列表/导出表头显示名
|
||||||
|
sort_no INT DEFAULT 0, -- 展示顺序(小在前)
|
||||||
|
visible SMALLINT DEFAULT 1, -- 是否显示 1显示 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_lfc_scene ON list_field_config (scene, sort_no);
|
||||||
|
|
||||||
|
COMMENT ON TABLE list_field_config IS '列表显示字段配置表(管理员控制检索结果展示字段)';
|
||||||
|
COMMENT ON COLUMN list_field_config.scene IS '配置场景:SEARCH 检索结果列表';
|
||||||
|
COMMENT ON COLUMN list_field_config.field_key IS '字段键,对应 VersionResource 的驼峰属性名';
|
||||||
|
COMMENT ON COLUMN list_field_config.field_label IS '列表与导出时的显示名';
|
||||||
|
COMMENT ON COLUMN list_field_config.sort_no IS '展示顺序,数值小的靠前';
|
||||||
|
COMMENT ON COLUMN list_field_config.visible IS '是否显示:1显示 0隐藏';
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ CREATE TABLE IF NOT EXISTS version_resource
|
|||||||
govern_status VARCHAR(32) DEFAULT 'RAW',
|
govern_status VARCHAR(32) DEFAULT 'RAW',
|
||||||
sensitive_flag SMALLINT DEFAULT 0,
|
sensitive_flag SMALLINT DEFAULT 0,
|
||||||
manage_status SMALLINT DEFAULT 0,
|
manage_status SMALLINT DEFAULT 0,
|
||||||
|
author_org VARCHAR(256),
|
||||||
|
source_repo VARCHAR(256),
|
||||||
is_special SMALLINT DEFAULT 0,
|
is_special SMALLINT DEFAULT 0,
|
||||||
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
@@ -92,6 +94,22 @@ CREATE TABLE IF NOT EXISTS resource_node
|
|||||||
CREATE INDEX IF NOT EXISTS idx_rn_sort ON resource_node (sort_no);
|
CREATE INDEX IF NOT EXISTS idx_rn_sort ON resource_node (sort_no);
|
||||||
CREATE INDEX IF NOT EXISTS idx_rn_category ON resource_node (category);
|
CREATE INDEX IF NOT EXISTS idx_rn_category ON resource_node (category);
|
||||||
|
|
||||||
|
-- 列表显示字段配置(检索结果展示字段,管理员可增减)
|
||||||
|
CREATE TABLE IF NOT EXISTS list_field_config
|
||||||
|
(
|
||||||
|
id BIGSERIAL NOT NULL PRIMARY KEY,
|
||||||
|
scene VARCHAR(64) NOT NULL, -- 配置场景:SEARCH 检索结果列表
|
||||||
|
field_key VARCHAR(64) NOT NULL, -- 字段键
|
||||||
|
field_label VARCHAR(64) NOT NULL, -- 显示名
|
||||||
|
sort_no INT DEFAULT 0, -- 展示顺序(小在前)
|
||||||
|
visible SMALLINT DEFAULT 1, -- 1显示 0隐藏
|
||||||
|
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
deleted SMALLINT DEFAULT 0
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_lfc_scene ON list_field_config (scene, sort_no);
|
||||||
|
|
||||||
-- 样例数据
|
-- 样例数据
|
||||||
INSERT INTO version_resource
|
INSERT INTO version_resource
|
||||||
(id, process_no, title, clc_code, keywords, summary, publish_year, process_date,
|
(id, process_no, title, clc_code, keywords, summary, publish_year, process_date,
|
||||||
|
|||||||
Generated
+96
-1
@@ -15,7 +15,8 @@
|
|||||||
"pinia": "^2.1.7",
|
"pinia": "^2.1.7",
|
||||||
"vue": "^3.4.31",
|
"vue": "^3.4.31",
|
||||||
"vue-router": "^4.4.0",
|
"vue-router": "^4.4.0",
|
||||||
"wordcloud": "^1.2.2"
|
"wordcloud": "^1.2.2",
|
||||||
|
"xlsx": "^0.18.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^20.14.9",
|
"@types/node": "^20.14.9",
|
||||||
@@ -1446,6 +1447,14 @@
|
|||||||
"vue": "^3.5.0"
|
"vue": "^3.5.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/adler-32": {
|
||||||
|
"version": "1.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/adler-32/-/adler-32-1.3.1.tgz",
|
||||||
|
"integrity": "sha512-ynZ4w/nUUv5rrsR8UUGoe1VC9hZj6V5hU9Qw1HlMDJGEJw5S7TfTErWTjMys6M7vr0YWcPqs3qAr4ss0nDfP+A==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/agent-base": {
|
"node_modules/agent-base": {
|
||||||
"version": "6.0.2",
|
"version": "6.0.2",
|
||||||
"resolved": "https://registry.npmmirror.com/agent-base/-/agent-base-6.0.2.tgz",
|
"resolved": "https://registry.npmmirror.com/agent-base/-/agent-base-6.0.2.tgz",
|
||||||
@@ -1519,6 +1528,18 @@
|
|||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/cfb": {
|
||||||
|
"version": "1.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/cfb/-/cfb-1.2.2.tgz",
|
||||||
|
"integrity": "sha512-KfdUZsSOw19/ObEWasvBP/Ac4reZvAGauZhs6S/gqNhXhI7cKwvlH7ulj+dOEYnca4bm4SGo8C1bTAQvnTjgQA==",
|
||||||
|
"dependencies": {
|
||||||
|
"adler-32": "~1.3.0",
|
||||||
|
"crc-32": "~1.2.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/chokidar": {
|
"node_modules/chokidar": {
|
||||||
"version": "4.0.3",
|
"version": "4.0.3",
|
||||||
"resolved": "https://registry.npmmirror.com/chokidar/-/chokidar-4.0.3.tgz",
|
"resolved": "https://registry.npmmirror.com/chokidar/-/chokidar-4.0.3.tgz",
|
||||||
@@ -1535,6 +1556,14 @@
|
|||||||
"url": "https://paulmillr.com/funding/"
|
"url": "https://paulmillr.com/funding/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/codepage": {
|
||||||
|
"version": "1.15.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/codepage/-/codepage-1.15.0.tgz",
|
||||||
|
"integrity": "sha512-3g6NUTPd/YtuuGrhMnOMRjFc+LJw/bnMp3+0r/Wcz3IXUuCosKRJvMphm5+Q+bvTVGcJJuRvVLuYba+WojaFaA==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/combined-stream": {
|
"node_modules/combined-stream": {
|
||||||
"version": "1.0.8",
|
"version": "1.0.8",
|
||||||
"resolved": "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz",
|
"resolved": "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||||
@@ -1547,6 +1576,17 @@
|
|||||||
"node": ">= 0.8"
|
"node": ">= 0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/crc-32": {
|
||||||
|
"version": "1.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz",
|
||||||
|
"integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==",
|
||||||
|
"bin": {
|
||||||
|
"crc32": "bin/crc32.njs"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/csstype": {
|
"node_modules/csstype": {
|
||||||
"version": "3.2.3",
|
"version": "3.2.3",
|
||||||
"resolved": "https://registry.npmmirror.com/csstype/-/csstype-3.2.3.tgz",
|
"resolved": "https://registry.npmmirror.com/csstype/-/csstype-3.2.3.tgz",
|
||||||
@@ -1791,6 +1831,14 @@
|
|||||||
"node": ">= 6"
|
"node": ">= 6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/frac": {
|
||||||
|
"version": "1.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/frac/-/frac-1.1.2.tgz",
|
||||||
|
"integrity": "sha512-w/XBfkibaTl3YDqASwfDUqkna4Z2p9cFSr1aHDt0WoMTECnRfBOv2WArlZILlqgWlmdIlALXGpM2AOhEk5W3IA==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/fsevents": {
|
"node_modules/fsevents": {
|
||||||
"version": "2.3.3",
|
"version": "2.3.3",
|
||||||
"resolved": "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.3.tgz",
|
"resolved": "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.3.tgz",
|
||||||
@@ -2263,6 +2311,17 @@
|
|||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/ssf": {
|
||||||
|
"version": "0.11.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/ssf/-/ssf-0.11.2.tgz",
|
||||||
|
"integrity": "sha512-+idbmIXoYET47hH+d7dfm2epdOMUDjqcB4648sTZ+t2JwoyBFL/insLfB/racrDmsKB3diwsDA696pZMieAC5g==",
|
||||||
|
"dependencies": {
|
||||||
|
"frac": "~1.1.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/tslib": {
|
"node_modules/tslib": {
|
||||||
"version": "2.3.0",
|
"version": "2.3.0",
|
||||||
"resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.3.0.tgz",
|
"resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.3.0.tgz",
|
||||||
@@ -2442,11 +2501,47 @@
|
|||||||
"typescript": ">=5.0.0"
|
"typescript": ">=5.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/wmf": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/wmf/-/wmf-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-/p9K7bEh0Dj6WbXg4JG0xvLQmIadrner1bi45VMJTfnbVHsc7yIajZyoSoK60/dtVBs12Fm6WkUI5/3WAVsNMw==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/word": {
|
||||||
|
"version": "0.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/word/-/word-0.3.0.tgz",
|
||||||
|
"integrity": "sha512-OELeY0Q61OXpdUfTp+oweA/vtLVg5VDOXh+3he3PNzLGG/y0oylSOC1xRVj0+l4vQ3tj/bB1HVHv1ocXkQceFA==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/wordcloud": {
|
"node_modules/wordcloud": {
|
||||||
"version": "1.2.2",
|
"version": "1.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/wordcloud/-/wordcloud-1.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/wordcloud/-/wordcloud-1.2.2.tgz",
|
||||||
"integrity": "sha512-fUnDsGrHXou+49j1OeKaC7nOeZPx+sWjIet0L/j6eAcm0nXy+a+AuUs/iDAX4PLBg1Zc6wgXWXhoXdQsXRWAEw=="
|
"integrity": "sha512-fUnDsGrHXou+49j1OeKaC7nOeZPx+sWjIet0L/j6eAcm0nXy+a+AuUs/iDAX4PLBg1Zc6wgXWXhoXdQsXRWAEw=="
|
||||||
},
|
},
|
||||||
|
"node_modules/xlsx": {
|
||||||
|
"version": "0.18.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/xlsx/-/xlsx-0.18.5.tgz",
|
||||||
|
"integrity": "sha512-dmg3LCjBPHZnQp5/F/+nnTa+miPJxUXB6vtk42YjBBKayDNagxGEeIdWApkYPOf3Z3pm3k62Knjzp7lMeTEtFQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"adler-32": "~1.3.0",
|
||||||
|
"cfb": "~1.2.1",
|
||||||
|
"codepage": "~1.15.0",
|
||||||
|
"crc-32": "~1.2.1",
|
||||||
|
"ssf": "~0.11.2",
|
||||||
|
"wmf": "~1.0.1",
|
||||||
|
"word": "~0.3.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"xlsx": "bin/xlsx.njs"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/zrender": {
|
"node_modules/zrender": {
|
||||||
"version": "5.6.1",
|
"version": "5.6.1",
|
||||||
"resolved": "https://registry.npmmirror.com/zrender/-/zrender-5.6.1.tgz",
|
"resolved": "https://registry.npmmirror.com/zrender/-/zrender-5.6.1.tgz",
|
||||||
|
|||||||
@@ -17,7 +17,8 @@
|
|||||||
"pinia": "^2.1.7",
|
"pinia": "^2.1.7",
|
||||||
"vue": "^3.4.31",
|
"vue": "^3.4.31",
|
||||||
"vue-router": "^4.4.0",
|
"vue-router": "^4.4.0",
|
||||||
"wordcloud": "^1.2.2"
|
"wordcloud": "^1.2.2",
|
||||||
|
"xlsx": "^0.18.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^20.14.9",
|
"@types/node": "^20.14.9",
|
||||||
|
|||||||
@@ -115,3 +115,34 @@ export function resourceStats(dim: 'sourceLibrary' | 'mediaType' | 'title', limi
|
|||||||
params: { dim, limit },
|
params: { dim, limit },
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ==================== 列表显示字段配置 ====================
|
||||||
|
|
||||||
|
export interface ListFieldConfig {
|
||||||
|
id?: number
|
||||||
|
/** 配置场景:SEARCH 检索结果列表 */
|
||||||
|
scene?: string
|
||||||
|
/** 字段键,对应 VersionResource 的驼峰属性名 */
|
||||||
|
fieldKey: string
|
||||||
|
/** 列表/导出显示名 */
|
||||||
|
fieldLabel: string
|
||||||
|
/** 展示顺序,小的靠前 */
|
||||||
|
sortNo?: number
|
||||||
|
/** 1显示 0隐藏 */
|
||||||
|
visible?: number
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 查询场景展示字段(为空时返回默认配置) */
|
||||||
|
export function listFields(scene: string) {
|
||||||
|
return request.get<never, ListFieldConfig[]>(`/admin/list-fields/${scene}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 全量覆盖保存展示字段 */
|
||||||
|
export function saveListFields(scene: string, items: ListFieldConfig[]) {
|
||||||
|
return request.put<never, void>(`/admin/list-fields/${scene}`, items)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 恢复场景默认展示字段 */
|
||||||
|
export function resetListFields(scene: string) {
|
||||||
|
return request.post<never, ListFieldConfig[]>(`/admin/list-fields/${scene}/reset`)
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onMounted, reactive, ref } from 'vue'
|
import { computed, onMounted, reactive, ref } from 'vue'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
|
|
||||||
const activeTab = ref('words')
|
const activeTab = ref('words')
|
||||||
@@ -9,7 +9,10 @@ import {
|
|||||||
createResourceNode,
|
createResourceNode,
|
||||||
createSensitiveWord,
|
createSensitiveWord,
|
||||||
handleHitAction,
|
handleHitAction,
|
||||||
|
listFields,
|
||||||
listResourceNodes,
|
listResourceNodes,
|
||||||
|
resetListFields,
|
||||||
|
saveListFields,
|
||||||
pageHits,
|
pageHits,
|
||||||
pageSensitiveWords,
|
pageSensitiveWords,
|
||||||
removeResourceNode,
|
removeResourceNode,
|
||||||
@@ -18,6 +21,7 @@ import {
|
|||||||
updateResourceNode,
|
updateResourceNode,
|
||||||
updateSensitiveWord,
|
updateSensitiveWord,
|
||||||
type HitAction,
|
type HitAction,
|
||||||
|
type ListFieldConfig,
|
||||||
type ResourceNode,
|
type ResourceNode,
|
||||||
type SensitiveHit,
|
type SensitiveHit,
|
||||||
type SensitiveWord,
|
type SensitiveWord,
|
||||||
@@ -267,11 +271,111 @@ async function batchDeleteNodes() {
|
|||||||
fetchNodes()
|
fetchNodes()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ==================== 列表显示字段配置 ====================
|
||||||
|
|
||||||
|
/** 可选字段池:新增字段行时从此处挑选 */
|
||||||
|
const fieldPool: { key: string; label: string }[] = [
|
||||||
|
{ key: 'title', label: '文献题名' },
|
||||||
|
{ key: 'publishYear', label: '发行时间' },
|
||||||
|
{ key: 'publishDate', label: '出版日期' },
|
||||||
|
{ key: 'author', label: '作者' },
|
||||||
|
{ key: 'authorOrg', label: '作者单位' },
|
||||||
|
{ key: 'publisher', label: '来源刊名/出版社' },
|
||||||
|
{ key: 'mediaType', label: '资源类型' },
|
||||||
|
{ key: 'sourceLibrary', label: '来源院校' },
|
||||||
|
{ key: 'sourceRepo', label: '来源资源库名' },
|
||||||
|
{ key: 'clcCode', label: '中图分类' },
|
||||||
|
{ key: 'keywords', label: '关键词' },
|
||||||
|
{ key: 'isbn', label: 'ISBN' },
|
||||||
|
{ key: 'format', label: '格式' },
|
||||||
|
{ key: 'language', label: '语种' },
|
||||||
|
{ key: 'pageCount', label: '页码' },
|
||||||
|
{ key: 'summary', label: '摘要' },
|
||||||
|
{ key: 'cdoi', label: 'CDOI' },
|
||||||
|
{ key: 'governStatus', label: '治理状态' }
|
||||||
|
]
|
||||||
|
|
||||||
|
const fieldScene = 'SEARCH'
|
||||||
|
const fieldList = ref<ListFieldConfig[]>([])
|
||||||
|
const fieldLoading = ref(false)
|
||||||
|
const fieldSaving = ref(false)
|
||||||
|
const addingKey = ref('')
|
||||||
|
|
||||||
|
async function fetchFields() {
|
||||||
|
fieldLoading.value = true
|
||||||
|
try {
|
||||||
|
fieldList.value = await listFields(fieldScene)
|
||||||
|
} finally {
|
||||||
|
fieldLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 上移 / 下移调整展示顺序 */
|
||||||
|
function moveField(idx: number, delta: number) {
|
||||||
|
const target = idx + delta
|
||||||
|
if (target < 0 || target >= fieldList.value.length) return
|
||||||
|
const arr = [...fieldList.value]
|
||||||
|
;[arr[idx], arr[target]] = [arr[target], arr[idx]]
|
||||||
|
arr.forEach((f, i) => (f.sortNo = (i + 1) * 10))
|
||||||
|
fieldList.value = arr
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeField(idx: number) {
|
||||||
|
fieldList.value.splice(idx, 1)
|
||||||
|
fieldList.value.forEach((f, i) => (f.sortNo = (i + 1) * 10))
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 从字段池新增一行(已存在的字段不可重复添加) */
|
||||||
|
function addField() {
|
||||||
|
if (!addingKey.value) return
|
||||||
|
if (fieldList.value.some((f) => f.fieldKey === addingKey.value)) {
|
||||||
|
ElMessage.warning('该字段已在列表中')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const src = fieldPool.find((f) => f.key === addingKey.value)
|
||||||
|
fieldList.value.push({
|
||||||
|
fieldKey: src!.key,
|
||||||
|
fieldLabel: src!.label,
|
||||||
|
sortNo: (fieldList.value.length + 1) * 10,
|
||||||
|
visible: 1
|
||||||
|
})
|
||||||
|
addingKey.value = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
const availableOptions = computed(() =>
|
||||||
|
fieldPool.filter((f) => !fieldList.value.some((c) => c.fieldKey === f.key))
|
||||||
|
)
|
||||||
|
|
||||||
|
async function saveFields() {
|
||||||
|
if (!fieldList.value.length) {
|
||||||
|
ElMessage.warning('至少保留一个展示字段')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (fieldList.value.some((f) => !f.fieldLabel?.trim())) {
|
||||||
|
ElMessage.warning('请填写完整的显示名')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
fieldSaving.value = true
|
||||||
|
try {
|
||||||
|
await saveListFields(fieldScene, fieldList.value)
|
||||||
|
ElMessage.success('字段配置已保存,检索结果列表即时生效')
|
||||||
|
} finally {
|
||||||
|
fieldSaving.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function resetFields() {
|
||||||
|
await ElMessageBox.confirm('确认恢复默认的展示字段配置?', '提示', { type: 'warning' })
|
||||||
|
fieldList.value = await resetListFields(fieldScene)
|
||||||
|
ElMessage.success('已恢复默认配置')
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
fetchWords()
|
fetchWords()
|
||||||
fetchHits()
|
fetchHits()
|
||||||
fetchNodes()
|
fetchNodes()
|
||||||
fetchStats()
|
fetchStats()
|
||||||
|
fetchFields()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -477,6 +581,52 @@ onMounted(() => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
|
||||||
|
<!-- ==================== 列表显示字段配置 ==================== -->
|
||||||
|
<el-tab-pane label="列表字段配置" name="fields">
|
||||||
|
<el-alert
|
||||||
|
class="hint"
|
||||||
|
type="info"
|
||||||
|
:closable="false"
|
||||||
|
title="配置检索结果列表显示哪些元数据字段:可新增、删除、上下调整顺序、修改显示名,或临时隐藏。保存后对全部用户的检索结果列表与导出字段即时生效。"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div class="toolbar">
|
||||||
|
<el-select v-model="addingKey" placeholder="选择要新增的字段" style="width: 240px" clearable>
|
||||||
|
<el-option v-for="f in availableOptions" :key="f.key" :label="f.label" :value="f.key" />
|
||||||
|
</el-select>
|
||||||
|
<el-button type="primary" plain :disabled="!addingKey" @click="addField">新增字段</el-button>
|
||||||
|
<el-button @click="resetFields">恢复默认</el-button>
|
||||||
|
<el-button type="primary" :loading="fieldSaving" @click="saveFields">保存配置</el-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-table v-loading="fieldLoading" :data="fieldList" border stripe max-height="520">
|
||||||
|
<el-table-column label="顺序" width="110" align="center">
|
||||||
|
<template #default="{ $index }">
|
||||||
|
<el-button-group>
|
||||||
|
<el-button size="small" :disabled="$index === 0" @click="moveField($index, -1)">↑</el-button>
|
||||||
|
<el-button size="small" :disabled="$index === fieldList.length - 1" @click="moveField($index, 1)">↓</el-button>
|
||||||
|
</el-button-group>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="fieldKey" label="字段键" width="150" />
|
||||||
|
<el-table-column label="显示名" min-width="200">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-input v-model="row.fieldLabel" size="small" maxlength="32" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="是否显示" width="100" align="center">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-switch v-model="row.visible" :active-value="1" :inactive-value="0" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" width="100" align="center">
|
||||||
|
<template #default="{ $index }">
|
||||||
|
<el-button link type="danger" size="small" @click="removeField($index)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
|
|
||||||
<!-- 敏感词 新增/编辑 弹窗 -->
|
<!-- 敏感词 新增/编辑 弹窗 -->
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, onMounted, reactive, ref } from 'vue'
|
import { computed, onMounted, reactive, ref, watch } from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import { getSearchDetail, getSimilar, unifiedSearch, type FacetItem, type SearchQuery } from '@/api/search'
|
import { ElMessage } from 'element-plus'
|
||||||
|
import * as XLSX from 'xlsx'
|
||||||
|
import { listFields, type ListFieldConfig } from '@/api/admin'
|
||||||
|
import { getSearchDetail, getSimilar, unifiedSearch, searchList, type FacetItem, type SearchQuery } from '@/api/search'
|
||||||
import type { VersionResource } from '@/api/resource'
|
import type { VersionResource } from '@/api/resource'
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
@@ -22,6 +25,28 @@ const query = reactive<SearchQuery>({
|
|||||||
/** 概览页每页条数选项(默认 50,可切 100/200;20 便于数据量小时演示翻页) */
|
/** 概览页每页条数选项(默认 50,可切 100/200;20 便于数据量小时演示翻页) */
|
||||||
const pageSizes = [20, 50, 100, 200]
|
const pageSizes = [20, 50, 100, 200]
|
||||||
|
|
||||||
|
// ==================== 检索结果展示字段(管理员在后台配置) ====================
|
||||||
|
|
||||||
|
/** 展示字段配置:取不到配置时用默认的 8 个字段兜底 */
|
||||||
|
const listFieldConfig = ref<ListFieldConfig[]>([])
|
||||||
|
const metaFields = computed(() =>
|
||||||
|
listFieldConfig.value.filter((f) => f.visible !== 0 && f.fieldKey !== 'title')
|
||||||
|
)
|
||||||
|
|
||||||
|
async function fetchListFields() {
|
||||||
|
try {
|
||||||
|
listFieldConfig.value = await listFields('SEARCH')
|
||||||
|
} catch {
|
||||||
|
listFieldConfig.value = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 按字段键取值(含高亮所需原文),未配置值返回空串 */
|
||||||
|
function metaValue(row: VersionResource, key: string): string {
|
||||||
|
const v = (row as unknown as Record<string, unknown>)[key]
|
||||||
|
return v === null || v === undefined ? '' : String(v)
|
||||||
|
}
|
||||||
|
|
||||||
/** 输入框内容(与查询参数分离,避免按途径分发后被清空) */
|
/** 输入框内容(与查询参数分离,避免按途径分发后被清空) */
|
||||||
const input = ref('')
|
const input = ref('')
|
||||||
const field = ref('综合')
|
const field = ref('综合')
|
||||||
@@ -138,6 +163,125 @@ function scrollToListTop() {
|
|||||||
window.scrollTo({ top: 0, behavior: 'smooth' })
|
window.scrollTo({ top: 0, behavior: 'smooth' })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ==================== 批量导出 Excel ====================
|
||||||
|
|
||||||
|
/** 可导出字段(key 对应 VersionResource 字段) */
|
||||||
|
const exportFields: { key: string; label: string }[] = [
|
||||||
|
{ key: 'processNo', label: '加工编号' },
|
||||||
|
{ key: 'title', label: '正题名' },
|
||||||
|
{ key: 'otherTitle', label: '其他题名' },
|
||||||
|
{ key: 'author', label: '责任者' },
|
||||||
|
{ key: 'authorOrg', label: '作者单位' },
|
||||||
|
{ key: 'responsibility', label: '责任方式' },
|
||||||
|
{ key: 'publisher', label: '出版者' },
|
||||||
|
{ key: 'sourceRepo', label: '来源资源库名' },
|
||||||
|
{ key: 'publishPlace', label: '出版地' },
|
||||||
|
{ key: 'publishDate', label: '出版日期' },
|
||||||
|
{ key: 'publishYear', label: '出版年份' },
|
||||||
|
{ key: 'edition', label: '版本' },
|
||||||
|
{ key: 'isbn', label: 'ISBN' },
|
||||||
|
{ key: 'clcCode', label: '中图分类' },
|
||||||
|
{ key: 'keywords', label: '关键词' },
|
||||||
|
{ key: 'summary', label: '摘要' },
|
||||||
|
{ key: 'mediaType', label: '媒体类型' },
|
||||||
|
{ key: 'format', label: '格式' },
|
||||||
|
{ key: 'language', label: '语种' },
|
||||||
|
{ key: 'pageCount', label: '页码' },
|
||||||
|
{ key: 'sourceLibrary', label: '来源馆' },
|
||||||
|
{ key: 'cdoi', label: 'CDOI' },
|
||||||
|
{ key: 'governStatus', label: '治理状态' },
|
||||||
|
{ key: 'fulltextUrl', label: '全文地址' }
|
||||||
|
]
|
||||||
|
|
||||||
|
/** 默认勾选的常用字段 */
|
||||||
|
const defaultFields = ['processNo', 'title', 'author', 'publisher', 'publishYear', 'isbn', 'clcCode', 'mediaType', 'sourceLibrary']
|
||||||
|
|
||||||
|
const exportVisible = ref(false)
|
||||||
|
const exporting = ref(false)
|
||||||
|
const exportScope = ref<'selected' | 'page' | 'all'>('all')
|
||||||
|
const exportFieldsChecked = ref<string[]>([...defaultFields])
|
||||||
|
|
||||||
|
/** 已勾选的记录(跨当前页保留) */
|
||||||
|
const selectedIds = ref<Set<number>>(new Set())
|
||||||
|
const selectedCount = computed(() => selectedIds.value.size)
|
||||||
|
|
||||||
|
function toggleSelect(row: VersionResource) {
|
||||||
|
const id = row.id as number
|
||||||
|
const next = new Set(selectedIds.value)
|
||||||
|
next.has(id) ? next.delete(id) : next.add(id)
|
||||||
|
selectedIds.value = next
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectAllOnPage() {
|
||||||
|
const next = new Set(selectedIds.value)
|
||||||
|
rows.value.forEach((r) => next.add(r.id as number))
|
||||||
|
selectedIds.value = next
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearSelection() {
|
||||||
|
selectedIds.value = new Set()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 取值:兼容 undefined / null,并按字段做必要的展示转换 */
|
||||||
|
function cellText(row: VersionResource, key: string): string {
|
||||||
|
const raw = ((row as unknown as Record<string, unknown>) || {})[key]
|
||||||
|
if (raw === null || raw === undefined) return ''
|
||||||
|
if (typeof raw === 'object') return JSON.stringify(raw)
|
||||||
|
// Excel 单格上限 32767 字符,超长摘要做截断保护
|
||||||
|
const s = String(raw)
|
||||||
|
return s.length > 32000 ? s.slice(0, 32000) + '…' : s
|
||||||
|
}
|
||||||
|
|
||||||
|
async function confirmExport() {
|
||||||
|
if (!exportFieldsChecked.value.length) {
|
||||||
|
ElMessage.warning('请至少选择一个导出字段')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
exporting.value = true
|
||||||
|
try {
|
||||||
|
let list: VersionResource[] = []
|
||||||
|
if (exportScope.value === 'selected') {
|
||||||
|
if (!selectedIds.value.size) {
|
||||||
|
ElMessage.warning('请先在结果列表中勾选要导出的记录')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
list = rows.value.filter((r) => selectedIds.value.has(r.id as number))
|
||||||
|
if (list.length < selectedIds.value.size) {
|
||||||
|
// 勾选可能来自其他页,需从后端按当前检索条件捞取后过滤
|
||||||
|
const all = await searchList({ ...query })
|
||||||
|
const wanted = new Set([...selectedIds.value])
|
||||||
|
list = all.filter((r) => wanted.has(r.id as number))
|
||||||
|
}
|
||||||
|
} else if (exportScope.value === 'page') {
|
||||||
|
list = rows.value
|
||||||
|
} else {
|
||||||
|
list = await searchList({ ...query })
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!list.length) {
|
||||||
|
ElMessage.warning('没有可导出的数据')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const fields = exportFields.filter((f) => exportFieldsChecked.value.includes(f.key))
|
||||||
|
const aoa: (string | number)[][] = [fields.map((f) => f.label)]
|
||||||
|
for (const row of list) {
|
||||||
|
aoa.push(fields.map((f) => cellText(row, f.key)))
|
||||||
|
}
|
||||||
|
|
||||||
|
const sheet = XLSX.utils.aoa_to_sheet(aoa)
|
||||||
|
sheet['!cols'] = fields.map((f) => ({ wch: Math.max(12, f.label.length * 2 + 6) }))
|
||||||
|
const wb = XLSX.utils.book_new()
|
||||||
|
XLSX.utils.book_append_sheet(wb, sheet, '检索结果')
|
||||||
|
const name = `${input.value.trim() || '全部资源'}-${list.length}条-${new Date().toISOString().slice(0, 10)}.xlsx`
|
||||||
|
XLSX.writeFile(wb, name)
|
||||||
|
ElMessage.success(`已导出 ${list.length} 条 / ${fields.length} 个字段`)
|
||||||
|
exportVisible.value = false
|
||||||
|
} finally {
|
||||||
|
exporting.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const drawer = ref(false)
|
const drawer = ref(false)
|
||||||
const detail = ref<VersionResource | null>(null)
|
const detail = ref<VersionResource | null>(null)
|
||||||
const similar = ref<VersionResource[]>([])
|
const similar = ref<VersionResource[]>([])
|
||||||
@@ -158,11 +302,21 @@ onMounted(() => {
|
|||||||
if (f && fields.includes(f)) {
|
if (f && fields.includes(f)) {
|
||||||
field.value = f
|
field.value = f
|
||||||
}
|
}
|
||||||
if (kw) {
|
// 检索条件为空时也执行检索 → 后端返回全部版本资源
|
||||||
input.value = kw
|
input.value = kw || ''
|
||||||
|
fetchListFields()
|
||||||
|
doSearch()
|
||||||
|
})
|
||||||
|
|
||||||
|
// 已在检索页时,主页/热词再次带词跳转也能触发新检索
|
||||||
|
watch(
|
||||||
|
() => route.query.keyword,
|
||||||
|
(kw) => {
|
||||||
|
if (route.path !== '/search') return
|
||||||
|
input.value = (kw as string) || ''
|
||||||
doSearch()
|
doSearch()
|
||||||
}
|
}
|
||||||
})
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -193,16 +347,33 @@ onMounted(() => {
|
|||||||
</aside>
|
</aside>
|
||||||
|
|
||||||
<section class="list">
|
<section class="list">
|
||||||
<div class="meta">共 <b>{{ total }}</b> 条,耗时 {{ costMs }} ms</div>
|
<div class="toolbar">
|
||||||
|
<div class="count">共 <b>{{ total }}</b> 条,耗时 {{ costMs }} ms<template v-if="selectedCount">,已勾选 <b>{{ selectedCount }}</b> 条</template></div>
|
||||||
|
<div class="ops">
|
||||||
|
<el-checkbox
|
||||||
|
:model-value="rows.length > 0 && rows.every((r) => selectedIds.has(r.id as number))"
|
||||||
|
:indeterminate="selectedCount > 0 && selectedCount < rows.length"
|
||||||
|
@change="(v: boolean) => (v ? selectAllOnPage() : clearSelection())"
|
||||||
|
>全选本页</el-checkbox>
|
||||||
|
<el-button size="small" :disabled="!selectedCount" @click="clearSelection">清空选择</el-button>
|
||||||
|
<el-button size="small" type="primary" @click="exportVisible = true">批量导出 Excel</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div v-loading="loading" class="cards">
|
<div v-loading="loading" class="cards">
|
||||||
<div v-for="r in rows" :key="r.id" class="card" @click="openDetail(r)">
|
<div v-for="r in rows" :key="r.id" class="card" :class="{ checked: selectedIds.has(r.id as number) }" @click="openDetail(r)">
|
||||||
|
<div class="pick" @click.stop>
|
||||||
|
<el-checkbox :model-value="selectedIds.has(r.id as number)" @change="toggleSelect(r)" />
|
||||||
|
</div>
|
||||||
<div class="cover">{{ (r.title || '').slice(0, 2) }}</div>
|
<div class="cover">{{ (r.title || '').slice(0, 2) }}</div>
|
||||||
<div class="info">
|
<div class="info">
|
||||||
<div class="t" v-html="highlight(r.title)"></div>
|
<div class="t" v-html="highlight(r.title)"></div>
|
||||||
<div class="d">
|
<div class="metas">
|
||||||
<span v-html="highlight(r.author || '-')"></span> · {{ r.publishYear || '-' }} · {{ r.mediaType || '-' }}
|
<div v-for="f in metaFields" :key="f.fieldKey" class="cmeta">
|
||||||
|
<span class="cmeta-k">{{ f.fieldLabel }}:</span>
|
||||||
|
<span v-if="metaValue(r, f.fieldKey)" v-html="highlight(metaValue(r, f.fieldKey))"></span>
|
||||||
|
<span v-else class="empty">-</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="d" v-html="highlight(r.sourceLibrary || '-')"></div>
|
|
||||||
<div v-for="s in snippets(r)" :key="s.label" class="snippet">
|
<div v-for="s in snippets(r)" :key="s.label" class="snippet">
|
||||||
<span class="snippet-label">{{ s.label }}:</span>
|
<span class="snippet-label">{{ s.label }}:</span>
|
||||||
<span v-html="s.html"></span>
|
<span v-html="s.html"></span>
|
||||||
@@ -224,6 +395,35 @@ onMounted(() => {
|
|||||||
|
|
||||||
<el-empty v-else description="请输入检索词开始检索" />
|
<el-empty v-else description="请输入检索词开始检索" />
|
||||||
|
|
||||||
|
<!-- 批量导出:选择范围与字段 -->
|
||||||
|
<el-dialog v-model="exportVisible" title="批量导出检索结果" width="620px">
|
||||||
|
<el-form label-width="88px">
|
||||||
|
<el-form-item label="导出范围">
|
||||||
|
<el-radio-group v-model="exportScope">
|
||||||
|
<el-radio value="all">全部检索结果(最多 1 万条,约 {{ total }} 条)</el-radio>
|
||||||
|
<el-radio value="page">当前页({{ rows.length }} 条)</el-radio>
|
||||||
|
<el-radio value="selected" :disabled="!selectedCount">仅勾选记录({{ selectedCount }} 条)</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="导出字段">
|
||||||
|
<div class="field-box">
|
||||||
|
<div class="field-ops">
|
||||||
|
<el-button link type="primary" @click="exportFieldsChecked = exportFields.map((f) => f.key)">全选</el-button>
|
||||||
|
<el-button link @click="exportFieldsChecked = [...defaultFields]">恢复默认</el-button>
|
||||||
|
<span class="hint">已选 {{ exportFieldsChecked.length }} / {{ exportFields.length }}</span>
|
||||||
|
</div>
|
||||||
|
<el-checkbox-group v-model="exportFieldsChecked">
|
||||||
|
<el-checkbox v-for="f in exportFields" :key="f.key" :value="f.key" class="field-item">{{ f.label }}</el-checkbox>
|
||||||
|
</el-checkbox-group>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="exportVisible = false">取消</el-button>
|
||||||
|
<el-button type="primary" :loading="exporting" @click="confirmExport">导出 Excel</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
<el-drawer v-model="drawer" title="文献细览" size="46%">
|
<el-drawer v-model="drawer" title="文献细览" size="46%">
|
||||||
<template v-if="detail">
|
<template v-if="detail">
|
||||||
<h3 class="dt">{{ detail.title }}</h3>
|
<h3 class="dt">{{ detail.title }}</h3>
|
||||||
@@ -254,15 +454,10 @@ onMounted(() => {
|
|||||||
.bar {
|
.bar {
|
||||||
max-width: 860px;
|
max-width: 860px;
|
||||||
margin: 8px auto 20px;
|
margin: 8px auto 20px;
|
||||||
padding: 10px;
|
|
||||||
background: var(--card-bg);
|
|
||||||
border: 1px solid var(--card-gold-border);
|
|
||||||
border-radius: var(--radius-sm);
|
|
||||||
box-shadow: var(--shadow-card);
|
|
||||||
|
|
||||||
:deep(.el-input-group__append) {
|
:deep(.el-input-group__append) {
|
||||||
background: var(--brand-primary-deep);
|
background: var(--brand-primary);
|
||||||
border-color: var(--brand-primary-deep);
|
border-color: var(--brand-primary);
|
||||||
color: #fff;
|
color: #fff;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
||||||
@@ -284,45 +479,48 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.side {
|
.side {
|
||||||
width: 220px;
|
width: 210px;
|
||||||
flex: none;
|
flex: none;
|
||||||
background: var(--card-bg);
|
background: #fff;
|
||||||
border: 1px solid var(--card-gold-border);
|
border: 1px solid var(--card-border);
|
||||||
border-radius: var(--radius-sm);
|
border-radius: var(--radius-sm);
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
height: fit-content;
|
height: fit-content;
|
||||||
box-shadow: var(--shadow-card);
|
|
||||||
|
|
||||||
.side-title {
|
.side-title {
|
||||||
font-family: var(--font-serif);
|
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
margin: 10px 0 6px;
|
margin: 10px 0 6px;
|
||||||
padding-left: 8px;
|
|
||||||
border-left: 2px solid var(--brand-gold);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.side-item {
|
.side-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
color: var(--text-sub);
|
color: #5b6472;
|
||||||
padding: 6px 8px;
|
padding: 4px 6px;
|
||||||
border-radius: var(--radius-sm);
|
border-radius: 4px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
&:hover { background: var(--brand-light); }
|
&:hover { background: var(--brand-light); }
|
||||||
&.on {
|
&.on { background: var(--brand-light); color: var(--brand-primary); }
|
||||||
background: var(--paper-warm);
|
em { color: #9aa3b2; font-style: normal; }
|
||||||
color: var(--brand-gold-deep);
|
|
||||||
box-shadow: inset 2px 0 0 var(--brand-gold);
|
|
||||||
}
|
|
||||||
em { color: var(--text-muted); font-style: normal; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.list { flex: 1; min-width: 0; }
|
.list { flex: 1; }
|
||||||
.meta { font-size: 13px; color: var(--text-sub); margin-bottom: 10px; }
|
|
||||||
|
.toolbar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
|
||||||
|
.count { font-size: 13px; color: #6b7280; }
|
||||||
|
.ops { display: flex; align-items: center; gap: 10px; }
|
||||||
|
}
|
||||||
|
|
||||||
.cards {
|
.cards {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -332,56 +530,68 @@ onMounted(() => {
|
|||||||
|
|
||||||
.card {
|
.card {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 14px;
|
gap: 12px;
|
||||||
background: var(--card-bg);
|
background: #fff;
|
||||||
border: 1px solid var(--card-gold-border);
|
border: 1px solid var(--card-border);
|
||||||
border-radius: var(--radius-sm);
|
border-radius: var(--radius-sm);
|
||||||
padding: 14px;
|
padding: 14px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: box-shadow 0.22s ease, transform 0.22s ease, border-color 0.22s ease;
|
transition: box-shadow 0.2s;
|
||||||
|
|
||||||
&:hover {
|
&:hover { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1); }
|
||||||
border-color: var(--brand-gold);
|
&.checked { border-color: var(--brand-primary); box-shadow: inset 0 0 0 1px var(--brand-primary); }
|
||||||
box-shadow: var(--shadow-lift);
|
}
|
||||||
transform: translateY(-2px);
|
|
||||||
}
|
.pick {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding-right: 2px;
|
||||||
|
cursor: default;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cover {
|
.cover {
|
||||||
width: 56px;
|
width: 56px;
|
||||||
height: 78px;
|
height: 76px;
|
||||||
flex: none;
|
flex: none;
|
||||||
border-radius: 2px 4px 4px 2px;
|
border-radius: 4px;
|
||||||
background:
|
background: var(--brand-primary);
|
||||||
linear-gradient(90deg, rgba(255, 255, 255, 0.12), transparent 18%),
|
color: #fff;
|
||||||
var(--brand-primary-deep);
|
|
||||||
color: var(--brand-gold-light);
|
|
||||||
border: 1px solid var(--brand-gold);
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
font-family: var(--font-kai);
|
font-size: 18px;
|
||||||
font-size: 16px;
|
|
||||||
letter-spacing: 1px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.info {
|
.info {
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
|
|
||||||
.t {
|
.t { font-size: 14px; font-weight: 600; color: #1f2937; margin-bottom: 6px; }
|
||||||
font-family: var(--font-serif);
|
.d { font-size: 12px; color: #8b93a1; }
|
||||||
font-size: 16px;
|
}
|
||||||
font-weight: 600;
|
|
||||||
color: var(--text-main);
|
/* 按管理员配置的字段渲染出的元信息区(两列自适应) */
|
||||||
margin-bottom: 6px;
|
.metas {
|
||||||
}
|
display: grid;
|
||||||
.d { font-size: 12px; color: var(--text-muted); }
|
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
|
||||||
|
gap: 2px 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cmeta {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #6b7280;
|
||||||
|
line-height: 1.7;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
|
||||||
|
.cmeta-k { color: #8b93a1; }
|
||||||
|
.empty { color: #b6bcc7; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 命中关键词高亮(v-html 动态插入的节点不带 scoped 属性,需用 :deep 穿透) */
|
/* 命中关键词高亮(v-html 动态插入的节点不带 scoped 属性,需用 :deep 穿透) */
|
||||||
:deep(.hl) {
|
:deep(.hl) {
|
||||||
background: var(--hl-bg);
|
background: #ffe6a3;
|
||||||
color: var(--hl-text);
|
color: #8a4b00;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
padding: 0 1px;
|
padding: 0 1px;
|
||||||
}
|
}
|
||||||
@@ -389,14 +599,23 @@ onMounted(() => {
|
|||||||
.snippet {
|
.snippet {
|
||||||
margin-top: 4px;
|
margin-top: 4px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: var(--text-sub);
|
color: #7b8493;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
|
|
||||||
.snippet-label {
|
.snippet-label {
|
||||||
font-family: var(--font-serif);
|
color: #4b5563;
|
||||||
color: var(--brand-primary-deep);
|
}
|
||||||
|
|
||||||
|
.field-box {
|
||||||
|
border: 1px solid var(--card-border);
|
||||||
|
border-radius: var(--radius-sm);
|
||||||
|
padding: 8px 10px;
|
||||||
|
|
||||||
|
.field-ops { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
|
||||||
|
.hint { font-size: 12px; color: #8b93a1; }
|
||||||
|
.field-item { width: 25% !important; margin-right: 0 !important; }
|
||||||
}
|
}
|
||||||
|
|
||||||
.pager {
|
.pager {
|
||||||
@@ -407,18 +626,6 @@ onMounted(() => {
|
|||||||
/* 页码较多时自动换行,保证页码按钮与跳转框都能点到 */
|
/* 页码较多时自动换行,保证页码按钮与跳转框都能点到 */
|
||||||
:deep(.el-pagination__jump) { margin-left: 12px; }
|
:deep(.el-pagination__jump) { margin-left: 12px; }
|
||||||
}
|
}
|
||||||
.dt { margin: 0 0 12px; font-size: 18px; letter-spacing: 1px; }
|
.dt { margin: 0 0 12px; font-size: 17px; }
|
||||||
.sim-item {
|
.sim-item { font-size: 13px; padding: 6px 0; border-bottom: 1px dashed #eee; cursor: pointer; }
|
||||||
font-size: 13px;
|
|
||||||
padding: 8px 0;
|
|
||||||
border-bottom: 1px solid var(--hair-line);
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
&:hover { color: var(--brand-gold-deep); }
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 760px) {
|
|
||||||
.body { flex-direction: column; }
|
|
||||||
.side { width: 100%; }
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user