refactor(系统设置): 任务中心联调任务中心停止测试计划
This commit is contained in:
parent
95eb0aa49e
commit
2aff835068
|
@ -23,9 +23,9 @@ import {
|
|||
scheduleOrgCenterListUrl,
|
||||
scheduleProCenterListUrl,
|
||||
scheduleSysCenterListUrl,
|
||||
stopRealOrdApiUrl,
|
||||
stopRealProjectApiUrl,
|
||||
stopRealSysApiUrl,
|
||||
stopRealOrdApiUrl, stopRealOrgPlanUrl,
|
||||
stopRealProjectApiUrl, stopRealProjectPlanUrl,
|
||||
stopRealSysApiUrl, stopRealSysPlanUrl,
|
||||
systemRealTotal,
|
||||
systemScheduleTotal,
|
||||
taskOrgPlanRealCenterListUrl,
|
||||
|
@ -209,4 +209,28 @@ export function getRealProPlanList(data: TableQueryParams) {
|
|||
return MSR.post<CommonList<RealTaskCenterApiCaseItem>>({ url: taskProPlanRealCenterListUrl, data });
|
||||
}
|
||||
|
||||
export function stopRealSysPlan(id: string) {
|
||||
return MSR.get({ url: `${stopRealSysPlanUrl}/${id}` });
|
||||
}
|
||||
|
||||
export function stopRealOrgPlan(id: string) {
|
||||
return MSR.get({ url: `${stopRealOrgPlanUrl}/${id}` });
|
||||
}
|
||||
|
||||
export function stopRealProPlan(id: string) {
|
||||
return MSR.get({ url: `${stopRealProjectPlanUrl}/${id}` });
|
||||
}
|
||||
|
||||
export function batchStopRealSysPlan(data: TableQueryParams) {
|
||||
return MSR.post({ url: `${stopRealSysPlanUrl}`, data });
|
||||
}
|
||||
|
||||
export function batchStopRealOrgPlan(data: TableQueryParams) {
|
||||
return MSR.post({ url: `${stopRealOrgPlanUrl}`, data });
|
||||
}
|
||||
|
||||
export function batchStopRealProPlan(data: TableQueryParams) {
|
||||
return MSR.post({ url: `${stopRealProjectPlanUrl}`, data });
|
||||
}
|
||||
|
||||
export default {};
|
||||
|
|
|
@ -80,3 +80,7 @@ export const projectRealTotal = '/task/center/project/real/total';
|
|||
export const taskSysPlanRealCenterListUrl = '/task/center/plan/system/real-time/page';
|
||||
export const taskOrgPlanRealCenterListUrl = '/task/center/plan/org/real-time/page';
|
||||
export const taskProPlanRealCenterListUrl = '/task/center/plan/project/real-time/page';
|
||||
|
||||
export const stopRealSysPlanUrl = '/task/center/plan/project/stop';
|
||||
export const stopRealOrgPlanUrl = '/task/center/plan/org/stop';
|
||||
export const stopRealProjectPlanUrl = '/task/center/plan/project/stop';
|
||||
|
|
|
@ -398,36 +398,6 @@
|
|||
showSelectAll: true,
|
||||
}
|
||||
);
|
||||
const triggerModeApiCase = ref([]);
|
||||
const triggerModeApiScenario = ref([]);
|
||||
|
||||
const triggerModeFiltersMap = ref<Record<string, string[]>>({
|
||||
API_CASE: triggerModeApiCase.value,
|
||||
API_SCENARIO: triggerModeApiScenario.value,
|
||||
});
|
||||
|
||||
const statusFilterApiCase = ref([]);
|
||||
const statusFilterApiScenario = ref([]);
|
||||
|
||||
const statusFiltersMap = ref<Record<string, string[]>>({
|
||||
API_CASE: statusFilterApiCase.value,
|
||||
API_SCENARIO: statusFilterApiScenario.value,
|
||||
});
|
||||
|
||||
const orgApiCaseFilter = ref([]);
|
||||
const orgApiScenarioFilter = ref([]);
|
||||
|
||||
const orgFiltersMap = ref<Record<string, string[]>>({
|
||||
API_CASE: orgApiCaseFilter.value,
|
||||
API_SCENARIO: orgApiScenarioFilter.value,
|
||||
});
|
||||
|
||||
const projectApiCaseFilter = ref([]);
|
||||
const projectApiScenarioFilter = ref([]);
|
||||
const projectFiltersMap = ref<Record<string, string[]>>({
|
||||
API_CASE: projectApiCaseFilter.value,
|
||||
API_SCENARIO: projectApiScenarioFilter.value,
|
||||
});
|
||||
|
||||
function initData() {
|
||||
setLoadListParams({
|
||||
|
@ -478,10 +448,7 @@
|
|||
condition: {
|
||||
keyword: keyword.value,
|
||||
filter: {
|
||||
status: statusFiltersMap.value[props.moduleType],
|
||||
triggerMode: triggerModeFiltersMap.value[props.moduleType],
|
||||
organizationIds: orgFiltersMap.value[props.moduleType],
|
||||
projectIds: projectFiltersMap.value[props.moduleType],
|
||||
...propsRes.value.filter,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -95,7 +95,7 @@
|
|||
['RUNNING', 'RERUNNING'].includes(record.execStatus) && hasAnyPermission(permissionsMap[props.group].stop)
|
||||
"
|
||||
class="!mr-0"
|
||||
@click="stop()"
|
||||
@click="stop(record)"
|
||||
>{{ t('project.taskCenter.stop') }}
|
||||
</MsButton>
|
||||
</template>
|
||||
|
@ -105,6 +105,7 @@
|
|||
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import MsButton from '@/components/pure/ms-button/index.vue';
|
||||
|
@ -115,11 +116,18 @@
|
|||
import ExecutionStatus from '@/views/test-plan/report/component/reportStatus.vue';
|
||||
|
||||
import {
|
||||
batchStopRealOrgPlan,
|
||||
batchStopRealProPlan,
|
||||
batchStopRealSysPlan,
|
||||
getRealOrgPlanList,
|
||||
getRealProPlanList,
|
||||
getRealSysPlanList,
|
||||
stopRealOrgPlan,
|
||||
stopRealProPlan,
|
||||
stopRealSysPlan,
|
||||
} from '@/api/modules/project-management/taskCenter';
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
import useModal from '@/hooks/useModal';
|
||||
import useOpenNewPage from '@/hooks/useOpenNewPage';
|
||||
import { useTableStore } from '@/store';
|
||||
import { characterLimit } from '@/utils';
|
||||
|
@ -138,6 +146,7 @@
|
|||
const { openNewPage } = useOpenNewPage();
|
||||
|
||||
const tableStore = useTableStore();
|
||||
const { openModal } = useModal();
|
||||
|
||||
const { t } = useI18n();
|
||||
const props = defineProps<{
|
||||
|
@ -150,29 +159,35 @@
|
|||
organization: {
|
||||
stop: ['ORGANIZATION_TASK_CENTER:READ+STOP', 'PROJECT_TEST_PLAN:READ+EXECUTE'],
|
||||
jump: ['PROJECT_TEST_PLAN:READ'],
|
||||
report: ['PROJECT_TEST_PLAN:READ+EXECUTE', 'PROJECT_TEST_PLAN_REPORT:READ'],
|
||||
report: ['PROJECT_TEST_PLAN:READ', 'PROJECT_TEST_PLAN_REPORT:READ'],
|
||||
},
|
||||
system: {
|
||||
stop: ['SYSTEM_TASK_CENTER:READ+STOP', 'PROJECT_TEST_PLAN:READ+EXECUTE'],
|
||||
jump: ['PROJECT_TEST_PLAN:READ'],
|
||||
report: ['PROJECT_TEST_PLAN:READ+EXECUTE', 'PROJECT_TEST_PLAN_REPORT:READ'],
|
||||
report: ['PROJECT_TEST_PLAN:READ', 'PROJECT_TEST_PLAN_REPORT:READ'],
|
||||
},
|
||||
project: {
|
||||
stop: ['PROJECT_TEST_PLAN:READ+EXECUTE'],
|
||||
jump: ['PROJECT_TEST_PLAN:READ'],
|
||||
report: ['PROJECT_TEST_PLAN:READ+EXECUTE', 'PROJECT_TEST_PLAN_REPORT:READ'],
|
||||
report: ['PROJECT_TEST_PLAN:READ', 'PROJECT_TEST_PLAN_REPORT:READ'],
|
||||
},
|
||||
};
|
||||
|
||||
const loadRealMap = ref({
|
||||
system: {
|
||||
list: getRealSysPlanList,
|
||||
stop: stopRealSysPlan,
|
||||
batchStop: batchStopRealSysPlan,
|
||||
},
|
||||
organization: {
|
||||
list: getRealOrgPlanList,
|
||||
stop: stopRealOrgPlan,
|
||||
batchStop: batchStopRealOrgPlan,
|
||||
},
|
||||
project: {
|
||||
list: getRealProPlanList,
|
||||
stop: stopRealProPlan,
|
||||
batchStop: batchStopRealProPlan,
|
||||
},
|
||||
});
|
||||
const hasJumpPermission = computed(() => hasAnyPermission(permissionsMap[props.group].jump));
|
||||
|
@ -284,15 +299,6 @@
|
|||
width: 150,
|
||||
showDrag: true,
|
||||
},
|
||||
{
|
||||
title: 'project.taskCenter.resourcePool',
|
||||
slotName: 'poolName',
|
||||
dataIndex: 'poolName',
|
||||
showInTable: true,
|
||||
showDrag: true,
|
||||
showTooltip: true,
|
||||
width: 200,
|
||||
},
|
||||
{
|
||||
title: 'project.taskCenter.operator',
|
||||
slotName: 'operationName',
|
||||
|
@ -371,11 +377,46 @@
|
|||
excludeIds: [] as string[],
|
||||
condition: {},
|
||||
});
|
||||
function batchStopRealTask() {
|
||||
openModal({
|
||||
type: 'warning',
|
||||
title: t('project.taskCenter.batchStopTask', { num: batchParams.value.currentSelectCount }),
|
||||
content: t('project.taskCenter.stopTaskContent'),
|
||||
okText: t('project.taskCenter.confirmStop'),
|
||||
cancelText: t('common.cancel'),
|
||||
okButtonProps: {
|
||||
status: 'danger',
|
||||
},
|
||||
onBeforeOk: async () => {
|
||||
try {
|
||||
const { selectIds, selectAll, excludeIds } = batchParams.value;
|
||||
await loadRealMap.value[props.group].batchStop({
|
||||
selectIds: selectIds || [],
|
||||
selectAll,
|
||||
excludeIds: excludeIds || [],
|
||||
condition: {
|
||||
keyword: keyword.value,
|
||||
filter: {
|
||||
...propsRes.value.filter,
|
||||
},
|
||||
},
|
||||
});
|
||||
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: params?.condition || {} };
|
||||
if (event.eventTag === 'batchStop') {
|
||||
// TODO
|
||||
batchStopRealTask();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -389,8 +430,29 @@
|
|||
// TODO
|
||||
}
|
||||
|
||||
function stop() {
|
||||
// TODO
|
||||
function stop(record: any) {
|
||||
openModal({
|
||||
type: 'warning',
|
||||
title: t('project.taskCenter.stopTask', { name: characterLimit(record.name) }),
|
||||
content: t('project.taskCenter.stopTaskContent'),
|
||||
okText: t('project.taskCenter.confirmStop'),
|
||||
cancelText: t('common.cancel'),
|
||||
okButtonProps: {
|
||||
status: 'danger',
|
||||
},
|
||||
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);
|
||||
}
|
||||
},
|
||||
hideCancel: false,
|
||||
});
|
||||
}
|
||||
|
||||
function searchList() {
|
||||
|
|
Loading…
Reference in New Issue