feat(接口管理):接口定义用例场景列表以及回收站增加操作人的筛选

--bug=1037790 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001037790
This commit is contained in:
guoyuqi 2024-04-07 18:47:46 +08:00 committed by Craftsman
parent aff509f431
commit f605fb41b5
11 changed files with 258 additions and 19 deletions

View File

@ -309,14 +309,18 @@
and api_definition.method in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
</when>
<when test="key=='create_user'">
<when test="key=='createUser'">
and api_definition.create_user in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
</when>
<when test="key=='version_id'">
<when test="key=='versionId'">
and api_definition.version_id in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
</when>
<when test="key=='deleteUser'">
and api_definition.delete_user in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
</when>
<when test="key.startsWith('custom_single')">
and api_definition.id in (
select api_id from api_definition_custom_field where concat('custom_single_', field_id) = #{key}

View File

@ -235,11 +235,19 @@
and api_scenario.status in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
</when>
<when test="key=='create_user'">
<when test="key=='createUser'">
and api_scenario.create_user in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
</when>
<when test="key=='version_id'">
<when test="key=='updateUser'">
and api_scenario.update_user in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
</when>
<when test="key=='deleteUser'">
and api_scenario.delete_user in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
</when>
<when test="key=='versionId'">
and api_scenario.version_id in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
</when>

View File

@ -458,6 +458,12 @@
(#{value})
</foreach>
</when>
<when test="key=='delete_user' or key=='deleteUser'">
and atc.delete_user in
<foreach collection="values" item="value" separator="," open="(" close=")">
(#{value})
</foreach>
</when>
</choose>
</if>
</foreach>

View File

@ -129,6 +129,19 @@
</a-select>
<apiStatus v-else :status="record.status" size="small" />
</template>
<template #createUserFilter="{ columnConfig }">
<TableFilter
v-model:visible="createUserFilterVisible"
v-model:status-filters="createUserFilters"
:title="(columnConfig.title as string)"
:list="memberOptions"
@search="loadApiList"
>
<template #item="{ item }">
{{ item.label }}
</template>
</TableFilter>
</template>
<template #action="{ record }">
<MsButton
v-permission="['PROJECT_API_DEFINITION:READ+UPDATE']"
@ -320,6 +333,7 @@
import apiMethodSelect from '@/views/api-test/components/apiMethodSelect.vue';
import apiStatus from '@/views/api-test/components/apiStatus.vue';
import moduleTree from '@/views/api-test/management/components/moduleTree.vue';
import TableFilter from '@/views/case-management/caseManagementFeature/components/tableFilter.vue';
import {
batchDeleteDefinition,
@ -330,6 +344,7 @@
sortDefinition,
updateDefinition,
} from '@/api/modules/api-test/management';
import { getProjectOptions } from '@/api/modules/project-management/projectMember';
import { useI18n } from '@/hooks/useI18n';
import useModal from '@/hooks/useModal';
import useTableStore from '@/hooks/useTableStore';
@ -450,10 +465,13 @@
},
{
title: 'common.creator',
slotName: 'createUserName',
dataIndex: 'createUserName',
width: 180,
showDrag: true,
titleSlotName: 'createUserFilter',
showInTable: true,
showTooltip: true,
width: 200,
showDrag: true,
},
{
title: hasOperationPermission.value ? 'common.operation' : '',
@ -534,6 +552,9 @@
const methodFilters = ref<string[]>([]);
const statusFilterVisible = ref(false);
const statusFilters = ref<string[]>([]);
const createUserFilterVisible = ref(false);
const createUserFilters = ref<string[]>([]);
const memberOptions = ref<{ label: string; value: string }[]>([]);
async function getModuleIds() {
let moduleIds: string[] = [];
@ -548,6 +569,8 @@
}
async function loadApiList() {
const moduleIds = await getModuleIds();
memberOptions.value = await getProjectOptions(appStore.currentProjectId, keyword.value);
memberOptions.value = memberOptions.value.map((e: any) => ({ label: e.name, value: e.id }));
const params = {
keyword: keyword.value,
@ -557,6 +580,7 @@
filter: {
status: statusFilters.value,
method: methodFilters.value,
createUser: createUserFilters.value,
},
};
setLoadListParams(params);

View File

@ -144,6 +144,19 @@
</template>
</a-trigger>
</template>
<template #createUserFilter="{ columnConfig }">
<TableFilter
v-model:visible="createUserFilterVisible"
v-model:status-filters="createUserFilters"
:title="(columnConfig.title as string)"
:list="memberOptions"
@search="loadCaseList"
>
<template #item="{ item }">
{{ item.label }}
</template>
</TableFilter>
</template>
<template #lastReportStatusFilter="{ columnConfig }">
<a-trigger
v-model:popup-visible="lastReportStatusFilterVisible"
@ -374,6 +387,7 @@
import BatchRunModal from '@/views/api-test/components/batchRunModal.vue';
import caseAndScenarioReportDrawer from '@/views/api-test/components/caseAndScenarioReportDrawer.vue';
import ExecutionStatus from '@/views/api-test/report/component/reportStatus.vue';
import TableFilter from '@/views/case-management/caseManagementFeature/components/tableFilter.vue';
import {
batchDeleteCase,
@ -386,6 +400,7 @@
updateCasePriority,
updateCaseStatus,
} from '@/api/modules/api-test/management';
import { getProjectOptions } from '@/api/modules/project-management/projectMember';
import { useI18n } from '@/hooks/useI18n';
import useModal from '@/hooks/useModal';
import useTableStore from '@/hooks/useTableStore';
@ -540,7 +555,10 @@
},
{
title: 'case.tableColumnCreateUser',
slotName: 'createName',
dataIndex: 'createName',
titleSlotName: 'createUserFilter',
showInTable: true,
showTooltip: true,
width: 180,
showDrag: true,
@ -614,6 +632,9 @@
const statusFilters = ref<string[]>([]);
const caseFilterVisible = ref(false);
const caseFilters = ref<string[]>([]);
const createUserFilterVisible = ref(false);
const createUserFilters = ref<string[]>([]);
const memberOptions = ref<{ label: string; value: string }[]>([]);
const lastReportStatusFilterVisible = ref(false);
const lastReportStatusList = computed(() => {
return Object.keys(ReportStatus[ReportEnum.API_REPORT]);
@ -634,6 +655,9 @@
async function loadCaseList() {
const selectModules = await getModuleIds();
memberOptions.value = await getProjectOptions(appStore.currentProjectId, keyword.value);
memberOptions.value = memberOptions.value.map((e: any) => ({ label: e.name, value: e.id }));
const params = {
apiDefinitionId: props.apiDetail?.id,
keyword: keyword.value,
@ -644,6 +668,7 @@
status: statusFilters.value,
priority: caseFilters.value,
lastReportStatus: lastReportStatusFilters.value,
createUser: createUserFilters.value,
},
};
setLoadListParams(params);

View File

@ -89,6 +89,19 @@
</template>
</a-trigger>
</template>
<template #deleteUserFilter="{ columnConfig }">
<TableFilter
v-model:visible="deleteUserFilterVisible"
v-model:status-filters="deleteUserFilters"
:title="(columnConfig.title as string)"
:list="memberOptions"
@search="loadApiList"
>
<template #item="{ item }">
{{ item.label }}
</template>
</TableFilter>
</template>
<template #deleteUserName="{ record }">
<span type="text" class="px-0">{{ record.updateUserName || '-' }}</span>
</template>
@ -122,6 +135,7 @@
import useTable from '@/components/pure/ms-table/useTable';
import apiMethodName from '@/views/api-test/components/apiMethodName.vue';
import apiStatus from '@/views/api-test/components/apiStatus.vue';
import TableFilter from '@/views/case-management/caseManagementFeature/components/tableFilter.vue';
import {
batchCleanOutDefinition,
@ -130,6 +144,7 @@
getDefinitionPage,
recoverDefinition,
} from '@/api/modules/api-test/management';
import { getProjectOptions } from '@/api/modules/project-management/projectMember';
import { useI18n } from '@/hooks/useI18n';
import useModal from '@/hooks/useModal';
import useTableStore from '@/hooks/useTableStore';
@ -222,11 +237,9 @@
{
title: 'apiTestManagement.deleteUser',
slotName: 'deleteUserName',
titleSlotName: 'deleteUserFilter',
showTooltip: true,
dataIndex: 'deleteUser',
sortable: {
sortDirections: ['ascend', 'descend'],
sorter: true,
},
width: 180,
showDrag: true,
},
@ -275,6 +288,9 @@
const methodFilters = ref<string[]>([]);
const statusFilterVisible = ref(false);
const statusFilters = ref<string[]>([]);
const deleteUserFilterVisible = ref(false);
const deleteUserFilters = ref<string[]>([]);
const memberOptions = ref<{ label: string; value: string }[]>([]);
const moduleIds = computed(() => {
if (props.activeModule === 'all') {
return [];
@ -283,14 +299,21 @@
});
const tableQueryParams = ref<any>();
function loadApiList() {
async function loadApiList() {
memberOptions.value = await getProjectOptions(appStore.currentProjectId, keyword.value);
memberOptions.value = memberOptions.value.map((e: any) => ({ label: e.name, value: e.id }));
const params = {
keyword: keyword.value,
projectId: appStore.currentProjectId,
moduleIds: moduleIds.value,
deleted: true,
protocol: props.protocol,
filter: { status: statusFilters.value, method: methodFilters.value },
filter: {
status: statusFilters.value,
method: methodFilters.value,
deleteUser: deleteUserFilters.value,
},
};
setLoadListParams(params);
loadList();

View File

@ -94,6 +94,45 @@
</template>
</a-trigger>
</template>
<template #createUserFilter="{ columnConfig }">
<TableFilter
v-model:visible="createUserFilterVisible"
v-model:status-filters="createUserFilters"
:title="(columnConfig.title as string)"
:list="memberOptions"
@search="loadCaseList"
>
<template #item="{ item }">
{{ item.label }}
</template>
</TableFilter>
</template>
<template #updateUserFilter="{ columnConfig }">
<TableFilter
v-model:visible="updateUserFilterVisible"
v-model:status-filters="updateUserFilters"
:title="(columnConfig.title as string)"
:list="memberOptions"
@search="loadCaseList"
>
<template #item="{ item }">
{{ item.label }}
</template>
</TableFilter>
</template>
<template #deleteUserFilter="{ columnConfig }">
<TableFilter
v-model:visible="deleteUserFilterVisible"
v-model:status-filters="deleteUserFilters"
:title="(columnConfig.title as string)"
:list="memberOptions"
@search="loadCaseList"
>
<template #item="{ item }">
{{ item.label }}
</template>
</TableFilter>
</template>
<template #lastReportStatusFilter="{ columnConfig }">
<a-trigger
v-model:popup-visible="lastReportStatusFilterVisible"
@ -181,6 +220,7 @@
import caseLevel from '@/components/business/ms-case-associate/caseLevel.vue';
import apiStatus from '@/views/api-test/components/apiStatus.vue';
import ExecutionStatus from '@/views/api-test/report/component/reportStatus.vue';
import TableFilter from '@/views/case-management/caseManagementFeature/components/tableFilter.vue';
import {
batchDeleteRecycleCase,
@ -190,6 +230,7 @@
recoverCase,
} from '@/api/modules/api-test/management';
import { getCaseDefaultFields } from '@/api/modules/case-management/featureCase';
import { getProjectOptions } from '@/api/modules/project-management/projectMember';
import { useI18n } from '@/hooks/useI18n';
import useModal from '@/hooks/useModal';
import useTableStore from '@/hooks/useTableStore';
@ -304,7 +345,8 @@
},
{
title: 'case.tableColumnUpdateUser',
dataIndex: 'updateUser',
dataIndex: 'updateName',
titleSlotName: 'updateUserFilter',
showInTable: true,
showTooltip: true,
width: 180,
@ -325,6 +367,7 @@
{
title: 'case.tableColumnCreateUser',
dataIndex: 'createName',
titleSlotName: 'createUserFilter',
showTooltip: true,
width: 180,
showDrag: true,
@ -344,6 +387,7 @@
{
title: 'apiTestManagement.deleteUser',
dataIndex: 'deleteName',
titleSlotName: 'deleteUserFilter',
showInTable: true,
showTooltip: true,
width: 180,
@ -408,12 +452,21 @@
const lastReportStatusFilterVisible = ref(false);
const lastReportStatusList = ref<string[]>(Object.keys(ReportStatus[ReportEnum.API_REPORT]));
const lastReportStatusFilters = ref<string[]>([]);
const createUserFilterVisible = ref(false);
const createUserFilters = ref<string[]>([]);
const updateUserFilterVisible = ref(false);
const updateUserFilters = ref<string[]>([]);
const deleteUserFilterVisible = ref(false);
const deleteUserFilters = ref<string[]>([]);
const memberOptions = ref<{ label: string; value: string }[]>([]);
const moduleIds = computed(() => {
return props.activeModule === 'all' ? [] : [props.activeModule];
});
function loadCaseList() {
async function loadCaseList() {
memberOptions.value = await getProjectOptions(appStore.currentProjectId, keyword.value);
memberOptions.value = memberOptions.value.map((e: any) => ({ label: e.name, value: e.id }));
const params = {
keyword: keyword.value,
projectId: appStore.currentProjectId,
@ -423,6 +476,9 @@
status: statusFilters.value,
priority: caseFilters.value,
lastReportStatus: lastReportStatusFilters.value,
createUser: createUserFilters.value,
updateUser: updateUserFilters.value,
deleteUser: deleteUserFilters.value,
},
};
setLoadListParams(params);

View File

@ -216,6 +216,32 @@
:status="record.lastReportStatus"
/>
</template>
<template #createUserFilter="{ columnConfig }">
<TableFilter
v-model:visible="createUserFilterVisible"
v-model:status-filters="createUserFilters"
:title="(columnConfig.title as string)"
:list="memberOptions"
@search="loadScenarioList"
>
<template #item="{ item }">
{{ item.label }}
</template>
</TableFilter>
</template>
<template #updateUserFilter="{ columnConfig }">
<TableFilter
v-model:visible="updateUserFilterVisible"
v-model:status-filters="updateUserFilters"
:title="(columnConfig.title as string)"
:list="memberOptions"
@search="loadScenarioList"
>
<template #item="{ item }">
{{ item.label }}
</template>
</TableFilter>
</template>
<template #operation="{ record }">
<MsButton
v-permission="['PROJECT_API_SCENARIO:READ+UPDATE']"
@ -564,6 +590,7 @@
import BatchRunModal from '@/views/api-test/components/batchRunModal.vue';
import ExecutionStatus from '@/views/api-test/report/component/reportStatus.vue';
import operationScenarioModuleTree from '@/views/api-test/scenario/components/operationScenarioModuleTree.vue';
import TableFilter from '@/views/case-management/caseManagementFeature/components/tableFilter.vue';
import { getEnvList, getPoolId, getPoolOption } from '@/api/modules/api-test/management';
import {
@ -578,6 +605,7 @@
updateScenarioPro,
updateScenarioStatus,
} from '@/api/modules/api-test/scenario';
import { getProjectOptions } from '@/api/modules/project-management/projectMember';
import { useI18n } from '@/hooks/useI18n';
import useModal from '@/hooks/useModal';
import useTableStore from '@/hooks/useTableStore';
@ -610,6 +638,11 @@
const lastReportStatusFilters = computed(() => {
return Object.keys(ReportStatus[ReportEnum.API_SCENARIO_REPORT]);
});
const createUserFilterVisible = ref(false);
const createUserFilters = ref<string[]>([]);
const updateUserFilterVisible = ref(false);
const updateUserFilters = ref<string[]>([]);
const memberOptions = ref<{ label: string; value: string }[]>([]);
const appStore = useAppStore();
const { t } = useI18n();
const { openModal } = useModal();
@ -783,6 +816,7 @@
title: 'apiScenario.table.columns.createUser',
dataIndex: 'createUserName',
slotName: 'createUserName',
titleSlotName: 'createUserFilter',
showTooltip: true,
showDrag: true,
width: 109,
@ -791,6 +825,7 @@
title: 'apiScenario.table.columns.updateUser',
dataIndex: 'updateUserName',
slotName: 'updateUserName',
titleSlotName: 'updateUserFilter',
showTooltip: true,
showDrag: true,
width: 109,
@ -923,6 +958,8 @@
moduleIds = [props.activeModule, ...props.offspringIds];
}
}
memberOptions.value = await getProjectOptions(appStore.currentProjectId, keyword.value);
memberOptions.value = memberOptions.value.map((e: any) => ({ label: e.name, value: e.id }));
const params = {
keyword: keyword.value,
projectId: appStore.currentProjectId,
@ -931,6 +968,8 @@
lastReportStatus: lastReportStatusListFilters.value,
status: statusFilters.value,
priority: priorityFilters.value,
createUser: createUserFilters.value,
updateUser: updateUserFilters.value,
},
};
setLoadListParams(params);

View File

@ -45,6 +45,7 @@ export default {
'apiScenario.table.columns.createTime': 'Create time',
'apiScenario.table.columns.updateUser': 'Update user',
'apiScenario.table.columns.updateTime': 'Update time',
'apiScenario.table.columns.deleteUser': 'Delete User',
'apiScenario.table.columns.operation': 'Operation',
'apiScenario.table.columns.deleteTime': 'Delete time',
'api_scenario.table.tableNoDataAndPlease': 'No data yet, please',

View File

@ -45,6 +45,7 @@ export default {
'apiScenario.table.columns.updateUser': '更新人',
'apiScenario.table.columns.updateTime': '更新时间',
'apiScenario.table.columns.operation': '操作人',
'apiScenario.table.columns.deleteUser': '删除人',
'apiScenario.table.columns.deleteTime': '删除时间',
'api_scenario.table.searchPlaceholder': '通过 ID/名称/标签搜索',
'api_scenario.table.batchModalSubTitle': '(已选 {count} 个场景)',

View File

@ -139,6 +139,45 @@
:status="record.lastReportStatus"
/>
</template>
<template #createUserFilter="{ columnConfig }">
<TableFilter
v-model:visible="createUserFilterVisible"
v-model:status-filters="createUserFilters"
:title="(columnConfig.title as string)"
:list="memberOptions"
@search="loadScenarioList"
>
<template #item="{ item }">
{{ item.label }}
</template>
</TableFilter>
</template>
<template #updateUserFilter="{ columnConfig }">
<TableFilter
v-model:visible="updateUserFilterVisible"
v-model:status-filters="updateUserFilters"
:title="(columnConfig.title as string)"
:list="memberOptions"
@search="loadScenarioList"
>
<template #item="{ item }">
{{ item.label }}
</template>
</TableFilter>
</template>
<template #deleteUserFilter="{ columnConfig }">
<TableFilter
v-model:visible="deleteUserFilterVisible"
v-model:status-filters="deleteUserFilters"
:title="(columnConfig.title as string)"
:list="memberOptions"
@search="loadScenarioList"
>
<template #item="{ item }">
{{ item.label }}
</template>
</TableFilter>
</template>
<template #operation="{ record }">
<MsButton
v-permission="['PROJECT_API_SCENARIO:READ+DELETED']"
@ -176,6 +215,7 @@
import type { CaseLevel } from '@/components/business/ms-case-associate/types';
import apiStatus from '@/views/api-test/components/apiStatus.vue';
import ExecutionStatus from '@/views/api-test/report/component/reportStatus.vue';
import TableFilter from '@/views/case-management/caseManagementFeature/components/tableFilter.vue';
import {
batchDeleteScenario,
@ -184,6 +224,7 @@
getTrashScenarioPage,
recoverScenario,
} from '@/api/modules/api-test/scenario';
import { getProjectOptions } from '@/api/modules/project-management/projectMember';
import { useI18n } from '@/hooks/useI18n';
import useModal from '@/hooks/useModal';
import useTableStore from '@/hooks/useTableStore';
@ -329,8 +370,8 @@
{
title: 'apiScenario.table.columns.createUser',
dataIndex: 'createUserName',
titleSlotName: 'createUserFilter',
showTooltip: true,
titleSlotName: 'createUser',
width: 109,
showDrag: true,
},
@ -338,15 +379,15 @@
title: 'apiScenario.table.columns.updateUser',
dataIndex: 'updateUserName',
showTooltip: true,
titleSlotName: 'updateUser',
titleSlotName: 'updateUserFilter',
width: 109,
showDrag: true,
},
{
title: 'apiScenario.table.columns.operation',
title: 'apiScenario.table.columns.deleteUser',
dataIndex: 'deleteUserName',
showTooltip: true,
titleSlotName: 'deleteUser',
titleSlotName: 'deleteUserFilter',
width: 109,
showDrag: true,
},
@ -406,6 +447,13 @@
const statusFilterVisible = ref(false);
const statusFilters = ref<string[]>([]);
const createUserFilterVisible = ref(false);
const createUserFilters = ref<string[]>([]);
const updateUserFilterVisible = ref(false);
const updateUserFilters = ref<string[]>([]);
const deleteUserFilterVisible = ref(false);
const deleteUserFilters = ref<string[]>([]);
const memberOptions = ref<{ label: string; value: string }[]>([]);
const tableStore = useTableStore();
async function loadScenarioList(refreshTreeCount?: boolean) {
let moduleIds: string[] = [];
@ -416,7 +464,8 @@
moduleIds = [props.activeModule, ...props.offspringIds];
}
}
memberOptions.value = await getProjectOptions(appStore.currentProjectId, keyword.value);
memberOptions.value = memberOptions.value.map((e: any) => ({ label: e.name, value: e.id }));
const params = {
keyword: keyword.value,
projectId: appStore.currentProjectId,
@ -425,6 +474,9 @@
lastReportStatus: lastReportStatusListFilters.value,
status: statusFilters.value,
priority: priorityFilters.value,
createUser: createUserFilters.value,
updateUser: updateUserFilters.value,
deleteUser: deleteUserFilters.value,
},
};
setLoadListParams(params);