fix(用例管理): 用例关联文件列表未排除已关联数据

--bug=1035885 --user=王旭 【用例管理】功能用例-用例详情-关联文件-关联文件后选择关联文件处不应该继续显示该文件 https://www.tapd.cn/55049933/s/1482006
This commit is contained in:
WangXu10 2024-03-27 16:21:30 +08:00 committed by 刘瑞斌
parent fad9c92b20
commit 79543f69e6
1 changed files with 57 additions and 30 deletions

View File

@ -536,36 +536,54 @@
//
async function deleteFileHandler(item: MsFileItem) {
openModal({
type: 'error',
title: t('caseManagement.featureCase.deleteFile', { name: item?.name }),
content: t('caseManagement.featureCase.deleteFileTip'),
okText: t('common.confirmDelete'),
cancelText: t('common.cancel'),
okButtonProps: {
status: 'danger',
},
onBeforeOk: async () => {
try {
const params = {
id: item.uid,
local: item.local,
caseId: detailForm.value.id,
projectId: currentProjectId.value,
};
await deleteFileOrCancelAssociation(params);
Message.success(
item.local
? t('caseManagement.featureCase.deleteSuccess')
: t('caseManagement.featureCase.cancelLinkSuccess')
);
emit('updateSuccess');
} catch (error) {
console.log(error);
}
},
hideCancel: false,
});
if (!item.local) {
try {
const params = {
id: item.uid,
local: item.local,
caseId: detailForm.value.id,
projectId: currentProjectId.value,
};
await deleteFileOrCancelAssociation(params);
Message.success(
item.local ? t('caseManagement.featureCase.deleteSuccess') : t('caseManagement.featureCase.cancelLinkSuccess')
);
emit('updateSuccess');
} catch (error) {
console.log(error);
}
} else {
openModal({
type: 'error',
title: t('caseManagement.featureCase.deleteFile', { name: item?.name }),
content: t('caseManagement.featureCase.deleteFileTip'),
okText: t('common.confirmDelete'),
cancelText: t('common.cancel'),
okButtonProps: {
status: 'danger',
},
onBeforeOk: async () => {
try {
const params = {
id: item.uid,
local: item.local,
caseId: detailForm.value.id,
projectId: currentProjectId.value,
};
await deleteFileOrCancelAssociation(params);
Message.success(
item.local
? t('caseManagement.featureCase.deleteSuccess')
: t('caseManagement.featureCase.cancelLinkSuccess')
);
emit('updateSuccess');
} catch (error) {
console.log(error);
}
},
hideCancel: false,
});
}
}
const transferVisible = ref<boolean>(false);
@ -662,6 +680,15 @@
}
);
//
watch(
() => fileList.value,
(arr) => {
getListFunParams.value.combine.hiddenIds = arr.filter((item) => !item.local).map((item) => item.uid);
},
{ deep: true, immediate: true }
);
async function startUpload(fileIds?: string[]) {
try {
const params = {