feat: 联调任务中心停止任务

This commit is contained in:
xinxin.wu 2024-02-21 11:39:03 +08:00 committed by 刘瑞斌
parent 6a9b37f86c
commit 2ab459c6ad
7 changed files with 148 additions and 34 deletions

View File

@ -1,9 +1,15 @@
import MSR from '@/api/http';
import {
batchStopRealOrdApiUrl,
batchStopRealProjectApiUrl,
batchStopRealSystemApiUrl,
deleteScheduleSysTaskUrl,
scheduleOrgCenterListUrl,
scheduleProCenterListUrl,
scheduleSysCenterListUrl,
stopRealOrdApiUrl,
stopRealProjectApiUrl,
stopRealSysApiUrl,
taskOrgRealCenterListUrl,
taskProRealCenterListUrl,
taskSysRealCenterListUrl,
@ -17,16 +23,37 @@ export function getRealSysApiCaseList(data: TableQueryParams) {
return MSR.post<CommonList<RealTaskCenterApiCaseItem>>({ url: taskSysRealCenterListUrl, data });
}
export function batchStopRealSystemApi(data: TableQueryParams) {
return MSR.post<CommonList<RealTaskCenterApiCaseItem>>({ url: batchStopRealSystemApiUrl, data });
}
export function getRealOrdApiCaseList(data: TableQueryParams) {
return MSR.post<CommonList<RealTaskCenterApiCaseItem>>({ url: taskOrgRealCenterListUrl, data });
}
export function batchStopRealOrdApi(data: TableQueryParams) {
return MSR.post<CommonList<RealTaskCenterApiCaseItem>>({ url: batchStopRealOrdApiUrl, data });
}
export function getRealProApiCaseList(data: TableQueryParams) {
return MSR.post<CommonList<RealTaskCenterApiCaseItem>>({ url: taskProRealCenterListUrl, data });
}
// 定时任务
export function batchStopRealProjectApi(data: TableQueryParams) {
return MSR.post<CommonList<RealTaskCenterApiCaseItem>>({ url: batchStopRealProjectApiUrl, data });
}
export function stopRealSysApi(id: string) {
return MSR.get({ url: `${stopRealSysApiUrl}/${id}` });
}
export function stopRealOrdApi(id: string) {
return MSR.get({ url: `${stopRealOrdApiUrl}/${id}` });
}
export function stopRealProjectApi(id: string) {
return MSR.get({ url: `${stopRealProjectApiUrl}/${id}` });
}
// 定时任务
export function getScheduleSysApiCaseList(data: TableQueryParams) {
return MSR.post<CommonList<TimingTaskCenterApiCaseItem>>({ url: scheduleSysCenterListUrl, data });
}

View File

@ -5,11 +5,16 @@ export const taskSysRealCenterListUrl = '/task/center/api/system/real-time/page'
export const scheduleSysCenterListUrl = '/task/center/system/schedule/page';
// 系统-任务中心-删除定时任务
export const deleteScheduleSysTaskUrl = '/task/center/schedule/delete';
// 系统接口用例和场景停止实时任务
export const batchStopRealSystemApiUrl = '/task/center/api/system/stop';
// 组织管理
// 任务中心-实时任务-接口用例/场景
export const taskOrgRealCenterListUrl = '/task/center/api/org/real-time/page';
// 组织接口用例和场景停止实时任务
export const batchStopRealOrdApiUrl = '/task/center/api/org/stop';
// 系统-任务中心-定时任务列表
export const scheduleOrgCenterListUrl = '/task/center/org/schedule/page';
@ -17,15 +22,15 @@ export const scheduleOrgCenterListUrl = '/task/center/org/schedule/page';
// 任务中心-实时任务-接口用例/场景
export const taskProRealCenterListUrl = '/task/center/api/project/real-time/page';
// 系统-任务中心-定时任务列表
// 项目-任务中心-定时任务列表
export const scheduleProCenterListUrl = '/task/center/project/schedule/page';
export default {
taskSysRealCenterListUrl,
scheduleSysCenterListUrl,
deleteScheduleSysTaskUrl,
taskOrgRealCenterListUrl,
scheduleOrgCenterListUrl,
taskProRealCenterListUrl,
scheduleProCenterListUrl,
};
// 项目-任务中心-实时任务列表
export const batchStopRealProjectApiUrl = '/task/center/api/project/stop';
// 停止单个任务(系统)
export const stopRealSysApiUrl = '/task/center/api/system/stop';
// 停止单个任务(组织)
export const stopRealOrdApiUrl = '/task/center/api/org/stop';
// 停止单个任务(项目)
export const stopRealProjectApiUrl = '/task/center/api/project/stop';

View File

@ -362,6 +362,7 @@
};
featureCaseStore.initCountMap(countMap);
}
function loadedCase(detail: DetailCase) {
getCaseTree();
detailInfo.value = { ...detail };
@ -398,7 +399,7 @@
followLoading.value = true;
try {
if (detailInfo.value.id) {
await followerCaseRequest({ userId: userStore.userInfo.id as string, functionalCaseId: detailInfo.value.id });
await followerCaseRequest({ userId: userStore.id as string, functionalCaseId: detailInfo.value.id });
updateSuccess();
Message.success(
detailInfo.value.followFlag
@ -547,7 +548,6 @@
if (val) {
showDrawerVisible.value = val;
activeTab.value = 'detail';
settingDrawerRef.value.getTabModule();
}
}
);
@ -609,6 +609,10 @@
}
}
);
onMounted(() => {
settingDrawerRef.value.getTabModule();
});
</script>
<style scoped lang="less">

View File

