feat(测试计划): 新建测试计划-创建到计划组

This commit is contained in:
teukkk 2024-06-14 11:40:37 +08:00 committed by 刘瑞斌
parent b84cdf7a54
commit c12cb63fd9
7 changed files with 67 additions and 11 deletions

View File

@ -24,7 +24,32 @@
<a-form-item field="description" :label="t('common.desc')" class="w-[732px]"> <a-form-item field="description" :label="t('common.desc')" class="w-[732px]">
<a-textarea v-model:model-value="form.description" :placeholder="t('common.pleaseInput')" :max-length="1000" /> <a-textarea v-model:model-value="form.description" :placeholder="t('common.pleaseInput')" :max-length="1000" />
</a-form-item> </a-form-item>
<a-form-item :label="t('common.belongModule')" class="w-[436px]"> <a-form-item
field="type"
:label="props.planId?.length ? t('caseManagement.featureCase.moveTo') : t('testPlan.planForm.createTo')"
>
<a-radio-group v-model:model-value="form.type">
<a-radio :value="testPlanTypeEnum.TEST_PLAN">{{ t('testPlan.testPlanGroup.module') }}</a-radio>
<a-radio :value="testPlanTypeEnum.GROUP">{{ t('testPlan.testPlanIndex.testPlanGroup') }}</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item
v-show="form.type === testPlanTypeEnum.GROUP"
field="groupId"
:label="t('testPlan.testPlanIndex.testPlanGroup')"
class="w-[436px]"
>
<a-select v-model="form.groupId" :placeholder="t('common.pleaseSelect')">
<a-option v-for="item of groupList" :key="item.id" :value="item.id">
{{ item.name }}
</a-option>
</a-select>
</a-form-item>
<a-form-item
v-show="form.type === testPlanTypeEnum.TEST_PLAN"
:label="t('common.belongModule')"
class="w-[436px]"
>
<a-tree-select <a-tree-select
v-model:modelValue="form.moduleId" v-model:modelValue="form.moduleId"
:data="props.moduleTree" :data="props.moduleTree"
@ -110,7 +135,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue'; import { ref } from 'vue';
import { FormInstance, Message, TreeNodeData, ValidatedError } from '@arco-design/web-vue'; import { FormInstance, Message, SelectOptionData, TreeNodeData, ValidatedError } from '@arco-design/web-vue';
import { cloneDeep } from 'lodash-es'; import { cloneDeep } from 'lodash-es';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
@ -118,7 +143,12 @@
import MsMoreSettingCollapse from '@/components/pure/ms-more-setting-collapse/index.vue'; import MsMoreSettingCollapse from '@/components/pure/ms-more-setting-collapse/index.vue';
import MsTagsInput from '@/components/pure/ms-tags-input/index.vue'; import MsTagsInput from '@/components/pure/ms-tags-input/index.vue';
import { addTestPlan, getTestPlanDetail, updateTestPlan } from '@/api/modules/test-plan/testPlan'; import {
addTestPlan,
getPlanGroupOptions,
getTestPlanDetail,
updateTestPlan,
} from '@/api/modules/test-plan/testPlan';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useAppStore from '@/store/modules/app'; import useAppStore from '@/store/modules/app';
@ -246,7 +276,6 @@
try { try {
const params: AddTestPlanParams = { const params: AddTestPlanParams = {
...cloneDeep(form.value), ...cloneDeep(form.value),
groupId: 'NONE',
plannedStartTime: form.value.cycle ? form.value.cycle[0] : undefined, plannedStartTime: form.value.cycle ? form.value.cycle[0] : undefined,
plannedEndTime: form.value.cycle ? form.value.cycle[1] : undefined, plannedEndTime: form.value.cycle ? form.value.cycle[1] : undefined,
projectId: appStore.currentProjectId, projectId: appStore.currentProjectId,
@ -288,12 +317,23 @@
} }
} }
const groupList = ref<SelectOptionData>([]);
async function initGroupOptions() {
try {
groupList.value = await getPlanGroupOptions(appStore.currentProjectId);
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
}
watch( watch(
() => innerVisible.value, () => innerVisible.value,
(val) => { (val) => {
if (val) { if (val) {
form.value = cloneDeep(initForm); form.value = cloneDeep(initForm);
getDetail(); getDetail();
initGroupOptions();
if (!props.planId && props.moduleId) { if (!props.planId && props.moduleId) {
form.value.moduleId = props.moduleId === 'all' ? 'root' : props.moduleId; form.value.moduleId = props.moduleId === 'all' ? 'root' : props.moduleId;
} }

View File

@ -2,7 +2,11 @@
<div class="p-[16px]"> <div class="p-[16px]">
<a-input <a-input
v-model:model-value="moduleKeyword" v-model:model-value="moduleKeyword"
:placeholder="t('caseManagement.caseReview.folderSearchPlaceholder')" :placeholder="
props.treeType === 'MODULE'
? t('caseManagement.caseReview.folderSearchPlaceholder')
: t('testPlan.testPlanGroup.newPlanPlaceHolder')
"
allow-clear allow-clear
class="mb-[8px]" class="mb-[8px]"
:max-length="255" :max-length="255"
@ -12,7 +16,7 @@
v-model:selectedProtocols="selectedProtocols" v-model:selectedProtocols="selectedProtocols"
:not-show-operation="props.treeType === 'COLLECTION'" :not-show-operation="props.treeType === 'COLLECTION'"
:active-folder="activeFolder" :active-folder="activeFolder"
:folder-name="t('apiTestManagement.allApi')" :folder-name="t('testPlan.testPlanIndex.apiCase')"
:all-count="allCount" :all-count="allCount"
:show-expand-api="false" :show-expand-api="false"
@set-active-folder="setActiveFolder" @set-active-folder="setActiveFolder"

View File

@ -2,7 +2,11 @@
<div class="p-[16px]"> <div class="p-[16px]">
<a-input <a-input
v-model:model-value="moduleKeyword" v-model:model-value="moduleKeyword"
:placeholder="t('caseManagement.caseReview.folderSearchPlaceholder')" :placeholder="
props.treeType === 'MODULE'
? t('caseManagement.caseReview.folderSearchPlaceholder')
: t('testPlan.testPlanGroup.newPlanPlaceHolder')
"
allow-clear allow-clear
class="mb-[8px]" class="mb-[8px]"
:max-length="255" :max-length="255"
@ -10,7 +14,7 @@
<MsFolderAll <MsFolderAll
v-model:isExpandAll="isExpandAll" v-model:isExpandAll="isExpandAll"
:active-folder="activeFolder" :active-folder="activeFolder"
:folder-name="t('apiScenario.allScenario')" :folder-name="t('caseManagement.featureCase.sceneCase')"
:all-count="allCount" :all-count="allCount"
@set-active-folder="setActiveFolder" @set-active-folder="setActiveFolder"
/> />

View File

@ -2,7 +2,11 @@
<div> <div>
<a-input <a-input
v-model:model-value="moduleKeyword" v-model:model-value="moduleKeyword"
:placeholder="t('caseManagement.caseReview.folderSearchPlaceholder')" :placeholder="
props.treeType === 'MODULE'
? t('caseManagement.caseReview.folderSearchPlaceholder')
: t('testPlan.testPlanGroup.newPlanPlaceHolder')
"
allow-clear allow-clear
class="mb-[8px]" class="mb-[8px]"
:max-length="255" :max-length="255"
@ -10,7 +14,7 @@
<MsFolderAll <MsFolderAll
v-model:isExpandAll="isExpandAll" v-model:isExpandAll="isExpandAll"
:active-folder="activeFolder" :active-folder="activeFolder"
:folder-name="t('caseManagement.caseReview.allCases')" :folder-name="t('testPlan.testPlanIndex.functionalUseCase')"
:all-count="allCount" :all-count="allCount"
@set-active-folder="setActiveFolder" @set-active-folder="setActiveFolder"
/> />

View File

@ -320,7 +320,7 @@
}, },
{ {
value: 'apiScenario', value: 'apiScenario',
label: t('testPlan.testPlanIndex.apiScenarioCase'), label: t('caseManagement.featureCase.sceneCase'),
}, },
{ {
value: 'defectList', value: 'defectList',

View File

@ -83,6 +83,8 @@ export default {
'testPlan.planForm.planStartAndEndTime': 'Planned start and end time', 'testPlan.planForm.planStartAndEndTime': 'Planned start and end time',
'testPlan.planForm.associateRepeatCase': 'Allow associated duplicate cases', 'testPlan.planForm.associateRepeatCase': 'Allow associated duplicate cases',
'testPlan.planForm.passThreshold': 'Pass threshold', 'testPlan.planForm.passThreshold': 'Pass threshold',
'testPlan.planForm.createTo': 'Create to',
'testPlan.planForm.selectPlanGroup': 'Select plan group',
'testPlan.planForm.repeatCaseTip1': 'Enable: Repeatedly associate the same case', 'testPlan.planForm.repeatCaseTip1': 'Enable: Repeatedly associate the same case',
'testPlan.planForm.repeatCaseTip2': 'Close: Cannot be associated with the same case repeatedly', 'testPlan.planForm.repeatCaseTip2': 'Close: Cannot be associated with the same case repeatedly',
'testPlan.planForm.passThresholdTip': 'If the pass rate reaches the specified pass threshold, the result is passed', 'testPlan.planForm.passThresholdTip': 'If the pass rate reaches the specified pass threshold, the result is passed',

View File

@ -78,6 +78,8 @@ export default {
'testPlan.planForm.planStartAndEndTime': '计划起止时间', 'testPlan.planForm.planStartAndEndTime': '计划起止时间',
'testPlan.planForm.associateRepeatCase': '允许关联重复用例', 'testPlan.planForm.associateRepeatCase': '允许关联重复用例',
'testPlan.planForm.passThreshold': '通过阀值', 'testPlan.planForm.passThreshold': '通过阀值',
'testPlan.planForm.createTo': '创建到',
'testPlan.planForm.selectPlanGroup': '选择计划组',
'testPlan.planForm.repeatCaseTip1': '开启:可重复关联同一个用例', 'testPlan.planForm.repeatCaseTip1': '开启:可重复关联同一个用例',
'testPlan.planForm.repeatCaseTip2': '关闭:不可重复关联同一用例', 'testPlan.planForm.repeatCaseTip2': '关闭:不可重复关联同一用例',
'testPlan.planForm.passThresholdTip': '通过率达到设置的通过阈值时,报告结果为通过', 'testPlan.planForm.passThresholdTip': '通过率达到设置的通过阈值时,报告结果为通过',