feat(脑图): 评审脑图&测试计划用例脑图支持表格排序

This commit is contained in:
baiqi 2024-11-04 13:48:39 +08:00 committed by Craftsman
parent 275703f0c9
commit 12fb9e86ae
8 changed files with 21 additions and 15 deletions

View File

@ -199,12 +199,7 @@ export function saveCaseMinder(data: FeatureCaseMinderUpdateParams) {
} }
// 获取脑图 // 获取脑图
export function getCaseMinder(data: { export function getCaseMinder(data: { projectId: string; moduleId: string; current: number }) {
projectId: string;
moduleId: string;
current: number;
sort?: Record<string, any>;
}) {
return MSR.post<CommonList<MinderJsonNode>>({ url: `${GetCaseMinderUrl}`, data }); return MSR.post<CommonList<MinderJsonNode>>({ url: `${GetCaseMinderUrl}`, data });
} }

View File

@ -165,6 +165,7 @@
reviewProgress: string; reviewProgress: string;
reviewPassRule: ReviewPassRule; // reviewPassRule: ReviewPassRule; //
moduleTree: ModuleTreeNode[]; moduleTree: ModuleTreeNode[];
tableSorter: Record<string, any>;
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
@ -302,6 +303,7 @@
moduleId: node.data?.id, moduleId: node.data?.id,
reviewId: route.query.id as string, reviewId: route.query.id as string,
viewStatusFlag: props.viewStatusFlag, viewStatusFlag: props.viewStatusFlag,
sort: props.tableSorter,
}); });
// //
removeFakeNode(node, loadMoreCurrent ? `tmp-${node.data?.id}` : 'fakeNode'); removeFakeNode(node, loadMoreCurrent ? `tmp-${node.data?.id}` : 'fakeNode');

View File

@ -141,7 +141,6 @@
moduleId: string; moduleId: string;
moduleName: string; moduleName: string;
modulesCount: Record<string, number>; // modulesCount: Record<string, number>; //
tableSorter: Record<string, any>;
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'save'): void; (e: 'save'): void;
@ -446,7 +445,6 @@
projectId: appStore.currentProjectId, projectId: appStore.currentProjectId,
moduleId: data.id, moduleId: data.id,
current: 1, current: 1,
sort: props.tableSorter,
}); });
const fakeNode = node.children?.find((e) => e.data?.id === 'fakeNode'); // const fakeNode = node.children?.find((e) => e.data?.id === 'fakeNode'); //
if (fakeNode) { if (fakeNode) {

View File

@ -285,6 +285,7 @@
planId: string; planId: string;
canEdit: boolean; // canEdit: boolean; //
treeType: 'MODULE' | 'COLLECTION'; treeType: 'MODULE' | 'COLLECTION';
tableSorter: Record<string, any>;
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
@ -399,6 +400,7 @@
...(props.treeType === 'COLLECTION' ? { collectionId: node.data?.id } : { moduleId: node.data?.id }), ...(props.treeType === 'COLLECTION' ? { collectionId: node.data?.id } : { moduleId: node.data?.id }),
projectId: node.data?.projectId, projectId: node.data?.projectId,
planId: props.planId, planId: props.planId,
sort: props.tableSorter,
}); });
// //
removeFakeNode(node, loadMoreCurrent ? `tmp-${node.data?.id}` : 'fakeNode'); removeFakeNode(node, loadMoreCurrent ? `tmp-${node.data?.id}` : 'fakeNode');

View File

@ -272,6 +272,7 @@ export interface CaseReviewMinderParams {
current?: number; current?: number;
reviewId: string; reviewId: string;
viewStatusFlag: boolean; // 我的评审结果 viewStatusFlag: boolean; // 我的评审结果
sort?: Record<string, any>;
} }
// 测试计划用例脑图 // 测试计划用例脑图
@ -281,4 +282,5 @@ export interface CasePlanMinderParams {
collectionId?: string; collectionId?: string;
current?: number; current?: number;
planId: string; planId: string;
sort?: Record<string, any>;
} }

View File

