2026-06-03 16:49:08 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="doc-section">
|
|
|
|
|
|
<div class="doc-section-header">
|
|
|
|
|
|
<div class="doc-section-left">
|
2026-06-05 17:37:21 +08:00
|
|
|
|
<div class="doc-section-title">{{`${$t('knowledgeBaseManagement.currentKnowledgeBaseDocuments')}(${kb?.name})`}}</div>
|
2026-06-09 17:22:18 +08:00
|
|
|
|
<div class="doc-section-count" v-if="kb">{{ $t('knowledgeBaseManagement.totalDocuments', { total }) }}</div>
|
2026-06-03 16:49:08 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="doc-section-actions">
|
|
|
|
|
|
<el-input
|
2026-06-05 17:37:21 +08:00
|
|
|
|
:placeholder="$t('knowledgeFileUpload.documentNamePlaceholder')"
|
2026-06-03 16:49:08 +08:00
|
|
|
|
v-model="searchDocName"
|
|
|
|
|
|
class="doc-search-input"
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
prefix-icon="el-icon-search"
|
|
|
|
|
|
clearable
|
|
|
|
|
|
/>
|
2026-06-05 17:37:21 +08:00
|
|
|
|
<el-button size="small" @click="handleSearch">{{ $t('knowledgeBaseManagement.search') }}</el-button>
|
|
|
|
|
|
<el-button size="small" @click="handleUpload">{{ $t('knowledgeBaseManagement.add') }}</el-button>
|
|
|
|
|
|
<el-button size="small" @click="handleRetrievalTest">{{ $t('knowledgeFileUpload.retrievalTest') }}</el-button>
|
2026-06-03 16:49:08 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2026-06-05 17:37:21 +08:00
|
|
|
|
<div class="doc-grid" v-loading="docLoading" :element-loading-text="$t('knowledgeBaseManagement.loading')">
|
2026-06-03 16:49:08 +08:00
|
|
|
|
<div v-for="doc in documents" :key="doc.id" class="doc-card">
|
|
|
|
|
|
<div class="doc-card-top">
|
2026-06-05 17:37:21 +08:00
|
|
|
|
<img class="doc-file-icon" :src="getFileIconSrc(doc.name)" />
|
2026-06-03 16:49:08 +08:00
|
|
|
|
<div class="doc-card-info">
|
|
|
|
|
|
<div class="doc-card-name" :title="doc.name">{{ doc.name }}</div>
|
2026-06-05 17:37:21 +08:00
|
|
|
|
<div class="doc-card-meta">{{ $t('knowledgeFileUpload.uploadTime') }} {{ formatDate(doc.createdAt) }}</div>
|
2026-06-03 16:49:08 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="doc-card-bottom">
|
|
|
|
|
|
<div class="doc-card-progress">
|
|
|
|
|
|
<div class="progress-ring">
|
2026-06-11 17:44:17 +08:00
|
|
|
|
<svg viewBox="0 0 40 40">
|
|
|
|
|
|
<circle class="bg" cx="20" cy="20" r="15"/>
|
|
|
|
|
|
<circle class="fg" :class="getProgressClass(doc)" cx="20" cy="20" r="15"
|
|
|
|
|
|
stroke-dasharray="94.25"
|
2026-06-03 16:49:08 +08:00
|
|
|
|
:stroke-dashoffset="getProgressOffset(doc)"/>
|
|
|
|
|
|
</svg>
|
|
|
|
|
|
<span class="progress-ring-text" :style="{ color: getProgressTextColor(doc) }">{{ getProgressText(doc) }}</span>
|
|
|
|
|
|
</div>
|
2026-06-05 17:37:21 +08:00
|
|
|
|
<div class="progress-container">
|
|
|
|
|
|
<span class="progress-label" :class="getProgressClass(doc)">{{ getDocStatusText(doc) }}</span>
|
|
|
|
|
|
<span class="doc-slice-count">{{ $t('knowledgeFileUpload.sliceCount') }} <b>{{ doc.sliceCount }}</b></span>
|
|
|
|
|
|
</div>
|
2026-06-03 16:49:08 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="doc-card-actions">
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
v-if="doc.parseStatusCode === 3"
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
@click.stop="$emit('view-slices', doc)"
|
|
|
|
|
|
>
|
2026-06-05 17:37:21 +08:00
|
|
|
|
{{ $t('knowledgeFileUpload.viewSlices') }}
|
2026-06-03 16:49:08 +08:00
|
|
|
|
</el-button>
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
v-else
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
:disabled="doc.parseStatusCode === 1"
|
|
|
|
|
|
:loading="doc.parsing"
|
|
|
|
|
|
@click.stop="handleParse(doc)"
|
|
|
|
|
|
>
|
2026-06-05 17:37:21 +08:00
|
|
|
|
{{ $t('knowledgeFileUpload.parse') }}
|
2026-06-03 16:49:08 +08:00
|
|
|
|
</el-button>
|
2026-06-09 17:22:18 +08:00
|
|
|
|
<el-button type="text" class="delete-btn" :loading="deleteLoadingMap[doc.id]" @click.stop="handleDelete(doc)">
|
2026-06-05 17:37:21 +08:00
|
|
|
|
{{ $t('knowledgeBaseManagement.delete') }}
|
2026-06-03 16:49:08 +08:00
|
|
|
|
</el-button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div v-if="documents.length === 0 && !docLoading" class="doc-empty">
|
2026-06-05 17:37:21 +08:00
|
|
|
|
<el-empty :description="$t('knowledgeBaseManagement.noData')"></el-empty>
|
2026-06-03 16:49:08 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2026-06-09 17:22:18 +08:00
|
|
|
|
<CustomPagination
|
|
|
|
|
|
:total="total"
|
|
|
|
|
|
:current-page="currentPage"
|
|
|
|
|
|
:page-size="pageSize"
|
|
|
|
|
|
:page-size-options="pageSizeOptions"
|
|
|
|
|
|
@page-change="handlePageChange"
|
|
|
|
|
|
@size-change="handleSizeChange"
|
|
|
|
|
|
/>
|
2026-06-03 16:49:08 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import Api from "@/apis/api";
|
2026-06-09 17:22:18 +08:00
|
|
|
|
import CustomPagination from "@/components/CustomPagination.vue";
|
2026-06-03 16:49:08 +08:00
|
|
|
|
|
2026-06-05 17:37:21 +08:00
|
|
|
|
const iconMap = {
|
|
|
|
|
|
pdf: require('@/assets/knowledge-base/pdf.png'),
|
|
|
|
|
|
doc: require('@/assets/knowledge-base/docX.png'),
|
|
|
|
|
|
docx: require('@/assets/knowledge-base/docX.png'),
|
|
|
|
|
|
xls: require('@/assets/knowledge-base/xlsx.png'),
|
|
|
|
|
|
xlsx: require('@/assets/knowledge-base/xlsx.png'),
|
|
|
|
|
|
csv: require('@/assets/knowledge-base/xlsx.png'),
|
|
|
|
|
|
md: require('@/assets/knowledge-base/MD.png'),
|
|
|
|
|
|
markdown: require('@/assets/knowledge-base/MD.png'),
|
|
|
|
|
|
txt: require('@/assets/knowledge-base/txt.png'),
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-06-03 16:49:08 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
name: 'LibraryItem',
|
2026-06-09 17:22:18 +08:00
|
|
|
|
components: { CustomPagination },
|
2026-06-03 16:49:08 +08:00
|
|
|
|
props: {
|
|
|
|
|
|
kb: {
|
|
|
|
|
|
type: Object,
|
|
|
|
|
|
default: null
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
documents: [],
|
|
|
|
|
|
docLoading: false,
|
2026-06-09 17:22:18 +08:00
|
|
|
|
deleteLoadingMap: {},
|
2026-06-03 16:49:08 +08:00
|
|
|
|
searchDocName: '',
|
2026-06-09 17:22:18 +08:00
|
|
|
|
total: 0,
|
|
|
|
|
|
currentPage: 1,
|
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
|
pageSizeOptions: [10, 20, 50, 100],
|
2026-06-03 16:49:08 +08:00
|
|
|
|
};
|
|
|
|
|
|
},
|
|
|
|
|
|
watch: {
|
|
|
|
|
|
kb: {
|
|
|
|
|
|
handler(newKb) {
|
|
|
|
|
|
if (newKb && newKb.datasetId) {
|
2026-06-09 17:22:18 +08:00
|
|
|
|
this.currentPage = 1;
|
2026-06-03 16:49:08 +08:00
|
|
|
|
this.fetchDocuments();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.documents = [];
|
2026-06-09 17:22:18 +08:00
|
|
|
|
this.total = 0;
|
2026-06-03 16:49:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
immediate: true
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
fetchDocuments() {
|
|
|
|
|
|
if (!this.kb || !this.kb.datasetId) return;
|
|
|
|
|
|
this.docLoading = true;
|
|
|
|
|
|
const params = {
|
2026-06-09 17:22:18 +08:00
|
|
|
|
page: this.currentPage,
|
|
|
|
|
|
page_size: this.pageSize,
|
2026-06-03 16:49:08 +08:00
|
|
|
|
name: this.searchDocName
|
|
|
|
|
|
};
|
|
|
|
|
|
Api.knowledgeBase.getDocumentList(
|
|
|
|
|
|
this.kb.datasetId,
|
|
|
|
|
|
params,
|
|
|
|
|
|
({ data }) => {
|
|
|
|
|
|
this.docLoading = false;
|
|
|
|
|
|
if (data && data.code === 0) {
|
|
|
|
|
|
this.documents = data.data.list || [];
|
2026-06-09 17:22:18 +08:00
|
|
|
|
this.total = data.data.total || 0;
|
2026-06-03 16:49:08 +08:00
|
|
|
|
this.fetchSliceCountsForDocuments();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(data?.msg || '获取文档列表失败');
|
|
|
|
|
|
this.documents = [];
|
2026-06-09 17:22:18 +08:00
|
|
|
|
this.total = 0;
|
2026-06-03 16:49:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
(err) => {
|
|
|
|
|
|
this.docLoading = false;
|
|
|
|
|
|
if (err && err.data) {
|
|
|
|
|
|
this.$message.error(err.data.msg || err.msg || '获取文档列表失败');
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error('获取文档列表失败');
|
|
|
|
|
|
}
|
|
|
|
|
|
this.documents = [];
|
2026-06-09 17:22:18 +08:00
|
|
|
|
this.total = 0;
|
2026-06-03 16:49:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
);
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
handleSearch() {
|
2026-06-09 17:22:18 +08:00
|
|
|
|
this.currentPage = 1;
|
|
|
|
|
|
this.fetchDocuments();
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
handlePageChange(page) {
|
|
|
|
|
|
this.currentPage = page;
|
|
|
|
|
|
this.fetchDocuments();
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
handleSizeChange(size) {
|
|
|
|
|
|
this.pageSize = size;
|
|
|
|
|
|
this.currentPage = 1;
|
2026-06-03 16:49:08 +08:00
|
|
|
|
this.fetchDocuments();
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
handleUpload() {
|
|
|
|
|
|
this.$emit('upload');
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
handleRetrievalTest() {
|
|
|
|
|
|
this.$emit('retrieval-test');
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
handleDelete(doc) {
|
|
|
|
|
|
if (!this.kb) return;
|
|
|
|
|
|
this.$confirm(
|
2026-06-05 17:37:21 +08:00
|
|
|
|
this.$t('knowledgeFileUpload.confirmDelete'),
|
|
|
|
|
|
this.$t('message.warning'),
|
2026-06-03 16:49:08 +08:00
|
|
|
|
{
|
2026-06-05 17:37:21 +08:00
|
|
|
|
confirmButtonText: this.$t('knowledgeBaseDialog.confirm'),
|
|
|
|
|
|
cancelButtonText: this.$t('knowledgeBaseDialog.cancel'),
|
2026-06-03 16:49:08 +08:00
|
|
|
|
type: 'warning'
|
|
|
|
|
|
}
|
|
|
|
|
|
).then(() => {
|
2026-06-09 17:22:18 +08:00
|
|
|
|
this.$set(this.deleteLoadingMap, doc.id, true);
|
2026-06-03 16:49:08 +08:00
|
|
|
|
Api.knowledgeBase.deleteDocument(this.kb.datasetId, doc.id, (res) => {
|
2026-06-09 17:22:18 +08:00
|
|
|
|
this.$set(this.deleteLoadingMap, doc.id, false);
|
2026-06-03 16:49:08 +08:00
|
|
|
|
if (res.data && res.data.code === 0) {
|
2026-06-09 17:22:18 +08:00
|
|
|
|
if (this.documents.length === 1 && this.currentPage > 1) {
|
|
|
|
|
|
this.currentPage--;
|
|
|
|
|
|
}
|
2026-06-03 16:49:08 +08:00
|
|
|
|
this.fetchDocuments();
|
2026-06-05 17:37:21 +08:00
|
|
|
|
this.$message.success(this.$t('knowledgeFileUpload.deleteSuccess'));
|
2026-06-03 16:49:08 +08:00
|
|
|
|
} else {
|
2026-06-05 17:37:21 +08:00
|
|
|
|
this.$message.error(res.data?.msg || this.$t('knowledgeFileUpload.deleteFailed'));
|
2026-06-03 16:49:08 +08:00
|
|
|
|
}
|
2026-06-11 17:17:59 +08:00
|
|
|
|
}, (err) => {
|
2026-06-09 17:22:18 +08:00
|
|
|
|
this.$set(this.deleteLoadingMap, doc.id, false);
|
2026-06-11 17:17:59 +08:00
|
|
|
|
this.$message.error(err?.data?.msg ||this.$t('knowledgeFileUpload.deleteFailed'));
|
2026-06-03 16:49:08 +08:00
|
|
|
|
});
|
|
|
|
|
|
}).catch(() => {});
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
handleParse(doc) {
|
2026-06-05 17:37:21 +08:00
|
|
|
|
this.$confirm(this.$t('knowledgeFileUpload.confirmParse'), this.$t('message.info'), {
|
|
|
|
|
|
confirmButtonText: this.$t('knowledgeFileUpload.confirm'),
|
|
|
|
|
|
cancelButtonText: this.$t('knowledgeFileUpload.cancel'),
|
2026-06-03 16:49:08 +08:00
|
|
|
|
type: 'info'
|
|
|
|
|
|
}).then(() => {
|
|
|
|
|
|
this.$set(doc, 'parsing', true);
|
|
|
|
|
|
doc.parseStatusCode = 1;
|
|
|
|
|
|
Api.knowledgeBase.parseDocument(
|
|
|
|
|
|
this.kb.datasetId,
|
|
|
|
|
|
doc.id,
|
|
|
|
|
|
({ data }) => {
|
|
|
|
|
|
if (data && data.code === 0) {
|
2026-06-05 17:37:21 +08:00
|
|
|
|
this.$message.success(this.$t('knowledgeFileUpload.parsing'));
|
2026-06-03 16:49:08 +08:00
|
|
|
|
this.$set(doc, 'parsing', false);
|
|
|
|
|
|
this.startParsePolling(doc);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$set(doc, 'parsing', false);
|
|
|
|
|
|
doc.parseStatusCode = 0;
|
2026-06-05 17:37:21 +08:00
|
|
|
|
this.$message.error(data?.msg || this.$t('knowledgeFileUpload.parseFailed'));
|
2026-06-03 16:49:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
(err) => {
|
|
|
|
|
|
this.$set(doc, 'parsing', false);
|
|
|
|
|
|
doc.parseStatusCode = 0;
|
2026-06-05 17:37:21 +08:00
|
|
|
|
this.$message.error(err?.data?.msg || this.$t('knowledgeFileUpload.parseFailed'));
|
2026-06-03 16:49:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
);
|
|
|
|
|
|
}).catch(() => {});
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
startParsePolling(doc) {
|
|
|
|
|
|
const poll = () => {
|
|
|
|
|
|
if (!this.kb) return;
|
|
|
|
|
|
Api.knowledgeBase.getDocumentList(
|
|
|
|
|
|
this.kb.datasetId,
|
|
|
|
|
|
{ page: 1, page_size: 100, name: this.searchDocName },
|
|
|
|
|
|
({ data }) => {
|
|
|
|
|
|
if (data && data.code === 0) {
|
|
|
|
|
|
const list = data.data.list || [];
|
|
|
|
|
|
const updated = list.find(d => d.id === doc.id);
|
|
|
|
|
|
if (updated) {
|
|
|
|
|
|
this.$set(doc, 'parseStatusCode', updated.parseStatusCode);
|
|
|
|
|
|
if (updated.parseStatusCode !== 1) {
|
|
|
|
|
|
this.$set(doc, 'parsing', false);
|
|
|
|
|
|
if (updated.parseStatusCode === 3) {
|
2026-06-05 17:37:21 +08:00
|
|
|
|
this.$message.success(`「${doc.name}」${this.$t('knowledgeFileUpload.parseSuccess')}`);
|
2026-06-03 16:49:08 +08:00
|
|
|
|
this.fetchSliceCountForSingleDocument(doc);
|
|
|
|
|
|
} else if (updated.parseStatusCode === 4) {
|
2026-06-05 17:37:21 +08:00
|
|
|
|
this.$message.error(`「${doc.name}」${this.$t('knowledgeFileUpload.parseFailed')}`);
|
2026-06-03 16:49:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
setTimeout(poll, 5000);
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
() => {
|
|
|
|
|
|
setTimeout(poll, 5000);
|
|
|
|
|
|
}
|
|
|
|
|
|
);
|
|
|
|
|
|
};
|
|
|
|
|
|
setTimeout(poll, 3000);
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
fetchSliceCountsForDocuments() {
|
|
|
|
|
|
if (!this.documents || this.documents.length === 0) return;
|
|
|
|
|
|
this.documents.forEach(doc => {
|
|
|
|
|
|
this.fetchSliceCountForSingleDocument(doc);
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
fetchSliceCountForSingleDocument(doc) {
|
|
|
|
|
|
const params = { page: 1, page_size: 1 };
|
|
|
|
|
|
Api.knowledgeBase.listChunks(
|
|
|
|
|
|
this.kb.datasetId,
|
|
|
|
|
|
doc.id,
|
|
|
|
|
|
params,
|
|
|
|
|
|
({ data }) => {
|
|
|
|
|
|
if (data && data.code === 0) {
|
|
|
|
|
|
this.$set(doc, 'sliceCount', data.data.total || 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
() => {}
|
|
|
|
|
|
);
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2026-06-05 17:37:21 +08:00
|
|
|
|
getFileIconSrc(fileName) {
|
|
|
|
|
|
if (!fileName) return require('@/assets/knowledge-base/default.png');
|
2026-06-03 16:49:08 +08:00
|
|
|
|
const ext = fileName.split('.').pop().toLowerCase();
|
2026-06-05 17:37:21 +08:00
|
|
|
|
return iconMap[ext] || require('@/assets/knowledge-base/default.png');
|
2026-06-03 16:49:08 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
getProgressClass(doc) {
|
|
|
|
|
|
const code = doc.parseStatusCode;
|
|
|
|
|
|
if (code === 3) return 'complete';
|
|
|
|
|
|
if (code === 1) return 'processing';
|
|
|
|
|
|
return 'pending';
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
getProgressOffset(doc) {
|
|
|
|
|
|
const code = doc.parseStatusCode;
|
2026-06-11 17:44:17 +08:00
|
|
|
|
const circumference = 94.25;
|
2026-06-03 16:49:08 +08:00
|
|
|
|
if (code === 3) return 0;
|
|
|
|
|
|
if (code === 1) {
|
|
|
|
|
|
const progress = doc.chunkNum && doc.totalChunkNum
|
|
|
|
|
|
? Math.round((doc.chunkNum / doc.totalChunkNum) * 100)
|
|
|
|
|
|
: 50;
|
|
|
|
|
|
return circumference * (1 - progress / 100);
|
|
|
|
|
|
}
|
|
|
|
|
|
return circumference;
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
getProgressText(doc) {
|
|
|
|
|
|
const code = doc.parseStatusCode;
|
2026-06-09 17:22:18 +08:00
|
|
|
|
if (code === 3) return '100%';
|
2026-06-03 16:49:08 +08:00
|
|
|
|
if (code === 1) {
|
|
|
|
|
|
if (doc.chunkNum && doc.totalChunkNum) {
|
|
|
|
|
|
return Math.round((doc.chunkNum / doc.totalChunkNum) * 100) + '%';
|
|
|
|
|
|
}
|
|
|
|
|
|
return '50%';
|
|
|
|
|
|
}
|
|
|
|
|
|
return '0%';
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
getProgressTextColor(doc) {
|
|
|
|
|
|
const code = doc.parseStatusCode;
|
|
|
|
|
|
if (code === 3) return '#34c759';
|
|
|
|
|
|
if (code === 1) return '#2f5bff';
|
|
|
|
|
|
return '#7888a8';
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
getDocStatusText(doc) {
|
|
|
|
|
|
const code = doc.parseStatusCode;
|
2026-06-05 17:37:21 +08:00
|
|
|
|
if (code === 3) return this.$t('knowledgeFileUpload.statusCompleted');
|
|
|
|
|
|
if (code === 1) return this.$t('knowledgeFileUpload.statusProcessing');
|
|
|
|
|
|
if (code === 0) return this.$t('knowledgeFileUpload.statusNotStarted');
|
|
|
|
|
|
if (code === 4) return this.$t('knowledgeFileUpload.statusFailed');
|
|
|
|
|
|
if (code === 2) return this.$t('knowledgeFileUpload.statusCancelled');
|
|
|
|
|
|
return this.$t('knowledgeFileUpload.statusNotStarted');
|
2026-06-03 16:49:08 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
formatDate(dateString) {
|
|
|
|
|
|
if (!dateString) return '';
|
|
|
|
|
|
const date = new Date(dateString);
|
|
|
|
|
|
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`;
|
|
|
|
|
|
},
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
/* ========== Document Section ========== */
|
|
|
|
|
|
.doc-section {
|
|
|
|
|
|
background: #fff;
|
2026-06-05 17:37:21 +08:00
|
|
|
|
border-radius: 10px;
|
2026-06-03 16:49:08 +08:00
|
|
|
|
padding: 16px 20px;
|
|
|
|
|
|
box-shadow: 0 4px 16px rgba(31, 42, 68, 0.06);
|
|
|
|
|
|
border: 1px solid #f0f3f9;
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
min-height: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.doc-section-header {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.doc-section-left {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 12px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.doc-section-title {
|
2026-06-11 17:44:17 +08:00
|
|
|
|
font-size: 18px;
|
2026-06-05 17:37:21 +08:00
|
|
|
|
font-weight: 500;
|
2026-06-03 16:49:08 +08:00
|
|
|
|
color: #1f2a44;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.doc-section-count {
|
2026-06-11 17:44:17 +08:00
|
|
|
|
font-size: 18px;
|
2026-06-03 16:49:08 +08:00
|
|
|
|
color: #788ba8;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.doc-section-actions {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.doc-search-input {
|
|
|
|
|
|
width: 200px;
|
2026-06-09 17:22:18 +08:00
|
|
|
|
margin-right: 10px;
|
2026-06-03 16:49:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* ========== Document Grid ========== */
|
|
|
|
|
|
.doc-grid {
|
|
|
|
|
|
padding: 10px;
|
|
|
|
|
|
display: grid;
|
2026-06-05 17:37:21 +08:00
|
|
|
|
grid-template-columns: repeat(auto-fill,minmax(300px, 1fr));
|
2026-06-03 16:49:08 +08:00
|
|
|
|
gap: 16px 20px;
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
min-height: 0;
|
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
|
scrollbar-width: thin;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.doc-card {
|
2026-06-11 17:44:17 +08:00
|
|
|
|
max-height: 110px;
|
2026-06-03 16:49:08 +08:00
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
border: 1px solid transparent;
|
|
|
|
|
|
padding: 18px;
|
|
|
|
|
|
background: #fff;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
2026-06-11 17:44:17 +08:00
|
|
|
|
justify-content: center;
|
2026-06-03 16:49:08 +08:00
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
transition: all 0.25s;
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
box-shadow: 0 0 6px rgba(47, 91, 255, 0.15);
|
|
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
|
box-shadow: 0 0 6px rgba(47, 91, 255, 0.15);
|
|
|
|
|
|
border: 1px solid #6b80eb;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.doc-card-top {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 14px;
|
|
|
|
|
|
margin-bottom: 12px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.doc-file-icon {
|
2026-06-05 17:37:21 +08:00
|
|
|
|
width: 46px;
|
|
|
|
|
|
height: 46px;
|
2026-06-03 16:49:08 +08:00
|
|
|
|
border-radius: 10px;
|
2026-06-05 17:37:21 +08:00
|
|
|
|
object-fit: contain;
|
2026-06-03 16:49:08 +08:00
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.doc-card-info {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
min-width: 0;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
justify-content: space-around;
|
|
|
|
|
|
text-align: left;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.doc-card-name {
|
|
|
|
|
|
font-size: 15px;
|
2026-06-05 17:37:21 +08:00
|
|
|
|
font-weight: 500;
|
2026-06-03 16:49:08 +08:00
|
|
|
|
color: #1f2a44;
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
|
margin-bottom: 4px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.doc-card-meta {
|
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
|
color: #7888a8;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.doc-card-bottom {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.doc-card-progress {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 8px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* ========== Progress Ring ========== */
|
|
|
|
|
|
.progress-ring {
|
2026-06-11 17:44:17 +08:00
|
|
|
|
width: 40px;
|
|
|
|
|
|
height: 40px;
|
2026-06-03 16:49:08 +08:00
|
|
|
|
position: relative;
|
|
|
|
|
|
|
|
|
|
|
|
svg {
|
2026-06-11 17:44:17 +08:00
|
|
|
|
width: 40px;
|
|
|
|
|
|
height: 40px;
|
2026-06-03 16:49:08 +08:00
|
|
|
|
transform: rotate(-90deg);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.bg {
|
|
|
|
|
|
fill: none;
|
|
|
|
|
|
stroke: #e7ecf5;
|
|
|
|
|
|
stroke-width: 4;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.fg {
|
|
|
|
|
|
fill: none;
|
|
|
|
|
|
stroke-width: 4;
|
|
|
|
|
|
stroke-linecap: round;
|
|
|
|
|
|
transition: stroke-dashoffset 0.5s ease;
|
|
|
|
|
|
|
|
|
|
|
|
&.complete { stroke: #34c759; }
|
|
|
|
|
|
&.processing { stroke: #2f5bff; }
|
|
|
|
|
|
&.pending { stroke: #e7ecf5; }
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.progress-ring-text {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: 50%;
|
|
|
|
|
|
left: 50%;
|
|
|
|
|
|
transform: translate(-50%, -50%);
|
|
|
|
|
|
font-size: 10px;
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
color: #7888a8;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-05 17:37:21 +08:00
|
|
|
|
.progress-container {
|
2026-06-11 17:44:17 +08:00
|
|
|
|
height: 36px;
|
2026-06-05 17:37:21 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
align-items: flex-start;
|
|
|
|
|
|
.progress-label {
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
color: #7888a8;
|
|
|
|
|
|
|
|
|
|
|
|
&.complete { color: #34c759; }
|
|
|
|
|
|
&.processing { color: #2f5bff; }
|
|
|
|
|
|
}
|
2026-06-03 16:49:08 +08:00
|
|
|
|
|
2026-06-05 17:37:21 +08:00
|
|
|
|
.doc-slice-count {
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
> b {
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-06-03 16:49:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-05 17:37:21 +08:00
|
|
|
|
|
2026-06-03 16:49:08 +08:00
|
|
|
|
.doc-card-actions {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 4px;
|
|
|
|
|
|
|
|
|
|
|
|
:deep(.el-button--text) {
|
|
|
|
|
|
padding: 4px 8px;
|
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.delete-btn {
|
|
|
|
|
|
color: #f56c6c !important;
|
|
|
|
|
|
&:hover {
|
|
|
|
|
|
color: #f78989 !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.doc-empty {
|
|
|
|
|
|
grid-column: 1 / -1;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
min-height: 300px;
|
|
|
|
|
|
color: #b0bbc9;
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
|
|
|
|
|
|
i {
|
|
|
|
|
|
font-size: 48px;
|
|
|
|
|
|
margin-bottom: 12px;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@media (max-width: 1144px) {
|
|
|
|
|
|
.doc-grid {
|
|
|
|
|
|
grid-template-columns: repeat(3, 1fr);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@media (max-width: 900px) {
|
|
|
|
|
|
.doc-grid {
|
|
|
|
|
|
grid-template-columns: repeat(2, 1fr);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|