@ -111,19 +111,32 @@
});
}
onBeforeMount(async () => {
templateOptions.value = await getTemplateOption(appStore.currentProjectId);
form.value.templateId = templateOptions.value.find((item) => item.enableDefault)?.id as string;
const result = await getTemplateDetailInfo({ id: form.value.templateId, projectId: appStore.currentProjectId });
templateCustomFields.value = result.customFields.map((item: any) => {
return {
id: item.fieldId,
name: item.fieldName,
type: item.type,
value: item.defaultValue || '',
};
});
});
async function initBugTemplate() {
try {
templateOptions.value = await getTemplateOption(appStore.currentProjectId);
form.value.templateId = templateOptions.value.find((item) => item.enableDefault)?.id as string;
const result = await getTemplateDetailInfo({ id: form.value.templateId, projectId: appStore.currentProjectId });
templateCustomFields.value = result.customFields.map((item: any) => {
return {
id: item.fieldId,
name: item.fieldName,
type: item.type,
value: item.defaultValue || '',
};
});
} catch (error) {
console.log(error);
}
}
watch(
() => showDrawer.value,
(val) => {
if (val) {
initBugTemplate();
}
}
);
</script>
<style scoped></style>

View File

@ -103,6 +103,7 @@
//
async function handleUpdateOrAdd(item: CommentParams, cb: (result: boolean) => void) {
debugger;
try {
if (item.id) {
await updateCommentList(item);

View File

@ -181,11 +181,13 @@
const showDrawer = ref<boolean>(false);
const drawerRef = ref();
//
function addCase() {
showDrawer.value = true;
drawerRef.value.initModules();
}
function successHandler() {
initData();
}
@ -199,7 +201,7 @@
}
);
onBeforeMount(() => {
onMounted(() => {
initData();
});
</script>

View File

@ -71,13 +71,21 @@
import ExecutionStatus from './executionStatus.vue';
import {
batchStopRealOrdApi,
batchStopRealProjectApi,
batchStopRealSystemApi,
getRealOrdApiCaseList,
getRealProApiCaseList,
getRealSysApiCaseList,
stopRealOrdApi,
stopRealProjectApi,
stopRealSysApi,
} from '@/api/modules/project-management/taskCenter';
import { useI18n } from '@/hooks/useI18n';
import useModal from '@/hooks/useModal';
import { characterLimit } from '@/utils';
import { BatchApiParams } from '@/models/common';
import { ExecutionMethodsLabel, TaskCenterEnum } from '@/enums/taskCenter';
import { TaskStatus } from './utils';
@ -90,7 +98,6 @@
moduleType: keyof typeof TaskCenterEnum;
name: string;
}>();
const keyword = ref<string>('');
const statusFilterVisible = ref(false);
const statusListFilters = ref<string[]>(Object.keys(TaskStatus[props.moduleType]));
@ -105,9 +112,21 @@
});
const loadRealMap = ref({
system: getRealSysApiCaseList,
organization: getRealOrdApiCaseList,
project: getRealProApiCaseList,
system: {
list: getRealSysApiCaseList,
stop: stopRealSysApi,
batchStop: batchStopRealSystemApi,
},
organization: {
list: getRealOrdApiCaseList,
stop: stopRealOrdApi,
batchStop: batchStopRealOrdApi,
},
project: {
list: getRealProApiCaseList,
stop: stopRealProjectApi,
batchStop: batchStopRealProjectApi,
},
});
const columns: MsTableColumn = [
@ -181,7 +200,7 @@
];
const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector, setProps } = useTable(
loadRealMap.value[props.group],
loadRealMap.value[props.group].list,
{
columns,
scroll: {
@ -215,7 +234,47 @@
},
],
};
function handleTableBatch(event: BatchActionParams, params: BatchActionQueryParams) {}
const batchParams = ref<BatchApiParams>({
selectIds: [],
selectAll: false,
excludeIds: [] as string[],
condition: {},
});
function batchStopRealTask() {
openModal({
type: 'warning',
title: t('project.taskCenter.batchStopTask', { num: batchParams.value.selectIds.length }),
content: t('project.taskCenter.stopTaskContent'),
okText: t('project.taskCenter.confirmStop'),
cancelText: t('common.cancel'),
okButtonProps: {
status: 'danger',
},
onBeforeOk: async () => {
try {
const { selectIds, selectAll } = batchParams.value;
await loadRealMap.value[props.group].batchStop({
selectIds: selectAll ? [] : selectIds,
selectAll,
});
resetSelector();
Message.success(t('project.taskCenter.stopSuccess'));
initData();
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
},
hideCancel: false,
});
}
function handleTableBatch(event: BatchActionParams, params: BatchActionQueryParams) {
batchParams.value = { ...params, selectIds: params?.selectedIds || [], condition: {} };
if (event.eventTag === 'batchStop') {
batchStopRealTask();
}
}
function searchList() {
resetSelector();
@ -225,7 +284,7 @@
function stop(record: any) {
openModal({
type: 'warning',
title: t('project.taskCenter.batchStopTask', { num: 3 }),
title: t('project.taskCenter.stopTask', { name: characterLimit(record.name) }),
content: t('project.taskCenter.stopTaskContent'),
okText: t('project.taskCenter.confirmStop'),
cancelText: t('common.cancel'),
@ -234,8 +293,10 @@
},
onBeforeOk: async () => {
try {
await loadRealMap.value[props.group].stop(record.id);
resetSelector();
Message.success(t('project.taskCenter.stopSuccess'));
initData();
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
@ -244,6 +305,7 @@
hideCancel: false,
});
}
function execution(record: any) {}
onBeforeMount(() => {