This commit is contained in:
2026-01-28 21:01:19 +08:00
6 changed files with 391 additions and 170 deletions

View File

@@ -368,7 +368,7 @@ watch(
fileName: '',
startTime: '',
endTime: '',
type: NODE_TYPE.TASK,
level: NODE_TYPE.TASK,
};
}
},

View File

@@ -96,6 +96,7 @@
v-if="showComponents"
:check-task-info="resultData"
:cloumn-width="cloumnWidth"
:checkType="analysisTypes"
>
</cloudImage>
</template>
@@ -142,11 +143,12 @@ import dayjs from 'dayjs';
import { ElMessage } from 'element-plus';
import { getAllRunResultByTaskIdApi } from '@/api/project/analysis';
import { getSimulationTaskFileApi } from '@/api/data/dataAnalysis';
import { getRunPerformanceApi } from '@/api/task/taskpool';
import { getRunPerformanceApi, getTaskPerformanceApi } from '@/api/task/taskpool';
import { exportToPdf } from '@/utils/exportPdf';
import { statusMapFun5, statusMapFun6 } from '@/components/common/statusDot/statusMap';
import { useDict } from '@/utils/useDict';
import StatusDot from '@/components/common/statusDot/index.vue';
import { FILE_TYPE } from '@/utils/enum/file';
const { RESULT_ACHIEVE_STATUS, TASK_ACHIEVE_STATUS, PERFORMANCE_TYPE, PERFORMANCE_UNIT } = useDict(
'RESULT_ACHIEVE_STATUS',
@@ -203,6 +205,7 @@ const changeChceckFun = async () => {
}, 50);
};
const analysisTypes = ref('仿真任务');
const getConvertData = async (flag: any, type: any) => {
let data: any = [];
// const tasklist = [
@@ -213,14 +216,14 @@ const getConvertData = async (flag: any, type: any) => {
// id: 'simu_a308aaba-db9e-40fd-9870-062a177f6faf78765',
// },
// ];
analysisTypes.value = type;
const tasklist = checktableData.value;
if (flag === 'numericalResult') {
if (type === '仿真任务' || type === '仿真算例') {
if (type === '仿真任务') {
for (let i = 0; i < tasklist.length; i++) {
const list = (await getAllRunResultByTaskIdFun(tasklist[i].uuid))?.performances;
const list = await getTaskPerformanceFun(tasklist[i]);
data = data.concat(list);
}
} else {
@@ -229,7 +232,6 @@ const getConvertData = async (flag: any, type: any) => {
data = data.concat(list);
}
}
performanceData.value = data;
} else {
performanceData.value = checktableData.value;
@@ -239,19 +241,18 @@ const getConvertData = async (flag: any, type: any) => {
if (type === '仿真任务' || type === '仿真算例') {
if (type === '仿真任务') {
for (let i = 0; i < tasklist.length; i++) {
const list = (await getAllRunResultByTaskIdFun(tasklist[i].uuid))?.runs;
data = data.concat(list);
const datas = await getSimulationTaskFileFun(tasklist[i], 'task', FILE_TYPE.MODEL_3D_FILE);
modelData.value = modelData.value.concat(datas);
}
} else {
data = checktableData.value;
}
const runs = data || [];
const runs = data || [];
if (runs.length) {
for (let i = 0; i < runs.length; i++) {
const datas = await getFileInfo(runs[i], 1);
modelData.value = modelData.value.concat(datas);
if (runs.length) {
for (let i = 0; i < runs.length; i++) {
const datas = await getFileInfo(runs[i], FILE_TYPE.MODEL_3D_FILE);
modelData.value = modelData.value.concat(datas);
}
}
}
} else {
@@ -262,17 +263,20 @@ const getConvertData = async (flag: any, type: any) => {
if (type === '仿真任务' || type === '仿真算例') {
if (type === '仿真任务') {
for (let i = 0; i < tasklist.length; i++) {
const list = (await getAllRunResultByTaskIdFun(tasklist[i].uuid))?.runs;
data = data.concat(list);
const datas = await getSimulationTaskFileFun(
tasklist[i],
'task',
FILE_TYPE.CALCULATION_FILE
);
calculationFileData.value = calculationFileData.value.concat(datas);
}
} else {
data = checktableData.value;
}
const runs = data || [];
if (runs.length) {
for (let i = 0; i < runs.length; i++) {
const datas = await getFileInfo(runs[i], 3);
calculationFileData.value = calculationFileData.value.concat(datas);
const runs = checktableData.value || [];
if (runs.length) {
for (let i = 0; i < runs.length; i++) {
const datas = await getFileInfo(runs[i], 3);
calculationFileData.value = calculationFileData.value.concat(datas);
}
}
}
} else {
@@ -280,29 +284,19 @@ const getConvertData = async (flag: any, type: any) => {
}
} else if (flag === 'result') {
resultData.value = [];
if (type === '仿真任务' || type === '仿真算例') {
if (type === '仿真任务') {
for (let i = 0; i < tasklist.length; i++) {
const list = (await getAllRunResultByTaskIdFun(tasklist[i].uuid))?.runs;
data = data.concat(list);
const datas = await getSimulationTaskFileFun(tasklist[i], 'task', FILE_TYPE.PNG_FILE);
resultData.value = resultData.value.concat(datas);
}
} else {
data = checktableData.value;
}
const runs = data || [];
if (runs.length) {
for (let i = 0; i < runs.length; i++) {
const datas = await getFileInfo(runs[i], 5);
resultData.value = resultData.value.concat(datas);
// const obj = {
// ...runs[i],
// runImgResult: datas,
// };
// resultData.value.push(obj);
// resultData.value = resultData.value.concat(datas);
const runs = checktableData.value || [];
if (runs.length) {
for (let i = 0; i < runs.length; i++) {
const datas = await getFileInfo(runs[i], 5);
resultData.value = resultData.value.concat(datas);
}
}
}
} else {
@@ -313,17 +307,18 @@ const getConvertData = async (flag: any, type: any) => {
if (type === '仿真任务' || type === '仿真算例') {
if (type === '仿真任务') {
for (let i = 0; i < tasklist.length; i++) {
const list = (await getAllRunResultByTaskIdFun(tasklist[i].uuid))?.runs;
data = data.concat(list);
// const list = (await getAllRunResultByTaskIdFun(tasklist[i].uuid))?.runs;
// data = data.concat(list);
const datas = await getSimulationTaskFileFun(tasklist[i], 'task', FILE_TYPE.CANVAS_FILE);
curveData.value = curveData.value.concat(datas);
}
} else {
data = checktableData.value;
}
const runs = data || [];
if (runs.length) {
for (let i = 0; i < runs.length; i++) {
const datas = await getFileInfo(runs[i], 4);
curveData.value = curveData.value.concat(datas);
const runs = checktableData.value || [];
if (runs.length) {
for (let i = 0; i < runs.length; i++) {
const datas = await getFileInfo(runs[i], 4);
curveData.value = curveData.value.concat(datas);
}
}
}
} else {
@@ -334,17 +329,18 @@ const getConvertData = async (flag: any, type: any) => {
if (type === '仿真任务' || type === '仿真算例') {
if (type === '仿真任务') {
for (let i = 0; i < tasklist.length; i++) {
const list = (await getAllRunResultByTaskIdFun(tasklist[i].uuid))?.runs;
data = data.concat(list);
// const list = (await getAllRunResultByTaskIdFun(tasklist[i].uuid))?.runs;
// data = data.concat(list);
const datas = await getSimulationTaskFileFun(tasklist[i], 'task', FILE_TYPE.CANVAS_FILE);
reportData.value = reportData.value.concat(datas);
}
} else {
data = checktableData.value;
}
const runs = data || [];
if (runs.length) {
for (let i = 0; i < runs.length; i++) {
const datas = await getFileInfo(runs[i], 2);
reportData.value = reportData.value.concat(datas);
const runs = checktableData.value || [];
if (runs.length) {
for (let i = 0; i < runs.length; i++) {
const datas = await getFileInfo(runs[i], 2);
reportData.value = reportData.value.concat(datas);
}
}
}
} else {
@@ -355,41 +351,41 @@ const getConvertData = async (flag: any, type: any) => {
return data || [];
};
const getAllRunResultByTaskIdFun = async (id: any) => {
const param = {
taskId: id,
};
try {
const res: any = await getAllRunResultByTaskIdApi(param);
if (res && res.code === 200) {
let performanceList: any = [];
// const getAllRunResultByTaskIdFun = async (id: any) => {
// const param = {
// taskId: id,
// };
// try {
// const res: any = await getAllRunResultByTaskIdApi(param);
// if (res && res.code === 200) {
// let performanceList: any = [];
const runs: any = [];
if (res.data?.runResultResp?.length) {
for (let i = 0; i < res.data?.runResultResp.length; i++) {
performanceList = performanceList.concat(res.data.runResultResp[i].simulationPerformance);
// const runs: any = [];
// if (res.data?.runResultResp?.length) {
// for (let i = 0; i < res.data?.runResultResp.length; i++) {
// performanceList = performanceList.concat(res.data.runResultResp[i].simulationPerformance);
const obj: any = {
...res.data.runResultResp[i].simulationRun,
taskName: res.data.runResultResp[i]?.simulationPerformance[0]?.taskName,
};
// const obj: any = {
// ...res.data.runResultResp[i].simulationRun,
// taskName: res.data.runResultResp[i]?.simulationPerformance[0]?.taskName,
// };
runs.push(obj);
}
}
// runs.push(obj);
// }
// }
return {
performances: performanceList,
runs,
};
}
} catch {}
};
// return {
// performances: performanceList,
// runs,
// };
// }
// } catch {}
// };
const analysisTypeList = ref<any>([
{
value: 'model',
name: '模型文件',
name: '3D模型',
includes: ['仿真任务', '仿真算例', '模型文件'],
},
{
@@ -477,6 +473,44 @@ const getRunPerformanceFn = async (data: any) => {
}
};
const getSimulationTaskFileFun = async (data: any, level: any, fileBizType: any) => {
let result: any = [];
const param = {
current: 1,
size: 999,
uuid: data.uuid,
fileBizType: fileBizType,
fileName: '',
startTime: '',
endTime: '',
level: level,
};
try {
const res: any = await getSimulationTaskFileApi(param);
if (res && res.code === 200) {
result = res.data.data;
return result;
} else {
return result;
}
} catch {
return result;
}
};
const getTaskPerformanceFun = async (data: any) => {
const res: any = await getTaskPerformanceApi({
taskId: data.uuid,
});
if (res && res.code === 200) {
const list = res.data;
return list;
}
};
watch(
() => props.analysisData,
async (newVal) => {

View File

@@ -1,5 +1,5 @@
<template>
<div class="model-file-page">
<!-- <div class="model-file-page" >
<BaseTable
v-if="showTableContent"
:row-config="{
@@ -18,13 +18,38 @@
</div>
</template>
</BaseTable>
</div> -->
<div class="model-file-page">
<div class="imglist" v-for="item_1 in imgLists" :key="item_1.name">
<div class="task-name">
<el-icon class="icon-style"><Document /></el-icon>
{{ item_1.name }}
</div>
<el-card class="task-img-content" v-for="item_2 in item_1.img" :key="item_2.uuid">
<div class="task-img-item">
<div class="img-box" @click="reviewFileFun(item_2.id)">
<img class="img-item" :src="getImgPathFun(item_2.id)" alt="" />
<div>{{ item_2.originalName }}</div>
</div>
<div class="img-attribute">{{ getFIleSuffix(item_2.originalName) }}</div>
<div class="img-attribute">{{ item_2.formatFileSize }}</div>
<div class="img-attribute">{{ item_2.createTime }}</div>
<div class="img-attribute">{{ item_2.ownProjectName }}</div>
<div class="img-attribute">{{ item_2.ownPhaseName }}</div>
<div class="img-attribute">{{ item_2.runName }}</div>
</div>
</el-card>
</div>
</div>
<FilePreview v-model="previewVisible" :fileId="fileId"></FilePreview>
</template>
<script setup lang="ts">
import { ref, nextTick, watch } from 'vue';
import BaseTable from '@/components/common/table/baseTable.vue';
import { objectTypeArrayRemovesDuplicates } from '@/utils/common';
import FilePreview from '@/components/common/filePreview/index.vue';
const props = defineProps({
checkTaskInfo: {
@@ -39,8 +64,14 @@ const props = defineProps({
type: String,
default: '',
},
checkType: {
type: String,
default: '',
},
});
const env = import.meta.env;
const previewVisible = ref(false);
const fileId = ref<any>('');
const cloudTableRef = ref();
const showTableContent = ref(false);
@@ -49,7 +80,44 @@ const tableColumns = ref<any>([]);
const tableData = ref<any>([]);
const imgLists = ref<any>([]);
const getTableColumnFun = (data: any) => {
const checkTypes = props.checkType;
console.log(data, 'datadatadata');
let key = 'owntaskName';
if (checkTypes === '仿真任务') {
key = 'owntaskName';
}
if (checkTypes === '仿真算例') {
key = 'ownRunName';
}
imgLists.value = [];
const names: any = data.map((item: any) => {
return item[key];
});
const checkNames: any = objectTypeArrayRemovesDuplicates(names, 1);
for (let i = 0; i < checkNames?.length; i++) {
const obj: any = {
name: checkNames[i],
img: [],
};
for (let j = 0; j < data.length; j++) {
if (checkNames[i] === data[j][key]) {
obj.img.push(data[j]);
}
}
imgLists.value.push(obj);
}
console.log(imgLists.value, 'imgLists.value');
return;
showTableContent.value = false;
tableData.value = [];
tableColumns.value = [];
@@ -116,6 +184,17 @@ const getImgPathFun = (id: any) => {
return `${env.VITE_API_IMAGE_PREVIEW_URL}/data/previewImage?fileId=${id}`;
};
const getFIleSuffix = (name: any) => {
let suffix: any = '';
suffix = name.split('.').at(-1);
return suffix;
};
const reviewFileFun = (ids: any) => {
fileId.value = ids;
previewVisible.value = true;
};
watch(
() => props.checkTaskInfo,
(newVal) => {
@@ -134,9 +213,67 @@ watch(
.model-file-page {
width: 100%;
height: 100%;
overflow: auto;
.img-content {
width: 100%;
}
.imglist {
width: 100%;
display: flex;
flex-wrap: wrap;
.task-name {
width: 100%;
height: 40px;
display: flex;
align-items: center;
font-size: 14px;
padding-left: 10px;
// border-left: 5px solid var(--el-color-primary);
}
.task-img-content {
// width: 200px;
width: calc(25% - 10px);
margin-right: 10px;
margin-bottom: 10px;
.task-img-item {
width: 100%;
display: flex;
flex-direction: column;
// justify-content: center;
text-align: center;
.img-box {
width: 100%;
cursor: pointer;
.img-item {
width: 150px;
height: 150px;
border-radius: 5px;
border: 1px solid #c0b9b91c;
overflow: hidden;
}
}
}
.img-attribute {
width: 100%;
height: 30px;
text-align: center;
line-height: 30px;
border-top: 1px solid #c0b9b91c;
}
}
}
}
.icon-style {
color: var(--el-color-primary);
margin-right: 5px;
}
</style>

View File

@@ -109,14 +109,16 @@ const getTableColumnFun = (data: any) => {
nextTick(async () => {
curveResultTableRef.value.setDataFun(tableData.value);
let ids: any = [];
for (let i = 0; i < tableData.value.length; i++) {
for (const key in tableData.value[i]) {
if (tableData.value[i][key] && !key.includes('row_')) {
await getCSVDataFun(tableData.value[i][key]);
ids.push(tableData.value[i][key]);
}
}
}
ids = ids.join(',');
await getCSVDataFun(ids);
});
};
@@ -126,7 +128,14 @@ const getCSVDataFun = async (ids: any) => {
}
const res: any = await getCSVDataApi({ fileId: ids });
if (res && res.code === 200) {
getCsvFormatDataFun(res.data, ids);
const list = ids.split(',');
for (let i = 0; i < res.data?.xData?.length; i++) {
const obj = {
xData: [res.data?.xData[i]],
yData: [res.data?.yData[i]],
};
getCsvFormatDataFun(obj, list[i]);
}
}
};

View File

@@ -1,20 +1,26 @@
<template>
<div class="model-file-page">
<div class="calculation-file-page">
<BaseTable
v-if="showTableContent"
ref="reportComparisonTableRef"
ref="calculationFileTableRef"
:head="tableColumns"
:tableName="checkTableName"
hidePagination
>
<template v-for="item in tableColumns" :key="item.key" #[item.key]="{ row }">
<div v-if="row[item.key]" class="img-content" @click="reviewFileFun(row[item.key])">
<el-icon><Document /></el-icon>
<span class="report-style">{{ getFileNameFun(row[item.key]) }}</span>
<div
v-if="row[item.key].includes('.') && row.attributes === '文件名称'"
class="img-content"
>
<el-button link type="primary" icon="Document" @click="reviewFileFun(row, item.key)"
>{{ row[item.key] }}
</el-button>
</div>
<div v-else>
<span class="report-style">{{ row[item.key] }}</span>
</div>
</template>
</BaseTable>
<FilePreview v-model="previewVisible" :fileId="fileId"></FilePreview>
</div>
</template>
@@ -23,6 +29,7 @@
import { ref, nextTick, watch } from 'vue';
import BaseTable from '@/components/common/table/baseTable.vue';
import { objectTypeArrayRemovesDuplicates } from '@/utils/common';
import { cloneDeep } from 'lodash-es';
import FilePreview from '@/components/common/filePreview/index.vue';
const props = defineProps({
@@ -39,132 +46,166 @@ const props = defineProps({
default: '',
},
});
const reportComparisonTableRef = ref();
const calculationFileTableRef = ref();
const showTableContent = ref(false);
const fileId = ref<any>('');
const previewVisible = ref(false);
const fileId = ref<any>('');
const tableColumns = ref<any>([]);
const tableData = ref<any>([]);
const inputDatas = ref<any>([]);
const modelAttribute = ref<any>([
{
name: '文件名称',
value: 'originalName',
},
{
name: '所属项目',
value: 'ownProjectName',
},
{
name: '所属阶段',
value: 'ownPhaseName',
},
{
name: '所属机台',
value: 'ownMachineName',
},
{
name: '所属工位',
value: 'ownWorkspaceName',
},
{
name: '所属工况',
value: 'owntaskName',
},
{
name: '所属算例',
value: 'ownRunName',
},
{
name: '文件大小',
value: 'formatFileSize',
},
{
name: '日期',
value: 'createTime',
},
]);
const getFileNameFun = (ids: any) => {
const file =
inputDatas.value.find((item: any) => {
return item.id === Number(ids);
}) || '';
const reviewFileFun = (row: any, key: any) => {
console.log(row);
return file.originalName || '';
let ids: any = '';
for (let i = 0; i < fileList.value.length; i++) {
if (key.endsWith(fileList.value[i].uuid)) {
ids = fileList.value[i].id;
}
}
fileId.value = ids;
previewVisible.value = true;
};
const fileList = ref<any>([]);
const getTableColumnFun = (data: any) => {
fileList.value = cloneDeep(data);
const titles = data.map((item: any) => {
const name =
item.taskName && item.runName ? item.taskName + '_' + item.runName : item.originalName;
const value = item.taskId && item.uuid ? item.taskId + '_' + item.uuid : item.id;
const obj = {
name,
value,
};
return obj;
});
const list: any = data || [];
showTableContent.value = false;
tableData.value = [];
tableColumns.value = [];
const list: any = data || [];
const defaultColumns: any = [
const defaultColumns = [
{
title: '报告名称',
title: '属性',
key: 'attributes',
isShow: true,
},
];
const reportComparisoncolumns: any = [];
let modelcolumns: any = [];
for (let i = 0; i < list.length; i++) {
const names =
list[i].taskName && list[i].runName
? list[i].taskName + '_' + list[i].runName
: list[i].originalName;
for (let i = 0; i < titles.length; i++) {
for (let j = 0; j < list.length; j++) {
const names =
list[j].taskName && list[j].runName
? list[j].taskName + '_' + list[j].runName
: list[j].originalName;
const obj: any = {
title: `${names}-报告`,
key: `${list[i].taskId}_${list[i].uuid}_${list[i].id}`,
isShow: true,
align: 'center',
};
reportComparisoncolumns.push(obj);
if (titles[i].name === names) {
const obj: any = {
title: titles[i].name,
key: titles[i].value,
isShow: true,
};
modelcolumns.push(obj);
}
}
}
modelcolumns = objectTypeArrayRemovesDuplicates(modelcolumns, 2);
tableColumns.value = defaultColumns.concat(modelcolumns);
tableColumns.value = defaultColumns.concat(reportComparisoncolumns);
tableColumns.value = objectTypeArrayRemovesDuplicates(tableColumns.value, 2);
if (props.cloumnWidth) {
for (let i = 0; i < tableColumns.value.length; i++) {
tableColumns.value[i].width = props.cloumnWidth;
}
}
const listData: any = [];
for (let i = 0; i < tableColumns.value.length; i++) {
const obj: any = {};
const str = tableColumns.value[i].key;
obj[str] = [];
for (let i = 0; i < modelAttribute.value.length; i++) {
for (let j = 0; j < list.length; j++) {
const str2 = list[j].taskId + '_' + list[j].uuid + '_' + list[j].id;
if (str2 === str) {
obj[str].push(list[j].id);
const values =
list[j].taskId && list[j].uuid ? list[j].taskId + '_' + list[j].uuid : list[j].id;
modelAttribute.value[i][values] = list[j][modelAttribute.value[i].value];
}
}
for (let i = 0; i < modelAttribute.value.length; i++) {
const obj: any = {};
for (let j = 0; j < tableColumns.value.length; j++) {
if (tableColumns.value[j].key === 'attributes') {
obj[tableColumns.value[j].key] = modelAttribute.value[i].name;
} else {
obj[tableColumns.value[j].key] = modelAttribute.value[i][tableColumns.value[j].key];
}
}
obj[str] = obj[str].join('_');
if (obj[str]) {
listData.push(obj);
}
tableData.value.push(obj);
}
const pngObj: any = {};
for (let i = 0; i < listData.length; i++) {
for (const key in listData[i]) {
pngObj[key] = listData[i][key];
}
}
tableData.value.push(pngObj);
showTableContent.value = true;
console.log(tableData.value, 'tableData.value');
nextTick(() => {
reportComparisonTableRef.value.setDataFun(tableData.value);
calculationFileTableRef.value.setDataFun(tableData.value);
});
};
watch(
() => props.checkTaskInfo,
(newVal) => {
if (newVal) {
inputDatas.value = newVal;
getTableColumnFun(newVal);
}
getTableColumnFun(newVal);
},
{
immediate: true,
deep: true,
}
);
const reviewFileFun = (ids: any) => {
fileId.value = ids;
previewVisible.value = true;
};
</script>
<style lang="scss" scoped>
.model-file-page {
.calculation-file-page {
width: 100%;
height: 100%;
.img-content {
width: 100%;
display: flex;
align-items: center;
// justify-content: center;
color: #409eff;
.report-style {
margin-left: 5px;
cursor: pointer;
}
}
}
</style>

View File

@@ -450,7 +450,7 @@ const modelData = ref<any>({
模型文件: {
tableName: 'RESULT_MODEL',
api: getSimulationTaskFileFun,
params: { model: '模型文件', fileBizType: 1 },
params: { model: '模型文件', fileBizType: 13 },
exportApi: exportTaskFileByScriptApi,
exportFileName: '模型文件',
exportParams: createFileExportParams('模型文件', 1),