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 MSR from '@/api/http';
import { import {
batchStopRealOrdApiUrl,
batchStopRealProjectApiUrl,
batchStopRealSystemApiUrl,
deleteScheduleSysTaskUrl, deleteScheduleSysTaskUrl,
scheduleOrgCenterListUrl, scheduleOrgCenterListUrl,
scheduleProCenterListUrl, scheduleProCenterListUrl,
scheduleSysCenterListUrl, scheduleSysCenterListUrl,
stopRealOrdApiUrl,
stopRealProjectApiUrl,
stopRealSysApiUrl,
taskOrgRealCenterListUrl, taskOrgRealCenterListUrl,
taskProRealCenterListUrl, taskProRealCenterListUrl,
taskSysRealCenterListUrl, taskSysRealCenterListUrl,
@ -17,16 +23,37 @@ export function getRealSysApiCaseList(data: TableQueryParams) {
return MSR.post<CommonList<RealTaskCenterApiCaseItem>>({ url: taskSysRealCenterListUrl, data }); 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) { export function getRealOrdApiCaseList(data: TableQueryParams) {
return MSR.post<CommonList<RealTaskCenterApiCaseItem>>({ url: taskOrgRealCenterListUrl, data }); 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) { export function getRealProApiCaseList(data: TableQueryParams) {
return MSR.post<CommonList<RealTaskCenterApiCaseItem>>({ url: taskProRealCenterListUrl, data }); 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) { export function getScheduleSysApiCaseList(data: TableQueryParams) {
return MSR.post<CommonList<TimingTaskCenterApiCaseItem>>({ url: scheduleSysCenterListUrl, data }); 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 scheduleSysCenterListUrl = '/task/center/system/schedule/page';
// 系统-任务中心-删除定时任务 // 系统-任务中心-删除定时任务
export const deleteScheduleSysTaskUrl = '/task/center/schedule/delete'; 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 taskOrgRealCenterListUrl = '/task/center/api/org/real-time/page';
// 组织接口用例和场景停止实时任务
export const batchStopRealOrdApiUrl = '/task/center/api/org/stop';
// 系统-任务中心-定时任务列表 // 系统-任务中心-定时任务列表
export const scheduleOrgCenterListUrl = '/task/center/org/schedule/page'; 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 taskProRealCenterListUrl = '/task/center/api/project/real-time/page';
// 系统-任务中心-定时任务列表 // 项目-任务中心-定时任务列表
export const scheduleProCenterListUrl = '/task/center/project/schedule/page'; export const scheduleProCenterListUrl = '/task/center/project/schedule/page';
export default { // 项目-任务中心-实时任务列表
taskSysRealCenterListUrl, export const batchStopRealProjectApiUrl = '/task/center/api/project/stop';
scheduleSysCenterListUrl,
deleteScheduleSysTaskUrl, // 停止单个任务(系统)
taskOrgRealCenterListUrl, export const stopRealSysApiUrl = '/task/center/api/system/stop';
scheduleOrgCenterListUrl, // 停止单个任务(组织)
taskProRealCenterListUrl, export const stopRealOrdApiUrl = '/task/center/api/org/stop';
scheduleProCenterListUrl, // 停止单个任务(项目)
}; export const stopRealProjectApiUrl = '/task/center/api/project/stop';

View File

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

View File

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

View File

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

View File

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

View File

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