fix(用例管理): 修复用例详情相关问题
--bug=1037261 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001037261 --bug=1036542 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001036542 --bug=1035893 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001035893
This commit is contained in:
parent
54f7adf4f0
commit
932d9fdb77
|
@ -241,7 +241,7 @@ export function getThirdDemandList(data: TableQueryParams) {
|
||||||
|
|
||||||
// 上传文件并关联用例
|
// 上传文件并关联用例
|
||||||
export function uploadOrAssociationFile(data: Record<string, any>) {
|
export function uploadOrAssociationFile(data: Record<string, any>) {
|
||||||
return MSR.uploadFile({ url: UploadOrAssociationFileUrl }, { request: data.request, fileList: data.file });
|
return MSR.uploadFile({ url: UploadOrAssociationFileUrl }, { request: data.request, fileList: [data.file] });
|
||||||
}
|
}
|
||||||
// 转存文件
|
// 转存文件
|
||||||
export function transferFileRequest(data: OperationFile) {
|
export function transferFileRequest(data: OperationFile) {
|
||||||
|
|
|
@ -806,10 +806,14 @@ export function customFieldDataToTableData(customFieldData: Record<string, any>[
|
||||||
tableData[field.id] = JSON.parse(field.value).join(',') || '-';
|
tableData[field.id] = JSON.parse(field.value).join(',') || '-';
|
||||||
} else if (multipleExcludes.includes(field.type) && Array.isArray(field.options) && field.value) {
|
} else if (multipleExcludes.includes(field.type) && Array.isArray(field.options) && field.value) {
|
||||||
// 多值的类型后端返回的是json字符串
|
// 多值的类型后端返回的是json字符串
|
||||||
field.value = JSON.parse(field.value);
|
try {
|
||||||
tableData[field.id] = field.value
|
field.value = JSON.parse(field.value);
|
||||||
.map((val: string) => field.options.find((option: { value: string }) => option.value === val)?.text)
|
tableData[field.id] = field.value
|
||||||
.join(',');
|
.map((val: string) => field.options.find((option: { value: string }) => option.value === val)?.text)
|
||||||
|
.join(',');
|
||||||
|
} catch (e) {
|
||||||
|
console.log('自定义字段值不是数组');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
tableData[field.id] = field.value;
|
tableData[field.id] = field.value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -646,7 +646,7 @@
|
||||||
line-height: 32px;
|
line-height: 32px;
|
||||||
@apply flex;
|
@apply flex;
|
||||||
.label {
|
.label {
|
||||||
width: 38%;
|
width: 84px;
|
||||||
color: var(--color-text-3);
|
color: var(--color-text-3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,7 @@
|
||||||
if (isContinue) {
|
if (isContinue) {
|
||||||
Message.success(t('caseManagement.featureCase.addSuccess'));
|
Message.success(t('caseManagement.featureCase.addSuccess'));
|
||||||
caseModuleDetailRef.value.resetForm();
|
caseModuleDetailRef.value.resetForm();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
createSuccessId.value = res.data.id;
|
createSuccessId.value = res.data.id;
|
||||||
|
|
|
@ -672,7 +672,7 @@
|
||||||
@apply flex;
|
@apply flex;
|
||||||
.label {
|
.label {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
width: 38%;
|
width: 84px;
|
||||||
color: var(--color-text-3);
|
color: var(--color-text-3);
|
||||||
}
|
}
|
||||||
.value {
|
.value {
|
||||||
|
@ -682,8 +682,26 @@
|
||||||
:deep(.arco-form-item-layout-horizontal) {
|
:deep(.arco-form-item-layout-horizontal) {
|
||||||
margin-bottom: 16px !important;
|
margin-bottom: 16px !important;
|
||||||
}
|
}
|
||||||
|
:deep(.arco-form-item-label-col) {
|
||||||
|
padding-right: 0;
|
||||||
|
}
|
||||||
|
:deep(.arco-col-9) {
|
||||||
|
flex: 0 0 84px;
|
||||||
|
width: 84px;
|
||||||
|
}
|
||||||
|
:deep(.arco-col-15) {
|
||||||
|
flex: 0 0 calc(100% - 84px);
|
||||||
|
width: calc(100% - 84px);
|
||||||
|
}
|
||||||
|
:deep(.arco-form-item-label::after) {
|
||||||
|
color: red !important;
|
||||||
|
}
|
||||||
:deep(.arco-form-item-label-col > .arco-form-item-label) {
|
:deep(.arco-form-item-label-col > .arco-form-item-label) {
|
||||||
color: var(--color-text-3) !important;
|
color: var(--color-text-3) !important;
|
||||||
|
width: 84px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
:deep(.arco-select-view-single) {
|
:deep(.arco-select-view-single) {
|
||||||
border-color: transparent !important;
|
border-color: transparent !important;
|
||||||
|
|
|
@ -160,7 +160,6 @@
|
||||||
ref="fileListRef"
|
ref="fileListRef"
|
||||||
v-model:file-list="fileList"
|
v-model:file-list="fileList"
|
||||||
:show-tab="false"
|
:show-tab="false"
|
||||||
mode="static"
|
|
||||||
:request-params="{
|
:request-params="{
|
||||||
caseId: detailForm.id,
|
caseId: detailForm.id,
|
||||||
projectId: currentProjectId,
|
projectId: currentProjectId,
|
||||||
|
@ -168,6 +167,7 @@
|
||||||
:upload-func="uploadOrAssociationFile"
|
:upload-func="uploadOrAssociationFile"
|
||||||
:handle-delete="deleteFileHandler"
|
:handle-delete="deleteFileHandler"
|
||||||
:show-delete="props.allowEdit"
|
:show-delete="props.allowEdit"
|
||||||
|
@finish="uploadFileOver"
|
||||||
>
|
>
|
||||||
<template #actions="{ item }">
|
<template #actions="{ item }">
|
||||||
<div v-if="props.allowEdit">
|
<div v-if="props.allowEdit">
|
||||||
|
@ -287,6 +287,7 @@
|
||||||
import AddStep from '../addStep.vue';
|
import AddStep from '../addStep.vue';
|
||||||
import TransferModal from './transferModal.vue';
|
import TransferModal from './transferModal.vue';
|
||||||
|
|
||||||
|
import { deleteRecycleCase } from '@/api/modules/api-test/management';
|
||||||
import {
|
import {
|
||||||
checkFileIsUpdateRequest,
|
checkFileIsUpdateRequest,
|
||||||
deleteFileOrCancelAssociation,
|
deleteFileOrCancelAssociation,
|
||||||
|
@ -302,8 +303,9 @@
|
||||||
import { getModules, getModulesCount } from '@/api/modules/project-management/fileManagement';
|
import { getModules, getModulesCount } from '@/api/modules/project-management/fileManagement';
|
||||||
import { PreviewEditorImageUrl } from '@/api/requrls/case-management/featureCase';
|
import { PreviewEditorImageUrl } from '@/api/requrls/case-management/featureCase';
|
||||||
import { useI18n } from '@/hooks/useI18n';
|
import { useI18n } from '@/hooks/useI18n';
|
||||||
|
import useModal from '@/hooks/useModal';
|
||||||
import useAppStore from '@/store/modules/app';
|
import useAppStore from '@/store/modules/app';
|
||||||
import { downloadByteFile, getGenerateId } from '@/utils';
|
import { downloadByteFile, getGenerateId, sleep } from '@/utils';
|
||||||
import { scrollIntoView } from '@/utils/dom';
|
import { scrollIntoView } from '@/utils/dom';
|
||||||
|
|
||||||
import type { AssociatedList, DetailCase, StepList } from '@/models/caseManagement/featureCase';
|
import type { AssociatedList, DetailCase, StepList } from '@/models/caseManagement/featureCase';
|
||||||
|
@ -314,6 +316,7 @@
|
||||||
const caseFormRef = ref<FormInstance>();
|
const caseFormRef = ref<FormInstance>();
|
||||||
|
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
|
const { openModal } = useModal();
|
||||||
const currentProjectId = computed(() => appStore.currentProjectId);
|
const currentProjectId = computed(() => appStore.currentProjectId);
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -533,21 +536,36 @@
|
||||||
|
|
||||||
// 删除本地文件
|
// 删除本地文件
|
||||||
async function deleteFileHandler(item: MsFileItem) {
|
async function deleteFileHandler(item: MsFileItem) {
|
||||||
try {
|
openModal({
|
||||||
const params = {
|
type: 'error',
|
||||||
id: item.uid,
|
title: t('caseManagement.featureCase.deleteFile', { name: item?.name }),
|
||||||
local: item.local,
|
content: t('caseManagement.featureCase.deleteFileTip'),
|
||||||
caseId: detailForm.value.id,
|
okText: t('common.confirmDelete'),
|
||||||
projectId: currentProjectId.value,
|
cancelText: t('common.cancel'),
|
||||||
};
|
okButtonProps: {
|
||||||
await deleteFileOrCancelAssociation(params);
|
status: 'danger',
|
||||||
Message.success(
|
},
|
||||||
item.local ? t('caseManagement.featureCase.deleteSuccess') : t('caseManagement.featureCase.cancelLinkSuccess')
|
onBeforeOk: async () => {
|
||||||
);
|
try {
|
||||||
emit('updateSuccess');
|
const params = {
|
||||||
} catch (error) {
|
id: item.uid,
|
||||||
console.log(error);
|
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);
|
const transferVisible = ref<boolean>(false);
|
||||||
|
|
||||||
|
@ -627,6 +645,12 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function restartUpload() {
|
||||||
|
await sleep(300);
|
||||||
|
console.log('ooo');
|
||||||
|
fileListRef.value?.startUpload();
|
||||||
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.form,
|
() => props.form,
|
||||||
(val) => {
|
(val) => {
|
||||||
|
@ -681,6 +705,10 @@
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function uploadFileOver() {
|
||||||
|
emit('updateSuccess');
|
||||||
|
}
|
||||||
|
|
||||||
function handleChange(_fileList: MsFileItem[], fileItem?: MsFileItem) {
|
function handleChange(_fileList: MsFileItem[], fileItem?: MsFileItem) {
|
||||||
// 校验本地文件是否重复
|
// 校验本地文件是否重复
|
||||||
const isRepeat = _fileList.filter((item) => item.name === fileItem?.name && item.local).length > 1;
|
const isRepeat = _fileList.filter((item) => item.name === fileItem?.name && item.local).length > 1;
|
||||||
|
@ -700,7 +728,7 @@
|
||||||
local: true, // 是否本地文件
|
local: true, // 是否本地文件
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
startUpload();
|
restartUpload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -271,4 +271,8 @@ export default {
|
||||||
'caseManagement.featureCase.excelImportTip': 'Only xls/xlsx files are supported',
|
'caseManagement.featureCase.excelImportTip': 'Only xls/xlsx files are supported',
|
||||||
'caseManagement.featureCase.xmindImportTip': 'Only xmind files are supported',
|
'caseManagement.featureCase.xmindImportTip': 'Only xmind files are supported',
|
||||||
'caseManagement.featureCase.AssociatedSuccess': 'Associated with success',
|
'caseManagement.featureCase.AssociatedSuccess': 'Associated with success',
|
||||||
|
'caseManagement.featureCase.deleteFile': 'Are you sure you want to delete file {name} ',
|
||||||
|
'caseManagement.featureCase.deleteFileTip':
|
||||||
|
'After deletion, the file cannot be restored. Please operate with caution!',
|
||||||
|
'caseManagement.featureCase.nameNotNull': 'The name can not be null!',
|
||||||
};
|
};
|
||||||
|
|
|
@ -267,4 +267,7 @@ export default {
|
||||||
'caseManagement.featureCase.excelImportTip': '仅支持xls/xlsx格式的文件',
|
'caseManagement.featureCase.excelImportTip': '仅支持xls/xlsx格式的文件',
|
||||||
'caseManagement.featureCase.xmindImportTip': '仅支持xmind格式的文件',
|
'caseManagement.featureCase.xmindImportTip': '仅支持xmind格式的文件',
|
||||||
'caseManagement.featureCase.AssociatedSuccess': '关联成功',
|
'caseManagement.featureCase.AssociatedSuccess': '关联成功',
|
||||||
|
'caseManagement.featureCase.deleteFile': '确认删除文件 {name} 吗',
|
||||||
|
'caseManagement.featureCase.deleteFileTip': '删除后,文件无法恢复,请谨慎操作!',
|
||||||
|
'caseManagement.featureCase.nameNotNull': '用例名称不能为空!',
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue