fix(测试计划): 测试计划详情-修改请求参数中projectId的值
This commit is contained in:
parent
363b668b05
commit
26561d991f
|
@ -187,7 +187,7 @@ export interface DisassociateCaseParams {
|
|||
export interface BatchFeatureCaseParams extends BatchActionQueryParams {
|
||||
testPlanId: string;
|
||||
moduleIds?: string[];
|
||||
projectId: string;
|
||||
projectId?: string;
|
||||
}
|
||||
|
||||
export interface ExecuteFeatureCaseFormParams {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import type { MsTreeNodeData } from '@/components/business/ms-tree/types';
|
||||
|
||||
interface Tree {
|
||||
id?: string | number;
|
||||
groupId?: number;
|
||||
|
@ -157,3 +159,11 @@ export function deleteNodesByGroupId(tree: Tree[], targetGroupId: number): void
|
|||
// 对树的每个根节点调用 deleteMatchingNodes 函数,并更新树
|
||||
tree.splice(0, tree.length, ...deleteMatchingNodes(tree));
|
||||
}
|
||||
|
||||
// 找到树结构最顶层的父节点id
|
||||
export function getNodeParentId(node: MsTreeNodeData): string {
|
||||
while (node?.parent) {
|
||||
node = node.parent;
|
||||
}
|
||||
return node.id;
|
||||
}
|
||||
|
|
|
@ -132,7 +132,6 @@
|
|||
import useModal from '@/hooks/useModal';
|
||||
import useOpenNewPage from '@/hooks/useOpenNewPage';
|
||||
import useTableStore from '@/hooks/useTableStore';
|
||||
import useAppStore from '@/store/modules/app';
|
||||
import { characterLimit } from '@/utils';
|
||||
import { hasAnyPermission } from '@/utils/permission';
|
||||
|
||||
|
@ -148,6 +147,7 @@
|
|||
const props = defineProps<{
|
||||
modulesCount: Record<string, number>; // 模块数量统计对象
|
||||
moduleName: string;
|
||||
moduleParentId: string;
|
||||
activeModule: string;
|
||||
offspringIds: string[];
|
||||
planId: string;
|
||||
|
@ -164,7 +164,6 @@
|
|||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
const appStore = useAppStore();
|
||||
const tableStore = useTableStore();
|
||||
const { openModal } = useModal();
|
||||
const { openNewPage } = useOpenNewPage();
|
||||
|
@ -360,7 +359,6 @@
|
|||
const selectModules = await getModuleIds();
|
||||
const commonParams = {
|
||||
testPlanId: props.planId,
|
||||
projectId: appStore.currentProjectId,
|
||||
protocols: props.selectedProtocols,
|
||||
...(props.treeType === 'COLLECTION' ? { collectionId: collectionId.value } : { moduleIds: selectModules }),
|
||||
};
|
||||
|
@ -370,6 +368,7 @@
|
|||
keyword: keyword.value,
|
||||
filter: propsRes.value.filter,
|
||||
},
|
||||
projectId: props.activeModule !== 'all' && props.treeType === 'MODULE' ? props.moduleParentId : '',
|
||||
...commonParams,
|
||||
};
|
||||
}
|
||||
|
@ -397,7 +396,10 @@
|
|||
|
||||
async function loadCaseList(refreshTreeCount = true) {
|
||||
const tableParams = await getTableParams(false);
|
||||
setLoadListParams(tableParams);
|
||||
setLoadListParams({
|
||||
...tableParams,
|
||||
projectId: props.activeModule !== 'all' && props.treeType === 'MODULE' ? props.moduleParentId : '',
|
||||
});
|
||||
loadList();
|
||||
if (refreshTreeCount) {
|
||||
emit('getModuleCount', {
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
import { getApiCaseModule } from '@/api/modules/test-plan/testPlan';
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
import { mapTree } from '@/utils';
|
||||
import { getNodeParentId } from '@/utils/tree';
|
||||
|
||||
import { ModuleTreeNode } from '@/models/common';
|
||||
|
||||
|
@ -74,7 +75,7 @@
|
|||
treeType: 'MODULE' | 'COLLECTION';
|
||||
}>();
|
||||
const emit = defineEmits<{
|
||||
(e: 'folderNodeSelect', ids: string[], _offspringIds: string[], nodeName?: string): void;
|
||||
(e: 'folderNodeSelect', ids: string[], _offspringIds: string[], nodeName?: string, parentId?: string): void;
|
||||
(e: 'init', params: ModuleTreeNode[]): void;
|
||||
(e: 'changeProtocol', selectedProtocols: string[]): void;
|
||||
}>();
|
||||
|
@ -134,7 +135,7 @@
|
|||
return e;
|
||||
});
|
||||
activeFolder.value = node.id;
|
||||
emit('folderNodeSelect', _selectedKeys as string[], offspringIds, node.name);
|
||||
emit('folderNodeSelect', _selectedKeys as string[], offspringIds, node.name, getNodeParentId(node));
|
||||
}
|
||||
|
||||
// 初始化模块文件数量
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
:tree-type="props.treeType"
|
||||
:modules-count="modulesCount"
|
||||
:module-name="moduleName"
|
||||
:module-parent-id="moduleParentId"
|
||||
:active-module="activeFolderId"
|
||||
:offspring-ids="offspringIds"
|
||||
:module-tree="moduleTree"
|
||||
|
@ -73,15 +74,17 @@
|
|||
const caseTableRef = ref<InstanceType<typeof CaseTable>>();
|
||||
const activeFolderId = ref<string>('all');
|
||||
const moduleName = ref<string>('');
|
||||
const moduleParentId = ref<string>('');
|
||||
const offspringIds = ref<string[]>([]);
|
||||
const selectedKeys = computed({
|
||||
get: () => [activeFolderId.value],
|
||||
set: (val) => val,
|
||||
});
|
||||
function handleFolderNodeSelect(ids: string[], _offspringIds: string[], name?: string) {
|
||||
function handleFolderNodeSelect(ids: string[], _offspringIds: string[], name?: string, parentId?: string) {
|
||||
[activeFolderId.value] = ids;
|
||||
offspringIds.value = [..._offspringIds];
|
||||
moduleName.value = name ?? '';
|
||||
moduleParentId.value = parentId ?? '';
|
||||
caseTableRef.value?.resetSelector();
|
||||
}
|
||||
|
||||
|
|
|
@ -129,7 +129,6 @@
|
|||
import useModal from '@/hooks/useModal';
|
||||
import useOpenNewPage from '@/hooks/useOpenNewPage';
|
||||
import useTableStore from '@/hooks/useTableStore';
|
||||
import useAppStore from '@/store/modules/app';
|
||||
import { characterLimit } from '@/utils';
|
||||
import { hasAnyPermission } from '@/utils/permission';
|
||||
|
||||
|
@ -145,6 +144,7 @@
|
|||
const props = defineProps<{
|
||||
modulesCount: Record<string, number>; // 模块数量统计对象
|
||||
moduleName: string;
|
||||
moduleParentId: string;
|
||||
activeModule: string;
|
||||
offspringIds: string[];
|
||||
planId: string;
|
||||
|
@ -160,7 +160,6 @@
|
|||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
const appStore = useAppStore();
|
||||
const tableStore = useTableStore();
|
||||
const { openModal } = useModal();
|
||||
const { openNewPage } = useOpenNewPage();
|
||||
|
@ -341,7 +340,6 @@
|
|||
const selectModules = await getModuleIds();
|
||||
const commonParams = {
|
||||
testPlanId: props.planId,
|
||||
projectId: appStore.currentProjectId,
|
||||
...(props.treeType === 'COLLECTION' ? { collectionId: collectionId.value } : { moduleIds: selectModules }),
|
||||
};
|
||||
if (isBatch) {
|
||||
|
@ -350,6 +348,7 @@
|
|||
keyword: keyword.value,
|
||||
filter: propsRes.value.filter,
|
||||
},
|
||||
projectId: props.activeModule !== 'all' && props.treeType === 'MODULE' ? props.moduleParentId : '',
|
||||
...commonParams,
|
||||
};
|
||||
}
|
||||
|
@ -377,7 +376,10 @@
|
|||
|
||||
async function loadCaseList(refreshTreeCount = true) {
|
||||
const tableParams = await getTableParams(false);
|
||||
setLoadListParams(tableParams);
|
||||
setLoadListParams({
|
||||
...tableParams,
|
||||
projectId: props.activeModule !== 'all' && props.treeType === 'MODULE' ? props.moduleParentId : '',
|
||||
});
|
||||
loadList();
|
||||
if (refreshTreeCount) {
|
||||
emit('getModuleCount', {
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
import { getApiScenarioModule } from '@/api/modules/test-plan/testPlan';
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
import { mapTree } from '@/utils';
|
||||
import { getNodeParentId } from '@/utils/tree';
|
||||
|
||||
import { ModuleTreeNode } from '@/models/common';
|
||||
|
||||
|
@ -70,7 +71,7 @@
|
|||
treeType: 'MODULE' | 'COLLECTION';
|
||||
}>();
|
||||
const emit = defineEmits<{
|
||||
(e: 'folderNodeSelect', ids: string[], _offspringIds: string[], nodeName?: string): void;
|
||||
(e: 'folderNodeSelect', ids: string[], _offspringIds: string[], nodeName?: string, parentId?: string): void;
|
||||
(e: 'init', params: ModuleTreeNode[]): void;
|
||||
}>();
|
||||
|
||||
|
@ -139,7 +140,7 @@
|
|||
return e;
|
||||
});
|
||||
activeFolder.value = node.id;
|
||||
emit('folderNodeSelect', _selectedKeys as string[], offspringIds, node.name);
|
||||
emit('folderNodeSelect', _selectedKeys as string[], offspringIds, node.name, getNodeParentId(node));
|
||||
}
|
||||
|
||||
onBeforeMount(() => {
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
:tree-type="props.treeType"
|
||||
:modules-count="modulesCount"
|
||||
:module-name="moduleName"
|
||||
:module-parent-id="moduleParentId"
|
||||
:active-module="activeFolderId"
|
||||
:offspring-ids="offspringIds"
|
||||
:module-tree="moduleTree"
|
||||
|
@ -67,15 +68,17 @@
|
|||
const caseTableRef = ref<InstanceType<typeof CaseTable>>();
|
||||
const activeFolderId = ref<string>('all');
|
||||
const moduleName = ref<string>('');
|
||||
const moduleParentId = ref<string>('');
|
||||
const offspringIds = ref<string[]>([]);
|
||||
const selectedKeys = computed({
|
||||
get: () => [activeFolderId.value],
|
||||
set: (val) => val,
|
||||
});
|
||||
function handleFolderNodeSelect(ids: string[], _offspringIds: string[], name?: string) {
|
||||
function handleFolderNodeSelect(ids: string[], _offspringIds: string[], name?: string, parentId?: string) {
|
||||
[activeFolderId.value] = ids;
|
||||
offspringIds.value = [..._offspringIds];
|
||||
moduleName.value = name ?? '';
|
||||
moduleParentId.value = parentId ?? '';
|
||||
caseTableRef.value?.resetSelector();
|
||||
}
|
||||
|
||||
|
|
|
@ -183,6 +183,7 @@
|
|||
const props = defineProps<{
|
||||
modulesCount: Record<string, number>; // 模块数量统计对象
|
||||
moduleName: string;
|
||||
moduleParentId: string;
|
||||
activeModule: string;
|
||||
offspringIds: string[];
|
||||
planId: string;
|
||||
|
@ -385,7 +386,6 @@
|
|||
const selectModules = await getModuleIds();
|
||||
const commonParams = {
|
||||
testPlanId: props.planId,
|
||||
projectId: appStore.currentProjectId,
|
||||
...(props.treeType === 'COLLECTION' ? { collectionId: collectionId.value } : { moduleIds: selectModules }),
|
||||
};
|
||||
if (isBatch) {
|
||||
|
@ -394,6 +394,7 @@
|
|||
keyword: keyword.value,
|
||||
filter: propsRes.value.filter,
|
||||
},
|
||||
projectId: props.activeModule !== 'all' && props.treeType === 'MODULE' ? props.moduleParentId : '',
|
||||
...commonParams,
|
||||
};
|
||||
}
|
||||
|
@ -421,7 +422,10 @@
|
|||
|
||||
async function loadCaseList(refreshTreeCount = true) {
|
||||
const tableParams = await getTableParams(false);
|
||||
setLoadListParams(tableParams);
|
||||
setLoadListParams({
|
||||
...tableParams,
|
||||
projectId: props.activeModule !== 'all' && props.treeType === 'MODULE' ? props.moduleParentId : '',
|
||||
});
|
||||
loadList();
|
||||
if (refreshTreeCount) {
|
||||
emit('getModuleCount', {
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
import { getFeatureCaseModule } from '@/api/modules/test-plan/testPlan';
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
import { mapTree } from '@/utils';
|
||||
import { getNodeParentId } from '@/utils/tree';
|
||||
|
||||
import { ModuleTreeNode } from '@/models/common';
|
||||
|
||||
|
@ -70,7 +71,7 @@
|
|||
treeType: 'MODULE' | 'COLLECTION';
|
||||
}>();
|
||||
const emit = defineEmits<{
|
||||
(e: 'folderNodeSelect', ids: string[], _offspringIds: string[], nodeName?: string): void;
|
||||
(e: 'folderNodeSelect', ids: string[], _offspringIds: string[], nodeName?: string, parentId?: string): void;
|
||||
(e: 'init', params: ModuleTreeNode[]): void;
|
||||
}>();
|
||||
|
||||
|
@ -144,7 +145,7 @@
|
|||
return e;
|
||||
});
|
||||
activeFolder.value = node.id;
|
||||
emit('folderNodeSelect', _selectedKeys as string[], offspringIds, node.name);
|
||||
emit('folderNodeSelect', _selectedKeys as string[], offspringIds, node.name, getNodeParentId(node));
|
||||
}
|
||||
|
||||
onBeforeMount(() => {
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
:plan-id="planId"
|
||||
:modules-count="modulesCount"
|
||||
:module-name="moduleName"
|
||||
:module-parent-id="moduleParentId"
|
||||
:active-module="activeFolderId"
|
||||
:offspring-ids="offspringIds"
|
||||
:module-tree="moduleTree"
|
||||
|
@ -69,15 +70,17 @@
|
|||
const caseTableRef = ref<InstanceType<typeof CaseTable>>();
|
||||
const activeFolderId = ref<string>('all');
|
||||
const moduleName = ref<string>('');
|
||||
const moduleParentId = ref<string>('');
|
||||
const offspringIds = ref<string[]>([]);
|
||||
const selectedKeys = computed({
|
||||
get: () => [activeFolderId.value],
|
||||
set: (val) => val,
|
||||
});
|
||||
function handleFolderNodeSelect(ids: string[], _offspringIds: string[], name?: string) {
|
||||
function handleFolderNodeSelect(ids: string[], _offspringIds: string[], name?: string, parentId?: string) {
|
||||
[activeFolderId.value] = ids;
|
||||
offspringIds.value = [..._offspringIds];
|
||||
moduleName.value = name ?? '';
|
||||
moduleParentId.value = parentId ?? '';
|
||||
caseTableRef.value?.resetSelector();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue