项目框架
@@ -0,0 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
// 根组件:仅承载路由出口
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<router-view />
|
||||
</template>
|
||||
@@ -0,0 +1,36 @@
|
||||
import request from './request'
|
||||
import type { FacetItem, YearStat } from './search'
|
||||
|
||||
/** 数据总览 */
|
||||
export interface AnalysisOverview {
|
||||
totalCount: number
|
||||
mediaRatio: FacetItem[]
|
||||
libraryContribution: FacetItem[]
|
||||
todaySearchCount: number
|
||||
todayAddCount: number
|
||||
onlineCount: number
|
||||
}
|
||||
|
||||
export function getOverview() {
|
||||
return request.get<never, AnalysisOverview>('/analysis/overview')
|
||||
}
|
||||
|
||||
export function getResourceRatio() {
|
||||
return request.get<never, FacetItem[]>('/analysis/resource-ratio')
|
||||
}
|
||||
|
||||
export function getLibraryContribution() {
|
||||
return request.get<never, FacetItem[]>('/analysis/library-contribution')
|
||||
}
|
||||
|
||||
export function getYearDistribution() {
|
||||
return request.get<never, YearStat[]>('/analysis/year-distribution')
|
||||
}
|
||||
|
||||
export function getHotKeywords(limit = 20) {
|
||||
return request.get<never, FacetItem[]>('/analysis/hot-keywords', { params: { limit } })
|
||||
}
|
||||
|
||||
export function getRecentActivity() {
|
||||
return request.get<never, YearStat[]>('/analysis/recent-activity')
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import request from './request'
|
||||
import type { UserInfo } from '@/utils/auth'
|
||||
|
||||
export interface LoginParams {
|
||||
username: string
|
||||
password: string
|
||||
}
|
||||
|
||||
export interface LoginResult extends UserInfo {
|
||||
token: string
|
||||
}
|
||||
|
||||
/** 登录 */
|
||||
export function login(data: LoginParams) {
|
||||
return request.post<never, LoginResult>('/auth/login', data)
|
||||
}
|
||||
|
||||
/** 当前登录用户 */
|
||||
export function getCurrentUser() {
|
||||
return request.get<never, UserInfo>('/auth/me')
|
||||
}
|
||||
|
||||
/** 登出 */
|
||||
export function logout() {
|
||||
return request.post<never, void>('/auth/logout')
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import request from './request'
|
||||
|
||||
export interface CollectTask {
|
||||
id?: number
|
||||
libraryCode: string
|
||||
libraryName?: string
|
||||
sourceType?: string
|
||||
targetCount?: number
|
||||
collectedCount?: number
|
||||
status?: string
|
||||
message?: string
|
||||
startTime?: string
|
||||
endTime?: string
|
||||
createTime?: string
|
||||
}
|
||||
|
||||
/** 创建采集任务 */
|
||||
export function createCollectTask(data: CollectTask) {
|
||||
return request.post<never, number>('/collect/task', data)
|
||||
}
|
||||
|
||||
/** 执行采集任务 */
|
||||
export function startCollectTask(id: number) {
|
||||
return request.post<never, void>(`/collect/task/${id}/start`)
|
||||
}
|
||||
|
||||
/** 任务列表 */
|
||||
export function listCollectTasks() {
|
||||
return request.get<never, CollectTask[]>('/collect/tasks')
|
||||
}
|
||||
|
||||
/** 某单位最新进度 */
|
||||
export function getCollectProgress(libraryCode: string) {
|
||||
return request.get<never, CollectTask>(`/collect/progress/${libraryCode}`)
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import request from './request'
|
||||
import type { PageResult } from './types'
|
||||
|
||||
export interface DepositRecord {
|
||||
id?: number
|
||||
orgName: string
|
||||
contact: string
|
||||
phone: string
|
||||
email?: string
|
||||
resourceTitle: string
|
||||
mediaType?: string
|
||||
summary?: string
|
||||
remark?: string
|
||||
fileUrl?: string
|
||||
status?: string
|
||||
auditRemark?: string
|
||||
auditTime?: string
|
||||
createTime?: string
|
||||
}
|
||||
|
||||
export interface DepositQuery {
|
||||
current?: number
|
||||
size?: number
|
||||
orgName?: string
|
||||
resourceTitle?: string
|
||||
status?: string
|
||||
}
|
||||
|
||||
/** 提交呈缴 */
|
||||
export function submitDeposit(data: DepositRecord) {
|
||||
return request.post<never, number>('/deposit', data)
|
||||
}
|
||||
|
||||
/** 管理端分页 */
|
||||
export function pageDeposit(params: DepositQuery) {
|
||||
return request.get<never, PageResult<DepositRecord>>('/deposit/page', { params })
|
||||
}
|
||||
|
||||
/** 接收 */
|
||||
export function acceptDeposit(id: number, auditRemark?: string) {
|
||||
return request.post<never, void>(`/deposit/${id}/accept`, null, { params: { auditRemark } })
|
||||
}
|
||||
|
||||
/** 退回 */
|
||||
export function rejectDeposit(id: number, auditRemark?: string) {
|
||||
return request.post<never, void>(`/deposit/${id}/reject`, null, { params: { auditRemark } })
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import request from './request'
|
||||
|
||||
export interface GovernanceJob {
|
||||
id?: number
|
||||
jobType: string
|
||||
status?: string
|
||||
affectedCount?: number
|
||||
resultSummary?: string
|
||||
startTime?: string
|
||||
endTime?: string
|
||||
createTime?: string
|
||||
}
|
||||
|
||||
/** 聚同 */
|
||||
export function runMerge() {
|
||||
return request.post<never, GovernanceJob>('/governance/merge')
|
||||
}
|
||||
|
||||
/** 优化 */
|
||||
export function runOptimize() {
|
||||
return request.post<never, GovernanceJob>('/governance/optimize')
|
||||
}
|
||||
|
||||
/** 提示 */
|
||||
export function runHint() {
|
||||
return request.post<never, GovernanceJob>('/governance/hint')
|
||||
}
|
||||
|
||||
/** 提纯 */
|
||||
export function runPurify() {
|
||||
return request.post<never, GovernanceJob>('/governance/purify')
|
||||
}
|
||||
|
||||
/** 治理任务历史 */
|
||||
export function listGovernanceJobs() {
|
||||
return request.get<never, GovernanceJob[]>('/governance/jobs')
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
import axios, { type AxiosInstance, type AxiosResponse } from 'axios'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { clearAuth, getToken } from '@/utils/auth'
|
||||
|
||||
/** 后端统一响应结构 */
|
||||
export interface ApiResult<T = unknown> {
|
||||
code: number
|
||||
message: string
|
||||
data: T
|
||||
}
|
||||
|
||||
const service: AxiosInstance = axios.create({
|
||||
baseURL: import.meta.env.VITE_API_BASE_URL || '/api',
|
||||
timeout: 30000,
|
||||
// 数组参数序列化为 key=a&key=b,便于 Spring 绑定 List
|
||||
paramsSerializer: { indexes: null }
|
||||
})
|
||||
|
||||
// 请求拦截器:附加登录令牌
|
||||
service.interceptors.request.use(
|
||||
(config) => {
|
||||
const token = getToken()
|
||||
if (token) {
|
||||
config.headers = config.headers ?? {}
|
||||
config.headers.Authorization = `Bearer ${token}`
|
||||
}
|
||||
return config
|
||||
},
|
||||
(error) => Promise.reject(error)
|
||||
)
|
||||
|
||||
// 响应拦截器:统一解包 + 错误提示 + 401 处理
|
||||
service.interceptors.response.use(
|
||||
(response: AxiosResponse<ApiResult>) => {
|
||||
const res = response.data
|
||||
if (res.code !== 200) {
|
||||
ElMessage.error(res.message || '请求失败')
|
||||
return Promise.reject(new Error(res.message || 'Error'))
|
||||
}
|
||||
return res.data as never
|
||||
},
|
||||
(error) => {
|
||||
const status = error?.response?.status
|
||||
if (status === 401) {
|
||||
clearAuth()
|
||||
ElMessage.error('登录已失效,请重新登录')
|
||||
if (window.location.pathname !== '/login') {
|
||||
window.location.href = '/login'
|
||||
}
|
||||
} else {
|
||||
const msg = error?.response?.data?.message || error?.message || '网络异常'
|
||||
ElMessage.error(msg)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
export default service
|
||||
@@ -0,0 +1,63 @@
|
||||
import request from './request'
|
||||
import type { PageResult } from './types'
|
||||
|
||||
/** 版本资源元数据 */
|
||||
export interface VersionResource {
|
||||
id?: number
|
||||
processNo?: string
|
||||
title: string
|
||||
clcCode?: string
|
||||
keywords?: string
|
||||
summary?: string
|
||||
publishYear?: string
|
||||
processDate?: string
|
||||
contentForm?: string
|
||||
mediaType?: string
|
||||
format?: string
|
||||
pageCount?: string
|
||||
language?: string
|
||||
submitOrg?: string
|
||||
taskYear?: string
|
||||
sourceLibrary?: string
|
||||
sourceLibraryAddr?: string
|
||||
fulltextUrl?: string
|
||||
author?: string
|
||||
publisher?: string
|
||||
isbn?: string
|
||||
governStatus?: string
|
||||
mergedToId?: number
|
||||
abnormalFlag?: number
|
||||
sensitiveFlag?: number
|
||||
}
|
||||
|
||||
export interface ResourceQuery {
|
||||
current?: number
|
||||
size?: number
|
||||
title?: string
|
||||
author?: string
|
||||
clcCode?: string
|
||||
mediaType?: string
|
||||
sourceLibrary?: string
|
||||
publishYear?: string
|
||||
governStatus?: string
|
||||
}
|
||||
|
||||
/** 分页查询版本资源 */
|
||||
export function pageResource(params: ResourceQuery) {
|
||||
return request.get<never, PageResult<VersionResource>>('/resource/page', { params })
|
||||
}
|
||||
|
||||
/** 查询单条 */
|
||||
export function getResource(id: number) {
|
||||
return request.get<never, VersionResource>(`/resource/${id}`)
|
||||
}
|
||||
|
||||
/** 新增或更新 */
|
||||
export function saveResource(data: VersionResource) {
|
||||
return request.post<never, number>('/resource', data)
|
||||
}
|
||||
|
||||
/** 删除 */
|
||||
export function removeResource(id: number) {
|
||||
return request.delete<never, void>(`/resource/${id}`)
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
import request from './request'
|
||||
import type { PageResult } from './types'
|
||||
import type { ResourceQuery, VersionResource } from './resource'
|
||||
|
||||
/** 检索条件(对应后端 SearchQuery) */
|
||||
export interface SearchQuery extends ResourceQuery {
|
||||
keyword?: string
|
||||
publisher?: string
|
||||
isbn?: string
|
||||
cdoi?: string
|
||||
sourceLibraries?: string[]
|
||||
publishYearStart?: string
|
||||
publishYearEnd?: string
|
||||
matchType?: 'EQ' | 'LEFT' | 'RIGHT' | 'LIKE'
|
||||
logic?: 'AND' | 'OR'
|
||||
orderBy?: string
|
||||
orderDir?: string
|
||||
}
|
||||
|
||||
export interface FacetItem {
|
||||
name: string
|
||||
value: number
|
||||
}
|
||||
|
||||
export interface YearStat {
|
||||
year: string
|
||||
count: number
|
||||
}
|
||||
|
||||
export interface SearchResultVO {
|
||||
page: PageResult<VersionResource>
|
||||
mediaTypeFacets: FacetItem[]
|
||||
sourceLibraryFacets: FacetItem[]
|
||||
clcFacets: FacetItem[]
|
||||
yearStats: YearStat[]
|
||||
costMs: number
|
||||
}
|
||||
|
||||
/** 统一检索(初级检索) */
|
||||
export function unifiedSearch(params: SearchQuery) {
|
||||
return request.get<never, SearchResultVO>('/search/unified', { params })
|
||||
}
|
||||
|
||||
/** 高级检索 */
|
||||
export function advancedSearch(params: SearchQuery) {
|
||||
return request.get<never, SearchResultVO>('/search/advanced', { params })
|
||||
}
|
||||
|
||||
/** 分页检索(POST,支持数组条件) */
|
||||
export function searchPage(data: SearchQuery) {
|
||||
return request.post<never, SearchResultVO>('/search/page', data)
|
||||
}
|
||||
|
||||
/** 文献细览 */
|
||||
export function getSearchDetail(id: number) {
|
||||
return request.get<never, VersionResource>(`/search/detail/${id}`)
|
||||
}
|
||||
|
||||
/** 相似文献推荐 */
|
||||
export function getSimilar(id: number, limit = 10) {
|
||||
return request.get<never, VersionResource[]>(`/search/similar/${id}`, { params: { limit } })
|
||||
}
|
||||
|
||||
/** 结果列表(用于导出) */
|
||||
export function searchList(data: SearchQuery) {
|
||||
return request.post<never, VersionResource[]>('/search/list', data)
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import request from './request'
|
||||
|
||||
export interface SpecialResource {
|
||||
id?: number
|
||||
name: string
|
||||
summary?: string
|
||||
category?: string
|
||||
coverUrl?: string
|
||||
ebookUrl?: string
|
||||
sortNo?: number
|
||||
status?: number
|
||||
}
|
||||
|
||||
/** 首页推荐 */
|
||||
export function getRecommend(limit = 8) {
|
||||
return request.get<never, SpecialResource[]>('/special/recommend', { params: { limit } })
|
||||
}
|
||||
|
||||
/** 特藏细览 */
|
||||
export function getSpecialDetail(id: number) {
|
||||
return request.get<never, SpecialResource>(`/special/${id}`)
|
||||
}
|
||||
|
||||
/** 管理端列表 */
|
||||
export function adminSpecialList() {
|
||||
return request.get<never, SpecialResource[]>('/special/admin/list')
|
||||
}
|
||||
|
||||
/** 管理端新增/更新 */
|
||||
export function saveSpecial(data: SpecialResource) {
|
||||
return request.post<never, number>('/special/admin', data)
|
||||
}
|
||||
|
||||
/** 管理端删除 */
|
||||
export function removeSpecial(id: number) {
|
||||
return request.delete<never, void>(`/special/admin/${id}`)
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
/** 通用分页返回结构 */
|
||||
export interface PageResult<T> {
|
||||
records: T[]
|
||||
total: number
|
||||
current: number
|
||||
size: number
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 635 B |
|
After Width: | Height: | Size: 437 B |
|
After Width: | Height: | Size: 959 KiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 711 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 1.3 MiB |
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* 数据字典。
|
||||
*
|
||||
* <p>与后端枚举保持一一对应,**前端只负责展示中文,数据库存储的是英文码值**。
|
||||
* 新增/修改枚举时,请同步修改这里与后端的 `GovernStatus`。</p>
|
||||
*/
|
||||
|
||||
export type TagType = 'primary' | 'success' | 'info' | 'warning' | 'danger'
|
||||
|
||||
export interface DictItem {
|
||||
/** 码值(与后端一致,存库用) */
|
||||
value: string
|
||||
/** 中文名称(展示用) */
|
||||
label: string
|
||||
/** 标签颜色 */
|
||||
tagType: TagType
|
||||
/** 说明 */
|
||||
description: string
|
||||
}
|
||||
|
||||
/** 治理状态字典 —— 对应后端 com.banben.modules.resource.enums.GovernStatus */
|
||||
export const GOVERN_STATUS: DictItem[] = [
|
||||
{ value: 'RAW', label: '原始', tagType: 'info', description: '刚采集入库,未做任何治理' },
|
||||
{ value: 'MERGED', label: '已聚同', tagType: 'primary', description: '同一文献已聚合为一条,并标注来源' },
|
||||
{ value: 'OPTIMIZED', label: '已优化', tagType: 'warning', description: '元数据描述已整合优化' },
|
||||
{ value: 'FINAL', label: '已提纯', tagType: 'success', description: '已纳入版本资源数据集' },
|
||||
{ value: 'MERGED_OUT', label: '已合并', tagType: 'danger', description: '本条已被聚同合并到主记录' }
|
||||
]
|
||||
|
||||
const GOVERN_STATUS_MAP = new Map(GOVERN_STATUS.map((i) => [i.value, i]))
|
||||
|
||||
/** 治理状态 → 中文名称 */
|
||||
export function governStatusLabel(code?: string | null): string {
|
||||
if (!code) return '-'
|
||||
return GOVERN_STATUS_MAP.get(code)?.label ?? code
|
||||
}
|
||||
|
||||
/** 治理状态 → 标签颜色 */
|
||||
export function governStatusTagType(code?: string | null): TagType {
|
||||
return GOVERN_STATUS_MAP.get(code ?? '')?.tagType ?? 'info'
|
||||
}
|
||||
|
||||
/** 媒体类型选项 */
|
||||
export const MEDIA_TYPES = [
|
||||
{ value: '纸质', label: '纸质' },
|
||||
{ value: '电子', label: '电子' }
|
||||
]
|
||||
@@ -0,0 +1,145 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { clearAuth, getUser } from '@/utils/auth'
|
||||
import logoUrl from '@/assets/logo.png'
|
||||
import noticeUrl from '@/assets/icon-notice.png'
|
||||
import settingUrl from '@/assets/icon-setting.png'
|
||||
import avatarUrl from '@/assets/avatar.png'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const user = computed(() => getUser())
|
||||
|
||||
const menus = [
|
||||
{ path: '/dashboard', title: '首页' },
|
||||
{ path: '/search', title: '版本资源检索' },
|
||||
{ path: '/special', title: '特藏版本推荐' },
|
||||
{ path: '/deposit', title: '版本资源呈缴' },
|
||||
{ path: '/analysis', title: '数据统计' },
|
||||
{ path: '/resource', title: '资源管理' },
|
||||
{ path: '/collect', title: '数据采集' },
|
||||
{ path: '/governance', title: '数据治理' }
|
||||
]
|
||||
|
||||
function logout() {
|
||||
clearAuth()
|
||||
router.push('/login')
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="site">
|
||||
<header class="site-header">
|
||||
<div class="logo" @click="router.push('/')">
|
||||
<img class="logo-img" :src="logoUrl" alt="logo" />
|
||||
<span class="logo-text">版本资源联合服务平台</span>
|
||||
</div>
|
||||
<nav class="nav">
|
||||
<a
|
||||
v-for="m in menus"
|
||||
:key="m.path"
|
||||
:class="{ active: route.path === m.path }"
|
||||
@click="router.push(m.path)"
|
||||
>
|
||||
{{ m.title }}
|
||||
</a>
|
||||
</nav>
|
||||
<div class="right">
|
||||
<img class="hicon" :src="noticeUrl" alt="notice" />
|
||||
<img class="hicon" :src="settingUrl" alt="setting" />
|
||||
<img class="avatar" :src="avatarUrl" alt="avatar" />
|
||||
<span class="user">{{ user?.realName || 'admin' }}</span>
|
||||
<a class="quit" @click="logout">退出登录</a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main class="site-main">
|
||||
<router-view />
|
||||
</main>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.site {
|
||||
min-height: 100vh;
|
||||
background: var(--page-bg);
|
||||
}
|
||||
|
||||
.site-header {
|
||||
height: 64px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 32px;
|
||||
padding: 0 24px;
|
||||
background: var(--header-bg) var(--nav-bg-img) center / cover no-repeat;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.logo-img {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.hicon {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
cursor: pointer;
|
||||
filter: brightness(0) invert(1);
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.logo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.logo-text {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.nav {
|
||||
display: flex;
|
||||
gap: 28px;
|
||||
flex: 1;
|
||||
justify-content: center;
|
||||
|
||||
a {
|
||||
color: rgba(255, 255, 255, 0.82);
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
|
||||
&.active,
|
||||
&:hover {
|
||||
color: #fff;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.quit {
|
||||
color: rgba(255, 255, 255, 0.85);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.site-main {
|
||||
padding: 20px 24px 40px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,27 @@
|
||||
import { createApp } from 'vue'
|
||||
import { createPinia } from 'pinia'
|
||||
import ElementPlus from 'element-plus'
|
||||
import zhCn from 'element-plus/es/locale/lang/zh-cn'
|
||||
import 'element-plus/dist/index.css'
|
||||
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
||||
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import './styles/theme.scss'
|
||||
import './styles/index.scss'
|
||||
import { applyTheme } from './utils/theme'
|
||||
|
||||
applyTheme()
|
||||
|
||||
const app = createApp(App)
|
||||
|
||||
// 注册所有 Element Plus 图标
|
||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||
app.component(key, component)
|
||||
}
|
||||
|
||||
app.use(createPinia())
|
||||
app.use(router)
|
||||
app.use(ElementPlus, { locale: zhCn })
|
||||
|
||||
app.mount('#app')
|
||||
@@ -0,0 +1,106 @@
|
||||
import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router'
|
||||
import BasicLayout from '@/layouts/BasicLayout.vue'
|
||||
import { getToken } from '@/utils/auth'
|
||||
|
||||
/**
|
||||
* 路由表:与招标文件功能模块对应。
|
||||
* meta.title 用于菜单与面包屑展示。
|
||||
*/
|
||||
const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
path: '/',
|
||||
component: BasicLayout,
|
||||
redirect: '/dashboard',
|
||||
children: [
|
||||
{
|
||||
path: 'dashboard',
|
||||
name: 'Dashboard',
|
||||
component: () => import('@/views/Dashboard.vue'),
|
||||
meta: { title: '首页概览', icon: 'HomeFilled' }
|
||||
},
|
||||
{
|
||||
path: 'search',
|
||||
name: 'Search',
|
||||
component: () => import('@/views/search/SearchView.vue'),
|
||||
meta: { title: '检索发现', icon: 'Search' }
|
||||
},
|
||||
{
|
||||
path: 'advanced',
|
||||
name: 'Advanced',
|
||||
component: () => import('@/views/search/AdvancedView.vue'),
|
||||
meta: { title: '高级检索' }
|
||||
},
|
||||
{
|
||||
path: 'resource',
|
||||
name: 'Resource',
|
||||
component: () => import('@/views/resource/ResourceList.vue'),
|
||||
meta: { title: '版本资源库', icon: 'Collection' }
|
||||
},
|
||||
{
|
||||
path: 'collect',
|
||||
name: 'Collect',
|
||||
component: () => import('@/views/collect/CollectView.vue'),
|
||||
meta: { title: '数据采集', icon: 'Download' }
|
||||
},
|
||||
{
|
||||
path: 'governance',
|
||||
name: 'Governance',
|
||||
component: () => import('@/views/governance/GovernanceView.vue'),
|
||||
meta: { title: '数据治理', icon: 'MagicStick' }
|
||||
},
|
||||
{
|
||||
path: 'special',
|
||||
name: 'Special',
|
||||
component: () => import('@/views/special/SpecialView.vue'),
|
||||
meta: { title: '特藏推荐', icon: 'Star' }
|
||||
},
|
||||
{
|
||||
path: 'deposit',
|
||||
name: 'Deposit',
|
||||
component: () => import('@/views/deposit/DepositView.vue'),
|
||||
meta: { title: '资源呈缴', icon: 'Upload' }
|
||||
},
|
||||
{
|
||||
path: 'analysis',
|
||||
name: 'Analysis',
|
||||
component: () => import('@/views/analysis/AnalysisView.vue'),
|
||||
meta: { title: '统计分析', icon: 'DataAnalysis' }
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
name: 'Login',
|
||||
component: () => import('@/views/Login.vue'),
|
||||
meta: { title: '登录', public: true }
|
||||
},
|
||||
{
|
||||
path: '/:pathMatch(.*)*',
|
||||
name: 'NotFound',
|
||||
component: () => import('@/views/NotFound.vue')
|
||||
}
|
||||
]
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes
|
||||
})
|
||||
|
||||
// 路由守卫:未登录跳转登录页
|
||||
router.beforeEach((to) => {
|
||||
const token = getToken()
|
||||
if (!to.meta?.public && !token) {
|
||||
return { path: '/login', query: { redirect: to.fullPath } }
|
||||
}
|
||||
if (to.path === '/login' && token) {
|
||||
return '/'
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
router.afterEach((to) => {
|
||||
const title = (to.meta?.title as string) || ''
|
||||
document.title = title ? `${title} - 版本资源联合服务系统` : '版本资源联合服务系统'
|
||||
})
|
||||
|
||||
export default router
|
||||
@@ -0,0 +1,22 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
|
||||
/**
|
||||
* 全局应用状态。
|
||||
*/
|
||||
export const useAppStore = defineStore('app', () => {
|
||||
/** 侧边栏是否折叠 */
|
||||
const sidebarCollapsed = ref(false)
|
||||
/** 登录 Token(对接认证后使用) */
|
||||
const token = ref<string>('')
|
||||
|
||||
function toggleSidebar() {
|
||||
sidebarCollapsed.value = !sidebarCollapsed.value
|
||||
}
|
||||
|
||||
function setToken(value: string) {
|
||||
token.value = value
|
||||
}
|
||||
|
||||
return { sidebarCollapsed, token, toggleSidebar, setToken }
|
||||
})
|
||||
@@ -0,0 +1,34 @@
|
||||
/* 全局样式 */
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html,
|
||||
body,
|
||||
#app {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
|
||||
'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
color: #303133;
|
||||
background-color: var(--page-bg);
|
||||
}
|
||||
|
||||
|
||||
.page-card {
|
||||
background-color: #fff;
|
||||
border-radius: 6px;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.page-title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
margin: 0 0 16px;
|
||||
}
|
||||
|
||||
.mb-16 {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/* 主站点:科技蓝 */
|
||||
:root.theme-blue {
|
||||
--brand-primary: #2b6cf6;
|
||||
--brand-light: #e8f0ff;
|
||||
--header-bg: #16306b;
|
||||
--side-bg: #16223c;
|
||||
--page-bg: #f2f5fb;
|
||||
--hero-bg: radial-gradient(1200px 500px at 50% 118%, #3ea8ff 0%, #1b4fd0 38%, #0d2a6b 68%, #071a45 100%);
|
||||
}
|
||||
|
||||
/* 分站点:书卷棕 */
|
||||
:root.theme-brown {
|
||||
--brand-primary: #8b5a2b;
|
||||
--brand-light: #faf3e6;
|
||||
--header-bg: #3f2a15;
|
||||
--side-bg: #3a2a1c;
|
||||
--page-bg: #f7f1e6;
|
||||
--hero-bg: radial-gradient(1200px 500px at 50% 118%, #d8a455 0%, #a9703c 38%, #6b3f1d 68%, #2e1a0a 100%);
|
||||
}
|
||||
|
||||
/* 切图资源(主站点蓝) */
|
||||
:root {
|
||||
--el-color-primary: var(--brand-primary);
|
||||
--nav-bg-img: url('@/assets/nav-bg.png');
|
||||
--hero-light-img: url('@/assets/hero-light.png');
|
||||
--hero-blur-img: url('@/assets/hero-blur.png');
|
||||
--page-bg-img: url('@/assets/page-bg.png');
|
||||
--hero-filter: none;
|
||||
}
|
||||
|
||||
/* 分站点:同一套切图做暖色调处理 */
|
||||
:root.theme-brown {
|
||||
--hero-filter: sepia(0.85) saturate(1.6) hue-rotate(-12deg);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/** 登录令牌与用户信息的本地存取 */
|
||||
|
||||
const TOKEN_KEY = 'banben_token'
|
||||
const USER_KEY = 'banben_user'
|
||||
|
||||
export interface UserInfo {
|
||||
userId: number
|
||||
username: string
|
||||
realName: string
|
||||
role: string
|
||||
orgName: string
|
||||
}
|
||||
|
||||
export function getToken(): string {
|
||||
return localStorage.getItem(TOKEN_KEY) || ''
|
||||
}
|
||||
|
||||
export function setToken(token: string): void {
|
||||
localStorage.setItem(TOKEN_KEY, token)
|
||||
}
|
||||
|
||||
export function getUser(): UserInfo | null {
|
||||
const raw = localStorage.getItem(USER_KEY)
|
||||
if (!raw) return null
|
||||
try {
|
||||
return JSON.parse(raw) as UserInfo
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
export function setUser(user: UserInfo): void {
|
||||
localStorage.setItem(USER_KEY, JSON.stringify(user))
|
||||
}
|
||||
|
||||
export function clearAuth(): void {
|
||||
localStorage.removeItem(TOKEN_KEY)
|
||||
localStorage.removeItem(USER_KEY)
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export function applyTheme() {
|
||||
const site = import.meta.env.VITE_SITE_TYPE || 'main'
|
||||
document.documentElement.className = site === 'branch' ? 'theme-brown' : 'theme-blue'
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
const router = useRouter()
|
||||
const keyword = ref('')
|
||||
const field = ref('题名')
|
||||
const fields = ['题名', '关键词', '作者', '出版机构']
|
||||
const types = ref<string[]>([])
|
||||
const typeOpts = ['纸质图书', '电子图书', '中文文献', '外文文献']
|
||||
const hot = ['古籍版本', '学位论文', '地方志', '民国文献']
|
||||
|
||||
function doSearch() {
|
||||
router.push({ path: '/search', query: { keyword: keyword.value } })
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="hero">
|
||||
<div class="hero-inner">
|
||||
<h1>一站式版本资源统一检索</h1>
|
||||
<p class="sub">支持纸电一体检索、表达式检索、主题联想、分面聚类检索</p>
|
||||
|
||||
<div class="searchbox">
|
||||
<div class="row1">
|
||||
<el-select v-model="field" class="sel">
|
||||
<el-option v-for="f in fields" :key="f" :label="f" :value="f" />
|
||||
</el-select>
|
||||
<input v-model="keyword" class="ipt" placeholder="请输入检索词,支持表达式检索" @keyup.enter="doSearch" />
|
||||
<button class="btn primary" @click="doSearch">检索</button>
|
||||
<button class="btn ghost" @click="router.push('/advanced')">高级检索</button>
|
||||
</div>
|
||||
|
||||
<div class="types">
|
||||
<span class="lbl">前置筛选:</span>
|
||||
<label v-for="t in typeOpts" :key="t">
|
||||
<input type="checkbox" :value="t" v-model="types" />{{ t }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hot">
|
||||
<span>热门检索:</span>
|
||||
<a v-for="h in hot" :key="h" @click="keyword = h; doSearch()">{{ h }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.hero {
|
||||
min-height: calc(100vh - 64px);
|
||||
margin: -20px -24px;
|
||||
background: var(--page-bg-img) center / cover no-repeat, #0d2a6b;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: var(--hero-light-img) center bottom / contain no-repeat;
|
||||
filter: var(--hero-filter);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
height: 42%;
|
||||
background: var(--hero-blur-img) center bottom / cover no-repeat;
|
||||
filter: var(--hero-filter);
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
.hero-inner {
|
||||
width: 100%;
|
||||
max-width: 900px;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
padding: 40px 20px;
|
||||
|
||||
h1 {
|
||||
color: #fff;
|
||||
font-size: 42px;
|
||||
letter-spacing: 2px;
|
||||
margin: 0 0 14px;
|
||||
}
|
||||
|
||||
.sub {
|
||||
color: rgba(255, 255, 255, 0.82);
|
||||
font-size: 14px;
|
||||
margin: 0 0 40px;
|
||||
}
|
||||
}
|
||||
|
||||
.searchbox {
|
||||
display: flex;
|
||||
background: #fff;
|
||||
border-radius: 6px;
|
||||
padding: 6px;
|
||||
gap: 6px;
|
||||
align-items: center;
|
||||
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
|
||||
.sel { width: 120px; flex: none; }
|
||||
.sel :deep(.el-input__wrapper) { box-shadow: none; }
|
||||
|
||||
.ipt {
|
||||
flex: 1;
|
||||
border: none;
|
||||
outline: none;
|
||||
font-size: 15px;
|
||||
padding: 0 8px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
height: 40px;
|
||||
padding: 0 26px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
font-size: 15px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.btn.primary { background: var(--brand-primary); color: #fff; }
|
||||
.btn.ghost { background: #fff; color: var(--brand-primary); border: 1px solid var(--brand-primary); }
|
||||
|
||||
.types {
|
||||
margin-top: 22px;
|
||||
display: flex;
|
||||
gap: 26px;
|
||||
justify-content: center;
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
font-size: 13px;
|
||||
|
||||
label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
|
||||
}
|
||||
|
||||
.hot {
|
||||
margin-top: 26px;
|
||||
color: rgba(255, 255, 255, 0.75);
|
||||
font-size: 13px;
|
||||
|
||||
a {
|
||||
margin-left: 14px;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,121 @@
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { ElMessage, type FormInstance, type FormRules } from 'element-plus'
|
||||
import { Lock, User } from '@element-plus/icons-vue'
|
||||
import { login } from '@/api/auth'
|
||||
import { setToken, setUser } from '@/utils/auth'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const formRef = ref<FormInstance>()
|
||||
const loading = ref(false)
|
||||
|
||||
const form = reactive({
|
||||
username: 'admin',
|
||||
password: 'admin123'
|
||||
})
|
||||
|
||||
const rules: FormRules = {
|
||||
username: [{ required: true, message: '请输入账号', trigger: 'blur' }],
|
||||
password: [{ required: true, message: '请输入密码', trigger: 'blur' }]
|
||||
}
|
||||
|
||||
async function handleLogin() {
|
||||
await formRef.value?.validate()
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await login(form)
|
||||
setToken(res.token)
|
||||
setUser({
|
||||
userId: res.userId,
|
||||
username: res.username,
|
||||
realName: res.realName,
|
||||
role: res.role,
|
||||
orgName: res.orgName
|
||||
})
|
||||
ElMessage.success('登录成功')
|
||||
const redirect = (route.query.redirect as string) || '/'
|
||||
router.push(redirect)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="login-page">
|
||||
<div class="login-box">
|
||||
<div class="login-title">
|
||||
<el-icon :size="30" color="#409eff"><Collection /></el-icon>
|
||||
<h2>版本资源联合服务系统</h2>
|
||||
<p>数据集成库 · 检索发现 · 大数据分析</p>
|
||||
</div>
|
||||
|
||||
<el-form ref="formRef" :model="form" :rules="rules" size="large" @submit.prevent>
|
||||
<el-form-item prop="username">
|
||||
<el-input v-model="form.username" placeholder="请输入账号" :prefix-icon="User" />
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-input
|
||||
v-model="form.password"
|
||||
type="password"
|
||||
placeholder="请输入密码"
|
||||
show-password
|
||||
:prefix-icon="Lock"
|
||||
@keyup.enter="handleLogin"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" :loading="loading" style="width: 100%" @click="handleLogin">
|
||||
登 录
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div class="login-tip">默认账号:admin / admin123</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.login-page {
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: var(--header-bg);
|
||||
}
|
||||
|
||||
.login-box {
|
||||
width: 380px;
|
||||
padding: 36px 32px 24px;
|
||||
background: #fff;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
|
||||
|
||||
.login-title {
|
||||
text-align: center;
|
||||
margin-bottom: 24px;
|
||||
|
||||
h2 {
|
||||
margin: 12px 0 6px;
|
||||
font-size: 19px;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
}
|
||||
}
|
||||
|
||||
.login-tip {
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
color: #c0c4cc;
|
||||
margin-top: 8px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,23 @@
|
||||
<script setup lang="ts">
|
||||
import { useRouter } from 'vue-router'
|
||||
const router = useRouter()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="not-found">
|
||||
<el-result icon="warning" title="404" sub-title="页面不存在">
|
||||
<template #extra>
|
||||
<el-button type="primary" @click="router.push('/')">返回首页</el-button>
|
||||
</template>
|
||||
</el-result>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.not-found {
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,204 @@
|
||||
<script setup lang="ts">
|
||||
import { onBeforeUnmount, onMounted, ref } from 'vue'
|
||||
import * as echarts from 'echarts'
|
||||
import {
|
||||
getHotKeywords,
|
||||
getLibraryContribution,
|
||||
getOverview,
|
||||
getRecentActivity,
|
||||
getResourceRatio,
|
||||
getYearDistribution,
|
||||
type AnalysisOverview
|
||||
} from '@/api/analysis'
|
||||
import type { FacetItem, YearStat } from '@/api/search'
|
||||
|
||||
const overview = ref<AnalysisOverview | null>(null)
|
||||
const hotKeywords = ref<FacetItem[]>([])
|
||||
const recent = ref<YearStat[]>([])
|
||||
|
||||
const ratioRef = ref<HTMLElement>()
|
||||
const yearRef = ref<HTMLElement>()
|
||||
const contribRef = ref<HTMLElement>()
|
||||
const hotRef = ref<HTMLElement>()
|
||||
const charts: echarts.ECharts[] = []
|
||||
|
||||
function initChart(el?: HTMLElement) {
|
||||
if (!el) return null
|
||||
const c = echarts.init(el)
|
||||
charts.push(c)
|
||||
return c
|
||||
}
|
||||
|
||||
async function loadAll() {
|
||||
overview.value = await getOverview()
|
||||
hotKeywords.value = await getHotKeywords(20)
|
||||
recent.value = await getRecentActivity()
|
||||
|
||||
const ratio = await getResourceRatio()
|
||||
initChart(ratioRef.value)?.setOption({
|
||||
tooltip: { trigger: 'item' },
|
||||
legend: { bottom: 0 },
|
||||
series: [
|
||||
{
|
||||
name: '资源比例',
|
||||
type: 'pie',
|
||||
radius: ['40%', '65%'],
|
||||
data: ratio.map((r) => ({ name: r.name, value: r.value }))
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
const year = await getYearDistribution()
|
||||
initChart(yearRef.value)?.setOption({
|
||||
tooltip: { trigger: 'axis' },
|
||||
grid: { left: 45, right: 20, top: 30, bottom: 30 },
|
||||
xAxis: { type: 'category', data: year.map((y) => y.year) },
|
||||
yAxis: { type: 'value' },
|
||||
series: [
|
||||
{
|
||||
name: '资源量',
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
areaStyle: { opacity: 0.15 },
|
||||
data: year.map((y) => y.count)
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
const contrib = await getLibraryContribution()
|
||||
initChart(contribRef.value)?.setOption({
|
||||
tooltip: { trigger: 'axis' },
|
||||
grid: { left: 45, right: 20, top: 30, bottom: 60 },
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: contrib.map((c) => c.name),
|
||||
axisLabel: { rotate: 25, fontSize: 10 }
|
||||
},
|
||||
yAxis: { type: 'value' },
|
||||
series: [
|
||||
{
|
||||
name: '资源量',
|
||||
type: 'bar',
|
||||
barMaxWidth: 36,
|
||||
itemStyle: { color: '#409eff' },
|
||||
data: contrib.map((c) => c.value)
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
initChart(hotRef.value)?.setOption({
|
||||
tooltip: { trigger: 'axis' },
|
||||
grid: { left: 90, right: 20, top: 20, bottom: 30 },
|
||||
xAxis: { type: 'value' },
|
||||
yAxis: {
|
||||
type: 'category',
|
||||
inverse: true,
|
||||
data: hotKeywords.value.slice(0, 10).map((k) => k.name)
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '检索次数',
|
||||
type: 'bar',
|
||||
itemStyle: { color: '#67c23a' },
|
||||
data: hotKeywords.value.slice(0, 10).map((k) => k.value)
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
function handleResize() {
|
||||
charts.forEach((c) => c.resize())
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await loadAll()
|
||||
window.addEventListener('resize', handleResize)
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
window.removeEventListener('resize', handleResize)
|
||||
charts.forEach((c) => c.dispose())
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<el-row :gutter="16" class="mb-16">
|
||||
<el-col :xs="24" :sm="6">
|
||||
<div class="page-card mini">
|
||||
<div class="v">{{ (overview?.totalCount ?? 0).toLocaleString() }}</div>
|
||||
<div class="l">版本资源总量</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="6">
|
||||
<div class="page-card mini">
|
||||
<div class="v">{{ overview?.todaySearchCount ?? 0 }}</div>
|
||||
<div class="l">今日检索量</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="6">
|
||||
<div class="page-card mini">
|
||||
<div class="v">{{ overview?.todayAddCount ?? 0 }}</div>
|
||||
<div class="l">今日资源增量</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="6">
|
||||
<div class="page-card mini">
|
||||
<div class="v">{{ overview?.onlineCount ?? 0 }}</div>
|
||||
<div class="l">当前在线用户</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="16" class="mb-16">
|
||||
<el-col :xs="24" :md="12">
|
||||
<div class="page-card">
|
||||
<h3 class="page-title">版本资源综合比例</h3>
|
||||
<div ref="ratioRef" class="chart-sm"></div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :xs="24" :md="12">
|
||||
<div class="page-card">
|
||||
<h3 class="page-title">来源单位贡献量</h3>
|
||||
<div ref="contribRef" class="chart-sm"></div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="16">
|
||||
<el-col :xs="24" :md="12">
|
||||
<div class="page-card">
|
||||
<h3 class="page-title">版本资源增量(按年份)</h3>
|
||||
<div ref="yearRef" class="chart-sm"></div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :xs="24" :md="12">
|
||||
<div class="page-card">
|
||||
<h3 class="page-title">热门检索词 TOP10</h3>
|
||||
<div ref="hotRef" class="chart-sm"></div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.mini {
|
||||
text-align: center;
|
||||
|
||||
.v {
|
||||
font-size: 22px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.l {
|
||||
font-size: 13px;
|
||||
color: #909399;
|
||||
margin-top: 6px;
|
||||
}
|
||||
}
|
||||
.chart-sm {
|
||||
width: 100%;
|
||||
height: 280px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,137 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage, type FormInstance, type FormRules } from 'element-plus'
|
||||
import { createCollectTask, listCollectTasks, startCollectTask, type CollectTask } from '@/api/collect'
|
||||
|
||||
const loading = ref(false)
|
||||
const list = ref<CollectTask[]>([])
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const formRef = ref<FormInstance>()
|
||||
const form = reactive<CollectTask>({
|
||||
libraryCode: '',
|
||||
libraryName: '',
|
||||
sourceType: 'MARC',
|
||||
targetCount: 200000
|
||||
})
|
||||
|
||||
const rules: FormRules = {
|
||||
libraryCode: [{ required: true, message: '请输入单位编码', trigger: 'blur' }],
|
||||
libraryName: [{ required: true, message: '请输入单位名称', trigger: 'blur' }]
|
||||
}
|
||||
|
||||
async function fetchList() {
|
||||
loading.value = true
|
||||
try {
|
||||
list.value = await listCollectTasks()
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function openCreate() {
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
async function handleCreate() {
|
||||
await formRef.value?.validate()
|
||||
await createCollectTask(form)
|
||||
ElMessage.success('采集任务已创建')
|
||||
dialogVisible.value = false
|
||||
formRef.value?.resetFields()
|
||||
fetchList()
|
||||
}
|
||||
|
||||
async function handleStart(row: CollectTask) {
|
||||
await startCollectTask(row.id as number)
|
||||
ElMessage.success('采集任务已执行')
|
||||
fetchList()
|
||||
}
|
||||
|
||||
function statusTag(status?: string) {
|
||||
if (status === 'SUCCESS') return 'success'
|
||||
if (status === 'RUNNING') return 'warning'
|
||||
if (status === 'FAILED') return 'danger'
|
||||
return 'info'
|
||||
}
|
||||
|
||||
onMounted(fetchList)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page-card">
|
||||
<div class="head">
|
||||
<h3 class="page-title">数据采集</h3>
|
||||
<el-button type="primary" @click="openCreate">新建采集任务</el-button>
|
||||
</div>
|
||||
|
||||
<el-alert
|
||||
title="采集 4 家单位图书馆纸电版本资源元数据,各馆不低于 20 万条,优先采集纸书元数据"
|
||||
type="info"
|
||||
:closable="false"
|
||||
class="mb-16"
|
||||
/>
|
||||
|
||||
<el-table v-loading="loading" :data="list" border stripe>
|
||||
<el-table-column prop="libraryCode" label="单位编码" width="110" />
|
||||
<el-table-column prop="libraryName" label="单位名称" min-width="160" />
|
||||
<el-table-column prop="sourceType" label="数据源" width="100" />
|
||||
<el-table-column prop="targetCount" label="目标量" width="100" />
|
||||
<el-table-column prop="collectedCount" label="已采集" width="100" />
|
||||
<el-table-column label="状态" width="110">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="statusTag(row.status)" size="small">{{ row.status }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="message" label="信息" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column prop="createTime" label="创建时间" width="170" />
|
||||
<el-table-column label="操作" width="110" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
size="small"
|
||||
:disabled="row.status === 'RUNNING'"
|
||||
@click="handleStart(row)"
|
||||
>
|
||||
执行
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-dialog v-model="dialogVisible" title="新建采集任务" width="480px">
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="单位编码" prop="libraryCode">
|
||||
<el-input v-model="form.libraryCode" placeholder="如 NC-01" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单位名称" prop="libraryName">
|
||||
<el-input v-model="form.libraryName" placeholder="如 江西南昌某馆" />
|
||||
</el-form-item>
|
||||
<el-form-item label="数据源类型">
|
||||
<el-select v-model="form.sourceType" style="width: 100%">
|
||||
<el-option label="MARC" value="MARC" />
|
||||
<el-option label="Excel" value="EXCEL" />
|
||||
<el-option label="数据库" value="DB" />
|
||||
<el-option label="接口" value="API" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="目标采集量">
|
||||
<el-input-number v-model="form.targetCount" :min="0" :step="10000" style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="handleCreate">创建</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,208 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage, ElMessageBox, type FormInstance, type FormRules } from 'element-plus'
|
||||
import {
|
||||
acceptDeposit,
|
||||
pageDeposit,
|
||||
rejectDeposit,
|
||||
submitDeposit,
|
||||
type DepositQuery,
|
||||
type DepositRecord
|
||||
} from '@/api/deposit'
|
||||
|
||||
const activeTab = ref('submit')
|
||||
|
||||
// ---------------- 提交呈缴 ----------------
|
||||
const formRef = ref<FormInstance>()
|
||||
const submitting = ref(false)
|
||||
const form = reactive<DepositRecord>({
|
||||
orgName: '',
|
||||
contact: '',
|
||||
phone: '',
|
||||
email: '',
|
||||
resourceTitle: '',
|
||||
mediaType: '纸质',
|
||||
summary: '',
|
||||
remark: ''
|
||||
})
|
||||
|
||||
const rules: FormRules = {
|
||||
orgName: [{ required: true, message: '请输入单位名称', trigger: 'blur' }],
|
||||
contact: [{ required: true, message: '请输入联系人', trigger: 'blur' }],
|
||||
phone: [{ required: true, message: '请输入联系方式', trigger: 'blur' }],
|
||||
resourceTitle: [{ required: true, message: '请输入版本资源名称', trigger: 'blur' }]
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
await formRef.value?.validate()
|
||||
submitting.value = true
|
||||
try {
|
||||
await submitDeposit(form)
|
||||
ElMessage.success('呈缴提交成功,等待管理员接收')
|
||||
formRef.value?.resetFields()
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------- 管理端 ----------------
|
||||
const loading = ref(false)
|
||||
const list = ref<DepositRecord[]>([])
|
||||
const total = ref(0)
|
||||
const query = reactive<DepositQuery>({ current: 1, size: 20, orgName: '', status: '' })
|
||||
|
||||
async function fetchList() {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await pageDeposit(query)
|
||||
list.value = res.records || []
|
||||
total.value = res.total || 0
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleAudit(row: DepositRecord, accepted: boolean) {
|
||||
const { value } = await ElMessageBox.prompt(
|
||||
accepted ? '确认接收该呈缴?' : '请输入退回原因',
|
||||
accepted ? '接收确认' : '退回',
|
||||
{ inputPlaceholder: '审核意见(可选)', confirmButtonText: '确定', cancelButtonText: '取消' }
|
||||
)
|
||||
if (accepted) {
|
||||
await acceptDeposit(row.id as number, value)
|
||||
} else {
|
||||
await rejectDeposit(row.id as number, value)
|
||||
}
|
||||
ElMessage.success('操作成功')
|
||||
fetchList()
|
||||
}
|
||||
|
||||
function statusTag(status?: string) {
|
||||
if (status === 'ACCEPTED') return 'success'
|
||||
if (status === 'REJECTED') return 'danger'
|
||||
return 'warning'
|
||||
}
|
||||
|
||||
function statusText(status?: string) {
|
||||
if (status === 'ACCEPTED') return '已接收'
|
||||
if (status === 'REJECTED') return '已退回'
|
||||
return '待审核'
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page-card">
|
||||
<el-tabs v-model="activeTab">
|
||||
<!-- 提交 -->
|
||||
<el-tab-pane label="提交呈缴" name="submit">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-width="110px"
|
||||
style="max-width: 660px"
|
||||
>
|
||||
<el-form-item label="单位名称" prop="orgName">
|
||||
<el-input v-model="form.orgName" placeholder="请输入呈缴单位名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="联系人" prop="contact">
|
||||
<el-input v-model="form.contact" placeholder="请输入联系人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="联系方式" prop="phone">
|
||||
<el-input v-model="form.phone" placeholder="请输入联系电话/邮箱" />
|
||||
</el-form-item>
|
||||
<el-form-item label="邮箱">
|
||||
<el-input v-model="form.email" placeholder="请输入邮箱" />
|
||||
</el-form-item>
|
||||
<el-form-item label="资源名称" prop="resourceTitle">
|
||||
<el-input v-model="form.resourceTitle" placeholder="请输入版本资源名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="媒体类型">
|
||||
<el-radio-group v-model="form.mediaType">
|
||||
<el-radio label="纸质">纸质</el-radio>
|
||||
<el-radio label="电子">电子</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="数字版文件">
|
||||
<el-upload action="#" :auto-upload="false" :limit="1">
|
||||
<el-button type="primary" plain>选择文件</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item label="简介">
|
||||
<el-input v-model="form.summary" type="textarea" :rows="3" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.remark" type="textarea" :rows="2" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" :loading="submitting" @click="handleSubmit">提交呈缴</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-tab-pane>
|
||||
|
||||
<!-- 管理 -->
|
||||
<el-tab-pane label="呈缴管理" name="admin">
|
||||
<el-form :inline="true" class="mb-16" @submit.prevent>
|
||||
<el-form-item label="单位名称">
|
||||
<el-input v-model="query.orgName" placeholder="单位名称" clearable style="width: 180px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-select v-model="query.status" placeholder="全部" clearable style="width: 130px">
|
||||
<el-option label="待审核" value="PENDING" />
|
||||
<el-option label="已接收" value="ACCEPTED" />
|
||||
<el-option label="已退回" value="REJECTED" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="fetchList">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table v-loading="loading" :data="list" border stripe>
|
||||
<el-table-column type="index" label="#" width="50" />
|
||||
<el-table-column prop="orgName" label="呈缴单位" min-width="160" show-overflow-tooltip />
|
||||
<el-table-column prop="contact" label="联系人" width="100" />
|
||||
<el-table-column prop="phone" label="联系方式" width="140" />
|
||||
<el-table-column prop="resourceTitle" label="资源名称" min-width="200" show-overflow-tooltip />
|
||||
<el-table-column prop="mediaType" label="类型" width="80" />
|
||||
<el-table-column label="状态" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="statusTag(row.status)" size="small">{{ statusText(row.status) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="提交时间" width="170" />
|
||||
<el-table-column label="操作" width="150" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<template v-if="row.status === 'PENDING'">
|
||||
<el-button link type="success" size="small" @click="handleAudit(row, true)">接收</el-button>
|
||||
<el-button link type="danger" size="small" @click="handleAudit(row, false)">退回</el-button>
|
||||
</template>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-pagination
|
||||
class="pager"
|
||||
background
|
||||
layout="total, prev, pager, next"
|
||||
:total="total"
|
||||
v-model:current-page="query.current"
|
||||
v-model:page-size="query.size"
|
||||
@current-change="fetchList"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.pager {
|
||||
margin-top: 16px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,107 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import {
|
||||
listGovernanceJobs,
|
||||
runHint,
|
||||
runMerge,
|
||||
runOptimize,
|
||||
runPurify,
|
||||
type GovernanceJob
|
||||
} from '@/api/governance'
|
||||
|
||||
const loading = ref(false)
|
||||
const running = ref('')
|
||||
const jobs = ref<GovernanceJob[]>([])
|
||||
|
||||
const actions = [
|
||||
{ type: 'MERGE', title: '聚同', desc: '将不同来源、不同媒体类型的同一文献元数据聚合为一条,并标注来源。', fn: runMerge },
|
||||
{ type: 'OPTIMIZE', title: '优化', desc: '整合聚同文献的不同描述元数据,生成质量更高、要素更完整的元数据。', fn: runOptimize },
|
||||
{ type: 'HINT', title: '提示', desc: '生成疑似同一文献提示清单、疑似元数据错漏提示清单。', fn: runHint },
|
||||
{ type: 'PURIFY', title: '提纯', desc: '将相关纸电图书数据从全部图书数据中提取出来,形成版本资源数据集。', fn: runPurify }
|
||||
]
|
||||
|
||||
async function fetchJobs() {
|
||||
loading.value = true
|
||||
try {
|
||||
jobs.value = await listGovernanceJobs()
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleRun(action: (typeof actions)[number]) {
|
||||
running.value = action.type
|
||||
try {
|
||||
const job = await action.fn()
|
||||
ElMessage.success(`${action.title}完成:${job.resultSummary || ''}`)
|
||||
fetchJobs()
|
||||
} finally {
|
||||
running.value = ''
|
||||
}
|
||||
}
|
||||
|
||||
function statusTag(status?: string) {
|
||||
if (status === 'SUCCESS') return 'success'
|
||||
if (status === 'RUNNING') return 'warning'
|
||||
if (status === 'FAILED') return 'danger'
|
||||
return 'info'
|
||||
}
|
||||
|
||||
onMounted(fetchJobs)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page-card">
|
||||
<h3 class="page-title">数据治理</h3>
|
||||
<el-alert
|
||||
title="治理四动作:聚同 / 优化 / 提示 / 提纯"
|
||||
type="info"
|
||||
:closable="false"
|
||||
class="mb-16"
|
||||
/>
|
||||
|
||||
<el-row :gutter="16">
|
||||
<el-col v-for="a in actions" :key="a.type" :xs="24" :sm="12">
|
||||
<el-card shadow="hover" class="gov-card">
|
||||
<h4>{{ a.title }}</h4>
|
||||
<p>{{ a.desc }}</p>
|
||||
<el-button type="primary" :loading="running === a.type" @click="handleRun(a)">
|
||||
执行{{ a.title }}
|
||||
</el-button>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<h3 class="page-title" style="margin-top: 20px">治理任务历史</h3>
|
||||
<el-table v-loading="loading" :data="jobs" border stripe>
|
||||
<el-table-column type="index" label="#" width="50" />
|
||||
<el-table-column prop="jobType" label="治理类型" width="120" />
|
||||
<el-table-column label="状态" width="110">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="statusTag(row.status)" size="small">{{ row.status }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="affectedCount" label="影响记录数" width="120" />
|
||||
<el-table-column prop="resultSummary" label="结果摘要" min-width="260" show-overflow-tooltip />
|
||||
<el-table-column prop="createTime" label="执行时间" width="170" />
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.gov-card {
|
||||
margin-bottom: 16px;
|
||||
|
||||
h4 {
|
||||
margin: 0 0 8px;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 13px;
|
||||
color: #909399;
|
||||
min-height: 38px;
|
||||
margin: 0 0 12px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,140 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { Refresh, Search } from '@element-plus/icons-vue'
|
||||
import { pageResource, removeResource, type ResourceQuery, type VersionResource } from '@/api/resource'
|
||||
import { GOVERN_STATUS, governStatusLabel, governStatusTagType } from '@/constants/dict'
|
||||
|
||||
const loading = ref(false)
|
||||
const list = ref<VersionResource[]>([])
|
||||
const total = ref(0)
|
||||
|
||||
const query = reactive<ResourceQuery>({
|
||||
current: 1,
|
||||
size: 20,
|
||||
title: '',
|
||||
author: '',
|
||||
mediaType: '',
|
||||
sourceLibrary: '',
|
||||
governStatus: ''
|
||||
})
|
||||
|
||||
async function fetchData() {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await pageResource(query)
|
||||
list.value = res.records || []
|
||||
total.value = res.total || 0
|
||||
} catch {
|
||||
// 错误已由响应拦截器统一提示
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
query.current = 1
|
||||
fetchData()
|
||||
}
|
||||
|
||||
function handleReset() {
|
||||
query.title = ''
|
||||
query.author = ''
|
||||
query.mediaType = ''
|
||||
query.sourceLibrary = ''
|
||||
query.governStatus = ''
|
||||
handleSearch()
|
||||
}
|
||||
|
||||
async function handleDelete(row: VersionResource) {
|
||||
await ElMessageBox.confirm(`确认删除《${row.title}》?`, '提示', { type: 'warning' })
|
||||
await removeResource(row.id as number)
|
||||
ElMessage.success('删除成功')
|
||||
fetchData()
|
||||
}
|
||||
|
||||
onMounted(fetchData)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div class="page-card mb-16">
|
||||
<el-form :inline="true" :model="query" @submit.prevent>
|
||||
<el-form-item label="题名">
|
||||
<el-input v-model="query.title" placeholder="正题名" clearable style="width: 180px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="责任者">
|
||||
<el-input v-model="query.author" placeholder="作者" clearable style="width: 160px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="媒体类型">
|
||||
<el-select v-model="query.mediaType" placeholder="全部" clearable style="width: 130px">
|
||||
<el-option label="纸质" value="纸质" />
|
||||
<el-option label="电子" value="电子" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="来源馆">
|
||||
<el-input v-model="query.sourceLibrary" placeholder="来源馆" clearable style="width: 180px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="治理状态">
|
||||
<el-select v-model="query.governStatus" placeholder="全部" clearable style="width: 130px">
|
||||
<el-option v-for="s in GOVERN_STATUS" :key="s.value" :label="s.label" :value="s.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" :icon="Search" @click="handleSearch">查询</el-button>
|
||||
<el-button :icon="Refresh" @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div class="page-card">
|
||||
<h3 class="page-title">版本资源库(元数据)</h3>
|
||||
<el-table v-loading="loading" :data="list" border stripe>
|
||||
<el-table-column type="index" label="#" width="50" />
|
||||
<el-table-column prop="title" label="正题名" min-width="200" show-overflow-tooltip />
|
||||
<el-table-column prop="author" label="责任者" width="140" show-overflow-tooltip />
|
||||
<el-table-column prop="clcCode" label="中图分类" width="110" />
|
||||
<el-table-column prop="mediaType" label="媒体类型" width="90" />
|
||||
<el-table-column prop="publishYear" label="出版年份" width="100" />
|
||||
<el-table-column prop="sourceLibrary" label="来源馆" width="180" show-overflow-tooltip />
|
||||
<el-table-column label="治理状态" width="110">
|
||||
<template #default="{ row }">
|
||||
<el-tag size="small" :type="governStatusTagType(row.governStatus)">
|
||||
{{ governStatusLabel(row.governStatus) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="错漏" width="80">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.abnormalFlag === 1" size="small" type="danger">疑似</el-tag>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="danger" size="small" @click="handleDelete(row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-pagination
|
||||
class="pager"
|
||||
background
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="total"
|
||||
v-model:current-page="query.current"
|
||||
v-model:page-size="query.size"
|
||||
:page-sizes="[20, 50, 100, 200]"
|
||||
@current-change="fetchData"
|
||||
@size-change="fetchData"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.pager {
|
||||
margin-top: 16px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,58 @@
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
const router = useRouter()
|
||||
const rows = ref([{ field: '题名', op: '模糊', value: '' }])
|
||||
const fields = ['题名', '责任者', '关键词', '摘要', '出版者', 'ISBN', '中图分类']
|
||||
const ops = ['模糊', '精确', '前方一致', '后方一致']
|
||||
|
||||
function add() {
|
||||
rows.value.push({ field: '题名', op: '模糊', value: '' })
|
||||
}
|
||||
|
||||
function search() {
|
||||
const first = rows.value.find((r) => r.value)
|
||||
router.push({ path: '/search', query: { keyword: first?.value || '' } })
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="adv">
|
||||
<h2>高级检索</h2>
|
||||
<div v-for="(r, i) in rows" :key="i" class="row">
|
||||
<el-select v-model="r.field" style="width: 140px">
|
||||
<el-option v-for="f in fields" :key="f" :label="f" :value="f" />
|
||||
</el-select>
|
||||
<el-select v-model="r.op" style="width: 120px">
|
||||
<el-option v-for="o in ops" :key="o" :label="o" :value="o" />
|
||||
</el-select>
|
||||
<el-input v-model="r.value" placeholder="请输入检索词" />
|
||||
<el-button v-if="i === rows.length - 1" type="primary" plain @click="add">添加条件</el-button>
|
||||
</div>
|
||||
<div class="ops">
|
||||
<el-button type="primary" @click="search">检索</el-button>
|
||||
<el-button @click="router.push('/search')">返回</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.adv {
|
||||
max-width: 820px;
|
||||
margin: 20px auto;
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
padding: 24px;
|
||||
|
||||
h2 { margin: 0 0 20px; font-size: 18px; }
|
||||
}
|
||||
|
||||
.row {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.ops { margin-top: 20px; text-align: center; }
|
||||
</style>
|
||||
@@ -0,0 +1,247 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { getSearchDetail, getSimilar, unifiedSearch, type FacetItem, type SearchQuery } from '@/api/search'
|
||||
import type { VersionResource } from '@/api/resource'
|
||||
|
||||
const route = useRoute()
|
||||
const loading = ref(false)
|
||||
const searched = ref(false)
|
||||
const rows = ref<VersionResource[]>([])
|
||||
const total = ref(0)
|
||||
const costMs = ref(0)
|
||||
const mediaFacets = ref<FacetItem[]>([])
|
||||
const libraryFacets = ref<FacetItem[]>([])
|
||||
|
||||
const query = reactive<SearchQuery>({
|
||||
current: 1,
|
||||
size: 20,
|
||||
keyword: '',
|
||||
mediaType: ''
|
||||
})
|
||||
|
||||
const field = ref('题名')
|
||||
const fields = ['题名', '责任者', '关键词', '出版社', 'ISBN']
|
||||
|
||||
async function doSearch() {
|
||||
loading.value = true
|
||||
searched.value = true
|
||||
try {
|
||||
const res = await unifiedSearch({ ...query })
|
||||
rows.value = res.page?.records || []
|
||||
total.value = res.page?.total || 0
|
||||
costMs.value = res.costMs || 0
|
||||
mediaFacets.value = res.mediaTypeFacets || []
|
||||
libraryFacets.value = res.sourceLibraryFacets || []
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function pick(type: 'mediaType' | 'sourceLibrary', v: string) {
|
||||
query[type] = v
|
||||
query.current = 1
|
||||
doSearch()
|
||||
}
|
||||
|
||||
function goPage(p: number) {
|
||||
query.current = p
|
||||
doSearch()
|
||||
}
|
||||
|
||||
const drawer = ref(false)
|
||||
const detail = ref<VersionResource | null>(null)
|
||||
const similar = ref<VersionResource[]>([])
|
||||
|
||||
async function openDetail(row: VersionResource) {
|
||||
detail.value = row
|
||||
similar.value = []
|
||||
drawer.value = true
|
||||
const d = await getSearchDetail(row.id as number)
|
||||
if (d) detail.value = d
|
||||
similar.value = await getSimilar(row.id as number, 6)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
const kw = route.query.keyword as string
|
||||
if (kw) {
|
||||
query.keyword = kw
|
||||
doSearch()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="search-page">
|
||||
<div class="bar">
|
||||
<el-input v-model="query.keyword" size="large" placeholder="请输入检索词" clearable @keyup.enter="doSearch">
|
||||
<template #prepend>
|
||||
<el-select v-model="field" style="width: 96px">
|
||||
<el-option v-for="f in fields" :key="f" :label="f" :value="f" />
|
||||
</el-select>
|
||||
</template>
|
||||
<template #append><el-button type="primary" @click="doSearch">检索</el-button></template>
|
||||
</el-input>
|
||||
</div>
|
||||
|
||||
<div class="body" v-if="searched">
|
||||
<aside class="side">
|
||||
<div class="side-title">资源类型</div>
|
||||
<div v-for="f in mediaFacets" :key="f.name" class="side-item"
|
||||
:class="{ on: query.mediaType === f.name }" @click="pick('mediaType', f.name)">
|
||||
<span>{{ f.name }}</span><em>{{ f.value }}</em>
|
||||
</div>
|
||||
<div class="side-title">来源院校</div>
|
||||
<div v-for="f in libraryFacets" :key="f.name" class="side-item"
|
||||
:class="{ on: query.sourceLibrary === f.name }" @click="pick('sourceLibrary', f.name)">
|
||||
<span>{{ f.name }}</span><em>{{ f.value }}</em>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<section class="list">
|
||||
<div class="meta">共 <b>{{ total }}</b> 条,耗时 {{ costMs }} ms</div>
|
||||
<div v-loading="loading" class="cards">
|
||||
<div v-for="r in rows" :key="r.id" class="card" @click="openDetail(r)">
|
||||
<div class="cover">{{ (r.title || '').slice(0, 2) }}</div>
|
||||
<div class="info">
|
||||
<div class="t">{{ r.title }}</div>
|
||||
<div class="d">{{ r.author || '-' }} · {{ r.publishYear || '-' }} · {{ r.mediaType || '-' }}</div>
|
||||
<div class="d">{{ r.sourceLibrary || '-' }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-pagination class="pager" background layout="prev, pager, next" :total="total"
|
||||
:current-page="query.current" :page-size="query.size" @current-change="goPage" />
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<el-empty v-else description="请输入检索词开始检索" />
|
||||
|
||||
<el-drawer v-model="drawer" title="文献细览" size="46%">
|
||||
<template v-if="detail">
|
||||
<h3 class="dt">{{ detail.title }}</h3>
|
||||
<el-descriptions :column="1" border size="small">
|
||||
<el-descriptions-item label="责任者">{{ detail.author || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="出版者">{{ detail.publisher || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="出版年份">{{ detail.publishYear || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="媒体类型">{{ detail.mediaType || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="中图分类">{{ detail.clcCode || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="来源院校">{{ detail.sourceLibrary || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="关键词">{{ detail.keywords || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="摘要">{{ detail.summary || '-' }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<div style="margin: 14px 0">
|
||||
<el-button v-if="detail.fulltextUrl" type="primary" tag="a" :href="detail.fulltextUrl" target="_blank">下载全文</el-button>
|
||||
<el-button v-else type="primary" disabled>暂无全文地址</el-button>
|
||||
</div>
|
||||
<div v-if="similar.length" class="sim">
|
||||
<div class="side-title">相似文献推荐</div>
|
||||
<div v-for="s in similar" :key="s.id" class="sim-item" @click="openDetail(s)">{{ s.title }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.bar {
|
||||
max-width: 860px;
|
||||
margin: 8px auto 20px;
|
||||
|
||||
:deep(.el-input-group__append) {
|
||||
background: var(--brand-primary);
|
||||
border-color: var(--brand-primary);
|
||||
color: #fff;
|
||||
padding: 0;
|
||||
|
||||
.el-button {
|
||||
background: transparent;
|
||||
color: #fff;
|
||||
border: none;
|
||||
height: 100%;
|
||||
padding: 0 22px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.body {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
max-width: 1240px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.side {
|
||||
width: 210px;
|
||||
flex: none;
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
padding: 12px;
|
||||
height: fit-content;
|
||||
|
||||
.side-title {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
margin: 10px 0 6px;
|
||||
}
|
||||
|
||||
.side-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 13px;
|
||||
color: #5b6472;
|
||||
padding: 4px 6px;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover { background: var(--brand-light); }
|
||||
&.on { background: var(--brand-light); color: var(--brand-primary); }
|
||||
em { color: #9aa3b2; font-style: normal; }
|
||||
}
|
||||
}
|
||||
|
||||
.list { flex: 1; }
|
||||
.meta { font-size: 13px; color: #6b7280; margin-bottom: 10px; }
|
||||
|
||||
.cards {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.card {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
padding: 14px;
|
||||
cursor: pointer;
|
||||
transition: box-shadow 0.2s;
|
||||
|
||||
&:hover { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1); }
|
||||
}
|
||||
|
||||
.cover {
|
||||
width: 56px;
|
||||
height: 76px;
|
||||
flex: none;
|
||||
border-radius: 4px;
|
||||
background: var(--brand-primary);
|
||||
color: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.info {
|
||||
min-width: 0;
|
||||
|
||||
.t { font-size: 14px; font-weight: 600; color: #1f2937; margin-bottom: 6px; }
|
||||
.d { font-size: 12px; color: #8b93a1; }
|
||||
}
|
||||
|
||||
.pager { margin-top: 18px; justify-content: center; }
|
||||
.dt { margin: 0 0 12px; font-size: 17px; }
|
||||
.sim-item { font-size: 13px; padding: 6px 0; border-bottom: 1px dashed #eee; cursor: pointer; }
|
||||
</style>
|
||||
@@ -0,0 +1,104 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { getRecommend, getSpecialDetail, type SpecialResource } from '@/api/special'
|
||||
|
||||
const loading = ref(false)
|
||||
const list = ref<SpecialResource[]>([])
|
||||
const dialogVisible = ref(false)
|
||||
const current = ref<SpecialResource | null>(null)
|
||||
|
||||
const palette = ['#8e6b3f', '#4a6fa5', '#5a8f5a', '#a54a4a', '#7a5ca8', '#3f8e8a']
|
||||
|
||||
async function fetchList() {
|
||||
loading.value = true
|
||||
try {
|
||||
list.value = await getRecommend(12)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function openDetail(item: SpecialResource) {
|
||||
current.value = item
|
||||
dialogVisible.value = true
|
||||
const res = await getSpecialDetail(item.id as number)
|
||||
if (res) current.value = res
|
||||
}
|
||||
|
||||
onMounted(fetchList)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page-card" v-loading="loading">
|
||||
<h3 class="page-title">特藏版本推荐</h3>
|
||||
|
||||
<el-empty v-if="!list.length" description="暂无特藏数据" />
|
||||
|
||||
<el-row v-else :gutter="16">
|
||||
<el-col v-for="(it, idx) in list" :key="it.id" :xs="24" :sm="12" :md="6">
|
||||
<el-card shadow="hover" class="special-card" @click="openDetail(it)">
|
||||
<div class="cover" :style="{ background: palette[idx % palette.length] }">
|
||||
{{ (it.name || '').slice(0, 2) }}
|
||||
</div>
|
||||
<div class="name">{{ it.name }}</div>
|
||||
<div class="desc">{{ it.summary || '暂无简介' }}</div>
|
||||
<el-tag size="small" type="info">{{ it.category || '特藏' }}</el-tag>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-dialog v-model="dialogVisible" :title="current?.name || '特藏细览'" width="620px">
|
||||
<template v-if="current">
|
||||
<el-descriptions :column="1" border size="small">
|
||||
<el-descriptions-item label="名称">{{ current.name }}</el-descriptions-item>
|
||||
<el-descriptions-item label="类别">{{ current.category || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="简介">{{ current.summary || '-' }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<div style="margin-top: 16px">
|
||||
<el-button
|
||||
v-if="current.ebookUrl"
|
||||
type="primary"
|
||||
tag="a"
|
||||
:href="current.ebookUrl"
|
||||
target="_blank"
|
||||
>
|
||||
电子版下载
|
||||
</el-button>
|
||||
<el-button v-else type="primary" disabled>暂无电子版</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.special-card {
|
||||
margin-bottom: 16px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
|
||||
.cover {
|
||||
height: 120px;
|
||||
border-radius: 4px;
|
||||
color: #fff;
|
||||
font-size: 28px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.name {
|
||||
font-weight: 600;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.desc {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
height: 36px;
|
||||
overflow: hidden;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,16 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
declare module '*.vue' {
|
||||
import type { DefineComponent } from 'vue'
|
||||
const component: DefineComponent<{}, {}, any>
|
||||
export default component
|
||||
}
|
||||
|
||||
interface ImportMetaEnv {
|
||||
readonly VITE_APP_TITLE: string
|
||||
readonly VITE_API_BASE_URL: string
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
readonly env: ImportMetaEnv
|
||||
}
|
||||