feat(测试计划): 测试规划-关联用例弹窗高级搜索增加所属测试计划查询

--story=1017296 --user=吕梦园
https://www.tapd.cn/55049933/prong/tasks/view/1155049933001017296
This commit is contained in:
teukkk 2024-12-10 14:36:45 +08:00 committed by Craftsman
parent 0af9b6ed6d
commit 270af8ace5
14 changed files with 95 additions and 7 deletions

View File

@ -66,6 +66,7 @@ import {
GetTestPlanDetailUrl, GetTestPlanDetailUrl,
GetTestPlanExecutorOptionsUrl, GetTestPlanExecutorOptionsUrl,
GetTestPlanListUrl, GetTestPlanListUrl,
GetTestPlanListWithoutPageUrl,
GetTestPlanModuleCountUrl, GetTestPlanModuleCountUrl,
GetTestPlanModuleUrl, GetTestPlanModuleUrl,
GetTestPlanUsersUrl, GetTestPlanUsersUrl,
@ -136,6 +137,7 @@ import type {
TestPlanBaseParams, TestPlanBaseParams,
TestPlanDetail, TestPlanDetail,
TestPlanItem, TestPlanItem,
TestPlanWithoutPageItem,
UseCountType, UseCountType,
} from '@/models/testPlan/testPlan'; } from '@/models/testPlan/testPlan';
@ -179,6 +181,11 @@ export function getTestPlanList(data: TableQueryParams) {
return MSR.post<CommonList<TestPlanItem>>({ url: GetTestPlanListUrl, data }); return MSR.post<CommonList<TestPlanItem>>({ url: GetTestPlanListUrl, data });
} }
// 获取计划列表(无分页)
export function getTestPlanListWithoutPage(projectId: string) {
return MSR.get<TestPlanWithoutPageItem[]>({ url: `${GetTestPlanListWithoutPageUrl}/${projectId}` });
}
// 创建测试计划 // 创建测试计划
export function addTestPlan(data: AddTestPlanParams) { export function addTestPlan(data: AddTestPlanParams) {
return MSR.post({ url: AddTestPlanUrl, data }); return MSR.post({ url: AddTestPlanUrl, data });

View File

@ -12,6 +12,8 @@ export const DeleteTestPlanModuleUrl = '/test-plan/module/delete';
export const GetTestPlanModuleCountUrl = '/test-plan/module/count'; export const GetTestPlanModuleCountUrl = '/test-plan/module/count';
// 测试计划列表 // 测试计划列表
export const GetTestPlanListUrl = '/test-plan/page'; export const GetTestPlanListUrl = '/test-plan/page';
// 测试计划列表 (无分页)
export const GetTestPlanListWithoutPageUrl = '/test-plan/test-plan-list';
// 创建测试计划 // 创建测试计划
export const AddTestPlanUrl = '/test-plan/add'; export const AddTestPlanUrl = '/test-plan/add';
// 功能用例列表 // 功能用例列表

View File

@ -55,6 +55,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue'; import { ref } from 'vue';
import { TableData } from '@arco-design/web-vue'; import { TableData } from '@arco-design/web-vue';
import { type SelectOptionData } from '@arco-design/web-vue';
import { FilterFormItem, FilterResult } from '@/components/pure/ms-advance-filter/type'; import { FilterFormItem, FilterResult } from '@/components/pure/ms-advance-filter/type';
import MsButton from '@/components/pure/ms-button/index.vue'; import MsButton from '@/components/pure/ms-button/index.vue';
@ -112,6 +113,7 @@
isAdvancedSearchMode?: boolean; isAdvancedSearchMode?: boolean;
moduleTree: MsTreeNodeData[]; moduleTree: MsTreeNodeData[];
modulesCount: Record<string, any>; modulesCount: Record<string, any>;
testPlanList: SelectOptionData[];
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
@ -367,7 +369,7 @@
{ {
title: 'case.apiParamsChange', title: 'case.apiParamsChange',
dataIndex: 'apiChange', dataIndex: 'apiChange',
type: FilterType.BOOLEAN, type: FilterType.SELECT_EQUAL,
selectProps: { selectProps: {
options: [ options: [
{ label: t('case.withoutChanges'), value: false }, { label: t('case.withoutChanges'), value: false },
@ -398,6 +400,14 @@
options: lastReportStatusListOptions.value, options: lastReportStatusListOptions.value,
}, },
}, },
{
title: 'ms.taskCenter.taskBelongTestPlan',
dataIndex: 'belongTestPlan',
type: FilterType.SELECT_EQUAL,
selectProps: {
options: props.testPlanList,
},
},
{ {
title: 'case.caseEnvironment', title: 'case.caseEnvironment',
dataIndex: 'environmentName', dataIndex: 'environmentName',

View File

@ -40,6 +40,8 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { type SelectOptionData } from '@arco-design/web-vue';
import { FilterFormItem, FilterResult } from '@/components/pure/ms-advance-filter/type'; import { FilterFormItem, FilterResult } from '@/components/pure/ms-advance-filter/type';
import MsButton from '@/components/pure/ms-button/index.vue'; import MsButton from '@/components/pure/ms-button/index.vue';
import MsBaseTable from '@/components/pure/ms-table/base-table.vue'; import MsBaseTable from '@/components/pure/ms-table/base-table.vue';
@ -89,6 +91,7 @@
protocols: string[]; protocols: string[];
moduleTree: MsTreeNodeData[]; moduleTree: MsTreeNodeData[];
modulesCount: Record<string, any>; modulesCount: Record<string, any>;
testPlanList: SelectOptionData[];
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
@ -336,6 +339,14 @@
precision: 0, precision: 0,
}, },
}, },
{
title: 'ms.taskCenter.taskBelongTestPlan',
dataIndex: 'belongTestPlan',
type: FilterType.SELECT_EQUAL,
selectProps: {
options: props.testPlanList,
},
},
{ {
title: 'common.tag', title: 'common.tag',
dataIndex: 'tags', dataIndex: 'tags',

View File

@ -55,6 +55,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue'; import { ref } from 'vue';
import { type SelectOptionData } from '@arco-design/web-vue';
import { getFilterCustomFields } from '@/components/pure/ms-advance-filter'; import { getFilterCustomFields } from '@/components/pure/ms-advance-filter';
import { FilterFormItem, FilterResult } from '@/components/pure/ms-advance-filter/type'; import { FilterFormItem, FilterResult } from '@/components/pure/ms-advance-filter/type';
@ -104,6 +105,7 @@
getPageApiType: keyof typeof CasePageApiTypeEnum; // Api getPageApiType: keyof typeof CasePageApiTypeEnum; // Api
extraTableParams?: TableQueryParams; // extraTableParams?: TableQueryParams; //
isAdvancedSearchMode?: boolean; isAdvancedSearchMode?: boolean;
testPlanList: SelectOptionData[];
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
@ -378,6 +380,14 @@
dataIndex: 'attachment', dataIndex: 'attachment',
type: FilterType.INPUT, type: FilterType.INPUT,
}, },
{
title: 'ms.taskCenter.taskBelongTestPlan',
dataIndex: 'belongTestPlan',
type: FilterType.SELECT_EQUAL,
selectProps: {
options: props.testPlanList,
},
},
{ {
title: 'common.creator', title: 'common.creator',
dataIndex: 'createUser', dataIndex: 'createUser',

View File

@ -202,6 +202,7 @@
:keyword="keyword" :keyword="keyword"
:module-tree="moduleTree" :module-tree="moduleTree"
:modules-count="modulesCount" :modules-count="modulesCount"
:test-plan-list="testPlanList"
@get-module-count="initModulesCount" @get-module-count="initModulesCount"
@refresh="loadCaseList" @refresh="loadCaseList"
> >
@ -228,6 +229,7 @@
:protocols="selectedProtocols" :protocols="selectedProtocols"
:module-tree="moduleTree" :module-tree="moduleTree"
:modules-count="modulesCount" :modules-count="modulesCount"
:test-plan-list="testPlanList"
@get-module-count="initModulesCount" @get-module-count="initModulesCount"
> >
<TotalCount :total-count="totalCount" /> <TotalCount :total-count="totalCount" />
@ -253,6 +255,7 @@
:protocols="selectedProtocols" :protocols="selectedProtocols"
:module-tree="moduleTree" :module-tree="moduleTree"
:modules-count="modulesCount" :modules-count="modulesCount"
:test-plan-list="testPlanList"
@get-module-count="initModulesCount" @get-module-count="initModulesCount"
> >
<TotalCount :total-count="totalCount" /> <TotalCount :total-count="totalCount" />
@ -277,6 +280,7 @@
:total-count="totalCount" :total-count="totalCount"
:is-advanced-search-mode="isAdvancedSearchMode" :is-advanced-search-mode="isAdvancedSearchMode"
:all-protocol-list="allProtocolList" :all-protocol-list="allProtocolList"
:test-plan-list="testPlanList"
@get-module-count="initModulesCount" @get-module-count="initModulesCount"
@refresh="loadCaseList" @refresh="loadCaseList"
> >
@ -374,6 +378,7 @@
import TotalCount from './totalCount.vue'; import TotalCount from './totalCount.vue';
import { getAssociatedProjectOptions } from '@/api/modules/case-management/featureCase'; import { getAssociatedProjectOptions } from '@/api/modules/case-management/featureCase';
import { getTestPlanListWithoutPage } from '@/api/modules/test-plan/testPlan';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useVisit from '@/hooks/useVisit'; import useVisit from '@/hooks/useVisit';
import useAppStore from '@/store/modules/app'; import useAppStore from '@/store/modules/app';
@ -803,6 +808,25 @@
msAdvanceFilterRef.value?.clearFilter(); msAdvanceFilterRef.value?.clearFilter();
} }
}); });
const testPlanList = ref<SelectOptionData[]>([]);
async function getTestPlanList() {
try {
const res = await getTestPlanListWithoutPage(innerProject.value);
testPlanList.value = res.map((item) => ({ value: item.id, label: `[${item.num}] ${item.name}` }));
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
}
watch(
() => innerProject.value,
() => {
getTestPlanList();
},
{ immediate: true }
);
</script> </script>
<style scoped lang="less"> <style scoped lang="less">

View File

@ -77,6 +77,7 @@
import { getPublicLinkCaseListMap } from './utils/page'; import { getPublicLinkCaseListMap } from './utils/page';
import { casePriorityOptions } from '@/views/api-test/components/config'; import { casePriorityOptions } from '@/views/api-test/components/config';
import { scenarioStatusOptions } from '@/views/api-test/scenario/components/config'; import { scenarioStatusOptions } from '@/views/api-test/scenario/components/config';
import type { SelectOptionData } from '@arco-design/web-vue';
const { t } = useI18n(); const { t } = useI18n();
const { openNewPage } = useOpenNewPage(); const { openNewPage } = useOpenNewPage();
@ -94,6 +95,7 @@
moduleTree: MsTreeNodeData[]; moduleTree: MsTreeNodeData[];
modulesCount: Record<string, any>; modulesCount: Record<string, any>;
isAdvancedSearchMode?: boolean; isAdvancedSearchMode?: boolean;
testPlanList: SelectOptionData[];
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
@ -364,6 +366,14 @@
precision: 0, precision: 0,
}, },
}, },
{
title: 'ms.taskCenter.taskBelongTestPlan',
dataIndex: 'belongTestPlan',
type: FilterType.SELECT_EQUAL,
selectProps: {
options: props.testPlanList,
},
},
{ {
title: 'common.creator', title: 'common.creator',
dataIndex: 'createUser', dataIndex: 'createUser',

View File

@ -115,7 +115,7 @@
}" }"
/> />
<MsSelect <MsSelect
v-else-if="item.type === FilterType.SELECT || item.type === FilterType.BOOLEAN" v-else-if="item.type === FilterType.SELECT || item.type === FilterType.SELECT_EQUAL"
v-model:model-value="item.value" v-model:model-value="item.value"
allow-clear allow-clear
allow-search allow-search

View File

@ -37,7 +37,7 @@ export const operatorOptionsMap: Record<string, { value: string; label: string }
[FilterType.NUMBER]: [GT, LT, EQUAL, EMPTY, NOT_EMPTY], [FilterType.NUMBER]: [GT, LT, EQUAL, EMPTY, NOT_EMPTY],
[FilterType.SELECT]: COMMON_SELECTION_OPERATORS, [FilterType.SELECT]: COMMON_SELECTION_OPERATORS,
[FilterType.CASCADER]: COMMON_SELECTION_OPERATORS, [FilterType.CASCADER]: COMMON_SELECTION_OPERATORS,
[FilterType.BOOLEAN]: [EQUAL], [FilterType.SELECT_EQUAL]: [EQUAL],
[FilterType.MEMBER]: COMMON_SELECTION_OPERATORS, [FilterType.MEMBER]: COMMON_SELECTION_OPERATORS,
[FilterType.TAGS_INPUT]: [EMPTY, CONTAINS, NO_CONTAINS, COUNT_LT, COUNT_GT], [FilterType.TAGS_INPUT]: [EMPTY, CONTAINS, NO_CONTAINS, COUNT_LT, COUNT_GT],
[FilterType.TREE_SELECT]: [BELONG_TO, NOT_BELONG_TO], [FilterType.TREE_SELECT]: [BELONG_TO, NOT_BELONG_TO],

View File

@ -23,7 +23,7 @@ export enum FilterType {
TAGS_INPUT = 'TagsInput', TAGS_INPUT = 'TagsInput',
TREE_SELECT = 'TreeSelect', TREE_SELECT = 'TreeSelect',
TEXTAREA = 'textArea', TEXTAREA = 'textArea',
BOOLEAN = 'boolean', SELECT_EQUAL = 'SelectEqual',
CASCADER = 'Cascader', CASCADER = 'Cascader',
} }

