feat(功能用例): 功能用例表格支持是否显示子目录数据

This commit is contained in:
song-tianyang 2024-03-20 19:16:00 +08:00 committed by Craftsman
parent 5674d80bb5
commit 8fc3fc6283
2 changed files with 42 additions and 22 deletions

View File

@ -45,6 +45,7 @@
v-on="propsEvent"
@batch-action="handleTableBatch"
@change="changeHandler"
@module-change="initData()"
>
<template #num="{ record, rowIndex }">
<span type="text" class="px-0" @click="showCaseDetail(record.id, rowIndex)">{{ record.num }}</span>
@ -878,10 +879,19 @@
const caseFilters = ref<string[]>([]);
const executeResultFilters = ref(Object.keys(executionResultMap));
function initTableParams() {
async function initTableParams() {
let moduleIds: string[] = [];
if (props.activeFolder && props.activeFolder !== 'all') {
moduleIds = [...featureCaseStore.moduleId];
const getAllChildren = await tableStore.getSubShow(TableKeyEnum.CASE_MANAGEMENT_TABLE);
if (getAllChildren) {
moduleIds = [...featureCaseStore.moduleId, ...props.offspringIds];
}
}
return {
keyword: keyword.value,
moduleIds: props.activeFolder === 'all' ? [] : [props.activeFolder, ...props.offspringIds],
moduleIds,
projectId: currentProjectId.value,
filter: {
@ -899,10 +909,10 @@
};
}
//
function emitTableParams() {
const moduleIds = props.activeFolder === 'all' ? [] : [props.activeFolder, ...props.offspringIds];
async function emitTableParams() {
const tableParams = await initTableParams();
emit('init', {
...initTableParams(),
...tableParams,
current: propsRes.value.msPagination?.current,
pageSize: propsRes.value.msPagination?.pageSize,
});
@ -938,13 +948,8 @@
}
const executeResultFilterList = ref(getExecuteResultList());
function getLoadListParams() {
if (props.activeFolder === 'all') {
searchParams.value.moduleIds = [];
} else {
searchParams.value.moduleIds = [...featureCaseStore.moduleId, ...props.offspringIds];
}
setLoadListParams(initTableParams());
async function getLoadListParams() {
setLoadListParams(await initTableParams());
}
//
@ -954,8 +959,8 @@
//
async function initData() {
getLoadListParams();
loadList();
await getLoadListParams();
await loadList();
emitTableParams();
}

View File

@ -94,6 +94,7 @@
@selected-change="handleTableSelect"
v-on="propsEvent"
@batch-action="handleTableBatch"
@module-change="initRecycleList()"
>
<template #num="{ record }">
<span class="flex w-full">{{ record.num }}</span>
@ -677,10 +678,18 @@
};
}
function initTableParams() {
async function initTableParams() {
let moduleIds: string[] = [];
if (activeFolder.value !== 'all') {
moduleIds = [activeFolder.value];
const getAllChildren = await tableStore.getSubShow(TableKeyEnum.CASE_MANAGEMENT_RECYCLE_TABLE);
if (getAllChildren) {
moduleIds = [activeFolder.value, ...offspringIds.value];
}
}
return {
keyword: keyword.value,
moduleIds: activeFolder.value === 'all' ? [] : [activeFolder.value, ...offspringIds.value],
moduleIds,
projectId: currentProjectId.value,
filter: {
reviewStatus: statusFilters.value,
@ -699,22 +708,28 @@
}
//
function initRecycleModulesCount() {
async function initRecycleModulesCount() {
const tableParams = await initTableParams();
featureCaseStore.getRecycleModulesCount({
...initTableParams(),
...tableParams,
current: propsRes.value.msPagination?.current,
pageSize: propsRes.value.msPagination?.pageSize,
});
}
//
function getLoadListParams() {
async function getLoadListParams() {
if (activeFolder.value === 'all') {
searchParams.value.moduleIds = [];
} else {
searchParams.value.moduleIds = [activeFolder.value, ...offspringIds.value];
const getAllChildren = await tableStore.getSubShow(TableKeyEnum.CASE_MANAGEMENT_RECYCLE_TABLE);
if (getAllChildren) {
searchParams.value.moduleIds = [activeFolder.value, ...offspringIds.value];
} else {
searchParams.value.moduleIds = [activeFolder.value];
}
}
setLoadListParams(initTableParams());
setLoadListParams(await initTableParams());
}
//
@ -725,7 +740,7 @@
//
async function initRecycleList() {
getLoadListParams();
await getLoadListParams();
await loadList();
initRecycleModulesCount();
}