From 2ab459c6ad0bc4906f168f4befe236422f04123e Mon Sep 17 00:00:00 2001 From: "xinxin.wu" Date: Wed, 21 Feb 2024 11:39:03 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=81=94=E8=B0=83=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E5=81=9C=E6=AD=A2=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/project-management/taskCenter.ts | 29 ++++++- .../requrls/project-management/taskCenter.ts | 25 +++--- .../components/caseDetailDrawer.vue | 8 +- .../tabContent/tabBug/addDefectDrawer.vue | 39 ++++++---- .../tabContent/tabComment/tabCommentIndex.vue | 1 + .../tabDependency/tabDependency.vue | 4 +- .../taskCenter/component/apiCase.vue | 76 +++++++++++++++++-- 7 files changed, 148 insertions(+), 34 deletions(-) diff --git a/frontend/src/api/modules/project-management/taskCenter.ts b/frontend/src/api/modules/project-management/taskCenter.ts index 880870c001..512deaca9e 100644 --- a/frontend/src/api/modules/project-management/taskCenter.ts +++ b/frontend/src/api/modules/project-management/taskCenter.ts @@ -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>({ url: taskSysRealCenterListUrl, data }); } +export function batchStopRealSystemApi(data: TableQueryParams) { + return MSR.post>({ url: batchStopRealSystemApiUrl, data }); +} + export function getRealOrdApiCaseList(data: TableQueryParams) { return MSR.post>({ url: taskOrgRealCenterListUrl, data }); } +export function batchStopRealOrdApi(data: TableQueryParams) { + return MSR.post>({ url: batchStopRealOrdApiUrl, data }); +} + export function getRealProApiCaseList(data: TableQueryParams) { return MSR.post>({ url: taskProRealCenterListUrl, data }); } -// 定时任务 +export function batchStopRealProjectApi(data: TableQueryParams) { + return MSR.post>({ 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>({ url: scheduleSysCenterListUrl, data }); } diff --git a/frontend/src/api/requrls/project-management/taskCenter.ts b/frontend/src/api/requrls/project-management/taskCenter.ts index f15ecf9b5e..4fb9b0090a 100644 --- a/frontend/src/api/requrls/project-management/taskCenter.ts +++ b/frontend/src/api/requrls/project-management/taskCenter.ts @@ -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'; diff --git a/frontend/src/views/case-management/caseManagementFeature/components/caseDetailDrawer.vue b/frontend/src/views/case-management/caseManagementFeature/components/caseDetailDrawer.vue index bde0f91777..3d97f09a79 100644 --- a/frontend/src/views/case-management/caseManagementFeature/components/caseDetailDrawer.vue +++ b/frontend/src/views/case-management/caseManagementFeature/components/caseDetailDrawer.vue @@ -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(); + }); diff --git a/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabComment/tabCommentIndex.vue b/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabComment/tabCommentIndex.vue index 6c7e1c3944..4387069cd7 100644 --- a/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabComment/tabCommentIndex.vue +++ b/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabComment/tabCommentIndex.vue @@ -103,6 +103,7 @@ // 添加或者更新评论 async function handleUpdateOrAdd(item: CommentParams, cb: (result: boolean) => void) { + debugger; try { if (item.id) { await updateCommentList(item); diff --git a/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabDependency/tabDependency.vue b/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabDependency/tabDependency.vue index ff5f051a24..8f02c20464 100644 --- a/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabDependency/tabDependency.vue +++ b/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabDependency/tabDependency.vue @@ -181,11 +181,13 @@ const showDrawer = ref(false); const drawerRef = ref(); + // 添加前后置用例 function addCase() { showDrawer.value = true; drawerRef.value.initModules(); } + function successHandler() { initData(); } @@ -199,7 +201,7 @@ } ); - onBeforeMount(() => { + onMounted(() => { initData(); }); diff --git a/frontend/src/views/project-management/taskCenter/component/apiCase.vue b/frontend/src/views/project-management/taskCenter/component/apiCase.vue index 27c8928397..ddbc4f0cc9 100644 --- a/frontend/src/views/project-management/taskCenter/component/apiCase.vue +++ b/frontend/src/views/project-management/taskCenter/component/apiCase.vue @@ -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(''); const statusFilterVisible = ref(false); const statusListFilters = ref(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({ + 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(() => {