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