diff --git a/frontend/src/api/modules/test-plan/testPlan.ts b/frontend/src/api/modules/test-plan/testPlan.ts index 231aa8125c..60ef9874db 100644 --- a/frontend/src/api/modules/test-plan/testPlan.ts +++ b/frontend/src/api/modules/test-plan/testPlan.ts @@ -1,6 +1,7 @@ import MSR from '@/api/http/index'; import { addTestPlanModuleUrl, + AddTestPlanUrl, DeleteTestPlanModuleUrl, GetTestPlanListUrl, GetTestPlanModuleCountUrl, @@ -12,7 +13,7 @@ import { import type { CreateOrUpdateModule, UpdateModule } from '@/models/caseManagement/featureCase'; import type { CommonList, MoveModules, TableQueryParams } from '@/models/common'; import { ModuleTreeNode } from '@/models/common'; -import type { TestPlanItem } from '@/models/testPlan/testPlan'; +import type { AddTestPlanParams, TestPlanItem } from '@/models/testPlan/testPlan'; // 获取模块树 export function getTestPlanModule(params: TableQueryParams) { @@ -48,3 +49,8 @@ export function getPlanModulesCounts(data: TableQueryParams) { export function getTestPlanList(data: TableQueryParams) { return MSR.post>({ url: GetTestPlanListUrl, data }); } + +// 创建测试计划 +export function addTestPlan(data: AddTestPlanParams) { + return MSR.post({ url: AddTestPlanUrl, data }); +} diff --git a/frontend/src/api/requrls/test-plan/testPlan.ts b/frontend/src/api/requrls/test-plan/testPlan.ts index 96d2962709..4a7f8ec04b 100644 --- a/frontend/src/api/requrls/test-plan/testPlan.ts +++ b/frontend/src/api/requrls/test-plan/testPlan.ts @@ -12,3 +12,5 @@ export const DeleteTestPlanModuleUrl = '/test-plan/module/delete'; export const GetTestPlanModuleCountUrl = '/test-plan/module/count'; // 测试计划列表 export const GetTestPlanListUrl = '/test-plan/page'; +// 创建测试计划 +export const AddTestPlanUrl = '/test-plan/add'; diff --git a/frontend/src/components/pure/ms-more-setting-collapse/index.vue b/frontend/src/components/pure/ms-more-setting-collapse/index.vue new file mode 100644 index 0000000000..0b81c6a021 --- /dev/null +++ b/frontend/src/components/pure/ms-more-setting-collapse/index.vue @@ -0,0 +1,38 @@ + + + diff --git a/frontend/src/locale/en-US/common.ts b/frontend/src/locale/en-US/common.ts index f8627f47ea..e1ffb580d0 100644 --- a/frontend/src/locale/en-US/common.ts +++ b/frontend/src/locale/en-US/common.ts @@ -164,4 +164,6 @@ export default { 'common.unExecute': 'Not executed', 'common.pass': 'Pass', 'common.unPass': 'Fail pass', + 'common.belongModule': 'Belong module', + 'common.moreSetting': 'More settings', }; diff --git a/frontend/src/locale/zh-CN/common.ts b/frontend/src/locale/zh-CN/common.ts index 43c190b75e..f2dd45eada 100644 --- a/frontend/src/locale/zh-CN/common.ts +++ b/frontend/src/locale/zh-CN/common.ts @@ -164,4 +164,6 @@ export default { 'common.unExecute': '未执行', 'common.pass': '通过', 'common.unPass': '不通过', + 'common.belongModule': '所属模块', + 'common.moreSetting': '更多设置', }; diff --git a/frontend/src/models/testPlan/testPlan.ts b/frontend/src/models/testPlan/testPlan.ts index cb605741c0..3e694923b4 100644 --- a/frontend/src/models/testPlan/testPlan.ts +++ b/frontend/src/models/testPlan/testPlan.ts @@ -1,3 +1,5 @@ +import { BatchApiParams } from '../common'; + // 计划分页 export interface TestPlanItem { id?: string; @@ -24,4 +26,31 @@ export interface ResourcesItem { status: boolean; } +export interface AssociateCaseRequest extends BatchApiParams { + functionalSelectIds?: string[]; + apiSelectIds?: string[]; + apiCaseSelectIds?: string[]; + apiScenarioSelectIds?: string[]; +} + +export interface AddTestPlanParams { + id?: string; + name: string; + projectId: string; + groupId?: string; + moduleId: string; + cycle?: number[]; + plannedStartTime?: number; + plannedEndTime?: number; + tags: string[]; + description?: string; + testPlanning: boolean; // 是否开启测试规划 + automaticStatusUpdate: boolean; // 是否自定更新功能用例状态 + repeatCase: boolean; // 是否允许重复添加用例 + passThreshold: number; + type: string; + baseAssociateCaseRequest: AssociateCaseRequest; + groupOption?: boolean; +} + export default {}; diff --git a/frontend/src/views/test-plan/testPlan/components/testPlanTree.vue b/frontend/src/views/test-plan/testPlan/components/testPlanTree.vue index b509ec1c52..07dbc88df0 100644 --- a/frontend/src/views/test-plan/testPlan/components/testPlanTree.vue +++ b/frontend/src/views/test-plan/testPlan/components/testPlanTree.vue @@ -164,10 +164,7 @@ if (isSetDefaultKey) { selectedNodeKeys.value = [caseTree.value[0].id]; } - emits( - 'init', - caseTree.value.map((e) => e.name) - ); + emits('init', caseTree.value); } catch (error) { // eslint-disable-next-line no-console console.log(error); diff --git a/frontend/src/views/test-plan/testPlan/createAndEditPlanDrawer.vue b/frontend/src/views/test-plan/testPlan/createAndEditPlanDrawer.vue new file mode 100644 index 0000000000..b7503824c1 --- /dev/null +++ b/frontend/src/views/test-plan/testPlan/createAndEditPlanDrawer.vue @@ -0,0 +1,201 @@ + + + diff --git a/frontend/src/views/test-plan/testPlan/index.vue b/frontend/src/views/test-plan/testPlan/index.vue index c985051e34..a8ee5e5b51 100644 --- a/frontend/src/views/test-plan/testPlan/index.vue +++ b/frontend/src/views/test-plan/testPlan/index.vue @@ -9,7 +9,7 @@ :placeholder="t('caseManagement.featureCase.searchTip')" allow-clear /> - + {{ t('common.newCreate') }} + @@ -101,12 +102,14 @@ import MsSplitBox from '@/components/pure/ms-split-box/index.vue'; import PlanTable from './components/planTable.vue'; import TestPlanTree from './components/testPlanTree.vue'; + import CreateAndEditPlanDrawer from './createAndEditPlanDrawer.vue'; import { createPlanModuleTree } from '@/api/modules/test-plan/testPlan'; import { useI18n } from '@/hooks/useI18n'; import useAppStore from '@/store/modules/app'; import type { CaseModuleQueryParams, CreateOrUpdateModule, ValidateInfo } from '@/models/caseManagement/featureCase'; + import type { ModuleTreeNode } from '@/models/common'; import Message from '@arco-design/web-vue/es/message'; @@ -141,7 +144,6 @@ }; const addSubVisible = ref(false); - const rootModulesName = ref([]); const planTreeRef = ref(); const confirmLoading = ref(false); const confirmRef = ref(); @@ -186,8 +188,11 @@ * 设置根模块名称列表 * @param names 根模块名称列表 */ - function setRootModules(names: string[]) { - rootModulesName.value = names; + const rootModulesName = ref([]); + const folderTree = ref([]); + function setRootModules(treeNode: ModuleTreeNode[]) { + folderTree.value = treeNode; + rootModulesName.value = treeNode.map((e) => e.name); } /** @@ -195,7 +200,16 @@ */ function initModulesCount(params: any) {} - function handleSelect() {} + const showPlanDrawer = ref(false); + function handleSelect(value: string | number | Record | undefined) { + switch (value) { + case 'createPlan': + showPlanDrawer.value = true; + break; + default: + break; + } + }