项目框架
This commit is contained in:
@@ -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>
|
||||
Reference in New Issue
Block a user