feat(pwl):添加项目报告材料分析、项目文档按钮
This commit is contained in:
@@ -99,6 +99,10 @@ export interface PwlProject {
|
|||||||
kbId?: string;
|
kbId?: string;
|
||||||
// 资料库库Ids
|
// 资料库库Ids
|
||||||
libraryIds?: string;
|
libraryIds?: string;
|
||||||
|
// 材料分析库
|
||||||
|
analysisLibrary?: string;
|
||||||
|
// 项目资料库
|
||||||
|
projectLibrary?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
:maxable="maxable"
|
:maxable="maxable"
|
||||||
:title="isUpdate ? '编辑项目' : '添加项目'"
|
:title="isUpdate ? '编辑项目' : '添加项目'"
|
||||||
:body-style="{ paddingBottom: '28px' }"
|
:body-style="{ paddingBottom: '28px' }"
|
||||||
|
:confirm-loading="loading"
|
||||||
@update:visible="updateVisible"
|
@update:visible="updateVisible"
|
||||||
@ok="save"
|
@ok="save"
|
||||||
>
|
>
|
||||||
@@ -391,7 +392,9 @@ const form = reactive<PwlProject>({
|
|||||||
bizLibName: [],
|
bizLibName: [],
|
||||||
pubLibIds: [], // 修改为pubLibIds
|
pubLibIds: [], // 修改为pubLibIds
|
||||||
pubLibName: [],
|
pubLibName: [],
|
||||||
libraryIds: undefined, // 新增libraryIds字段
|
libraryIds: undefined,
|
||||||
|
analysisLibrary: undefined,
|
||||||
|
projectLibrary: undefined,
|
||||||
comments: undefined,
|
comments: undefined,
|
||||||
electron: undefined,
|
electron: undefined,
|
||||||
paper: undefined,
|
paper: undefined,
|
||||||
@@ -645,6 +648,7 @@ const save = () => {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
|
loading.value = false;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,7 @@
|
|||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="column.key === 'action'">
|
<template v-if="column.key === 'action'">
|
||||||
|
<div>
|
||||||
<a class="text-pink-500" @click="openReport(record)">生成报告</a>
|
<a class="text-pink-500" @click="openReport(record)">生成报告</a>
|
||||||
<a-divider type="vertical"/>
|
<a-divider type="vertical"/>
|
||||||
<a @click="openEdit(record)">修改</a>
|
<a @click="openEdit(record)">修改</a>
|
||||||
@@ -79,6 +80,12 @@
|
|||||||
>
|
>
|
||||||
<a class="ele-text-danger">删除</a>
|
<a class="ele-text-danger">删除</a>
|
||||||
</a-popconfirm>
|
</a-popconfirm>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a @click="openCaseManagement(record)">材料分析</a>
|
||||||
|
<a-divider type="vertical"/>
|
||||||
|
<a @click="openDocumentManagement(record)">项目文档</a>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</ele-pro-table>
|
</ele-pro-table>
|
||||||
@@ -88,6 +95,50 @@
|
|||||||
<Edit v-model:visible="showEdit" :data="current" @done="reload"/>
|
<Edit v-model:visible="showEdit" :data="current" @done="reload"/>
|
||||||
<!-- 生成报告 -->
|
<!-- 生成报告 -->
|
||||||
<Report v-model:visible="showReport" :data="current" @done="reload"/>
|
<Report v-model:visible="showReport" :data="current" @done="reload"/>
|
||||||
|
|
||||||
|
<!-- 添加文档管理弹窗 -->
|
||||||
|
<a-modal
|
||||||
|
v-model:visible="showDocManage"
|
||||||
|
:title="`文档管理 - ${currentDocType} - ${current?.name || ''}`"
|
||||||
|
width="800px"
|
||||||
|
:footer="null"
|
||||||
|
>
|
||||||
|
<div style="margin-bottom: 16px;">
|
||||||
|
<a-button type="primary" @click="openImport">新增文档</a-button>
|
||||||
|
</div>
|
||||||
|
<a-table
|
||||||
|
:dataSource="docList"
|
||||||
|
:columns="docColumns"
|
||||||
|
:loading="docLoading"
|
||||||
|
rowKey="id"
|
||||||
|
:pagination="{
|
||||||
|
current: currentPage,
|
||||||
|
pageSize: 10,
|
||||||
|
total: total,
|
||||||
|
showSizeChanger: false,
|
||||||
|
showTotal: (total) => `共 ${total} 条`
|
||||||
|
}"
|
||||||
|
@change="(pag) => { currentPage = pag.current; loadDocuments(); }"
|
||||||
|
>
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.key === 'action'">
|
||||||
|
<a-space>
|
||||||
|
<a-popconfirm
|
||||||
|
title="确定要删除此文档吗?"
|
||||||
|
@confirm="deleteDoc(record)"
|
||||||
|
>
|
||||||
|
<a class="ele-text-danger">删除</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</a-table>
|
||||||
|
</a-modal>
|
||||||
|
|
||||||
|
<!-- 导入弹窗 -->
|
||||||
|
<Import v-model:visible="showImport" @done="loadDocuments" :kbId="currentKbId"/>
|
||||||
|
|
||||||
|
|
||||||
</a-page-header>
|
</a-page-header>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -108,6 +159,8 @@ import {pagePwlProject, removePwlProject, removeBatchPwlProject} from '@/api/pwl
|
|||||||
import type {PwlProject, PwlProjectParam} from '@/api/pwl/pwlProject/model';
|
import type {PwlProject, PwlProjectParam} from '@/api/pwl/pwlProject/model';
|
||||||
import {getPageTitle} from "@/utils/common";
|
import {getPageTitle} from "@/utils/common";
|
||||||
import Extra from "./components/extra.vue";
|
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<InstanceType<typeof EleProTable> | null>(null);
|
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||||
@@ -128,6 +181,108 @@ const showMove = ref(false);
|
|||||||
// const saleUser = ref<string[]>([]);
|
// const saleUser = ref<string[]>([]);
|
||||||
// 加载状态
|
// 加载状态
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
|
// 文档管理相关响应式变量
|
||||||
|
const showDocManage = ref(false); // 是否显示文档管理弹窗
|
||||||
|
const showImport = ref(false); // 是否显示导入弹窗
|
||||||
|
const currentKbId = ref(''); // 当前知识库ID
|
||||||
|
const currentDocType = ref(''); // 当前文档类型(材料分析/项目文档)
|
||||||
|
const docList = ref<any[]>([]); // 文档列表数据
|
||||||
|
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 = ({
|
const datasource: DatasourceFunction = ({
|
||||||
|
|||||||
Reference in New Issue
Block a user