2025-10-30 19:30:06 +08:00
|
|
|
<template>
|
|
|
|
|
<div class="task-performance-page">
|
2026-01-10 14:00:47 +08:00
|
|
|
<div class="task-img-box">
|
|
|
|
|
<BaseTable
|
|
|
|
|
tableName="TASK_IMAGE_FILE"
|
|
|
|
|
ref="baseTableRef"
|
|
|
|
|
:api="getSimulationTaskFilesApi"
|
|
|
|
|
:params="{
|
|
|
|
|
uuid: taskId,
|
|
|
|
|
fileBizType: FILE_TYPE.PNG_FILE,
|
|
|
|
|
fileName: '',
|
|
|
|
|
startTime: '',
|
|
|
|
|
endTime: '',
|
|
|
|
|
}"
|
|
|
|
|
:show-checkbox="true"
|
2026-01-15 17:04:38 +08:00
|
|
|
:actionList="actionList"
|
2026-01-10 14:00:47 +08:00
|
|
|
:full-height="true"
|
|
|
|
|
>
|
|
|
|
|
<template v-if="showLeftOptions" #leftOptions>
|
|
|
|
|
<!-- <el-form :model="filterForm" inline>
|
|
|
|
|
<el-form-item label="列数:">
|
|
|
|
|
<el-input-number
|
|
|
|
|
v-model="filterForm.lineNum"
|
|
|
|
|
:min="1"
|
|
|
|
|
:max="5"
|
|
|
|
|
@change="handleChangeLineFun"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item v-if="showLeftOptions">
|
|
|
|
|
<el-upload :show-file-list="false" :accept="accept" :before-upload="beforeUploadFun">
|
|
|
|
|
<el-button>上传文件</el-button>
|
|
|
|
|
</el-upload>
|
|
|
|
|
<el-button type="primary" class="ml12" @click="downLoadFun">下载文件</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form> -->
|
2026-01-14 17:19:33 +08:00
|
|
|
<el-upload
|
|
|
|
|
:show-file-list="false"
|
|
|
|
|
:accept="accept"
|
|
|
|
|
multiple
|
|
|
|
|
:before-upload="beforeUploadFun"
|
|
|
|
|
>
|
2026-01-05 19:55:41 +08:00
|
|
|
<el-button>上传文件</el-button>
|
|
|
|
|
</el-upload>
|
|
|
|
|
<el-button type="primary" class="ml12" @click="downLoadFun">下载文件</el-button>
|
2026-01-10 14:00:47 +08:00
|
|
|
</template>
|
|
|
|
|
<template #type="{ row }">
|
|
|
|
|
<span>{{ getfileType(row) }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
<template #fileSize="{ row }">
|
|
|
|
|
<span>{{ row.formatFileSize }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</BaseTable>
|
2025-10-30 19:30:06 +08:00
|
|
|
</div>
|
|
|
|
|
|
2026-01-10 14:00:47 +08:00
|
|
|
<FilePreview v-model="previewVisible" :fileId="currentRow?.id" />
|
2025-10-30 19:30:06 +08:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2026-01-10 14:00:47 +08:00
|
|
|
import { ref, onMounted, watch } from 'vue';
|
2026-01-14 17:19:33 +08:00
|
|
|
import { batchAddFileInfoApi, getSimulationTaskFilesApi } from '@/api/data/data';
|
2026-01-04 16:17:06 +08:00
|
|
|
import { queryTaskRunApi } from '@/api/project/run';
|
|
|
|
|
import { NODE_TYPE } from '@/utils/enum/node';
|
|
|
|
|
import { FILE_TYPE } from '@/utils/enum/file';
|
2026-01-05 19:55:41 +08:00
|
|
|
import { downloadFileById, getFileUploadAcceptFun, queryFileIdByNodeIdFun } from '@/utils/file';
|
2026-01-10 14:00:47 +08:00
|
|
|
import BaseTable from '@/components/common/table/baseTable.vue';
|
|
|
|
|
import FilePreview from '@/components/common/filePreview/index.vue';
|
2026-01-14 17:19:33 +08:00
|
|
|
import emitter from '@/utils/eventBus';
|
|
|
|
|
import { dataOverViewDeleteSimulationNodeFilesApi } from '@/api/data/dataOverView';
|
2025-10-30 19:30:06 +08:00
|
|
|
|
2026-01-05 20:46:26 +08:00
|
|
|
const props = defineProps({
|
|
|
|
|
taskId: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: '',
|
|
|
|
|
},
|
|
|
|
|
showLeftOptions: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: true,
|
|
|
|
|
},
|
|
|
|
|
});
|
2026-01-10 14:00:47 +08:00
|
|
|
const baseTableRef = ref();
|
2025-10-30 19:30:06 +08:00
|
|
|
|
2026-01-04 16:17:06 +08:00
|
|
|
const exampleList = ref<any>([]);
|
2026-01-05 19:55:41 +08:00
|
|
|
const nodeFIleId = ref<any>('');
|
|
|
|
|
const accept = ref<any>('');
|
2025-10-30 19:30:06 +08:00
|
|
|
|
2026-01-04 16:17:06 +08:00
|
|
|
const queryTaskRunFun = async (id: any) => {
|
|
|
|
|
const res: any = await queryTaskRunApi({ taskId: id });
|
|
|
|
|
if (res && res.code === 200) {
|
|
|
|
|
const list = res.data.map((item: any) => {
|
|
|
|
|
return {
|
|
|
|
|
...item,
|
|
|
|
|
name: item.runName,
|
|
|
|
|
type: NODE_TYPE.RUN,
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
return list;
|
|
|
|
|
} else {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2026-01-10 14:00:47 +08:00
|
|
|
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) => {
|
|
|
|
|
// const downloadUrl = `${env.VITE_API_FILE_URL}/data/downloadFile?fileId=${row.id}`;
|
|
|
|
|
// window.open(downloadUrl, '_blank');
|
|
|
|
|
downloadFileById(row.id);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '预览',
|
|
|
|
|
type: 'primary',
|
|
|
|
|
click: (row: any) => {
|
|
|
|
|
previewFileFun(row);
|
|
|
|
|
},
|
|
|
|
|
},
|
2026-01-14 17:19:33 +08:00
|
|
|
{
|
|
|
|
|
title: '删除',
|
|
|
|
|
type: 'danger',
|
|
|
|
|
needConfirm: true,
|
|
|
|
|
confirmTip: '删除后不可恢复,确认删除吗?',
|
|
|
|
|
click: (row: any) => {
|
|
|
|
|
deleteFun(row);
|
|
|
|
|
},
|
2026-01-15 17:04:38 +08:00
|
|
|
hide: () => {
|
|
|
|
|
return !props.showLeftOptions;
|
|
|
|
|
},
|
2026-01-14 17:19:33 +08:00
|
|
|
},
|
2026-01-10 14:00:47 +08:00
|
|
|
]);
|
|
|
|
|
|
2026-01-14 17:19:33 +08:00
|
|
|
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 (error) {
|
|
|
|
|
console.log(error);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2026-01-10 14:00:47 +08:00
|
|
|
const getfileType = (data: any) => {
|
|
|
|
|
const fileType = data.originalName.split('.').pop();
|
|
|
|
|
return fileType;
|
|
|
|
|
};
|
2026-01-04 16:17:06 +08:00
|
|
|
watch(
|
|
|
|
|
() => props.taskId,
|
|
|
|
|
async (newVal) => {
|
|
|
|
|
const task = [
|
|
|
|
|
{
|
|
|
|
|
name: '当前任务',
|
|
|
|
|
id: newVal,
|
|
|
|
|
uuid: newVal,
|
|
|
|
|
type: NODE_TYPE.TASK,
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const runList = await queryTaskRunFun(newVal);
|
|
|
|
|
exampleList.value = task.concat(runList);
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
immediate: true,
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
2026-01-05 19:55:41 +08:00
|
|
|
const beforeUploadFun = (file: any) => {
|
2026-01-14 17:19:33 +08:00
|
|
|
const { name, size } = file;
|
|
|
|
|
|
|
|
|
|
const sourceFiles = [
|
|
|
|
|
{
|
|
|
|
|
fileName: name,
|
|
|
|
|
size: size,
|
|
|
|
|
raw: file,
|
|
|
|
|
fileType: FILE_TYPE.PNG_FILE,
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
2026-01-05 19:55:41 +08:00
|
|
|
const params = {
|
2026-01-14 17:19:33 +08:00
|
|
|
sourceFiles,
|
|
|
|
|
uploadTaskId: new Date().getTime(),
|
2026-01-05 19:55:41 +08:00
|
|
|
dirId: nodeFIleId.value,
|
2026-01-14 17:19:33 +08:00
|
|
|
projectId: null,
|
|
|
|
|
type: 0,
|
2026-01-05 19:55:41 +08:00
|
|
|
};
|
2026-01-14 17:19:33 +08:00
|
|
|
|
|
|
|
|
batchAddFileInfoApi(params).then((res: any) => {
|
2026-01-05 19:55:41 +08:00
|
|
|
if (res.code === 200) {
|
2026-01-10 14:00:47 +08:00
|
|
|
baseTableRef.value.resetFun();
|
2026-01-14 17:19:33 +08:00
|
|
|
|
|
|
|
|
res.data.forEach((item: any) => {
|
|
|
|
|
emitter.emit('ADD_UPLOAD_FILE', {
|
|
|
|
|
file: file,
|
|
|
|
|
data: {
|
|
|
|
|
...item,
|
|
|
|
|
isApprove: 0,
|
|
|
|
|
taskType: 1,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
});
|
2026-01-05 19:55:41 +08:00
|
|
|
}
|
|
|
|
|
});
|
2026-01-14 17:19:33 +08:00
|
|
|
|
2026-01-05 19:55:41 +08:00
|
|
|
return false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const downLoadFun = async () => {
|
2026-01-10 14:00:47 +08:00
|
|
|
const data: any = baseTableRef.value.tableRef.getCheckboxRecords() || [];
|
|
|
|
|
if (data.length) {
|
|
|
|
|
for (let i = 0; i < data.length; i++) {
|
|
|
|
|
downloadFileById(data[i].id);
|
2026-01-05 19:55:41 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
accept.value = await getFileUploadAcceptFun('PNG_FILE_FORMAT');
|
|
|
|
|
nodeFIleId.value = await queryFileIdByNodeIdFun(props.taskId);
|
2025-10-30 19:30:06 +08:00
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.task-performance-page {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
// height: 450px;
|
|
|
|
|
|
|
|
|
|
.task-img-box {
|
|
|
|
|
width: 100%;
|
2026-01-10 14:00:47 +08:00
|
|
|
height: 100%;
|
2025-10-30 19:30:06 +08:00
|
|
|
|
|
|
|
|
.img-item {
|
|
|
|
|
margin-right: 10px;
|
|
|
|
|
margin-bottom: 10px;
|
2025-12-02 19:31:45 +08:00
|
|
|
min-height: 100px;
|
2025-10-30 19:30:06 +08:00
|
|
|
|
|
|
|
|
.task-img {
|
|
|
|
|
width: 100%;
|
|
|
|
|
border: 1px solid #ddd;
|
2026-01-05 19:55:41 +08:00
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.check {
|
|
|
|
|
border: 1px solid var(--el-color-primary);
|
2025-10-30 19:30:06 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-01-05 19:55:41 +08:00
|
|
|
|
|
|
|
|
.ml12 {
|
|
|
|
|
margin-left: 12px;
|
|
|
|
|
}
|
2025-10-30 19:30:06 +08:00
|
|
|
</style>
|