fix: 网元软件多文件上传文件删除副本记录

This commit is contained in:
TsMask
2024-06-25 17:54:50 +08:00
parent 2a2b441e09
commit a213be0d64

View File

@@ -1,12 +1,12 @@
<script setup lang="ts">
import { reactive, onMounted, toRaw, watch } from 'vue';
import { message, Upload, notification } from 'ant-design-vue/lib';
import type { UploadRequestOption } from 'ant-design-vue/lib/vc-upload/interface';
import type { FileType, UploadFile } from 'ant-design-vue/lib/upload/interface';
import useI18n from '@/hooks/useI18n';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { NE_TYPE_LIST, NE_EXPAND_LIST } from '@/constants/ne-constants';
import { UploadRequestOption } from 'ant-design-vue/lib/vc-upload/interface';
import { addNeSoftware } from '@/api/ne/neSoftware';
import { FileType } from 'ant-design-vue/lib/upload/interface';
import { uploadFileChunk } from '@/api/tool/file';
const { t } = useI18n();
const emit = defineEmits(['ok', 'cancel', 'update:visible']);
@@ -230,6 +230,20 @@ function fnBeforeUploadFile(file: FileType) {
return true;
}
/**表单上传前删除 */
function fnBeforeRemoveFile(file: UploadFile) {
const fileName = file.name;
// 取网元类型判断是否支持
let neType = '';
const neTypeIndex = fileName.indexOf('-');
if (neTypeIndex !== -1) {
neType = fileName.substring(0, neTypeIndex).toUpperCase();
}
const idx = modalState.from.findIndex(item => item.neType === neType);
modalState.from.splice(idx, 1);
return true;
}
/**表单上传文件 */
function fnUploadFile(up: UploadRequestOption) {
const uploadFile = modalState.uploadFiles.find(
@@ -465,6 +479,7 @@ onMounted(() => {});
showRemoveIcon: true,
showDownloadIcon: false,
}"
:remove="fnBeforeRemoveFile"
:before-upload="fnBeforeUploadFile"
:custom-request="fnUploadFile"
:disabled="modalState.confirmLoading"