fix(测试计划): 修复关联用例默认关闭同步添加功能用例的关联用例

This commit is contained in:
xinxin.wu 2024-07-16 12:48:30 +08:00 committed by Craftsman
parent 0c4aebd30a
commit ed7d40175e
1 changed files with 16 additions and 7 deletions

View File

@ -279,7 +279,7 @@
<div class="flex items-center"> <div class="flex items-center">
<slot name="footerLeft"> <slot name="footerLeft">
<div v-if="props.associatedType === CaseLinkEnum.FUNCTIONAL" class="flex items-center"> <div v-if="props.associatedType === CaseLinkEnum.FUNCTIONAL" class="flex items-center">
<a-switch v-model:model-value="syncCase" size="small" type="line" /> <a-switch v-model:model-value="syncCase" size="small" type="line" @change="changeSyncCase" />
<div class="ml-[8px]">{{ t('ms.case.associate.syncFunctionalCase') }}</div> <div class="ml-[8px]">{{ t('ms.case.associate.syncFunctionalCase') }}</div>
<a-tooltip :content="t('ms.case.associate.addAutomaticallyCase')" position="top"> <a-tooltip :content="t('ms.case.associate.addAutomaticallyCase')" position="top">
<icon-question-circle <icon-question-circle
@ -482,7 +482,7 @@
set: (val) => val, set: (val) => val,
}); });
const syncCase = ref<boolean>(true); const syncCase = ref<boolean>(false);
const folderName = computed(() => { const folderName = computed(() => {
switch (associationType.value) { switch (associationType.value) {
@ -556,8 +556,8 @@
associateType: 'FUNCTIONAL', associateType: 'FUNCTIONAL',
totalCount: totalCount.value, totalCount: totalCount.value,
}; };
//
if (props.associatedType === CaseLinkEnum.FUNCTIONAL) { if (props.associatedType === CaseLinkEnum.FUNCTIONAL && syncCase.value) {
params.apiCaseCollectionId = apiCaseCollectionId.value; params.apiCaseCollectionId = apiCaseCollectionId.value;
params.apiScenarioCollectionId = apiScenarioCollectionId.value; params.apiScenarioCollectionId = apiScenarioCollectionId.value;
params.syncCase = syncCase.value; params.syncCase = syncCase.value;
@ -663,6 +663,15 @@
} }
} }
function changeSyncCase(value: string | number | boolean, ev: Event) {
if (value) {
initTestSet();
} else {
apiCaseCollectionId.value = '';
apiScenarioCollectionId.value = '';
}
}
function changeProjectHandler(visible: boolean) { function changeProjectHandler(visible: boolean) {
if (visible && !getIsVisited()) { if (visible && !getIsVisited()) {
selectPopVisible.value = true; selectPopVisible.value = true;
@ -695,9 +704,6 @@
associationType.value = props.associatedType; associationType.value = props.associatedType;
activeFolder.value = 'all'; activeFolder.value = 'all';
initProjectList(); initProjectList();
if (props.associatedType === 'FUNCTIONAL') {
initTestSet();
}
} }
selectPopVisible.value = false; selectPopVisible.value = false;
keyword.value = ''; keyword.value = '';
@ -718,6 +724,9 @@
excludeIds: new Set(excludeIds), excludeIds: new Set(excludeIds),
}; };
}); });
//
} else {
clearSelector();
} }
} }
); );