diff --git a/frontend/src/components/business/ms-associate-case/apiCaseTable.vue b/frontend/src/components/business/ms-associate-case/apiCaseTable.vue index 18037328b0..841d0f7816 100644 --- a/frontend/src/components/business/ms-associate-case/apiCaseTable.vue +++ b/frontend/src/components/business/ms-associate-case/apiCaseTable.vue @@ -7,6 +7,7 @@ baseAction: [], moreAction: [], }" + :not-show-table-filter="props.isAdvancedSearchMode" always-show-selected-count v-on="propsEvent" @row-select-change="rowSelectChange" @@ -55,6 +56,7 @@ import { ref } from 'vue'; import { TableData } from '@arco-design/web-vue'; + import { FilterFormItem, FilterResult } from '@/components/pure/ms-advance-filter/type'; import MsButton from '@/components/pure/ms-button/index.vue'; import MsBaseTable from '@/components/pure/ms-table/base-table.vue'; import { MsTableColumn } from '@/components/pure/ms-table/type'; @@ -67,10 +69,12 @@ import { useI18n } from '@/hooks/useI18n'; import useOpenNewPage from '@/hooks/useOpenNewPage'; import useTableStore from '@/hooks/useTableStore'; + import useAppStore from '@/store/modules/app'; import { characterLimit } from '@/utils'; import { ApiCaseDetail } from '@/models/apiTest/management'; import type { TableQueryParams } from '@/models/common'; + import { FilterType } from '@/enums/advancedFilterEnum'; import { CasePageApiTypeEnum } from '@/enums/associateCaseEnum'; import { CaseLinkEnum } from '@/enums/caseEnum'; import { ReportEnum, ReportStatus } from '@/enums/reportEnum'; @@ -81,10 +85,11 @@ import type { moduleKeysType } from './types'; import useModuleSelection from './useModuleSelection'; import { getPublicLinkCaseListMap } from './utils/page'; - import { casePriorityOptions } from '@/views/api-test/components/config'; + import { casePriorityOptions, caseStatusOptions } from '@/views/api-test/components/config'; const { openNewPage } = useOpenNewPage(); const { t } = useI18n(); + const appStore = useAppStore(); const props = defineProps<{ associationType: string; // 关联类型 项目 | 测试计划 | 用例评审 @@ -99,6 +104,8 @@ getPageApiType: keyof typeof CasePageApiTypeEnum; // 获取未关联分页Api extraTableParams?: TableQueryParams; // 查询表格的额外参数 protocols: string[]; + allProtocolList: string[]; + isAdvancedSearchMode?: boolean; moduleTree: MsTreeNodeData[]; modulesCount: Record; }>(); @@ -120,7 +127,7 @@ return Object.keys(ReportStatus).map((key) => { return { value: key, - ...Object.keys(ReportStatus[key]), + label: t(ReportStatus[key].label), }; }); }); @@ -236,6 +243,9 @@ const { propsRes, propsEvent, + viewId, + advanceFilter, + setAdvanceFilter, loadList, setLoadListParams, resetSelector, @@ -289,14 +299,153 @@ }); } const tableParams = await getTableParams(); - setLoadListParams(tableParams); - loadList(); - - emit('getModuleCount', { + setLoadListParams({ ...tableParams, - current: propsRes.value.msPagination?.current, - pageSize: propsRes.value.msPagination?.pageSize, + moduleIds: props.isAdvancedSearchMode ? [] : tableParams.moduleIds, + protocols: props.isAdvancedSearchMode ? props.allProtocolList : props.protocols || [], + viewId: viewId.value, + combineSearch: advanceFilter, }); + loadList(); + if (!props.isAdvancedSearchMode) { + emit('getModuleCount', { + ...tableParams, + current: propsRes.value.msPagination?.current, + pageSize: propsRes.value.msPagination?.pageSize, + }); + } + } + + const filterConfigList = computed(() => [ + { + title: 'caseManagement.featureCase.tableColumnID', + dataIndex: 'num', + type: FilterType.INPUT, + }, + { + title: 'case.caseName', + dataIndex: 'name', + type: FilterType.INPUT, + }, + { + title: 'common.belongModule', + dataIndex: 'moduleId', + type: FilterType.TREE_SELECT, + treeSelectData: props.moduleTree, + treeSelectProps: { + fieldNames: { + title: 'name', + key: 'id', + children: 'children', + }, + multiple: true, + treeCheckable: true, + treeCheckStrictly: true, + }, + }, + { + title: 'apiTestManagement.protocol', + dataIndex: 'protocol', + type: FilterType.SELECT, + selectProps: { + multiple: true, + options: props.allProtocolList?.map((item) => ({ label: item, value: item })), + }, + }, + { + title: 'case.caseLevel', + dataIndex: 'priority', + type: FilterType.SELECT, + selectProps: { + multiple: true, + options: casePriorityOptions, + }, + }, + { + title: 'case.apiParamsChange', + dataIndex: 'apiChange', + type: FilterType.BOOLEAN, + selectProps: { + options: [ + { label: t('case.withoutChanges'), value: false }, + { label: t('case.withChanges'), value: true }, + ], + }, + }, + { + title: 'apiTestManagement.path', + dataIndex: 'path', + type: FilterType.INPUT, + }, + { + title: 'apiTestManagement.apiStatus', + dataIndex: 'status', + type: FilterType.SELECT, + selectProps: { + multiple: true, + options: caseStatusOptions.map((item) => ({ label: t(item.label), value: item.value })), + }, + }, + { + title: 'case.lastReportStatus', + dataIndex: 'lastReportStatus', + type: FilterType.SELECT, + selectProps: { + multiple: true, + options: lastReportStatusListOptions.value, + }, + }, + { + title: 'case.passRate', + dataIndex: 'passRate', + type: FilterType.NUMBER, + numberProps: { + min: 0, + }, + }, + { + title: 'case.caseEnvironment', + dataIndex: 'environmentName', + type: FilterType.SELECT, + selectProps: { + labelKey: 'name', + valueKey: 'id', + multiple: true, + options: appStore.envList, + }, + }, + { + title: 'common.tag', + dataIndex: 'tags', + type: FilterType.TAGS_INPUT, + numberProps: { + min: 0, + precision: 0, + }, + }, + { + title: 'common.creator', + dataIndex: 'createUser', + type: FilterType.MEMBER, + }, + { + title: 'common.createTime', + dataIndex: 'createTime', + type: FilterType.DATE_PICKER, + }, + { + title: 'common.updateUserName', + dataIndex: 'updateUser', + type: FilterType.MEMBER, + }, + { + title: 'common.updateTime', + dataIndex: 'updateTime', + type: FilterType.DATE_PICKER, + }, + ]); + function setCaseAdvanceFilter(filter: FilterResult, id: string) { + setAdvanceFilter(filter, id); } const tableRef = ref>(); @@ -328,7 +477,7 @@ watch( () => props.activeModule, (val) => { - if (val) { + if (val && !props.isAdvancedSearchMode) { resetSelector(); resetFilterParams(); loadCaseList(); @@ -397,6 +546,8 @@ defineExpose({ getApiCaseSaveParams, loadCaseList, + filterConfigList, + setCaseAdvanceFilter, }); await tableStore.initColumn(TableKeyEnum.ASSOCIATE_CASE_API_CASE, columns, 'drawer'); diff --git a/frontend/src/components/business/ms-associate-case/apiTable.vue b/frontend/src/components/business/ms-associate-case/apiTable.vue index 5faf5b6d32..72ed4af0ed 100644 --- a/frontend/src/components/business/ms-associate-case/apiTable.vue +++ b/frontend/src/components/business/ms-associate-case/apiTable.vue @@ -8,6 +8,7 @@ baseAction: [], moreAction: [], }" + :not-show-table-filter="props.isAdvancedSearchMode" always-show-selected-count v-on="propsEvent" @filter-change="getModuleCount" @@ -39,6 +40,7 @@