diff --git a/frontend/src/views/case-management/components/linkDefectDrawer.vue b/frontend/src/views/case-management/components/linkDefectDrawer.vue index d4debb0859..5c973caf93 100644 --- a/frontend/src/views/case-management/components/linkDefectDrawer.vue +++ b/frontend/src/views/case-management/components/linkDefectDrawer.vue @@ -13,22 +13,24 @@ @confirm="handleDrawerConfirm" @cancel="handleDrawerCancel" > -
-
{{ t('caseManagement.featureCase.defectList') }}
-
- -
-
+ + + import { ref } from 'vue'; + import { getFilterCustomFields, MsAdvanceFilter } from '@/components/pure/ms-advance-filter'; + import { FilterFormItem, FilterResult } from '@/components/pure/ms-advance-filter/type'; import MsDrawer from '@/components/pure/ms-drawer/index.vue'; import MsBaseTable from '@/components/pure/ms-table/base-table.vue'; import type { MsTableColumn, MsTableProps } from '@/components/pure/ms-table/type'; import useTable from '@/components/pure/ms-table/useTable'; import BugNamePopover from '@/views/case-management/caseManagementFeature/components/tabContent/tabBug/bugNamePopover.vue'; - import { getBugList } from '@/api/modules/bug-management'; + import { getBugList, getCustomFieldHeader, getCustomOptionHeader } from '@/api/modules/bug-management'; import { getDrawerDebugPage } from '@/api/modules/case-management/featureCase'; + import { getPlatformOptions } from '@/api/modules/project-management/menuManagement'; import { getTestPlanApiBugPage, getTestPlanBugPage, @@ -67,8 +72,11 @@ import { useI18n } from '@/hooks/useI18n'; import { useAppStore } from '@/store'; - import { BugListItem } from '@/models/bug-management'; + import { BugEditCustomField, BugListItem, BugOptionItem } from '@/models/bug-management'; + import { PoolOption } from '@/models/projectManagement/menuManagement'; + import { FilterType, ViewTypeEnum } from '@/enums/advancedFilterEnum'; import { AssociatedBugApiTypeEnum } from '@/enums/associateBugEnum'; + import { MenuEnum } from '@/enums/commonEnum'; import { TableKeyEnum } from '@/enums/tableEnum'; import debounce from 'lodash-es/debounce'; @@ -251,10 +259,130 @@ keyword: keyword.value, projectId: currentProjectId.value, sourceId: props.caseId || '', + viewId: currentCaseTable.value.viewId.value, + combineSearch: currentCaseTable.value.advanceFilter, }); currentCaseTable.value.loadList(); } + // 获取自定义字段 + const searchCustomFields = ref([]); + const getCustomFieldColumns = async () => { + try { + const res = await getCustomFieldHeader(currentProjectId.value); + searchCustomFields.value = getFilterCustomFields( + res.filter((item: BugEditCustomField) => item.fieldId !== 'title') + ); + } catch (error) { + // eslint-disable-next-line no-console + console.log(error); + } + }; + + const statusOption = ref([]); + async function initFilterOptions() { + try { + const res = await getCustomOptionHeader(appStore.currentProjectId); + statusOption.value = res.statusOption; + } catch (error) { + // eslint-disable-next-line no-console + } + } + + const platformOption = ref([]); + const initPlatformOption = async () => { + try { + const res = await getPlatformOptions(appStore.currentOrgId, MenuEnum.bugManagement); + platformOption.value = [...res, { id: 'Local', name: 'Local' }]; + } catch (error) { + // eslint-disable-next-line no-console + console.log(error); + } + }; + + const filterConfigList = computed(() => [ + { + title: 'bugManagement.ID', + dataIndex: 'num', + type: FilterType.INPUT, + }, + { + title: 'bugManagement.bugName', + dataIndex: 'title', + type: FilterType.INPUT, + }, + { + title: 'bugManagement.belongPlatform', + dataIndex: 'platform', + type: FilterType.SELECT, + selectProps: { + multiple: true, + labelKey: 'name', + valueKey: 'id', + options: platformOption.value, + }, + }, + { + title: 'caseManagement.featureCase.defectState', + dataIndex: 'status', + type: FilterType.SELECT, + selectProps: { + multiple: true, + labelKey: 'text', + options: statusOption.value, + }, + }, + { + title: 'bugManagement.numberOfCase', + dataIndex: 'relationCaseCount', + type: FilterType.NUMBER, + numberProps: { + min: 0, + precision: 0, + }, + }, + { + title: 'bugManagement.handleMan', + dataIndex: 'handleUser', + type: FilterType.MEMBER, + }, + { + 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: 'apiScenario.table.columns.updateUser', + dataIndex: 'updateUser', + type: FilterType.MEMBER, + }, + { + title: 'common.updateTime', + dataIndex: 'updateTime', + type: FilterType.DATE_PICKER, + }, + ]); + // 高级检索 + const handleAdvSearch = (filter: FilterResult, id: string) => { + keyword.value = ''; + currentCaseTable.value.setAdvanceFilter(filter, id); + getFetch(); // 基础筛选都清空 + }; + const searchList = debounce(() => { getFetch(); }, 100); @@ -269,6 +397,12 @@ } } ); + + onBeforeMount(() => { + initFilterOptions(); + getCustomFieldColumns(); + initPlatformOption(); + });