update:报告模版换文件预览
This commit is contained in:
@@ -27,6 +27,11 @@ export const dataUploadFilesApi = (params: any, onProgress?: any) => {
|
||||
return upload(`${PREFIX}data/uploadFiles`, params, onProgress);
|
||||
};
|
||||
|
||||
// 上传文件到报告模板库
|
||||
export const uploadReportTemplateFileApi = (params: any, onProgress?: any) => {
|
||||
return upload(`${PREFIX}data/uploadReportTemplateFile`, params, onProgress);
|
||||
};
|
||||
|
||||
export const dataCreateDirApi = (params: any) => {
|
||||
return post(`${PREFIX}data/createDir`, params);
|
||||
};
|
||||
|
||||
@@ -73,7 +73,7 @@ import PoolTaskSelect from '@/components/pool/poolTaskSelect.vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { createReportTemplateApi, updateReportTemplateApi } from '@/api/capability/report';
|
||||
import { REPORT_OPERATION_TYPE } from '@/utils/enum/report';
|
||||
import { getFileBaseInfoApi } from '@/api/data/data';
|
||||
import { getFileBaseInfoApi, uploadReportTemplateFileApi } from '@/api/data/data';
|
||||
|
||||
const props = defineProps<{
|
||||
showDialog: boolean;
|
||||
@@ -156,6 +156,15 @@ const confirmFun = async (type: string) => {
|
||||
simulationPoolInfoList: oldSimulationPoolInfoList.value,
|
||||
});
|
||||
}
|
||||
// 重新选了文件,则要获取预览id
|
||||
if (!editRowInfo.value?.file[0]?.id) {
|
||||
const fileRes = await uploadReportTemplateFileApi({
|
||||
file: editRowInfo.value?.file[0]?.raw,
|
||||
});
|
||||
if (fileRes.code === 200) {
|
||||
flowForm.file[0].id = fileRes.data;
|
||||
}
|
||||
}
|
||||
emits('confirm', {
|
||||
type,
|
||||
uuid: flowForm.uuid,
|
||||
|
||||
@@ -131,6 +131,12 @@ const getReportDetail = async () => {
|
||||
if (res.code === 200) {
|
||||
for (const key in res.data) {
|
||||
reportDetail[key] = res.data[key];
|
||||
if (key === 'fileId') {
|
||||
// 用表单中的文件id覆盖报告详情的文件id,兼容换文件预览的场景
|
||||
if (props.upgradeReportInfo.fileId) {
|
||||
reportDetail[key] = props.upgradeReportInfo.fileId;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!res.data.templateContent || res.data.templateContent?.length < 10) {
|
||||
reportDetail.templateContent = [];
|
||||
|
||||
Reference in New Issue
Block a user