2025-11-21 15:19:37 +08:00
|
|
|
<!-- 节点输入文件 -->
|
|
|
|
|
<!-- 节点输出文件 -->
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<div class="node-file-page">
|
2026-02-02 10:30:24 +08:00
|
|
|
<div class="table-box">
|
|
|
|
|
<BaseTable
|
|
|
|
|
showIndex
|
|
|
|
|
ref="baseTableRef"
|
|
|
|
|
tableName="RUN_RESULT_FILE_TABLE"
|
|
|
|
|
:api="queryRunDirFun"
|
|
|
|
|
:params="{
|
|
|
|
|
fileId: fileId,
|
|
|
|
|
// uuid:nodeInfo.uuid
|
|
|
|
|
}"
|
2026-02-02 10:53:13 +08:00
|
|
|
:row-config="{
|
|
|
|
|
height: '34',
|
|
|
|
|
}"
|
2026-02-02 10:30:24 +08:00
|
|
|
:show-checkbox="true"
|
|
|
|
|
:action-list="actionList"
|
|
|
|
|
:full-height="true"
|
|
|
|
|
:show-setting="false"
|
|
|
|
|
>
|
2026-03-05 11:43:36 +08:00
|
|
|
<template #leftOptions v-if="!readonly">
|
2026-02-26 11:50:25 +08:00
|
|
|
<el-button type="" @click="asyncFileFun">归档</el-button>
|
2026-03-10 16:21:48 +08:00
|
|
|
|
|
|
|
|
<el-button class="ml10" type="primary" @click="openUploadFileFun">上传</el-button>
|
|
|
|
|
|
|
|
|
|
<!-- <el-upload v-if="false" :show-file-list="false" :before-upload="beforeUploadFun">
|
2026-02-26 11:50:25 +08:00
|
|
|
<el-button class="ml10" type="primary">上传</el-button>
|
2026-03-10 16:21:48 +08:00
|
|
|
</el-upload> -->
|
|
|
|
|
|
2026-02-04 17:10:17 +08:00
|
|
|
<el-button type="primary" class="ml10" @click="downLoadFileFun">下载</el-button>
|
|
|
|
|
<el-button type="danger" @click="deleteFileFun">删除</el-button>
|
2026-02-02 10:30:24 +08:00
|
|
|
</template>
|
2026-03-05 11:43:36 +08:00
|
|
|
<template #leftOptions v-else>
|
|
|
|
|
<el-button type="primary" @click="downLoadFileFun">下载</el-button>
|
|
|
|
|
</template>
|
2026-02-02 10:30:24 +08:00
|
|
|
<template #fileSize="{ row }">
|
|
|
|
|
<span>{{ formatFileSize(row.fileSize) }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</BaseTable>
|
|
|
|
|
</div>
|
2026-02-04 17:10:17 +08:00
|
|
|
<!-- <div class="operate-box">
|
|
|
|
|
<el-upload :show-file-list="false" multiple :before-upload="beforeUploadFun">
|
2026-02-02 10:30:24 +08:00
|
|
|
<el-button>上传</el-button>
|
|
|
|
|
</el-upload>
|
|
|
|
|
<el-button type="primary" class="ml10" @click="downLoadFileFun">下载</el-button>
|
|
|
|
|
<el-button type="danger" @click="deleteFileFun">删除</el-button>
|
2026-02-04 17:10:17 +08:00
|
|
|
</div> -->
|
2026-02-02 10:30:24 +08:00
|
|
|
|
2025-12-16 11:19:40 +08:00
|
|
|
<FilePreview v-model="previewVisible" :fileId="currentRow?.id" />
|
2026-02-26 11:50:25 +08:00
|
|
|
<Dialog
|
|
|
|
|
v-model="showSyncFileTypeSelectFlag"
|
|
|
|
|
diaTitle="文件归档"
|
|
|
|
|
:width="'20%'"
|
|
|
|
|
:height="'30%'"
|
|
|
|
|
:confirm-closable="false"
|
|
|
|
|
>
|
|
|
|
|
<div class="form-content">
|
|
|
|
|
<el-form :model="formData">
|
|
|
|
|
<el-form-item label="文件类型">
|
|
|
|
|
<el-select v-model="formData.fileType">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in fileTypeList"
|
|
|
|
|
:key="item.value"
|
|
|
|
|
:label="item.label"
|
|
|
|
|
:value="item.value"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
</div>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<el-button @click="cancalFun">取消</el-button>
|
|
|
|
|
<el-button @click="submitFun" type="primary">确定</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</Dialog>
|
2026-03-10 16:21:48 +08:00
|
|
|
|
|
|
|
|
<Dialog
|
|
|
|
|
v-model="showUploadFileVisible"
|
|
|
|
|
diaTitle="文件上传"
|
|
|
|
|
:width="'25%'"
|
|
|
|
|
:height="'40%'"
|
|
|
|
|
:confirm-closable="false"
|
|
|
|
|
>
|
|
|
|
|
<div class="form-content">
|
|
|
|
|
<el-form :model="formData">
|
|
|
|
|
<TableForm
|
|
|
|
|
ref="tableFormRef"
|
|
|
|
|
:tableName="'TASK_DETAIL_UPLOAD_FILE'"
|
|
|
|
|
:itemNum="3"
|
|
|
|
|
v-model:data="formData"
|
|
|
|
|
/>
|
|
|
|
|
</el-form>
|
|
|
|
|
</div>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<el-button @click="cancalFun">取消</el-button>
|
|
|
|
|
<el-button @click="submitFun2" type="primary">确定</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</Dialog>
|
2025-11-21 15:19:37 +08:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2026-03-10 16:21:48 +08:00
|
|
|
import { nextTick, reactive, ref, watch } from 'vue';
|
2025-11-21 15:19:37 +08:00
|
|
|
import BaseTable from '@/components/common/table/baseTable.vue';
|
2026-02-26 11:50:25 +08:00
|
|
|
import { queryRunDirApi, syncKeyResultToTaskApi, uploadRunFilesApi } from '@/api/project/run';
|
2026-01-21 10:59:18 +08:00
|
|
|
import { downloadFileById, downloadFileByStream, fileUploadAllocationTypeFun } from '@/utils/file';
|
2025-12-16 11:19:40 +08:00
|
|
|
import FilePreview from '@/components/common/filePreview/index.vue';
|
|
|
|
|
import { formatFileSize } from '@/utils/file';
|
2025-12-22 11:08:13 +08:00
|
|
|
import emitter from '@/utils/eventBus';
|
2025-12-29 14:13:59 +08:00
|
|
|
import { dataDelFileApi } from '@/api/data/data';
|
|
|
|
|
import { ElMessage } from 'element-plus';
|
2026-02-26 11:50:25 +08:00
|
|
|
import Dialog from '@/components/common/dialog/index.vue';
|
|
|
|
|
import { useDict } from '@/utils/useDict';
|
2026-03-10 16:21:48 +08:00
|
|
|
import { FILE_TYPE } from '@/utils/enum/file';
|
|
|
|
|
import TableForm from '@/components/common/table/tableForm.vue';
|
2025-12-01 19:13:11 +08:00
|
|
|
|
2025-11-21 15:19:37 +08:00
|
|
|
const props = defineProps({
|
2025-12-01 19:13:11 +08:00
|
|
|
nodeInfo: {
|
2025-11-21 15:19:37 +08:00
|
|
|
type: Object,
|
|
|
|
|
default: () => {},
|
|
|
|
|
},
|
2026-03-10 16:30:52 +08:00
|
|
|
runInfo: {
|
|
|
|
|
type: Object,
|
|
|
|
|
default: () => {},
|
|
|
|
|
},
|
2025-12-01 19:13:11 +08:00
|
|
|
fileId: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: '',
|
|
|
|
|
},
|
2026-03-05 11:43:36 +08:00
|
|
|
readonly: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
2025-11-21 15:19:37 +08:00
|
|
|
});
|
|
|
|
|
const baseTableRef = ref();
|
2026-03-10 16:21:48 +08:00
|
|
|
const tableFormRef = ref();
|
2026-02-26 11:50:25 +08:00
|
|
|
const showSyncFileTypeSelectFlag = ref(false);
|
2026-03-10 16:21:48 +08:00
|
|
|
const showUploadFileVisible = ref(false);
|
2026-02-26 11:50:25 +08:00
|
|
|
const formData = reactive<any>({
|
|
|
|
|
fileType: '',
|
2026-03-10 16:21:48 +08:00
|
|
|
fileTypeDictValue: [FILE_TYPE.CALCULATION_FILE],
|
|
|
|
|
files: [],
|
|
|
|
|
disciplineDictValue: '',
|
2026-02-26 11:50:25 +08:00
|
|
|
});
|
|
|
|
|
const { ALL_FILE_TYPE }: any = useDict('ALL_FILE_TYPE');
|
|
|
|
|
const fileTypeList = ref<any>(ALL_FILE_TYPE.value['A']);
|
2025-12-09 09:47:27 +08:00
|
|
|
const beforeUploadFun = async (file: any) => {
|
2025-12-01 19:13:11 +08:00
|
|
|
if (!props.fileId) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2025-11-21 15:19:37 +08:00
|
|
|
|
2025-12-22 11:08:13 +08:00
|
|
|
const list = [file];
|
|
|
|
|
|
|
|
|
|
const sourceFiles = [
|
|
|
|
|
{
|
|
|
|
|
fileName: file.name,
|
|
|
|
|
size: file.size,
|
2026-01-21 20:54:10 +08:00
|
|
|
fileType: fileUploadAllocationTypeFun(file.name),
|
2025-12-22 11:08:13 +08:00
|
|
|
},
|
|
|
|
|
];
|
2025-12-01 19:13:11 +08:00
|
|
|
|
|
|
|
|
const param = {
|
2025-12-22 11:08:13 +08:00
|
|
|
sourceFiles,
|
|
|
|
|
uploadTaskId: new Date().getTime(),
|
2025-12-01 19:13:11 +08:00
|
|
|
dirId: props.fileId,
|
|
|
|
|
};
|
|
|
|
|
|
2025-12-22 11:08:13 +08:00
|
|
|
const res: any = await uploadRunFilesApi(param);
|
|
|
|
|
if (res && res.code === 200) {
|
|
|
|
|
res.data.forEach((item: any, index: any) => {
|
2026-01-23 16:21:31 +08:00
|
|
|
item.isSaveLocal = 'Y';
|
2025-12-22 11:08:13 +08:00
|
|
|
emitter.emit('ADD_UPLOAD_FILE', {
|
|
|
|
|
file: list[index],
|
|
|
|
|
data: {
|
|
|
|
|
// 接口返回的文件目录信息,包括配置信息
|
|
|
|
|
...item,
|
|
|
|
|
isApprove: 0, // 0否 1是
|
|
|
|
|
taskType: 4, // 4交付物
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
reloadFun();
|
|
|
|
|
}
|
2025-12-01 19:13:11 +08:00
|
|
|
};
|
|
|
|
|
|
2025-12-09 09:47:27 +08:00
|
|
|
const queryRunDirFun = async (param: any) => {
|
2025-12-01 19:13:11 +08:00
|
|
|
if (param.fileId) {
|
2025-12-09 09:47:27 +08:00
|
|
|
const res: any = await queryRunDirApi(param);
|
2025-12-01 19:13:11 +08:00
|
|
|
return res;
|
2026-01-14 13:50:50 +08:00
|
|
|
} else {
|
|
|
|
|
return {};
|
2025-12-01 19:13:11 +08:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const downLoadFileFun = async () => {
|
2026-02-02 10:30:24 +08:00
|
|
|
const checkData: any = baseTableRef.value.tableRef.getCheckboxRecords();
|
|
|
|
|
|
|
|
|
|
if (checkData?.length) {
|
|
|
|
|
for (let i = 0; i < checkData.length; i++) {
|
|
|
|
|
downloadFileByStream(checkData[i].id);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ElMessage.warning('请选择文件后再下载');
|
2025-12-01 19:13:11 +08:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const reloadFun = async () => {
|
|
|
|
|
if (baseTableRef.value) {
|
|
|
|
|
await baseTableRef.value.resetFun();
|
|
|
|
|
}
|
2025-11-21 15:19:37 +08:00
|
|
|
};
|
|
|
|
|
|
2025-12-16 11:19:40 +08:00
|
|
|
const currentRow = ref();
|
|
|
|
|
const previewVisible = ref(false);
|
|
|
|
|
const previewFileFun = (row: any) => {
|
|
|
|
|
currentRow.value = row;
|
|
|
|
|
previewVisible.value = true;
|
|
|
|
|
};
|
|
|
|
|
|
2026-02-02 10:30:24 +08:00
|
|
|
const deleteFileFun = async () => {
|
|
|
|
|
const checkData: any = baseTableRef.value.tableRef.getCheckboxRecords();
|
|
|
|
|
|
|
|
|
|
if (checkData?.length) {
|
|
|
|
|
for (let i = 0; i < checkData.length; i++) {
|
|
|
|
|
await dataDelFileApi({ delFileId: checkData[i].id });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
reloadFun();
|
|
|
|
|
} else {
|
|
|
|
|
ElMessage.warning('请选择文件后再删除');
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-12-16 11:19:40 +08:00
|
|
|
const actionList = ref([
|
|
|
|
|
{
|
|
|
|
|
title: '下载',
|
|
|
|
|
type: 'primary',
|
|
|
|
|
click: (row: any) => {
|
|
|
|
|
downloadFileById(row.id);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '预览',
|
|
|
|
|
type: 'primary',
|
|
|
|
|
click: (row: any) => {
|
2026-01-20 13:16:50 +08:00
|
|
|
previewFileFun(row);
|
2025-12-16 11:19:40 +08:00
|
|
|
},
|
|
|
|
|
},
|
2025-12-29 14:13:59 +08:00
|
|
|
{
|
|
|
|
|
title: '删除',
|
|
|
|
|
type: 'danger',
|
2026-03-05 11:43:36 +08:00
|
|
|
hide: () => {
|
|
|
|
|
return props.readonly;
|
|
|
|
|
},
|
2025-12-29 14:13:59 +08:00
|
|
|
click: async (row: any) => {
|
|
|
|
|
const res: any = await dataDelFileApi({ delFileId: row.id });
|
|
|
|
|
if (res && res.code === 200) {
|
|
|
|
|
ElMessage.success('删除成功');
|
|
|
|
|
reloadFun();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
2025-12-16 11:19:40 +08:00
|
|
|
]);
|
|
|
|
|
|
2026-02-26 11:50:25 +08:00
|
|
|
// 归档算例下文件到工况下
|
|
|
|
|
const syncFiles = ref<any>([]);
|
|
|
|
|
const asyncFileFun = () => {
|
|
|
|
|
syncFiles.value = baseTableRef.value.tableRef.getCheckboxRecords() || [];
|
|
|
|
|
formData.fileType = '';
|
|
|
|
|
if (syncFiles.value?.length) {
|
|
|
|
|
showSyncFileTypeSelectFlag.value = true;
|
|
|
|
|
} else {
|
|
|
|
|
ElMessage.warning('请选择文件进行归档');
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const cancalFun = () => {
|
|
|
|
|
showSyncFileTypeSelectFlag.value = false;
|
2026-03-10 16:21:48 +08:00
|
|
|
showUploadFileVisible.value = false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const openUploadFileFun = () => {
|
2026-03-10 16:30:52 +08:00
|
|
|
console.log(props.runInfo, 'runInfo');
|
|
|
|
|
|
2026-03-10 16:21:48 +08:00
|
|
|
showUploadFileVisible.value = true;
|
|
|
|
|
formData.fileTypeDictValue = [FILE_TYPE.CALCULATION_FILE];
|
|
|
|
|
formData.files = [];
|
|
|
|
|
formData.disciplineDictValue = '';
|
|
|
|
|
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
tableFormRef.value.resetFun();
|
|
|
|
|
});
|
2026-02-26 11:50:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const submitFun = async () => {
|
|
|
|
|
if (!formData.fileType) {
|
|
|
|
|
ElMessage.warning('请选择归档文件类型');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const fileIds = syncFiles.value.map((item: any) => {
|
|
|
|
|
return item.id;
|
|
|
|
|
});
|
|
|
|
|
const param = {
|
|
|
|
|
fileIds,
|
|
|
|
|
fileType: formData.fileType,
|
|
|
|
|
runId: props.nodeInfo.runId,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
const res: any = await syncKeyResultToTaskApi(param);
|
|
|
|
|
if (res && res.code == 200) {
|
|
|
|
|
ElMessage.success('归档成功');
|
|
|
|
|
showSyncFileTypeSelectFlag.value = false;
|
|
|
|
|
}
|
|
|
|
|
} catch {}
|
|
|
|
|
};
|
|
|
|
|
|
2026-03-10 16:21:48 +08:00
|
|
|
const submitFun2 = async () => {
|
|
|
|
|
const valid = await tableFormRef.value.validateFun();
|
|
|
|
|
|
|
|
|
|
if (valid) {
|
|
|
|
|
const fromData: any = tableFormRef.value.getFormDataFun();
|
|
|
|
|
|
|
|
|
|
console.log(fromData, 'fromData');
|
|
|
|
|
|
|
|
|
|
const list = fromData.files.map((item: any) => {
|
|
|
|
|
return item.raw;
|
|
|
|
|
});
|
|
|
|
|
const sourceFiles = list.map((item: any) => {
|
|
|
|
|
return {
|
|
|
|
|
fileName: item.name,
|
|
|
|
|
size: item.size,
|
|
|
|
|
fileType: fileUploadAllocationTypeFun(item.name),
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const param = {
|
|
|
|
|
sourceFiles,
|
|
|
|
|
uploadTaskId: new Date().getTime(),
|
|
|
|
|
dirId: props.fileId,
|
2026-03-13 16:24:26 +08:00
|
|
|
fileTypeDictValue:
|
|
|
|
|
fromData.fileTypeDictValue instanceof Array
|
|
|
|
|
? fromData.fileTypeDictValue.join(',')
|
|
|
|
|
: fromData.fileTypeDictValue,
|
2026-03-10 16:21:48 +08:00
|
|
|
disciplineDictValue: fromData.disciplineDictValue,
|
|
|
|
|
fileTypeDictClass: 'ALL_FILE_TYPE',
|
|
|
|
|
disciplineTypeDictClass: 'DISCIPLINE_TYPE',
|
|
|
|
|
dictTags: [
|
|
|
|
|
'fileTypeDictClass',
|
|
|
|
|
'fileTypeDictValue',
|
|
|
|
|
'disciplineTypeDictClass',
|
|
|
|
|
'disciplineDictValue',
|
|
|
|
|
],
|
2026-03-10 16:30:52 +08:00
|
|
|
tagReq: props.runInfo?.tagReq || {},
|
2026-03-10 16:21:48 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const res: any = await uploadRunFilesApi(param);
|
|
|
|
|
if (res && res.code === 200) {
|
|
|
|
|
res.data.forEach((item: any, index: any) => {
|
|
|
|
|
item.isSaveLocal = 'Y';
|
|
|
|
|
emitter.emit('ADD_UPLOAD_FILE', {
|
|
|
|
|
file: list[index],
|
|
|
|
|
data: {
|
|
|
|
|
// 接口返回的文件目录信息,包括配置信息
|
|
|
|
|
...item,
|
|
|
|
|
isApprove: 0, // 0否 1是
|
|
|
|
|
taskType: 4, // 4交付物
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
reloadFun();
|
|
|
|
|
showUploadFileVisible.value = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-12-09 09:47:27 +08:00
|
|
|
watch(
|
|
|
|
|
() => props.nodeInfo,
|
|
|
|
|
(newVal) => {
|
|
|
|
|
if (newVal) {
|
2026-03-10 16:30:52 +08:00
|
|
|
console.log(newVal, 'newVal');
|
2025-12-09 09:47:27 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
immediate: true,
|
|
|
|
|
deep: true,
|
2025-11-21 15:19:37 +08:00
|
|
|
}
|
2025-12-09 09:47:27 +08:00
|
|
|
);
|
2025-11-21 15:19:37 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2025-12-09 09:47:27 +08:00
|
|
|
.node-file-page {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
padding: 10px;
|
2025-11-21 15:19:37 +08:00
|
|
|
|
2026-02-02 10:30:24 +08:00
|
|
|
.table-box {
|
|
|
|
|
width: 100%;
|
2026-02-04 17:10:17 +08:00
|
|
|
height: 100%;
|
|
|
|
|
|
|
|
|
|
// height: calc(100% - 50px);
|
2026-02-02 10:30:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.operate-box {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 50px;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: flex-end;
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-09 09:47:27 +08:00
|
|
|
.ml10 {
|
|
|
|
|
margin-left: 10px;
|
|
|
|
|
}
|
2025-11-21 15:19:37 +08:00
|
|
|
}
|
|
|
|
|
</style>
|