feat(接口测试): 场景表格支持拖拽排序
This commit is contained in:
parent
69fc71c3d3
commit
6442bd7641
|
@ -14,6 +14,7 @@ import {
|
|||
DebugScenarioUrl,
|
||||
DeleteModuleUrl,
|
||||
DeleteScenarioUrl,
|
||||
dragSortUrl,
|
||||
ExecuteHistoryUrl,
|
||||
ExecuteScenarioUrl,
|
||||
FollowScenarioUrl,
|
||||
|
@ -64,7 +65,14 @@ import {
|
|||
ScenarioHistoryPageParams,
|
||||
ScenarioStepResourceInfo,
|
||||
} from '@/models/apiTest/scenario';
|
||||
import { AddModuleParams, CommonList, ModuleTreeNode, MoveModules, TransferFileParams } from '@/models/common';
|
||||
import {
|
||||
AddModuleParams,
|
||||
CommonList,
|
||||
DragSortParams,
|
||||
ModuleTreeNode,
|
||||
MoveModules,
|
||||
TransferFileParams,
|
||||
} from '@/models/common';
|
||||
import { ApiScenarioStatus, ScenarioStepType } from '@/enums/apiEnum';
|
||||
|
||||
import type { RequestParam as CaseRequestParam } from '@/views/api-test/components/requestComposition/index.vue';
|
||||
|
@ -278,6 +286,11 @@ export function updateScenarioStatus(id: string | number, status: ApiScenarioSta
|
|||
return MSR.get({ url: `${UpdateScenarioStatusUrl}/${id}/${status}` });
|
||||
}
|
||||
|
||||
// 拖拽排序
|
||||
export function dragSort(data: DragSortParams) {
|
||||
return MSR.post({ url: dragSortUrl, data });
|
||||
}
|
||||
|
||||
export function updateScenarioPro(id: string | number, priority: CaseLevel | undefined) {
|
||||
return MSR.get({ url: `${UpdateScenarioPriorityUrl}/${id}/${priority}` });
|
||||
}
|
||||
|
|
|
@ -27,7 +27,8 @@ export const BatchEditScenarioUrl = '/api/scenario/batch-operation/edit'; // 批
|
|||
export const BatchRunScenarioUrl = '/api/scenario/batch-operation/run'; // 批量执行接口场景
|
||||
export const UpdateScenarioPriorityUrl = '/api/scenario/update-priority'; // 场景更新等级
|
||||
export const UpdateScenarioStatusUrl = '/api/scenario/update-status'; // 场景更新状态
|
||||
|
||||
// 场景拖拽排序
|
||||
export const dragSortUrl = '/api/scenario/edit/pos';
|
||||
// 回收站相关
|
||||
export const GetTrashModuleTreeUrl = '/api/scenario/module/trash/tree';
|
||||
export const GetTrashModuleCountUrl = '/api/scenario/module/trash/count';
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
v-on="propsEvent"
|
||||
@selected-change="handleTableSelect"
|
||||
@batch-action="handleTableBatch"
|
||||
@drag-change="changeHandler"
|
||||
@module-change="loadScenarioList(false)"
|
||||
>
|
||||
<template #statusFilter="{ columnConfig }">
|
||||
|
@ -622,6 +623,7 @@
|
|||
batchRecycleScenario,
|
||||
batchRunScenario,
|
||||
deleteScheduleConfig,
|
||||
dragSort,
|
||||
getScenarioPage,
|
||||
recycleScenario,
|
||||
scenarioScheduleConfig,
|
||||
|
@ -638,6 +640,7 @@
|
|||
|
||||
import { Environment } from '@/models/apiTest/management';
|
||||
import { ApiScenarioScheduleConfig, ApiScenarioTableItem, ApiScenarioUpdateDTO } from '@/models/apiTest/scenario';
|
||||
import { DragSortParams } from '@/models/common';
|
||||
import { ResourcePoolItem } from '@/models/setting/resourcePool';
|
||||
import { ApiScenarioStatus } from '@/enums/apiEnum';
|
||||
import { ReportEnum, ReportStatus } from '@/enums/reportEnum';
|
||||
|
@ -1489,6 +1492,17 @@
|
|||
);
|
||||
}
|
||||
|
||||
// 拖拽排序
|
||||
async function changeHandler(params: DragSortParams) {
|
||||
try {
|
||||
await dragSort(params);
|
||||
Message.success(t('caseManagement.featureCase.sortSuccess'));
|
||||
loadScenarioList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
onBeforeMount(() => {
|
||||
loadScenarioList();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue