fix: 文件上传后关闭窗口复位上传结果

This commit is contained in:
TsMask
2024-04-25 14:16:41 +08:00
parent e6a439faea
commit b3cb40fd8c

View File

@@ -99,6 +99,7 @@ function fnModalOk() {
function fnModalCancel() { function fnModalCancel() {
modalState.visibleByMoreFile = false; modalState.visibleByMoreFile = false;
modalState.confirmLoading = false; modalState.confirmLoading = false;
modalState.from = [];
modalState.uploadFiles = []; modalState.uploadFiles = [];
emit('cancel'); emit('cancel');
emit('update:visible', false); emit('update:visible', false);
@@ -118,16 +119,25 @@ function fnBeforeUploadFile(file: FileType) {
); );
return Upload.LIST_IGNORE; return Upload.LIST_IGNORE;
} }
// 取网元类型判断是否支持
let neType = '';
const neTypeIndex = fileName.indexOf('-');
if (neTypeIndex !== -1) {
neType = fileName.substring(0, neTypeIndex).toUpperCase();
}
if (!NE_TYPE_LIST.includes(neType)) {
message.error(fileName + ' 未解析出对应的网元类型', 3);
return Upload.LIST_IGNORE;
}
// 根据给定的软件名取版本号 ims-r2.2312.x-ub22.deb // 根据给定的软件名取版本号 ims-r2.2312.x-ub22.deb
let version = ''; let version = '';
const matches = fileName.match(/([0-9.]+[0-9x]+)/); const matches = fileName.match(/([0-9.]+[0-9x]+)/);
if (matches) { if (matches) {
version = matches[0]; version = matches[0];
} } else {
let neType = ''; message.error(fileName + ' 未解析出对应的版本号', 3);
const neTypeIndex = fileName.indexOf('-'); return Upload.LIST_IGNORE;
if (neTypeIndex !== -1) {
neType = fileName.substring(0, neTypeIndex).toUpperCase();
} }
// 批量文件信息 // 批量文件信息
@@ -215,6 +225,7 @@ onMounted(() => {});
<a-form-item <a-form-item
:label="`Upload File (Max: ${NE_TYPE_LIST.length})`" :label="`Upload File (Max: ${NE_TYPE_LIST.length})`"
name="file" name="file"
help="仅支持文件名称解析如:网元类型-版本号-操作系统.文件格式"
> >
<a-upload <a-upload
name="file" name="file"