update:任务详情增加编辑报告

This commit is contained in:
2026-02-10 14:35:16 +08:00
parent 6b855f8ada
commit 2d31607c11
3 changed files with 46 additions and 8 deletions

View File

@@ -46,17 +46,20 @@ import { ref, watch, nextTick } from 'vue';
import Dialog from '@/components/common/dialog/index.vue';
import { queryReportTemplateApi } from '@/api/capability/report';
import { editReportApi, editReportAndDownloadApi, queryTaskRunApi } from '@/api/project/run';
import { getTaskDetailApi } from '@/api/project/task';
import ReportEdit from '@/components/common/report/reportEdit/index.vue';
import { ElMessage } from 'element-plus';
interface Props {
modelValue: boolean;
data: any;
taskId?: any;
runId?: any;
}
const props = withDefaults(defineProps<Props>(), {
modelValue: false,
data: {},
taskId: '',
runId: '',
});
watch(
@@ -92,7 +95,33 @@ const getReportListFun = () => {
queryReportTemplateApi(params).then((res: any) => {
if (res.code === 200) {
reportList.value = res.data.data;
getRunDetailFun();
if (props.taskId) {
getTaskDetailFun();
}
if (props.runId) {
getRunDetailFun();
}
}
});
};
const getTaskDetailFun = () => {
const params = {
relatedResourceUuid: props.taskId,
};
getTaskDetailApi(params).then((res: any) => {
if (res.code === 200) {
// 编辑过算例报告的获取historyData
historyData.value = JSON.parse(res.data.reportContent);
if (historyData.value) {
// 匹配对应的报告模版数据data
const data = reportList.value.find((i: any) => i.uuid === res.data.reportTemplate);
if (!data) {
return;
}
reportData.value = data;
setReportDataFun(data);
}
}
});
};
@@ -100,7 +129,7 @@ const getReportListFun = () => {
const historyData = ref<any>([]);
const getRunDetailFun = () => {
const params = {
runId: props.data.uuid,
runId: props.runId,
};
queryTaskRunApi(params).then((res: any) => {
if (res.code === 200) {
@@ -133,12 +162,17 @@ const ReportEditRef = ref<any>();
const saveFun = (download: boolean) => {
const fileName = reportData.value.templateName + '.docx';
const data = ReportEditRef.value?.getFormatDataFun();
const params = {
runId: props.data.uuid,
const params: any = {
reportTemplate: reportDataId.value,
reportContent: JSON.stringify(data),
fileName,
};
if (props.taskId) {
params.taskId = props.taskId;
}
if (props.runId) {
params.runId = props.runId;
}
let api: any = editReportApi;
if (download) {
api = editReportAndDownloadApi;

View File

@@ -10,6 +10,7 @@
:actionList="actionList"
>
<template v-if="showLeftOptions" #leftOptions>
<el-button @click="reportInpDiaShow = true">编辑报告</el-button>
<AddFile
:accept="accept"
ref="AddFileRef"
@@ -26,7 +27,7 @@
}"
@finished="uploadFinishedFun"
>
<el-button>上传文件</el-button>
<el-button class="ml12">上传文件</el-button>
</AddFile>
<el-button class="ml12" type="primary" @click="downLoadFun">下载文件</el-button>
</template>
@@ -44,6 +45,7 @@
</BaseTable>
</DragUploader>
<FilePreview v-model="previewVisible" :fileId="currentRow?.id" />
<ReportInputDialog v-model="reportInpDiaShow" :taskId="taskId" />
</div>
</template>
@@ -66,6 +68,7 @@ import { dataOverViewDeleteSimulationNodeFilesApi } from '@/api/data/dataOverVie
import { getSimulationTaskFilesApi } from '@/api/data/dataAnalysis';
import { NODE_TYPE } from '@/utils/enum/node';
import DragUploader from '@/components/common/dragUploader/index.vue';
import ReportInputDialog from '@/components/common/report/reportInputDialog.vue';
const props = defineProps({
taskId: {
@@ -90,6 +93,7 @@ const currentId = ref<any>(props.taskId);
const taskRunList = ref<any>([]);
const nodeFIleId = ref<any>('');
const accept = ref<any>('');
const reportInpDiaShow = ref(false);
// const env = import.meta.env;
// 获取任务下指标信息

View File

@@ -201,7 +201,7 @@
</p>
</div>
</Teleport>
<ReportInputDialog v-model="reportInpDiaShow" :data="rightClickNode" />
<ReportInputDialog v-model="reportInpDiaShow" :runId="rightClickNode?.uuid" />
</div>
</template>