View File

@ -99,6 +99,20 @@ export interface TestPlanDetail extends AddTestPlanParams {
apiCaseCount?: number; apiCaseCount?: number;
apiScenarioCount?: number; apiScenarioCount?: number;
} }
// 计划列表(不分页)
export interface TestPlanWithoutPageItem {
id: string;
num: number;
groupId: string;
projectId: string;
moduleId: string;
name: string;
status: planStatusType;
type: keyof typeof testPlanTypeEnum;
tags: string[] | { id: string; name: string }[];
createUser: string;
createTime: string;
}
// 计划分页 // 计划分页
export interface TestPlanItem { export interface TestPlanItem {

View File

@ -757,7 +757,7 @@
{ {
title: 'case.apiParamsChange', title: 'case.apiParamsChange',
dataIndex: 'apiChange', dataIndex: 'apiChange',
type: FilterType.BOOLEAN, type: FilterType.SELECT_EQUAL,
selectProps: { selectProps: {
options: [ options: [
{ label: t('case.withoutChanges'), value: false }, { label: t('case.withoutChanges'), value: false },

View File

@ -496,7 +496,7 @@
{ {
title: 'common.status', title: 'common.status',
dataIndex: 'enable', dataIndex: 'enable',
type: FilterType.BOOLEAN, type: FilterType.SELECT_EQUAL,
selectProps: { selectProps: {
options: [ options: [
{ label: t('system.config.email.close'), value: false }, { label: t('system.config.email.close'), value: false },

View File

@ -563,7 +563,7 @@
{ {
title: 'case.apiParamsChange', title: 'case.apiParamsChange',
dataIndex: 'apiChange', dataIndex: 'apiChange',
type: FilterType.BOOLEAN, type: FilterType.SELECT_EQUAL,
selectProps: { selectProps: {
options: [ options: [
{ label: t('case.withoutChanges'), value: false }, { label: t('case.withoutChanges'), value: false },