fix(用例管理): 文件框上重新上传同名文件可以替换

--bug=1038960 --user=王旭 【用例管理】用例导入,重新上传不会覆盖原文件,导致上传失败; https://www.tapd.cn/55049933/s/1494609
This commit is contained in:
WangXu10 2024-04-11 14:37:36 +08:00 committed by 刘瑞斌
parent 1281f88e57
commit f35f88a0cf
2 changed files with 9 additions and 4 deletions

View File

@ -95,6 +95,7 @@
cutHeight: number; //
fileTypeTip?: string; //
limit: number; //
allowRepeat?: boolean; //
}> & {
accept: UploadType;
};
@ -104,6 +105,7 @@
isLimit: true,
isAllScreen: false,
cutHeight: 110,
allowRepeat: false,
});
const emit = defineEmits(['update:fileList', 'change']);
@ -126,10 +128,12 @@
async function beforeUpload(file: File) {
if (innerFileList.value.length > 0) {
//
const isRepeat = innerFileList.value.filter((item) => item.name === file.name && item.local).length >= 1;
if (isRepeat) {
Message.warning(t('ms.add.attachment.repeatFileTip'));
return Promise.resolve(false);
if (!props.allowRepeat) {
const isRepeat = innerFileList.value.filter((item) => item.name === file.name && item.local).length >= 1;
if (isRepeat) {
Message.warning(t('ms.add.attachment.repeatFileTip'));
return Promise.resolve(false);
}
}
if (!props.multiple) {
//

View File

@ -41,6 +41,7 @@
"
:show-file-list="false"
:auto-upload="false"
:allow-repeat="true"
:disabled="confirmLoading"
:file-type-tip="fileTypeTip"
></MsUpload>