fix(测试计划): 修复测试计划bug&功能用例关联文件问题

This commit is contained in:
xinxin.wu 2024-06-18 20:25:07 +08:00 committed by Craftsman
parent 81484e4272
commit 705f89c07e
13 changed files with 56 additions and 36 deletions

View File

@ -358,6 +358,7 @@
//
function saveSelectAssociatedFile(fileData: AssociatedList[]) {
// TODO :
const fileResultList = fileData.map((fileInfo) => convertToFile(fileInfo));
if (props.mode === 'button') {
fileList.value.push(...fileResultList);

View File

@ -194,7 +194,7 @@
selectable: true,
showSelectAll: true,
heightUsed: 310,
showSelectorAll: true,
showSelectorAll: false,
},
(record) => {
return {

View File

@ -166,7 +166,7 @@
selectable: true,
showSelectAll: true,
heightUsed: 310,
showSelectorAll: true,
showSelectorAll: false,
});
async function getTableParams() {

View File

@ -202,7 +202,7 @@
selectable: true,
showSelectAll: true,
heightUsed: 310,
showSelectorAll: true,
showSelectorAll: false,
},
(record) => {
return {

View File

@ -186,7 +186,7 @@
selectable: true,
showSelectAll: true,
heightUsed: 310,
showSelectorAll: true,
showSelectorAll: false,
});
async function getTableParams() {

View File

@ -85,6 +85,7 @@
:file-all-count-by-storage="fileAllCountByStorage"
:filetype="props.filetype"
@init="handleModuleTableInit"
@update-file-ids="updateFiles"
/>
</template>
</MsSplitBox>
@ -121,7 +122,7 @@
}>();
const emit = defineEmits<{
(e: 'save', val: AssociatedList[]): void;
(e: 'save', val: AssociatedList[], selectIds?: string[]): void;
(e: 'update:visible', val: boolean): void;
}>();
const showDrawer = computed({
@ -244,9 +245,14 @@
}
const selectFile = ref<AssociatedList[]>([]);
const selectIds = ref<string[]>([]);
function updateFiles(fileIds: string[]) {
selectIds.value = fileIds;
}
function handleDrawerConfirm() {
emit('save', selectFile.value);
emit('save', selectFile.value, selectIds.value);
showDrawer.value = false;
}

View File

@ -112,6 +112,7 @@
const emit = defineEmits<{
(e: 'init', params: FileListQueryParams): void;
(e: 'update:selectFile', val: AssociatedList[]): void;
(e: 'updateFileIds', val: string[]): void;
}>();
const tableFileTypeOptions = ref<string[]>([]);
@ -342,11 +343,12 @@
watch(
() => selectedIds.value,
() => {
(val) => {
emit(
'update:selectFile',
propsRes.value.data.filter((item: any) => selectedIds.value.indexOf(item.id) > -1)
);
emit('updateFileIds', val);
}
);

View File

@ -511,14 +511,12 @@
}
//
async function saveSelectAssociatedFile(fileData: AssociatedList[]) {
const fileResultList = fileData.map(convertToFileByDetail);
fileList.value.push(...fileResultList);
async function saveSelectAssociatedFile(fileData: AssociatedList[], selectFileIds?: string[]) {
const params = {
request: {
bugId: bugId.value as string,
projectId: currentProjectId.value,
selectIds: fileResultList.map((item: any) => item.uid),
selectIds: selectFileIds || [],
},
};
await uploadOrAssociationFile(params);

View File

@ -139,6 +139,7 @@
</div>
</div>
<inputComment
v-if="activeTab !== 'detail'"
ref="commentInputRef"
v-model:content="content"
v-model:notice-user-ids="noticeUserIds"

View File

@ -693,11 +693,8 @@
}
//
function saveSelectAssociatedFile(fileData: AssociatedList[]) {
const fileResultList = fileData.map((fileInfo) => convertToFile(fileInfo));
fileList.value.push(...fileResultList);
const fileIds = fileResultList.map((item: any) => item.uid);
startUpload(fileIds);
function saveSelectAssociatedFile(fileData: AssociatedList[], selectIds?: string[]) {
startUpload(selectIds || []);
}
//

View File

@ -18,7 +18,9 @@
<ExecutionStatus :status="filterContent.value" />
</template>
<template #operation="{ record }">
<MsButton class="!mx-0" @click="openReport(record)">{{ t('report.detail.testPlanGroup.viewReport') }}</MsButton>
<MsButton class="!mx-0" :disabled="record.deleted" @click="openReport(record)">{{
t('report.detail.testPlanGroup.viewReport')
}}</MsButton>
</template>
</MsBaseTable>
<ReportDrawer v-model:visible="reportVisible" :report-id="independentReportId" />

View File

@ -249,14 +249,14 @@
<template #operation="{ record }">
<div class="flex items-center">
<MsButton
v-if="isShowExecuteButton(record, ['PROJECT_TEST_PLAN:READ+EXECUTE'])"
v-if="isShowExecuteButton(record) && hasAnyPermission(['PROJECT_TEST_PLAN:READ+EXECUTE'])"
class="!mx-0"
:disabled="executeId == record.id"
@click="executePlan(record)"
>{{ t('testPlan.testPlanIndex.execution') }}</MsButton
>
<a-divider
v-if="isShowExecuteButton(record, ['PROJECT_TEST_PLAN:READ+EXECUTE'])"
v-if="isShowExecuteButton(record) && hasAnyPermission(['PROJECT_TEST_PLAN:READ+EXECUTE'])"
direction="vertical"
:margin="8"
></a-divider>
@ -274,13 +274,13 @@
></a-divider>
<MsButton
v-if="!isShowExecuteButton(record, ['PROJECT_TEST_PLAN:READ+ADD'])"
v-if="!isShowExecuteButton(record) && hasAnyPermission(['PROJECT_TEST_PLAN:READ+ADD'])"
class="!mx-0"
@click="copyTestPlanOrGroup(record.id)"
>{{ t('common.copy') }}</MsButton
>
<a-divider
v-if="!isShowExecuteButton(record, ['PROJECT_TEST_PLAN:READ+ADD'])"
v-if="!isShowExecuteButton(record) && hasAnyPermission(['PROJECT_TEST_PLAN:READ+ADD'])"
direction="vertical"
:margin="8"
></a-divider>
@ -290,11 +290,11 @@
<template v-if="(keyword || '').trim() === ''" #empty>
<div class="flex w-full items-center justify-center p-[8px] text-[var(--color-text-4)]">
{{ t('common.noData') }}
<MsButton v-permission="['PROJECT_TEST_PLAN:READ+ADD']" class="ml-[8px]" @click="emit('new', 'group')">
<MsButton v-permission="['PROJECT_TEST_PLAN:READ+ADD']" class="ml-[8px]" @click="emit('new', 'testPlan')">
{{ t('testPlan.testPlanIndex.createTestPlan') }}
</MsButton>
{{ t('caseManagement.featureCase.or') }}
<MsButton v-permission="['PROJECT_TEST_PLAN:READ+ADD']" class="ml-[8px]" @click="emit('new', 'testPlan')">
<MsButton v-permission="['PROJECT_TEST_PLAN:READ+ADD']" class="ml-[8px]" @click="emit('new', 'group')">
{{ t('testPlan.testPlanIndex.createTestPlanGroup') }}
</MsButton>
</div>
@ -473,7 +473,6 @@
width: 180,
showInTable: true,
showDrag: false,
showTooltip: true,
columnSelectorDisabled: true,
},
{
@ -741,11 +740,10 @@
return defaultCountDetailMap.value[id].scheduleConfig.enable;
}
function isShowExecuteButton(record: TestPlanItem, permission: string[]) {
function isShowExecuteButton(record: TestPlanItem) {
return (
((record.type === testPlanTypeEnum.TEST_PLAN && getFunctionalCount(record.id) > 0) ||
(record.type === testPlanTypeEnum.GROUP && record.childrenCount)) &&
hasAnyPermission(permission) &&
record.status !== 'ARCHIVED'
);
}
@ -754,7 +752,8 @@
const { status: planStatus } = record;
//
const copyAction = isShowExecuteButton(record, ['PROJECT_TEST_PLAN:READ+ADD']) ? copyActions : [];
const copyAction =
isShowExecuteButton(record) && hasAnyPermission(['PROJECT_TEST_PLAN:READ+ADD']) ? copyActions : [];
let scheduledTaskAction: ActionsItem[] = [];
if (planStatus !== 'ARCHIVED' && record.groupId && record.groupId === 'NONE') {
@ -944,7 +943,7 @@
const confirmLoading = ref<boolean>(false);
async function executeHandler() {
async function batchHandleExecute() {
confirmLoading.value = true;
try {
await executePlanOrGroup(executeForm.value);
@ -961,29 +960,40 @@
const executeId = ref<string>('');
async function singleExecute(id: string) {
confirmLoading.value = true;
executeId.value = id;
try {
const params: ExecutePlan = {
executeId: id,
runMode: 'SERIAL',
runMode: executeForm.value.runMode,
executionSource: 'MANUAL',
};
await executeSinglePlan(params);
Message.success(t('case.detail.execute.success'));
fetchData();
cancelHandler();
} catch (error) {
console.log(error);
} finally {
executeId.value = '';
confirmLoading.value = false;
}
}
async function executeHandler() {
if (executeId.value) {
singleExecute(executeId.value);
} else {
batchHandleExecute();
}
}
//
function executePlan(record: TestPlanItem) {
const { type, id } = record;
executeId.value = id;
if (type === testPlanTypeEnum.GROUP) {
singleExecute(record.id);
executeVisible.value = true;
return;
}
if (type === testPlanTypeEnum.TEST_PLAN) {

View File

@ -48,7 +48,7 @@
</a-form-item>
<a-form-item v-else field="moduleId" :label="t('common.belongModule')" class="w-[436px]">
<a-tree-select
v-model:modelValue="form.moduleId"
v-model="form.moduleId"
:data="props.moduleTree"
:field-names="{ title: 'name', key: 'id', children: 'children' }"
:tree-props="{
@ -181,11 +181,16 @@
const drawerLoading = ref(false);
const formRef = ref<FormInstance>();
const moduleId = computed(() => {
return props.moduleId && props.moduleId !== 'all' ? props.moduleId : 'root';
});
const initForm: AddTestPlanParams = {
isGroup: false,
name: '',
projectId: '',
moduleId: 'root',
moduleId: moduleId.value,
cycle: [],
tags: [],
description: '',
@ -359,9 +364,7 @@
form.value = cloneDeep(initForm);
getDetail();
initGroupOptions();
if (!props.planId && props.moduleId) {
form.value.moduleId = props.moduleId === 'all' ? 'root' : props.moduleId;
}
form.value.moduleId = moduleId.value;
}
}
);