update:拖拽优化

This commit is contained in:
2025-11-25 20:04:31 +08:00
15 changed files with 259 additions and 58 deletions

View File

@@ -82,4 +82,33 @@ export const getTaskRunVersionApi = (params: any) => {
*/
export const getRunVersionApi = (params: any) => {
return post(`${PREFIX}run/getRunVersion`, params);
};
};
/**
*算例录入关键结果
* @param params
* @returns
*/
export const addSimulationKeyResultApi = (params: any) => {
return upload(`${PREFIX}run/addSimulationKeyResult`, params);
};
/**
* 查询算例关键结果列表
* @param params runId keyResultType size current
* @returns
*/
export const listSimulationKeyResult = (params: any) => {
return post(`${PREFIX}run/listSimulationKeyResult`, params);
};
/**
*删除算例关键结果列表
* @param params
* @returns
*/
export const deleteSimulationKeyResultApi = (params: any) => {
return post(`${PREFIX}run/deleteSimulationKeyResult`, params);
};

View File

@@ -54,3 +54,8 @@ export const batchAddTaskPerformanceApi = (params: any) => {
export const batchDeleteTaskPerformanceApi = (params: any) => {
return post(`${PREFIX}taskPerformance/batchDeleteTaskPerformance`, params);
};
export const getRunPerformanceApi = (params: any) => {
return get(`${PREFIX}taskPerformance/getRunPerformance`, params);
};

View File

@@ -60,7 +60,7 @@ const getTaskResultImageDataFn = async () => {
const res: any = await getSimulationTaskFilesApi({
taskId: props.taskId,
fileType: 1,
fileBizType: 1,
fileName: '',
startTime: '',
endTime: '',
@@ -69,7 +69,7 @@ const getTaskResultImageDataFn = async () => {
});
if (res && res.code === 200) {
exampleImglist.value = res.data.data.map((item: any) => {
exampleImglist.value = res.data?.data?.map((item: any) => {
return {
...item,
url: `${env.VITE_API_IMAGE_PREVIEW_URL}/data/previewImage?fileId=${item.id}`,

View File

@@ -121,7 +121,7 @@ const getCheckedNodesCurveFn = async () => {
const res: any = await getSimulationTaskFilesApi({
taskId: props.taskId,
fileType: 5,
fileBizType: 5,
fileName: '',
startTime: '',
endTime: '',

View File

@@ -7,7 +7,7 @@
showCheckbox
:params="{
taskId: taskId,
fileType: 3,
fileBizType: 3,
fileName: '',
startTime: '',
endTime: ''

View File

@@ -8,7 +8,7 @@
showCheckbox
:params="{
taskId: taskId,
fileType: 1,
fileBizType: 1,
fileName: '',
startTime: '',
endTime: ''

View File

@@ -1,6 +1,6 @@
<template>
<div class="task-performance-page">
<BaseTable tableName="TASK_PERFORMANCE" ref="baseTableRef" showCheckbox hidePagination>
<BaseTable tableName="TASK_PERFORMANCE" ref="baseTableRef" showCheckbox hidePagination :actionList="actionList">
<template #leftOptions>
<div class="operate-box">
<el-upload
@@ -16,6 +16,7 @@
</el-upload>
<el-button icon="" @click="exportFileFn">导出Excel</el-button>
<el-button type="primary" @click="openAddPerformanceWindFn">新增</el-button>
<el-button v-if="showSaveButton" type="primary" @click="saveFn">保存</el-button>
</div>
</template>
@@ -42,15 +43,32 @@
import { ref, onMounted } from 'vue';
import BaseTable from '@/components/common/table/baseTable.vue';
import { ElMessage } from 'element-plus';
import { getTaskPerformanceApi, batchAddTaskPerformanceApi, batchDeleteTaskPerformanceApi } from '@/api/task/taskpool';
import { getTaskPerformanceApi, batchAddTaskPerformanceApi, batchDeleteTaskPerformanceApi, getRunPerformanceApi } from '@/api/task/taskpool';
import { cloneDeep } from 'lodash-es';
import { FileUtil } from '@/utils/file';
import addTaskPerformance from './addTaskPerformance.vue';
const props = defineProps({
taskId: {
type: Number,
default: 100,
},
runInfo: {
type: Object,
default: () => {},
},
taskInfo: {
type: Object,
default: () => {},
},
showSaveButton: {
type: Boolean,
default: false,
},
paramType: {
type: String,
default: 'task',
},
});
const baseTableRef = ref();
const performanceVisible = ref(false);
@@ -58,7 +76,8 @@ const performanceVisible = ref(false);
const performanceData = ref<any>([]);
const getTaskPerformanceDataFn = async () => {
console.log(props.taskId);
const res: any = await getTaskPerformanceApi({ taskId: props.taskId });
console.log(props.runInfo);
const res: any = props.paramType === 'task' ? await getTaskPerformanceApi({ taskId: props.taskInfo?.id }) : await getRunPerformanceApi({ runId: props.runInfo?.uuid }) ;
if (res && res.code === 200) {
performanceData.value = res.data;
@@ -83,7 +102,7 @@ const addPerformanceFn = async (data: any) => {
const { fullData, visibleData, tableData, footerData } = baseTableRef.value.tableRef.getTableData();
const existPerformance = fullData.find((item: any) => {
return item.performanceName === data.performanceName;
return item.nodeName === data.nodeName;
}) || null;
if (existPerformance) {
@@ -116,13 +135,13 @@ const batchAddTaskPerformanceFn = async () => {
const list = baseTableRef.value.tableRef.getInsertRecords();
console.log(list, 'list');
console.log(props.paramType, 'paramType');
const performanceList: any = [];
for (let i = 0; i < list.length; i++) {
const obj = {
const obj :any = {
uuid: '',
taskId: props.taskId,
nodeId: '',
performanceName: list[i].performanceName,
nodeName: list[i].nodeName,
@@ -143,15 +162,38 @@ const batchAddTaskPerformanceFn = async () => {
pid: 0,
};
if (props.paramType === 'task') {
obj.taskId = props.taskInfo?.uuid;
}
if (props.paramType === 'run') {
obj.runId = props.runInfo.uuid;
obj.taskId = props.runInfo.taskId;
}
console.log(obj, 'objobjobj');
performanceList.push(obj);
}
if (!list.length) {
return;
}
const res: any = await batchAddTaskPerformanceApi({
taskId: props.taskId,
const param:any = {
performanceList: performanceList,
});
};
if (props.paramType === 'task') {
param.taskId = props.taskInfo?.uuid;
}
if (props.paramType === 'run') {
param.taskId = props.runInfo.taskId;
param.runId = props.runInfo.uuid;
}
const res: any = await batchAddTaskPerformanceApi(param);
if (res && res.code === 200) {
// ElMessage.success('新增成功!');
} else {
@@ -396,6 +438,18 @@ defineExpose({
saveFn,
});
const actionList = ref([
{
title: '删除',
type: 'danger',
needConfirm: true,
confirmTip: '确认删除吗?',
click: (row:any) => {
delPerformance(row);
},
},
]);
onMounted(async () => {
// props.taskId = props.taskId;

View File

@@ -5,7 +5,7 @@
:api="getSimulationTaskFilesApi"
:params="{
taskId: currentId,
fileType: 2,
fileBizType: 2,
fileName: '',
startTime: '',
endTime: ''

View File

@@ -358,7 +358,7 @@ const getFileInfo = async (data: any, fileType: any) => {
const res: any = await getSimulationTaskFileApi({
taskId: '',
runId: data.uuid,
fileType: fileType,
fileBizType: fileType,
fileName: '',
startTime: '',
endTime: '',

View File

@@ -80,7 +80,7 @@
ref="tableRef"
:searchItems="searchItems"
:searchParams="{model:'模型文件'}"
:params="{ fileType:1}"
:params="{ fileBizType:1}"
:api="getSimulationTaskFileApi"
:searchLimitNum="3"
tableName="RESULT_MODEL"
@@ -110,7 +110,7 @@
ref="tableRef"
:searchItems="searchItems"
:searchParams="{model:'仿真报告'}"
:params="{ fileType:2}"
:params="{ fileBizType:2}"
:api="getSimulationTaskFileApi"
:searchLimitNum="3"
tableName="RESULT_REPORT"
@@ -140,7 +140,7 @@
ref="tableRef"
:searchItems="searchItems"
:searchParams="{model:'计算文件'}"
:params="{ fileType:3}"
:params="{ fileBizType:3}"
:api="getSimulationTaskFileApi"
:searchLimitNum="3"
tableName="RESULT_FILE"
@@ -169,7 +169,7 @@
ref="tableRef"
:searchItems="searchItems"
:searchParams="{model:'结果曲线'}"
:params="{ fileType:4}"
:params="{ fileBizType:4}"
:api="getSimulationTaskFileApi"
:searchLimitNum="3"
tableName="RESULT_CURVE"
@@ -199,7 +199,7 @@
ref="tableRef"
:searchItems="searchItems"
:searchParams="{model:'结果云图'}"
:params="{ fileType:5}"
:params="{ fileBizType:5}"
:api="getSimulationTaskFileApi"
:searchLimitNum="3"
tableName="RESULT_PNG"
@@ -440,7 +440,7 @@ const searchItems = [
title: '阶段', key: 'phase', type: 'select', inputMode: 'select', clearable: true, options: [],
},
{
title: '学科', key: 'taskId', type: 'select', inputMode: 'select', clearable: true, options: [],
title: '学科', key: 'discipline', type: 'select', inputMode: 'select', clearable: true, options: [],
},
{ title: '名称', key: 'name', clearable: true, type: 'input', inputMode: 'input' },
{ title: '时间范围', key: 'dateRange', clearable: true, inputMode: 'daterange' },
@@ -467,7 +467,7 @@ const getPhaseOptionsFun = () => {
getChildrenNodeListApi({ current: 1, size: 999, nodeType: NODE_TYPE.PHASE, nodeId: projectId }).then((res: any) => {
console.log(res);
if (res.code === 200) {
phaseOptions.value = res.data?.data?.map((item: any) => {
phaseOptions.value = res.data?.map((item: any) => {
return {
label: item.nodeName,
value: item.id,

View File

@@ -14,7 +14,7 @@
</el-form-item>
<el-form-item label="项目:">
<el-select v-model="filterFormData.projectName" filterable @change="projectInfoChangeFn('projectName')">
<el-option v-for="item in projectList" :key="item.id" :label="item.nodeName" :value="item.uuid"></el-option>
<el-option v-for="item in projectList" :key="item.id" :label="item.nodeName" :value="item.id"></el-option>
</el-select>
</el-form-item>
@@ -159,7 +159,7 @@ const getProjectListFn = async (val?: any) => {
if (val) {
filterFormData.projectName = val;
} else {
filterFormData.projectName = projectList.value[0].uuid;
filterFormData.projectName = projectList.value[0].id;
}
}
} else {

View File

@@ -312,9 +312,13 @@ const getTaskRunTreeDataFn = async (data: any) => {
* 点击选中的节点数据
*/
const currentNodeInfo = ref<any>(null);
const nodeChangeClickFn = (data: any) => {
const nodeChangeClickFn = (data: any, node:any) => {
clearTreeMenuFn();
currentNodeInfo.value = data;
if (node.data.nodeType === NODE_TYPE.RUN) {
currentNodeInfo.value.runTaskId = node.parent.data.id;
}
defaultExpandKeys.value = [data.id];
localStorage.setItem('CURRENT_TASK_RUN_INFO', JSON.stringify(data));
emits('nodeClickFn', { node: currentNodeInfo.value });

View File

@@ -106,7 +106,7 @@
<div class="tabs-info-content">
<resultData v-if="taskActiveName === 'result'" :current-run-ifno="runInfo"></resultData>
<jobList v-if="taskActiveName === 'job-list'"></jobList>
<taskPerformance v-if="taskActiveName === 'performance'" :task-id="runInfo.id"></taskPerformance>
<taskPerformance v-if="taskActiveName === 'performance'" :param-type="'run'" :run-info="runInfo" :show-save-button="true"></taskPerformance>
<runLogs v-if="taskActiveName === 'job-log'"></runLogs>
<ModelReview v-if="taskActiveName === '3D-model'"></ModelReview>
<runVersionTree v-if="taskActiveName === 'associated-run'" :current-task-info="runInfo"></runVersionTree>
@@ -300,6 +300,7 @@ watch(() => props.runInfo, (newVal) => {
width: 100%;
height: calc(100% - 40px);
padding: 10px;
overflow: auto;
}
}

View File

@@ -3,7 +3,7 @@
<template>
<div class="result-page">
<div class="tab-title-box">
<el-radio-group v-model="currentDirName" >
<el-radio-group v-model="currentDirName" @change="runResultDirChangeFn">
<el-radio v-for="item in runDirNameList" :key="item.id" :value="item.id">{{ item.name }}</el-radio>
</el-radio-group>
</div>
@@ -11,28 +11,43 @@
<BaseTable
showIndex
ref="baseTableRef"
tableName="RUN_RESULT_FILE_TABLE"
:tableName="tableName"
:api="queryDirDataFn"
:params="{
fileId: currentDirName,
keyResultType,
runId:runInfo.uuid
}"
:action-list="actionList"
>
<template #leftOptions>
<el-upload :show-file-list="false" :before-upload="beforeUploadFun">
<el-button @click="openFn">上传文件</el-button>
<!-- <el-upload :show-file-list="false" :before-upload="beforeUploadFun">
<el-button>上传文件</el-button>
</el-upload>
</el-upload> -->
</template>
</BaseTable>
</div>
</div>
<el-drawer v-model="visible" :title="`文件上传`" :size="500" :close-on-click-modal="false" @close="closeFun">
<TableForm ref="tableFormRef" :tableName="tableName" />
<template #footer>
<div>
<el-button @click="closeFun">关闭</el-button>
<el-button type="primary" @click="submitFun">确定</el-button>
</div>
</template>
</el-drawer>
</template>
<script setup lang="ts">
import { queryRunDirApi, uploadRunFilesApi } from '@/api/project/run';
import { queryRunDirApi, listSimulationKeyResult, addSimulationKeyResultApi, deleteSimulationKeyResultApi } from '@/api/project/run';
import { ref, defineProps, watch, nextTick, onMounted } from 'vue';
import BaseTable from '@/components/common/table/baseTable.vue';
import { ElMessage } from 'element-plus';
import { UPLOAD_RUN_FILE_TYPE } from '@/utils/enum/file';
import TableForm from '@/components/common/table/tableForm.vue';
const env = import.meta.env;
const props = defineProps({
currentRunIfno: {
@@ -44,7 +59,8 @@ const props = defineProps({
});
const baseTableRef = ref();
const tableFormRef = ref();
const visible = ref(false);
const runInfo = ref<any>({});
const currentDirName = ref<any>();
@@ -61,7 +77,9 @@ const getRunInfoDirsFn = async () => {
});
if (res && res.code === 200) {
runDirs.value = res.data?.data || [];
runDirs.value = res.data?.data.filter((item:any) => {
return item.dataType === 1;
}) || [];
runDirNameList.value = runDirs.value.map((item: any) => {
return { name: item.originalName, id: item.id };
}) || [];
@@ -77,7 +95,7 @@ const getRunInfoDirsFn = async () => {
};
const queryDirDataFn = async (param: any) => {
const res: any = await queryRunDirApi({
const res: any = await listSimulationKeyResult({
...param,
});
if (res && res.code === 200) {
@@ -86,31 +104,35 @@ const queryDirDataFn = async (param: any) => {
}
};
const beforeUploadFun = (file: any) => {
if (!currentDirName.value) {
ElMessage.warning('请选择一个目录');
return;
}
const { name } = file;
const params = {
fileName: name,
dirId: currentDirName.value,
file: file,
fileType: getFileType(),
};
uploadRunFilesApi(params).then((res: any) => {
if (res.code === 200) {
ElMessage.success('上传成功');
reloadFun();
}
});
return false;
};
const keyResultType = ref('1');
const reloadFun = () => {
if (baseTableRef.value) {
baseTableRef.value.resetFun();
}
};
const tableName = ref('RUN_RESULT_IMAGE_TABLE');
const runResultDirChangeFn = () => {
const name = runDirNameList.value.find((item:any) => {
return item.id === currentDirName.value;
})?.name;
if (name === '图片结果') {
tableName.value = 'RUN_RESULT_IMAGE_TABLE';
keyResultType.value = '1';
}
if (name === '曲线结果') {
tableName.value = 'RUN_RESULT_CANVAS_TABLE';
keyResultType.value = '2';
}
if (name === '报告结果') {
tableName.value = 'RUN_RESULT_REPORT_TABLE';
keyResultType.value = '3';
}
};
watch(() => props.currentRunIfno, async (newVal) => {
@@ -150,6 +172,92 @@ const getFileType = () => {
};
const closeFun = () => {
visible.value = false;
};
const openFn = () => {
visible.value = true;
nextTick(() => {
tableFormRef.value.resetFun();
});
};
const submitFun = async () => {
const valid = await tableFormRef.value.validateFun();
if (valid) {
const fromData = tableFormRef.value.getFormDataFun();
const file = fromData.uploadFile[0].raw;
const name = file.name;
const paramData:any = {};
for (const key in fromData) {
if (key != 'extras' && key != 'uploadFile') {
paramData[key] = fromData[key];
}
}
const params = {
fileName: name,
name: name,
dirId: currentDirName.value,
file: file,
fileType: getFileType(),
keyResultType: keyResultType.value,
runId: runInfo.value.uuid,
...paramData,
};
await addSimulationKeyResultApi(params).then((res: any) => {
if (res.code === 200) {
ElMessage.success('上传成功');
reloadFun();
}
});
visible.value = false;
console.log(fromData, 'fromData');
}
};
const deleteFile = async (data:any) => {
const res:any = await deleteSimulationKeyResultApi({
uuid: data.uuid,
fileId: data.fileId,
});
if (res && res.code === 200) {
ElMessage.success('删除成功');
} else {
ElMessage.error('删除失败');
}
};
const actionList = ref([
{
title: '下载',
type: 'primary',
click: (row:any) => {
const downloadUrl = `${env.VITE_API_FILE_URL}/data/downloadFile?fileId=${row.fileId}`;
window.open(downloadUrl, '_blank');
},
},
{
title: '删除',
type: 'danger',
needConfirm: true,
confirmTip: '确认删除吗?',
click: (row:any) => {
deleteFile(row);
},
},
]);
onMounted(() => {
});

View File

@@ -14,7 +14,7 @@
<div class="task-content">
<div class="tabs-component" v-if="activeName === 'performance'">
<taskPerformance :task-id="currentTaskInfo?.id"></taskPerformance>
<taskPerformance :task-id="currentTaskInfo?.id" :show-save-button="true" :task-info="currentTaskInfo" ></taskPerformance>
</div>
<div class="tabs-component" v-if="activeName === 'picture'">
<resultImage :task-id="currentTaskInfo?.id"></resultImage>