diff --git a/src/api/pwl/pwlProject/model/index.ts b/src/api/pwl/pwlProject/model/index.ts index 98aa068..b79f091 100644 --- a/src/api/pwl/pwlProject/model/index.ts +++ b/src/api/pwl/pwlProject/model/index.ts @@ -99,6 +99,10 @@ export interface PwlProject { kbId?: string; // 资料库库Ids libraryIds?: string; + // 材料分析库 + analysisLibrary?: string; + // 项目资料库 + projectLibrary?: string; } /** diff --git a/src/views/pwl/pwlProject/components/pwlProjectEdit.vue b/src/views/pwl/pwlProject/components/pwlProjectEdit.vue index e663b2d..c3d17e4 100644 --- a/src/views/pwl/pwlProject/components/pwlProjectEdit.vue +++ b/src/views/pwl/pwlProject/components/pwlProjectEdit.vue @@ -7,6 +7,7 @@ :maxable="maxable" :title="isUpdate ? '编辑项目' : '添加项目'" :body-style="{ paddingBottom: '28px' }" + :confirm-loading="loading" @update:visible="updateVisible" @ok="save" > @@ -391,7 +392,9 @@ const form = reactive({ bizLibName: [], pubLibIds: [], // 修改为pubLibIds pubLibName: [], - libraryIds: undefined, // 新增libraryIds字段 + libraryIds: undefined, + analysisLibrary: undefined, + projectLibrary: undefined, comments: undefined, electron: undefined, paper: undefined, @@ -645,6 +648,7 @@ const save = () => { }); }) .catch(() => { + loading.value = false; }); }; diff --git a/src/views/pwl/pwlProject/index.vue b/src/views/pwl/pwlProject/index.vue index d7ed378..235d914 100644 --- a/src/views/pwl/pwlProject/index.vue +++ b/src/views/pwl/pwlProject/index.vue @@ -69,6 +69,7 @@ @@ -88,6 +95,50 @@ + + + +
+ 新增文档 +
+ + + +
+ + + + + @@ -108,6 +159,8 @@ import {pagePwlProject, removePwlProject, removeBatchPwlProject} from '@/api/pwl import type {PwlProject, PwlProjectParam} from '@/api/pwl/pwlProject/model'; import {getPageTitle} from "@/utils/common"; import Extra from "./components/extra.vue"; +import Import from '@/views/oa/oaCompany/components/Import.vue'; +import {getKnowledgeBaseDocuments, deleteKnowledgeBaseDocument} from '@/api/ai/knowledgeBase'; // 表格实例 const tableRef = ref | null>(null); @@ -128,6 +181,108 @@ const showMove = ref(false); // const saleUser = ref([]); // 加载状态 const loading = ref(true); +// 文档管理相关响应式变量 +const showDocManage = ref(false); // 是否显示文档管理弹窗 +const showImport = ref(false); // 是否显示导入弹窗 +const currentKbId = ref(''); // 当前知识库ID +const currentDocType = ref(''); // 当前文档类型(材料分析/项目文档) +const docList = ref([]); // 文档列表数据 +const docLoading = ref(false); // 文档加载状态 +const currentPage = ref(1); +const total = ref(0); + +// 文档表格列配置 +const docColumns = ref([ + { + title: '文件名', + dataIndex: 'name', + key: 'fileName', + }, + { + title: '文件大小', + dataIndex: 'size', + key: 'fileSize', + }, + { + title: '上传时间', + dataIndex: 'gmtModified', + key: 'createTime', + customRender: ({ text }) => toDateString(text) + }, + { + title: '操作', + key: 'action', + width: 100, + } +]); + +// 打开材料分析 +const openCaseManagement = (record: PwlProject) => { + if (!record.analysisLibrary) { + message.warning('当前记录没有关联材料分析知识库'); + return; + } + currentKbId.value = record.analysisLibrary; + currentDocType.value = '材料分析'; + currentPage.value = 1; + showDocManage.value = true; + loadDocuments(); +}; + +// 打开项目文档 +const openDocumentManagement = (record: PwlProject) => { + if (!record.projectLibrary) { + message.warning('当前记录没有关联项目文档知识库'); + return; + } + currentKbId.value = record.projectLibrary; + currentDocType.value = '项目文档'; + currentPage.value = 1; + showDocManage.value = true; + loadDocuments(); +}; + +// 加载文档列表 +const loadDocuments = async () => { + docLoading.value = true; + try { + const response = await getKnowledgeBaseDocuments( + currentKbId.value, + 10, + currentPage.value + ); + docList.value = Array.isArray(response?.list) ? response.list : []; + total.value = response?.count || 0; + } catch (error) { + message.error('加载文档列表失败'); + console.error('加载文档错误:', error); + } finally { + docLoading.value = false; + } +}; + +// 删除文档 +const deleteDoc = async (record: any) => { + try { + await deleteKnowledgeBaseDocument(currentKbId.value, record.id); + + // 立即本地删除 + const index = docList.value.findIndex(item => item.id === record.id); + if (index > -1) { + docList.value.splice(index, 1); + total.value -= 1; + } + message.success('删除成功'); + } catch (error) { + message.error('删除失败'); + console.error(error); + } +}; + +// 打开导入弹窗 +const openImport = () => { + showImport.value = true; +}; // 表格数据源 const datasource: DatasourceFunction = ({