This commit is contained in:
2026-02-10 14:36:13 +08:00
7 changed files with 379 additions and 22 deletions

View File

@@ -0,0 +1,217 @@
<template>
<div class="task-performance-page">
<DragUploader @beforeUpload="beforeUploadFun">
<BaseTable
tableName="TASK_REPORT"
:api="getSimulationTaskFilesApi"
:params="apiParam"
ref="baseTableRef"
:showCheckbox="true"
:actionList="actionList"
>
<template v-if="showLeftOptions" #leftOptions>
<AddFile
:accept="accept"
ref="AddFileRef"
:api="batchAddFileInfoForTaskApi"
:fileType="FILE_TYPE.VIDEO_FILE"
tableName="TASK_DETAIL_UPLOAD_FILE"
callbackFlag="TASK_REPORT_UPLOAD_FINISHED"
multiple
:discipline="taskData?.discipline"
:data="{
dirId: nodeFIleId,
projectId: null,
uuid: taskId,
}"
@finished="uploadFinishedFun"
>
<el-button>上传文件</el-button>
</AddFile>
<el-button class="ml12" type="primary" @click="downLoadFun">下载文件</el-button>
</template>
<template #type="{ row }">
<span>{{ getfileType(row) }}</span>
</template>
<template #fileSize="{ row }">
<span>{{ formatFileSize(row.fileSize) }}</span>
</template>
<template #operate="{ row }">
<el-button link type="primary">
<UploadFile v-model="row.id" :name="'下载'" />
</el-button>
</template>
</BaseTable>
</DragUploader>
<FilePreview v-model="previewVisible" :fileId="currentRow?.id" />
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, watch } from 'vue';
import BaseTable from '@/components/common/table/baseTable.vue';
import { batchAddFileInfoForTaskApi } from '@/api/project/run';
import {
downloadFileById,
downloadFileByStream,
formatFileSize,
getFileUploadAcceptFun,
queryFileIdByNodeIdFun,
} from '@/utils/file';
import UploadFile from '@/components/common/uploadFile/index.vue';
import FilePreview from '@/components/common/filePreview/index.vue';
import AddFile from '@/components/common/addFile/index.vue';
import { FILE_TYPE } from '@/utils/enum/file';
import { dataOverViewDeleteSimulationNodeFilesApi } from '@/api/data/dataOverView';
import { getSimulationTaskFilesApi } from '@/api/data/dataAnalysis';
import { NODE_TYPE } from '@/utils/enum/node';
import DragUploader from '@/components/common/dragUploader/index.vue';
const props = defineProps({
taskId: {
type: String,
default: '',
},
showFilter: {
type: Boolean,
default: true,
},
showLeftOptions: {
type: Boolean,
default: true,
},
taskData: {
type: Object,
default: () => ({}),
},
});
const baseTableRef = ref();
const currentId = ref<any>(props.taskId);
const taskRunList = ref<any>([]);
const nodeFIleId = ref<any>('');
const accept = ref<any>('');
// const env = import.meta.env;
// 获取任务下指标信息
const getTaskRunInfoFun = async () => {
taskRunList.value = [
{
name: '当前任务',
id: props.taskId,
},
];
currentId.value = taskRunList.value[0].id;
};
const getfileType = (data: any) => {
const fileType = data.originalName.split('.').pop();
return fileType;
};
const currentRow = ref();
const previewVisible = ref(false);
const previewFileFun = (row: any) => {
currentRow.value = row;
previewVisible.value = true;
};
const actionList = ref([
{
title: '下载',
type: 'primary',
click: (row: any) => {
downloadFileById(row.id);
},
},
{
title: '预览',
type: 'primary',
click: (row: any) => {
previewFileFun(row);
},
},
{
title: '删除',
type: 'danger',
needConfirm: true,
confirmTip: '删除后不可恢复,确认删除吗?',
click: (row: any) => {
deleteFun(row);
},
hide: () => {
return !props.showLeftOptions;
},
},
]);
const deleteFun = async (row: any) => {
const param = {
deleteId: row.id,
dataType: 2,
};
try {
const res: any = await dataOverViewDeleteSimulationNodeFilesApi(param);
if (res && res.code === 200) {
baseTableRef.value.resetFun();
}
} catch {}
};
const uploadFinishedFun = (data: any) => {
if (data.callbackFlag === 'TASK_REPORT_UPLOAD_FINISHED') {
baseTableRef.value.resetFun();
}
};
const downLoadFun = async () => {
const data: any = baseTableRef.value.tableRef.getCheckboxRecords() || [];
if (data.length) {
for (let i = 0; i < data.length; i++) {
downloadFileByStream(data[i].id);
}
}
};
const apiParam = ref<any>({});
watch(
() => props.taskId,
(newVal) => {
if (newVal) {
apiParam.value = {
uuid: currentId,
fileBizType: FILE_TYPE.VIDEO_FILE,
fileName: '',
startTime: '',
endTime: '',
level: NODE_TYPE.TASK,
};
}
},
{
immediate: true,
deep: true,
}
);
const AddFileRef = ref<any>();
const beforeUploadFun = (file: any) => {
AddFileRef.value.addFileFun(file);
};
onMounted(async () => {
getTaskRunInfoFun();
accept.value = await getFileUploadAcceptFun('VIDEO_FILE_FORMAT');
nodeFIleId.value = await queryFileIdByNodeIdFun(props.taskId);
});
</script>
<style lang="scss" scoped>
.task-performance-page {
width: 100%;
height: 100%;
.ml12 {
margin-left: 12px;
}
}
</style>

