feat(personal): add reviewed enterprise publishing
This commit is contained in:
@@ -59,6 +59,31 @@
|
||||
</el-table>
|
||||
</section>
|
||||
|
||||
<section class="panel publish-review-panel">
|
||||
<div class="panel-title compact">
|
||||
<div>
|
||||
<h2>个人知识入库审核</h2>
|
||||
<p>只审核元数据与脱敏预览;批准后生成脱敏企业副本,不转移个人资料。</p>
|
||||
</div>
|
||||
<el-button :icon="Refresh" :loading="publishLoading" size="small" @click="loadPublishRequests">刷新</el-button>
|
||||
</div>
|
||||
<el-table v-loading="publishLoading" :data="publishRequests" size="small">
|
||||
<el-table-column prop="title" label="资料标题" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column prop="sourceType" label="来源" width="90" />
|
||||
<el-table-column prop="targetScope" label="发布范围" width="160" />
|
||||
<el-table-column prop="reason" label="申请原因" min-width="220" show-overflow-tooltip />
|
||||
<el-table-column prop="sanitizedPreview" label="脱敏预览" min-width="260" show-overflow-tooltip />
|
||||
<el-table-column prop="createdAt" label="申请时间" width="170" />
|
||||
<el-table-column label="操作" width="150">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="danger" @click="reviewPublish(row, true)">批准</el-button>
|
||||
<el-button link @click="reviewPublish(row, false)">驳回</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-empty v-if="!publishLoading && publishRequests.length === 0" description="暂无待审核申请" :image-size="72" />
|
||||
</section>
|
||||
|
||||
<section class="metric-grid">
|
||||
<article v-for="metric in displayOverview.metrics" :key="metric.key" class="metric-card" :class="`metric-${metric.type}`">
|
||||
<div class="metric-icon">
|
||||
@@ -282,6 +307,7 @@ import {
|
||||
type ProcessingOverview
|
||||
} from '@/api/aihr/processing';
|
||||
import { uploadKnowledgeDocAsync, listUploadItems, retryUploadItem, type UploadItem } from '@/api/aihr/sop';
|
||||
import { listPersonalPublishRequests, reviewPersonalPublishRequest, type PersonalPublishRequestRow } from '@/api/aihr/personal';
|
||||
|
||||
const acceptTypes = '.txt,.md,.markdown,.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.jpg,.jpeg,.png,.gif,.webp,.bmp,.mp4,.mov,.avi,.mkv,.webm,.m4v';
|
||||
const autoCategory = '__auto__';
|
||||
@@ -298,6 +324,8 @@ const loading = ref(false);
|
||||
const uploading = ref(false);
|
||||
const serverImporting = ref(false);
|
||||
const importTaskLoading = ref(false);
|
||||
const publishLoading = ref(false);
|
||||
const publishRequests = ref<PersonalPublishRequestRow[]>([]);
|
||||
const overview = ref<ProcessingOverview | null>(null);
|
||||
const overviewFailed = ref(false);
|
||||
const importTasks = ref<LocalImportTask[]>([]);
|
||||
@@ -449,10 +477,40 @@ const filteredTasks = computed(() => displayOverview.value.tasks.filter((item) =
|
||||
const runningImport = computed(() => importTasks.value.some((item) => item.status === '导入中'));
|
||||
|
||||
onMounted(async () => {
|
||||
await Promise.all([loadOverview(), loadImportTasks()]);
|
||||
await Promise.all([loadOverview(), loadImportTasks(), loadPublishRequests()]);
|
||||
scheduleImportPoll();
|
||||
});
|
||||
|
||||
async function loadPublishRequests() {
|
||||
publishLoading.value = true;
|
||||
try {
|
||||
const response = await listPersonalPublishRequests();
|
||||
publishRequests.value = response.data ?? [];
|
||||
} catch {
|
||||
publishRequests.value = [];
|
||||
} finally {
|
||||
publishLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function reviewPublish(row: PersonalPublishRequestRow, approved: boolean) {
|
||||
try {
|
||||
const result = await ElMessageBox.prompt(
|
||||
approved ? '批准后将生成脱敏企业副本,请填写审核意见。' : '请填写驳回原因。',
|
||||
approved ? '批准个人知识入库' : '驳回个人知识入库',
|
||||
{
|
||||
inputPlaceholder: approved ? '例如:脱敏后可入库' : '例如:内容不具备通用性',
|
||||
inputValidator: (value) => Boolean(value?.trim()) || '请填写审核意见'
|
||||
}
|
||||
);
|
||||
await reviewPersonalPublishRequest(row.id, { approved, comment: result.value.trim() });
|
||||
ElMessage.success(approved ? '已批准并生成企业知识副本' : '已驳回');
|
||||
await loadPublishRequests();
|
||||
} catch (error) {
|
||||
if (error !== 'cancel' && error !== 'close') ElMessage.error('审核失败,请重试');
|
||||
}
|
||||
}
|
||||
|
||||
onUnmounted(() => {
|
||||
clearImportPoll();
|
||||
clearBatchPoll();
|
||||
|
||||
Reference in New Issue
Block a user