@ -64,7 +64,6 @@
@change="changeHandler" @change="changeHandler"
@cell-click="handleCellClick" @cell-click="handleCellClick"
@filter-change="filterChange" @filter-change="filterChange"
@sorter-change="handleSorterChange"
> >
<template #num="{ record }"> <template #num="{ record }">
<span type="text" class="one-line-text cursor-pointer px-0 text-[rgb(var(--primary-5))]"> <span type="text" class="one-line-text cursor-pointer px-0 text-[rgb(var(--primary-5))]">
@ -240,7 +239,6 @@
:module-id="props.activeFolder" :module-id="props.activeFolder"
:modules-count="modulesCount" :modules-count="modulesCount"
:module-name="props.moduleName" :module-name="props.moduleName"
:table-sorter="tableSorter"
@save="handleMinderSave" @save="handleMinderSave"
/> />
<MsDrawer v-model:visible="visible" :width="480" :mask="false"> <MsDrawer v-model:visible="visible" :width="480" :mask="false">
@ -1811,11 +1809,6 @@
emitTableParams(); emitTableParams();
} }
const tableSorter = ref<Record<string, string>>({});
function handleSorterChange(sorter: { [key: string]: string }) {
tableSorter.value = sorter;
}
async function mountedLoad() { async function mountedLoad() {
await initFilter(); await initFilter();
await initData(); await initData();

View File

@ -14,6 +14,7 @@
@keyword-search="searchCase()" @keyword-search="searchCase()"
@adv-search="handleAdvSearch" @adv-search="handleAdvSearch"
@refresh="handleRefreshAll" @refresh="handleRefreshAll"
@sorter-change="handleSorterChange"
> >
<template v-if="showType !== 'list'" #nameRight> <template v-if="showType !== 'list'" #nameRight>
<div v-if="reviewPassRule === 'MULTIPLE'" class="ml-[16px]"> <div v-if="reviewPassRule === 'MULTIPLE'" class="ml-[16px]">
@ -179,6 +180,7 @@
:module-tree="moduleTree" :module-tree="moduleTree"
:review-progress="props.reviewProgress" :review-progress="props.reviewProgress"
:review-pass-rule="props.reviewPassRule" :review-pass-rule="props.reviewPassRule"
:table-sorter="tableSorter"
@operation="handleMinderOperation" @operation="handleMinderOperation"
@handle-review-done="emit('refresh')" @handle-review-done="emit('refresh')"
/> />
@ -591,6 +593,11 @@
], ],
}; };
const tableSorter = ref<Record<string, string>>({});
function handleSorterChange(sorter: { [key: string]: string }) {
tableSorter.value = sorter;
}
function userIsReviewer(record: ReviewCaseItem) { function userIsReviewer(record: ReviewCaseItem) {
return record.reviewers.some((e) => e === userStore.id); return record.reviewers.some((e) => e === userStore.id);
} }

View File

@ -42,6 +42,7 @@
@drag-change="handleDragChange" @drag-change="handleDragChange"
@selected-change="handleTableSelect" @selected-change="handleTableSelect"
@filter-change="getModuleCount" @filter-change="getModuleCount"
@sorter-change="handleSorterChange"
> >
<template #num="{ record }"> <template #num="{ record }">
<MsButton type="text" @click="toCaseDetail(record)">{{ record.num }}</MsButton> <MsButton type="text" @click="toCaseDetail(record)">{{ record.num }}</MsButton>
@ -128,6 +129,7 @@
:tree-type="props.treeType" :tree-type="props.treeType"
:plan-id="props.planId" :plan-id="props.planId"
:can-edit="props.canEdit" :can-edit="props.canEdit"
:table-sorter="tableSorter"
@operation="handleMinderOperation" @operation="handleMinderOperation"
@refresh-plan="emit('refresh')" @refresh-plan="emit('refresh')"
/> />
@ -824,6 +826,11 @@
await testPlanFeatureCaseStore.getModuleCount(params); await testPlanFeatureCaseStore.getModuleCount(params);
} }
const tableSorter = ref<Record<string, string>>({});
function handleSorterChange(sorter: { [key: string]: string }) {
tableSorter.value = sorter;
}
/** /**
* 更新数据 * 更新数据
* @param getCount 获取模块树数量 * @param getCount 获取模块树数量