View File

@@ -6,7 +6,27 @@
:head="tableColumns"
:tableName="checkTableName"
hidePagination
></BaseTable>
>
<template v-for="item in tableColumns" :key="item.key" #[item.key]="{ row }">
<div v-if="row.attributes != '操作'">
<img
v-if="row.attributes === '文件名称'"
:src="fileUploadAllocationIconFun(row[item.key])"
class="img"
/>
<span>{{ row[item.key] || '--' }}</span>
</div>
<div v-else>
<span v-if="item.key === 'attributes'">{{ row[item.key] }}</span>
<div v-else>
<el-button type="primary" link @click="reviewFun(item)">预览</el-button>
<el-button type="primary" link @click="downLoadFun(item)">下载</el-button>
</div>
</div>
</template>
</BaseTable>
<FilePreview v-model="previewVisible" :fileId="fileId"></FilePreview>
</div>
</template>
@@ -14,6 +34,8 @@
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';
import { downloadFileByStream, fileUploadAllocationIconFun } from '@/utils/file';
const props = defineProps({
checkTaskInfo: {
@@ -35,7 +57,8 @@ const showTableContent = ref(false);
const tableColumns = ref<any>([]);
const tableData = ref<any>([]);
const previewVisible = ref(false);
const fileId = ref<any>('');
const modelAttribute = ref<any>([
{
name: '文件名称',
@@ -73,6 +96,10 @@ const modelAttribute = ref<any>([
name: '日期',
value: 'createTime',
},
{
name: '操作',
value: 'operate',
},
]);
const getTableColumnFun = (data: any) => {
@@ -156,6 +183,16 @@ const getTableColumnFun = (data: any) => {
});
};
const reviewFun = (column: any) => {
fileId.value = column.key;
previewVisible.value = true;
};
const downLoadFun = (column: any) => {
fileId.value = column.key;
downloadFileByStream(fileId.value);
};
watch(
() => props.checkTaskInfo,
(newVal) => {
@@ -173,4 +210,11 @@ watch(
width: 100%;
height: 100%;
}
.img {
width: 20px;
height: 20px;
margin-right: 8px;
transform: translateY(3px);
}
</style>

View File

@@ -38,6 +38,10 @@
<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 class="img-attribute">
<el-button type="primary" link @click="reviewFun(item_2)">预览</el-button>
<el-button type="primary" link @click="downLoadFun(item_2)">下载</el-button>
</div>
</div>
</el-card>
</div>
@@ -50,6 +54,7 @@ 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';
import { downloadFileByStream } from '@/utils/file';
const props = defineProps({
checkTaskInfo: {
@@ -195,6 +200,17 @@ const reviewFileFun = (ids: any) => {
previewVisible.value = true;
};
// 预览文件
const reviewFun = (column: any) => {
fileId.value = column.id;
previewVisible.value = true;
};
const downLoadFun = (column: any) => {
fileId.value = column.id;
downloadFileByStream(fileId.value);
};
watch(
() => props.checkTaskInfo,
(newVal) => {

View File

@@ -6,7 +6,26 @@
:head="tableColumns"
:tableName="checkTableName"
hidePagination
></BaseTable>
>
<template v-for="item in tableColumns" :key="item.key" #[item.key]="{ row }">
<div v-if="row.attributes != '操作'">
<img
v-if="row.attributes === '文件名称'"
:src="fileUploadAllocationIconFun(row[item.key])"
class="img"
/>
<span>{{ row[item.key] || '--' }}</span>
</div>
<div v-else>
<span v-if="item.key === 'attributes'">{{ row[item.key] }}</span>
<div v-else>
<el-button type="primary" link @click="reviewFun(item)">预览</el-button>
<el-button type="primary" link @click="downLoadFun(item)">下载</el-button>
</div>
</div>
</template>
</BaseTable>
<FilePreview v-model="previewVisible" :fileId="fileId"></FilePreview>
</div>
</template>
@@ -14,6 +33,8 @@
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';
import { downloadFileByStream, fileUploadAllocationIconFun } from '@/utils/file';
const props = defineProps({
checkTaskInfo: {
@@ -35,7 +56,8 @@ const showTableContent = ref(false);
const tableColumns = ref<any>([]);
const tableData = ref<any>([]);
const previewVisible = ref(false);
const fileId = ref<any>('');
const modelAttribute = ref<any>([
{
name: '文件名称',
@@ -73,6 +95,10 @@ const modelAttribute = ref<any>([
name: '日期',
value: 'createTime',
},
{
name: '操作',
value: 'operate',
},
]);
const getTableColumnFun = (data: any) => {
@@ -148,6 +174,9 @@ const getTableColumnFun = (data: any) => {
tableData.value.push(obj);
}
console.log(tableData.value, 'tableData.value');
console.log(tableColumns.value, 'tableColumns.value');
showTableContent.value = true;
nextTick(() => {
@@ -155,6 +184,17 @@ const getTableColumnFun = (data: any) => {
});
};
// 预览文件
const reviewFun = (column: any) => {
fileId.value = column.key;
previewVisible.value = true;
};
const downLoadFun = (column: any) => {
fileId.value = column.key;
downloadFileByStream(fileId.value);
};
watch(
() => props.checkTaskInfo,
(newVal) => {
@@ -174,4 +214,11 @@ watch(
width: 100%;
height: 100%;
}
.img {
width: 20px;
height: 20px;
margin-right: 8px;
transform: translateY(3px);
}
</style>

View File

@@ -8,16 +8,20 @@
hidePagination
>
<template v-for="item in tableColumns" :key="item.key" #[item.key]="{ row }">
<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 v-if="row.attributes != '操作'">
<img
v-if="row.attributes === '文件名称'"
:src="fileUploadAllocationIconFun(row[item.key])"
class="img"
/>
<span>{{ row[item.key] || '--' }}</span>
</div>
<div v-else>
<span class="report-style">{{ row[item.key] }}</span>
<span v-if="item.key === 'attributes'">{{ row[item.key] }}</span>
<div v-else>
<el-button type="primary" link @click="reviewFun(item)">预览</el-button>
<el-button type="primary" link @click="downLoadFun(item)">下载</el-button>
</div>
</div>
</template>
</BaseTable>
@@ -31,6 +35,7 @@ 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';
import { downloadFileByStream, fileUploadAllocationIconFun } from '@/utils/file';
const props = defineProps({
checkTaskInfo: {
@@ -91,21 +96,23 @@ const modelAttribute = ref<any>([
name: '日期',
value: 'createTime',
},
{
name: '操作',
value: 'operate',
},
]);
const reviewFileFun = (row: any, key: any) => {
console.log(row);
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;
// 预览文件
const reviewFun = (column: any) => {
fileId.value = column.key;
previewVisible.value = true;
};
const downLoadFun = (column: any) => {
fileId.value = column.key;
downloadFileByStream(fileId.value);
};
const fileList = ref<any>([]);
const getTableColumnFun = (data: any) => {
fileList.value = cloneDeep(data);
@@ -208,4 +215,11 @@ watch(
width: 100%;
height: 100%;
}
.img {
width: 20px;
height: 20px;
margin-right: 8px;
transform: translateY(3px);
}
</style>

View File

@@ -8,6 +8,7 @@
<el-tab-pane label="性能指标" name="performance" v-if="showPerformance"></el-tab-pane>
<el-tab-pane label="图片文件" name="picture"></el-tab-pane>
<el-tab-pane label="曲线文件" name="canvas"></el-tab-pane>
<el-tab-pane label="视频文件" name="video"></el-tab-pane>
<el-tab-pane label="试验结果" name="experiment"></el-tab-pane>
<el-tab-pane label="任务信息" name="taskInfo" v-if="showTaskInfo"></el-tab-pane>
@@ -66,6 +67,12 @@
:show-left-options="showLeftOptions"
></taskReport>
</div>
<div class="tabs-component" v-if="activeName === 'video'">
<videoFile
:task-id="currentTaskInfo?.uuid"
:show-left-options="showLeftOptions"
></videoFile>
</div>
<div class="tabs-component" v-if="activeName === 'experiment'">
<experimentResult
:task-info="currentTaskInfo"
@@ -140,6 +147,7 @@ import Dialog from '@/components/common/dialog/index.vue';
import task3DModel from '@/components/taskDetail/task3DModel.vue';
import taskInfoPage from '@/components/taskDetail/taskInfo.vue';
import { getSimulationTaskFilesApi } from '@/api/data/dataAnalysis';
import videoFile from '@/components/taskDetail/videoFile.vue';
const props = defineProps({
taskInfo: {

View File

@@ -92,6 +92,16 @@
></taskCurve>
</div>
</el-tab-pane>
<el-tab-pane label="视频文件" name="video">
<div class="task-tab-content">
<videoFile
v-if="activeTab === 'video'"
:task-id="currentTaskInfo?.uuid"
:taskData="currentTaskInfo"
:show-left-options="showLeftOptions"
></videoFile>
</div>
</el-tab-pane>
<el-tab-pane label="试验结果" name="experiment">
<experimentResult
@@ -184,6 +194,7 @@ import experimentResult from '@/views/task/execution/components/taskDetailPage/c
import runVersionTree from '@/views/task/execution/components/runDetailPage/runPagecomponent/runVersionTree.vue';
import taskDemand from '@/components/taskDetail/taskDemand.vue';
import { getSimulationTaskFilesApi } from '@/api/data/dataAnalysis';
import videoFile from '@/components/taskDetail/videoFile.vue';
const emits = defineEmits(['closeFn', 'updateFn']);
const props = defineProps({