fix:生成报告更新图片选择逻辑

This commit is contained in:
2025-12-16 10:40:15 +08:00
parent f609e6c4ba
commit 499304ed44
2 changed files with 145 additions and 49 deletions

View File

@@ -1,6 +1,12 @@
<template>
<Dialog v-model="visible" diaTitle="生成报告" :width="'80%'" :height="'80%'" :zIndex="100" @close="handleCloseFun">
<Dialog
v-model="visible"
diaTitle="生成报告"
:width="'80%'"
:height="'80%'"
:zIndex="100"
@close="handleCloseFun"
>
<div class="report-page">
<div class="form-box">
<el-form :model="reportFormData" inline>
@@ -15,7 +21,7 @@
</el-form-item>
<el-form-item label="申请日期:">
<el-date-picker
class="w180"
class="w180"
v-model="reportFormData.date"
type="datetime"
placeholder="申请日期"
@@ -33,9 +39,24 @@
<el-input class="w180" v-model="reportFormData.workspace"></el-input>
</el-form-item>
<el-form-item label="分析类型:">
<el-select class="w180" v-model="reportFormData.taskType" >
<el-option v-for="item in taskTypeList" :key="item.value" :label="item.name" :value="item.value"></el-option>
<el-select class="w180" v-model="reportFormData.taskType" @change="taskTypeChangeFun">
<el-option
v-for="item in taskTypeList"
:key="item.value"
:label="item.name"
:value="item.value"
></el-option>
</el-select>
<el-tooltip
class="box-item"
effect="dark"
:content="
'该类型包含的图片文件名称为:' + taskTypeImgFileMap[reportFormData.taskType]
"
placement="top-start"
>
<el-icon class="ml5"><InfoFilled /></el-icon>
</el-tooltip>
</el-form-item>
<el-form-item label="报告版本:">
<el-input class="w180" v-model="reportFormData.reportVer"></el-input>
@@ -45,7 +66,7 @@
</el-form-item>
<el-form-item label="拟定时间:">
<el-date-picker
class="w180"
class="w180"
v-model="reportFormData.formulateTime"
type="datetime"
placeholder="拟定时间"
@@ -55,7 +76,7 @@
</el-form-item>
<el-form-item label="检查时间:">
<el-date-picker
class="w180"
class="w180"
v-model="reportFormData.checkTime"
type="datetime"
placeholder="检查时间"
@@ -65,7 +86,7 @@
</el-form-item>
<el-form-item label="审批时间:">
<el-date-picker
class="w180"
class="w180"
v-model="reportFormData.approveTime"
type="datetime"
placeholder="审批时间"
@@ -86,26 +107,37 @@
<el-form>
<el-form-item label="图片选择:">
<div class="img-content">
<div class="img-item" v-for="item in resultImgList" :key="item.id">
<el-checkbox v-model="item.checkImg" class="check-style" size="large" />
<el-image class="img-style" title="点击预览图片" :src="item.url" :zoom-rate="1.2" :max-scale="7"
:min-scale="0.2" :preview-src-list="[item.url]" show-progress :initial-index="4" fit="cover" />
</div>
<template v-for="item in resultImgList" :key="item.id">
<div class="img-item" v-if="item.show">
<el-checkbox v-model="item.checkImg" class="check-style" size="large" />
<el-image
class="img-style"
title="点击预览图片"
:src="item.url"
:zoom-rate="1.2"
:max-scale="7"
:min-scale="0.2"
:preview-src-list="[item.url]"
show-progress
:initial-index="4"
fit="cover"
/>
</div>
</template>
</div>
</el-form-item>
<el-form-item label="指标选择:">
<taskPerformance ref="taskPerformanceRef" :task-info="currentNodeInfo" :run-info="currentNodeInfo"
:param-type="currentNodeInfo?.nodeType"></taskPerformance>
<taskPerformance
ref="taskPerformanceRef"
:task-info="currentNodeInfo"
:run-info="currentNodeInfo"
:param-type="currentNodeInfo?.nodeType"
></taskPerformance>
</el-form-item>
</el-form>
</div>
</div>
</Dialog>
</template>
<script setup lang="ts">
@@ -120,11 +152,11 @@ const env = import.meta.env;
const props = defineProps({
currentNodeInfo: {
type: Object,
default: () => { },
default: () => {},
},
parentNodeInfo: {
type: Object,
default: () => { },
default: () => {},
},
});
@@ -139,7 +171,7 @@ const reportFormData = reactive<any>({
projectNum: '',
workspaceNum: '',
workspace: '',
taskType: '',
taskType: 'statics',
reportVer: '',
fileNum: '',
formulateTime: '',
@@ -149,25 +181,64 @@ const reportFormData = reactive<any>({
loadcaseName: '',
});
const taskTypeImgFileMap = ref<any>({
statics: [
'model.png',
'stand_distance.png',
'stand_stress.png',
'forklift_stress.png',
'forklift_distance.png',
'forklift_max_stress.png',
],
dynamics: [
'square_stress_img0.png',
'square_stress_img1.png',
'square_distance_img1.png',
'square_stress_img2.png',
'actuat_distance_img1.png',
'actuat_stress_img1.png',
'square_x_curve_distance.png',
'square_y_curve_distance.png',
'square_z_curve_distance.png',
'square_stress_img3.png',
'actuat_x_curve_distance.png',
'actuat_y_curve_distance.png',
'actuat_z_curve_distance.png',
'actuat_stress_img2.png',
],
fluid: [
'fluid_img1.png',
'fluid_img2.png',
'velocity_contour.png',
'fluid_img3.png',
'fluid_img4.png',
'fluid_img5.png',
'fluid_img6.png',
'luid_img7.png',
'luid_img8.png',
'fluid_img9.png',
],
thermal: ['img1.png', 'img2.png', 'img3.png', 'img4.png', 'img5.png'],
});
const taskTypeList = ref([
{
name:'静力学',
value:'statics'
},
{
name:'动力学',
value:'dynamics'
},
{
name:'流体 ',
value:'fluid'
},
{
name:'热分析',
value:'thermal'
},
])
name: '静力学',
value: 'statics',
},
{
name: '动力学',
value: 'dynamics',
},
{
name: '流体 ',
value: 'fluid',
},
{
name: '热分析',
value: 'thermal',
},
]);
const handleCloseFun = () => {
emits('close');
@@ -200,7 +271,6 @@ const createSuccessFun = async () => {
projecInfoReq: reportFormData,
fileName,
});
};
const resultImgList = ref<any>([]);
@@ -218,14 +288,41 @@ const queryDirDataFun = async () => {
url: `${env.VITE_API_IMAGE_PREVIEW_URL}/data/previewImage?fileId=${item.fileId}`,
};
});
showIMgFileList();
}
};
const taskTypeChangeFun = () => {
showIMgFileList();
};
const showIMgFileList = () => {
const list = taskTypeImgFileMap.value[reportFormData.taskType];
for (let i = 0; i < resultImgList.value.length; i++) {
resultImgList.value[i].checkImg = false;
if (list.includes(resultImgList.value[i].name)) {
resultImgList.value[i].show = true;
} else {
resultImgList.value[i].show = false;
}
}
console.log(resultImgList.value, 'resultImgList.value');
// const imgs = resultImgList.value.filter((item: any) => {
// return list.includes(item.name);
// });
// return imgs;
};
onMounted(async () => {
await queryDirDataFun();
reportFormData.reportName = '算例报告_' + dayjs().format('YYYY_MM_DD_HH_mm');
});
</script>
<style lang="scss" scoped>
@@ -240,7 +337,6 @@ onMounted(async () => {
}
.content-box {
.img-content {
width: 100%;
min-height: 200px;
@@ -261,23 +357,22 @@ onMounted(async () => {
position: absolute;
top: 0px;
left: 5px;
}
.img-style {
width: 150px;
height: 150px;
}
}
}
}
.w180{
.ml5{
margin-left: 5px;
}
.w180 {
width: 230px !important;
}
}
</style>

View File

@@ -134,6 +134,7 @@ import { NODE_TYPE } from '@/utils/enum/node';
import { CommonStore } from '@/stores/common';
import attachments from '@/views/task/simulationTask/components/attachments.vue';
import { disposeMemberList } from '../../projectDetail/components/project';
// import { useDict } from '@/utils/useDict';
// import { disposeSimType } from '@/utils/task';
import {
TASK_PROCESS_STATUS_OBJ,