fix(测试计划): 修复测试计划bug&功能用例关联文件问题
This commit is contained in:
parent
81484e4272
commit
705f89c07e
|
@ -358,6 +358,7 @@
|
||||||
|
|
||||||
// 处理关联文件
|
// 处理关联文件
|
||||||
function saveSelectAssociatedFile(fileData: AssociatedList[]) {
|
function saveSelectAssociatedFile(fileData: AssociatedList[]) {
|
||||||
|
// TODO : 这里需要优化选择跨页的数据
|
||||||
const fileResultList = fileData.map((fileInfo) => convertToFile(fileInfo));
|
const fileResultList = fileData.map((fileInfo) => convertToFile(fileInfo));
|
||||||
if (props.mode === 'button') {
|
if (props.mode === 'button') {
|
||||||
fileList.value.push(...fileResultList);
|
fileList.value.push(...fileResultList);
|
||||||
|
|
|
@ -194,7 +194,7 @@
|
||||||
selectable: true,
|
selectable: true,
|
||||||
showSelectAll: true,
|
showSelectAll: true,
|
||||||
heightUsed: 310,
|
heightUsed: 310,
|
||||||
showSelectorAll: true,
|
showSelectorAll: false,
|
||||||
},
|
},
|
||||||
(record) => {
|
(record) => {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -166,7 +166,7 @@
|
||||||
selectable: true,
|
selectable: true,
|
||||||
showSelectAll: true,
|
showSelectAll: true,
|
||||||
heightUsed: 310,
|
heightUsed: 310,
|
||||||
showSelectorAll: true,
|
showSelectorAll: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
async function getTableParams() {
|
async function getTableParams() {
|
||||||
|
|
|
@ -202,7 +202,7 @@
|
||||||
selectable: true,
|
selectable: true,
|
||||||
showSelectAll: true,
|
showSelectAll: true,
|
||||||
heightUsed: 310,
|
heightUsed: 310,
|
||||||
showSelectorAll: true,
|
showSelectorAll: false,
|
||||||
},
|
},
|
||||||
(record) => {
|
(record) => {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -186,7 +186,7 @@
|
||||||
selectable: true,
|
selectable: true,
|
||||||
showSelectAll: true,
|
showSelectAll: true,
|
||||||
heightUsed: 310,
|
heightUsed: 310,
|
||||||
showSelectorAll: true,
|
showSelectorAll: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
async function getTableParams() {
|
async function getTableParams() {
|
||||||
|
|
|
@ -85,6 +85,7 @@
|
||||||
:file-all-count-by-storage="fileAllCountByStorage"
|
:file-all-count-by-storage="fileAllCountByStorage"
|
||||||
:filetype="props.filetype"
|
:filetype="props.filetype"
|
||||||
@init="handleModuleTableInit"
|
@init="handleModuleTableInit"
|
||||||
|
@update-file-ids="updateFiles"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</MsSplitBox>
|
</MsSplitBox>
|
||||||
|
@ -121,7 +122,7 @@
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'save', val: AssociatedList[]): void;
|
(e: 'save', val: AssociatedList[], selectIds?: string[]): void;
|
||||||
(e: 'update:visible', val: boolean): void;
|
(e: 'update:visible', val: boolean): void;
|
||||||
}>();
|
}>();
|
||||||
const showDrawer = computed({
|
const showDrawer = computed({
|
||||||
|
@ -244,9 +245,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const selectFile = ref<AssociatedList[]>([]);
|
const selectFile = ref<AssociatedList[]>([]);
|
||||||
|
const selectIds = ref<string[]>([]);
|
||||||
|
|
||||||
|
function updateFiles(fileIds: string[]) {
|
||||||
|
selectIds.value = fileIds;
|
||||||
|
}
|
||||||
|
|
||||||
function handleDrawerConfirm() {
|
function handleDrawerConfirm() {
|
||||||
emit('save', selectFile.value);
|
emit('save', selectFile.value, selectIds.value);
|
||||||
showDrawer.value = false;
|
showDrawer.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,6 +112,7 @@
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'init', params: FileListQueryParams): void;
|
(e: 'init', params: FileListQueryParams): void;
|
||||||
(e: 'update:selectFile', val: AssociatedList[]): void;
|
(e: 'update:selectFile', val: AssociatedList[]): void;
|
||||||
|
(e: 'updateFileIds', val: string[]): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const tableFileTypeOptions = ref<string[]>([]);
|
const tableFileTypeOptions = ref<string[]>([]);
|
||||||
|
@ -342,11 +343,12 @@
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => selectedIds.value,
|
() => selectedIds.value,
|
||||||
() => {
|
(val) => {
|
||||||
emit(
|
emit(
|
||||||
'update:selectFile',
|
'update:selectFile',
|
||||||
propsRes.value.data.filter((item: any) => selectedIds.value.indexOf(item.id) > -1)
|
propsRes.value.data.filter((item: any) => selectedIds.value.indexOf(item.id) > -1)
|
||||||
);
|
);
|
||||||
|
emit('updateFileIds', val);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -511,14 +511,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关联文件
|
// 关联文件
|
||||||
async function saveSelectAssociatedFile(fileData: AssociatedList[]) {
|
async function saveSelectAssociatedFile(fileData: AssociatedList[], selectFileIds?: string[]) {
|
||||||
const fileResultList = fileData.map(convertToFileByDetail);
|
|
||||||
fileList.value.push(...fileResultList);
|
|
||||||
const params = {
|
const params = {
|
||||||
request: {
|
request: {
|
||||||
bugId: bugId.value as string,
|
bugId: bugId.value as string,
|
||||||
projectId: currentProjectId.value,
|
projectId: currentProjectId.value,
|
||||||
selectIds: fileResultList.map((item: any) => item.uid),
|
selectIds: selectFileIds || [],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
await uploadOrAssociationFile(params);
|
await uploadOrAssociationFile(params);
|
||||||
|
|
|
@ -139,6 +139,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<inputComment
|
<inputComment
|
||||||
|
v-if="activeTab !== 'detail'"
|
||||||
ref="commentInputRef"
|
ref="commentInputRef"
|
||||||
v-model:content="content"
|
v-model:content="content"
|
||||||
v-model:notice-user-ids="noticeUserIds"
|
v-model:notice-user-ids="noticeUserIds"
|
||||||
|
|
|
@ -693,11 +693,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理关联文件
|
// 处理关联文件
|
||||||
function saveSelectAssociatedFile(fileData: AssociatedList[]) {
|
function saveSelectAssociatedFile(fileData: AssociatedList[], selectIds?: string[]) {
|
||||||
const fileResultList = fileData.map((fileInfo) => convertToFile(fileInfo));
|
startUpload(selectIds || []);
|
||||||
fileList.value.push(...fileResultList);
|
|
||||||
const fileIds = fileResultList.map((item: any) => item.uid);
|
|
||||||
startUpload(fileIds);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新文件
|
// 更新文件
|
||||||
|
|
|
@ -18,7 +18,9 @@
|
||||||
<ExecutionStatus :status="filterContent.value" />
|
<ExecutionStatus :status="filterContent.value" />
|
||||||
</template>
|
</template>
|
||||||
<template #operation="{ record }">
|
<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>
|
</template>
|
||||||
</MsBaseTable>
|
</MsBaseTable>
|
||||||
<ReportDrawer v-model:visible="reportVisible" :report-id="independentReportId" />
|
<ReportDrawer v-model:visible="reportVisible" :report-id="independentReportId" />
|
||||||
|
|
|
@ -249,14 +249,14 @@
|
||||||
<template #operation="{ record }">
|
<template #operation="{ record }">
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<MsButton
|
<MsButton
|
||||||
v-if="isShowExecuteButton(record, ['PROJECT_TEST_PLAN:READ+EXECUTE'])"
|
v-if="isShowExecuteButton(record) && hasAnyPermission(['PROJECT_TEST_PLAN:READ+EXECUTE'])"
|
||||||
class="!mx-0"
|
class="!mx-0"
|
||||||
:disabled="executeId == record.id"
|
:disabled="executeId == record.id"
|
||||||
@click="executePlan(record)"
|
@click="executePlan(record)"
|
||||||
>{{ t('testPlan.testPlanIndex.execution') }}</MsButton
|
>{{ t('testPlan.testPlanIndex.execution') }}</MsButton
|
||||||
>
|
>
|
||||||
<a-divider
|
<a-divider
|
||||||
v-if="isShowExecuteButton(record, ['PROJECT_TEST_PLAN:READ+EXECUTE'])"
|
v-if="isShowExecuteButton(record) && hasAnyPermission(['PROJECT_TEST_PLAN:READ+EXECUTE'])"
|
||||||
direction="vertical"
|
direction="vertical"
|
||||||
:margin="8"
|
:margin="8"
|
||||||
></a-divider>
|
></a-divider>
|
||||||
|
@ -274,13 +274,13 @@
|
||||||
></a-divider>
|
></a-divider>
|
||||||
|
|
||||||
<MsButton
|
<MsButton
|
||||||
v-if="!isShowExecuteButton(record, ['PROJECT_TEST_PLAN:READ+ADD'])"
|
v-if="!isShowExecuteButton(record) && hasAnyPermission(['PROJECT_TEST_PLAN:READ+ADD'])"
|
||||||
class="!mx-0"
|
class="!mx-0"
|
||||||
@click="copyTestPlanOrGroup(record.id)"
|
@click="copyTestPlanOrGroup(record.id)"
|
||||||
>{{ t('common.copy') }}</MsButton
|
>{{ t('common.copy') }}</MsButton
|
||||||
>
|
>
|
||||||
<a-divider
|
<a-divider
|
||||||
v-if="!isShowExecuteButton(record, ['PROJECT_TEST_PLAN:READ+ADD'])"
|
v-if="!isShowExecuteButton(record) && hasAnyPermission(['PROJECT_TEST_PLAN:READ+ADD'])"
|
||||||
direction="vertical"
|
direction="vertical"
|
||||||
:margin="8"
|
:margin="8"
|
||||||
></a-divider>
|
></a-divider>
|
||||||
|
@ -290,11 +290,11 @@
|
||||||
<template v-if="(keyword || '').trim() === ''" #empty>
|
<template v-if="(keyword || '').trim() === ''" #empty>
|
||||||
<div class="flex w-full items-center justify-center p-[8px] text-[var(--color-text-4)]">
|
<div class="flex w-full items-center justify-center p-[8px] text-[var(--color-text-4)]">
|
||||||
{{ t('common.noData') }}
|
{{ 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') }}
|
{{ t('testPlan.testPlanIndex.createTestPlan') }}
|
||||||
</MsButton>
|
</MsButton>
|
||||||
{{ t('caseManagement.featureCase.or') }}
|
{{ 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') }}
|
{{ t('testPlan.testPlanIndex.createTestPlanGroup') }}
|
||||||
</MsButton>
|
</MsButton>
|
||||||
</div>
|
</div>
|
||||||
|
@ -473,7 +473,6 @@
|
||||||
width: 180,
|
width: 180,
|
||||||
showInTable: true,
|
showInTable: true,
|
||||||
showDrag: false,
|
showDrag: false,
|
||||||
showTooltip: true,
|
|
||||||
columnSelectorDisabled: true,
|
columnSelectorDisabled: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -741,11 +740,10 @@
|
||||||
return defaultCountDetailMap.value[id].scheduleConfig.enable;
|
return defaultCountDetailMap.value[id].scheduleConfig.enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isShowExecuteButton(record: TestPlanItem, permission: string[]) {
|
function isShowExecuteButton(record: TestPlanItem) {
|
||||||
return (
|
return (
|
||||||
((record.type === testPlanTypeEnum.TEST_PLAN && getFunctionalCount(record.id) > 0) ||
|
((record.type === testPlanTypeEnum.TEST_PLAN && getFunctionalCount(record.id) > 0) ||
|
||||||
(record.type === testPlanTypeEnum.GROUP && record.childrenCount)) &&
|
(record.type === testPlanTypeEnum.GROUP && record.childrenCount)) &&
|
||||||
hasAnyPermission(permission) &&
|
|
||||||
record.status !== 'ARCHIVED'
|
record.status !== 'ARCHIVED'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -754,7 +752,8 @@
|
||||||
const { status: planStatus } = record;
|
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[] = [];
|
let scheduledTaskAction: ActionsItem[] = [];
|
||||||
if (planStatus !== 'ARCHIVED' && record.groupId && record.groupId === 'NONE') {
|
if (planStatus !== 'ARCHIVED' && record.groupId && record.groupId === 'NONE') {
|
||||||
|
@ -944,7 +943,7 @@
|
||||||
|
|
||||||
const confirmLoading = ref<boolean>(false);
|
const confirmLoading = ref<boolean>(false);
|
||||||
|
|
||||||
async function executeHandler() {
|
async function batchHandleExecute() {
|
||||||
confirmLoading.value = true;
|
confirmLoading.value = true;
|
||||||
try {
|
try {
|
||||||
await executePlanOrGroup(executeForm.value);
|
await executePlanOrGroup(executeForm.value);
|
||||||
|
@ -961,29 +960,40 @@
|
||||||
|
|
||||||
const executeId = ref<string>('');
|
const executeId = ref<string>('');
|
||||||
async function singleExecute(id: string) {
|
async function singleExecute(id: string) {
|
||||||
|
confirmLoading.value = true;
|
||||||
executeId.value = id;
|
executeId.value = id;
|
||||||
try {
|
try {
|
||||||
const params: ExecutePlan = {
|
const params: ExecutePlan = {
|
||||||
executeId: id,
|
executeId: id,
|
||||||
runMode: 'SERIAL',
|
runMode: executeForm.value.runMode,
|
||||||
executionSource: 'MANUAL',
|
executionSource: 'MANUAL',
|
||||||
};
|
};
|
||||||
await executeSinglePlan(params);
|
await executeSinglePlan(params);
|
||||||
Message.success(t('case.detail.execute.success'));
|
Message.success(t('case.detail.execute.success'));
|
||||||
fetchData();
|
fetchData();
|
||||||
|
cancelHandler();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
} finally {
|
} finally {
|
||||||
executeId.value = '';
|
executeId.value = '';
|
||||||
|
confirmLoading.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function executeHandler() {
|
||||||
|
if (executeId.value) {
|
||||||
|
singleExecute(executeId.value);
|
||||||
|
} else {
|
||||||
|
batchHandleExecute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 测试计划详情
|
// 测试计划详情
|
||||||
function executePlan(record: TestPlanItem) {
|
function executePlan(record: TestPlanItem) {
|
||||||
const { type, id } = record;
|
const { type, id } = record;
|
||||||
|
executeId.value = id;
|
||||||
if (type === testPlanTypeEnum.GROUP) {
|
if (type === testPlanTypeEnum.GROUP) {
|
||||||
singleExecute(record.id);
|
executeVisible.value = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (type === testPlanTypeEnum.TEST_PLAN) {
|
if (type === testPlanTypeEnum.TEST_PLAN) {
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item v-else field="moduleId" :label="t('common.belongModule')" class="w-[436px]">
|
<a-form-item v-else field="moduleId" :label="t('common.belongModule')" class="w-[436px]">
|
||||||
<a-tree-select
|
<a-tree-select
|
||||||
v-model:modelValue="form.moduleId"
|
v-model="form.moduleId"
|
||||||
:data="props.moduleTree"
|
:data="props.moduleTree"
|
||||||
:field-names="{ title: 'name', key: 'id', children: 'children' }"
|
:field-names="{ title: 'name', key: 'id', children: 'children' }"
|
||||||
:tree-props="{
|
:tree-props="{
|
||||||
|
@ -181,11 +181,16 @@
|
||||||
|
|
||||||
const drawerLoading = ref(false);
|
const drawerLoading = ref(false);
|
||||||
const formRef = ref<FormInstance>();
|
const formRef = ref<FormInstance>();
|
||||||
|
|
||||||
|
const moduleId = computed(() => {
|
||||||
|
return props.moduleId && props.moduleId !== 'all' ? props.moduleId : 'root';
|
||||||
|
});
|
||||||
|
|
||||||
const initForm: AddTestPlanParams = {
|
const initForm: AddTestPlanParams = {
|
||||||
isGroup: false,
|
isGroup: false,
|
||||||
name: '',
|
name: '',
|
||||||
projectId: '',
|
projectId: '',
|
||||||
moduleId: 'root',
|
moduleId: moduleId.value,
|
||||||
cycle: [],
|
cycle: [],
|
||||||
tags: [],
|
tags: [],
|
||||||
description: '',
|
description: '',
|
||||||
|
@ -359,9 +364,7 @@
|
||||||
form.value = cloneDeep(initForm);
|
form.value = cloneDeep(initForm);
|
||||||
getDetail();
|
getDetail();
|
||||||
initGroupOptions();
|
initGroupOptions();
|
||||||
if (!props.planId && props.moduleId) {
|
form.value.moduleId = moduleId.value;
|
||||||
form.value.moduleId = props.moduleId === 'all' ? 'root' : props.moduleId;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue