feat: 任务中心需求调整&补充&优化报告状态筛选
This commit is contained in:
parent
ad1c56290e
commit
a06eb32fcc
|
@ -14,6 +14,7 @@ import {
|
|||
taskOrgRealCenterListUrl,
|
||||
taskProRealCenterListUrl,
|
||||
taskSysRealCenterListUrl,
|
||||
updateRunRulesUrl,
|
||||
} from '@/api/requrls/project-management/taskCenter';
|
||||
|
||||
import type { CommonList, TableQueryParams } from '@/models/common';
|
||||
|
@ -75,4 +76,7 @@ export function deleteScheduleSysTask(id: string) {
|
|||
export function switchSchedule(id: string) {
|
||||
return MSR.get({ url: `${enableSchedule}/${id}` });
|
||||
}
|
||||
export function updateRunRules(id: string, data: string) {
|
||||
return MSR.get({ url: `${updateRunRulesUrl}/${id}`, data });
|
||||
}
|
||||
export default {};
|
||||
|
|
|
@ -36,3 +36,5 @@ export const stopRealSysApiUrl = '/task/center/api/system/stop';
|
|||
export const stopRealOrdApiUrl = '/task/center/api/org/stop';
|
||||
// 停止单个任务(项目)
|
||||
export const stopRealProjectApiUrl = '/task/center/api/project/stop';
|
||||
// 更新定时任务运行规则
|
||||
export const updateRunRulesUrl = '/task/center/schedule/update';
|
||||
|
|
|
@ -432,7 +432,7 @@
|
|||
});
|
||||
const moduleTree = computed(() => mapTree(props.moduleTree, (node) => ({ ...node, draggable: false })));
|
||||
const syncFrequencyOptions = [
|
||||
{ label: t('apiTestManagement.timeTaskHour'), value: '0 0 0/1 * * ? ' },
|
||||
{ label: t('apiTestManagement.timeTaskHour'), value: '0 0 0/1 * * ?' },
|
||||
{ label: t('apiTestManagement.timeTaskSixHour'), value: '0 0 0/6 * * ?' },
|
||||
{ label: t('apiTestManagement.timeTaskTwelveHour'), value: '0 0 0/12 * * ?' },
|
||||
{ label: t('apiTestManagement.timeTaskDay'), value: '0 0 0 * * ?' },
|
||||
|
|
|
@ -49,10 +49,7 @@
|
|||
v-if="!(step.children && step.children.length && showApiType.includes(step.stepType))"
|
||||
class="flex cursor-pointer items-center gap-[2px] text-[var(--color-text-4)]"
|
||||
>
|
||||
<MsIcon
|
||||
:type="step.expanded ? 'icon-icon_split-turn-down-left' : 'icon-icon_split_turn-down_arrow'"
|
||||
:size="14"
|
||||
/>
|
||||
<MsIcon :type="'icon-icon_split_turn-down_arrow'" :size="14" />
|
||||
<span class="mx-1"> {{ step.children?.length || 0 }}</span>
|
||||
</div>
|
||||
</a-tooltip>
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
import StepTree from './step/stepTree.vue';
|
||||
|
||||
import type { ReportDetail, ScenarioItemType } from '@/models/apiTest/report';
|
||||
import { ScenarioStepType } from '@/enums/apiEnum';
|
||||
|
||||
import { addFoldField } from '../utils';
|
||||
|
||||
|
@ -89,6 +90,12 @@
|
|||
},
|
||||
{ deep: true, immediate: true }
|
||||
);
|
||||
const showApiType = ref<string[]>([
|
||||
ScenarioStepType.API,
|
||||
ScenarioStepType.API_CASE,
|
||||
ScenarioStepType.CUSTOM_REQUEST,
|
||||
ScenarioStepType.SCRIPT,
|
||||
]);
|
||||
|
||||
function searchStep() {
|
||||
const splitLevel = props.keyWords.split('-');
|
||||
|
@ -97,20 +104,32 @@
|
|||
const search = (_data: ScenarioItemType[]) => {
|
||||
const result: ScenarioItemType[] = [];
|
||||
_data.forEach((item) => {
|
||||
const isStepChildren = item.children && item?.children.length && showApiType.value.includes(item.stepType);
|
||||
if (
|
||||
stepType.includes(item.stepType) &&
|
||||
((item.status && item.status === stepTypeStatus && stepTypeStatus !== 'scriptIdentifier') ||
|
||||
(stepTypeStatus.includes('scriptIdentifier') && item.scriptIdentifier))
|
||||
) {
|
||||
result.push({ ...item, expanded: true });
|
||||
const resItem = {
|
||||
...item,
|
||||
expanded: false,
|
||||
stepChildren: isStepChildren ? cloneDeep(item.children) : [],
|
||||
children: isStepChildren ? [] : item.children,
|
||||
};
|
||||
result.push(resItem);
|
||||
} else if (item.children) {
|
||||
const filterData = search(item.children);
|
||||
if (filterData.length) {
|
||||
result.push({
|
||||
const filterItem = {
|
||||
...item,
|
||||
expanded: true,
|
||||
expanded: false,
|
||||
children: filterData,
|
||||
});
|
||||
};
|
||||
if (isStepChildren) {
|
||||
filterItem.stepChildren = cloneDeep(item.children);
|
||||
filterItem.children = [];
|
||||
}
|
||||
result.push(filterItem);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1126,7 +1126,7 @@
|
|||
|
||||
const showScheduleModal = ref(false);
|
||||
const syncFrequencyOptions = [
|
||||
{ label: t('apiTestManagement.timeTaskHour'), value: '0 0 0/1 * * ? ' },
|
||||
{ label: t('apiTestManagement.timeTaskHour'), value: '0 0 0/1 * * ?' },
|
||||
{ label: t('apiTestManagement.timeTaskSixHour'), value: '0 0 0/6 * * ?' },
|
||||
{ label: t('apiTestManagement.timeTaskTwelveHour'), value: '0 0 0/12 * * ?' },
|
||||
{ label: t('apiTestManagement.timeTaskDay'), value: '0 0 0 * * ?' },
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<span>{{ t('project.taskCenter.apiCaseList', { type: props.name }) }}</span>
|
||||
<a-input-search
|
||||
v-model:model-value="keyword"
|
||||
:placeholder="t('caseManagement.featureCase.searchByNameAndId')"
|
||||
:placeholder="t('system.organization.searchIndexPlaceholder')"
|
||||
allow-clear
|
||||
class="mx-[8px] w-[240px]"
|
||||
@search="searchList"
|
||||
|
@ -19,8 +19,13 @@
|
|||
v-on="propsEvent"
|
||||
@batch-action="handleTableBatch"
|
||||
>
|
||||
<template #resourceId="{ record }">
|
||||
<div type="text" class="one-line-text flex w-full">{{ record.resourceId }}</div>
|
||||
<template #resourceNum="{ record }">
|
||||
<div
|
||||
type="text"
|
||||
class="one-line-text flex w-full text-[rgb(var(--primary-5))]"
|
||||
@click="showDetail(record.resourceId)"
|
||||
>{{ record.resourceNum }}</div
|
||||
>
|
||||
</template>
|
||||
<template #statusFilter="{ columnConfig }">
|
||||
<a-trigger
|
||||
|
@ -85,7 +90,6 @@
|
|||
<MsButton class="!mr-0" @click="viewReport(record.id, rowIndex)">{{
|
||||
t('project.taskCenter.viewReport')
|
||||
}}</MsButton>
|
||||
<span></span>
|
||||
<a-divider v-if="['RUNNING', 'RERUNNING'].includes(record.status)" direction="vertical" />
|
||||
<MsButton
|
||||
v-if="['RUNNING', 'RERUNNING'].includes(record.status) && hasAnyPermission(permissionsMap[props.group].stop)"
|
||||
|
@ -196,8 +200,9 @@
|
|||
dataIndex: 'resourceNum',
|
||||
slotName: 'resourceNum',
|
||||
width: 200,
|
||||
sortIndex: 1,
|
||||
fixed: 'left',
|
||||
showTooltip: true,
|
||||
showDrag: false,
|
||||
},
|
||||
{
|
||||
title: 'project.taskCenter.resourceName',
|
||||
|
@ -207,6 +212,22 @@
|
|||
showDrag: false,
|
||||
showTooltip: true,
|
||||
},
|
||||
{
|
||||
title: 'system.project.name',
|
||||
dataIndex: 'projectName',
|
||||
slotName: 'projectName',
|
||||
showTooltip: true,
|
||||
showDrag: true,
|
||||
width: 200,
|
||||
},
|
||||
{
|
||||
title: 'system.organization.organizationName',
|
||||
dataIndex: 'organizationName',
|
||||
slotName: 'organizationName',
|
||||
showTooltip: true,
|
||||
showDrag: true,
|
||||
width: 200,
|
||||
},
|
||||
{
|
||||
title: 'project.taskCenter.executionResult',
|
||||
dataIndex: 'status',
|
||||
|
@ -271,6 +292,7 @@
|
|||
showSetting: true,
|
||||
selectable: true,
|
||||
heightUsed: 330,
|
||||
enableDrag: false,
|
||||
showSelectAll: true,
|
||||
}
|
||||
);
|
||||
|
@ -459,17 +481,17 @@
|
|||
}
|
||||
);
|
||||
/**
|
||||
* 跳转接口用例详情 TODO 后台要加字段 加了字段再处理
|
||||
* 跳转接口用例详情
|
||||
*/
|
||||
|
||||
function showDetail(id: string) {
|
||||
if (props.moduleType === 'API_CASE') {
|
||||
openNewPage(RouteEnum.API_TEST_MANAGEMENT, {
|
||||
cId: id,
|
||||
});
|
||||
} else {
|
||||
openNewPage(RouteEnum.API_TEST_MANAGEMENT, {
|
||||
dId: id,
|
||||
}
|
||||
if (props.moduleType === 'API_SCENARIO') {
|
||||
openNewPage(RouteEnum.API_TEST_SCENARIO, {
|
||||
sId: id,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
</a-button>-->
|
||||
<a-input-search
|
||||
v-model:model-value="keyword"
|
||||
:placeholder="t('caseManagement.featureCase.searchByNameAndId')"
|
||||
:placeholder="t('system.organization.searchIndexPlaceholder')"
|
||||
allow-clear
|
||||
class="mx-[8px] w-[240px]"
|
||||
@search="searchList"
|
||||
|
@ -22,10 +22,34 @@
|
|||
@batch-action="handleTableBatch"
|
||||
>
|
||||
<template #resourceNum="{ record }">
|
||||
<a-button type="text" class="flex w-full">{{ record.resourceNum }}</a-button>
|
||||
<div
|
||||
type="text"
|
||||
class="one-line-text flex w-full text-[rgb(var(--primary-5))]"
|
||||
@click="showDetail(record.resourceId)"
|
||||
>{{ record.resourceNum }}</div
|
||||
>
|
||||
</template>
|
||||
<template #resourceName="{ record }">
|
||||
<a-button type="text" class="flex w-full">{{ record.resourceName }}</a-button>
|
||||
<div type="text" class="flex w-full">{{ record.resourceName }}</div>
|
||||
</template>
|
||||
<template #resourceType="{ record }">
|
||||
<div type="text" class="flex w-full">{{ t(resourceTypeMap[record.resourceType].label) }}</div>
|
||||
</template>
|
||||
<template #value="{ record }">
|
||||
<a-select
|
||||
v-model:model-value="record.value"
|
||||
:placeholder="t('common.pleaseSelect')"
|
||||
class="param-input w-full min-w-[250px]"
|
||||
:disabled="!record.enable"
|
||||
@change="() => changeRunRules(record)"
|
||||
>
|
||||
<a-option v-for="item of syncFrequencyOptions" :key="item.value" :value="item.value">
|
||||
<span class="text-[var(--color-text-2)]"> {{ item.value }}</span
|
||||
><span class="ml-1 text-[var(--color-text-n4)] hover:text-[rgb(var(--primary-5))]">
|
||||
{{ item.label }}
|
||||
</span>
|
||||
</a-option>
|
||||
</a-select>
|
||||
</template>
|
||||
<template #operation="{ record }">
|
||||
<a-switch
|
||||
|
@ -64,15 +88,22 @@
|
|||
getScheduleProApiCaseList,
|
||||
getScheduleSysApiCaseList,
|
||||
switchSchedule,
|
||||
updateRunRules,
|
||||
} 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 { TimingTaskCenterApiCaseItem } from '@/models/projectManagement/taskCenter';
|
||||
import { RouteEnum } from '@/enums/routeEnum';
|
||||
import { TableKeyEnum } from '@/enums/tableEnum';
|
||||
import { TaskCenterEnum } from '@/enums/taskCenter';
|
||||
|
||||
import { resourceTypeMap } from './utils';
|
||||
|
||||
const { openNewPage } = useOpenNewPage();
|
||||
|
||||
const tableStore = useTableStore();
|
||||
const { openModal } = useModal();
|
||||
const { t } = useI18n();
|
||||
|
@ -115,7 +146,7 @@
|
|||
dataIndex: 'value',
|
||||
slotName: 'value',
|
||||
showInTable: true,
|
||||
width: 150,
|
||||
width: 300,
|
||||
showDrag: true,
|
||||
showTooltip: true,
|
||||
},
|
||||
|
@ -143,6 +174,10 @@
|
|||
showInTable: true,
|
||||
width: 200,
|
||||
showDrag: true,
|
||||
// sortable: {
|
||||
// sortDirections: ['ascend', 'descend'],
|
||||
// sorter: true,
|
||||
// },
|
||||
},
|
||||
{
|
||||
title: 'common.operation',
|
||||
|
@ -153,6 +188,12 @@
|
|||
showDrag: false,
|
||||
},
|
||||
];
|
||||
const syncFrequencyOptions = [
|
||||
{ label: t('apiTestManagement.timeTaskHour'), value: '0 0 0/1 * * ?' },
|
||||
{ label: t('apiTestManagement.timeTaskSixHour'), value: '0 0 0/6 * * ?' },
|
||||
{ label: t('apiTestManagement.timeTaskTwelveHour'), value: '0 0 0/12 * * ?' },
|
||||
{ label: t('apiTestManagement.timeTaskDay'), value: '0 0 0 * * ?' },
|
||||
];
|
||||
|
||||
const loadRealMap = ref({
|
||||
system: getScheduleSysApiCaseList,
|
||||
|
@ -165,7 +206,7 @@
|
|||
{
|
||||
tableKey: TableKeyEnum.TASK_SCHEDULE_TASK,
|
||||
scroll: {
|
||||
x: '100%',
|
||||
x: 1200,
|
||||
},
|
||||
showSetting: true,
|
||||
selectable: true,
|
||||
|
@ -248,6 +289,29 @@
|
|||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 更新运行规则
|
||||
*/
|
||||
async function changeRunRules(record: TimingTaskCenterApiCaseItem) {
|
||||
try {
|
||||
await updateRunRules(record.id, record.value);
|
||||
Message.success(t('common.updateSuccess'));
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转接口用例详情
|
||||
*/
|
||||
|
||||
function showDetail(id: string) {
|
||||
if (props.moduleType === 'TEST_RESOURCE') {
|
||||
openNewPage(RouteEnum.API_TEST_SCENARIO, {
|
||||
sId: id,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const moreActions: ActionsItem[] = [
|
||||
{
|
||||
|
@ -277,4 +341,19 @@
|
|||
});
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
<style scoped lang="less">
|
||||
:deep(.param-input:not(.arco-input-focus, .arco-select-view-focus)) {
|
||||
&:not(:hover) {
|
||||
border-color: transparent !important;
|
||||
.arco-input::placeholder {
|
||||
@apply invisible;
|
||||
}
|
||||
.arco-select-view-icon {
|
||||
@apply invisible;
|
||||
}
|
||||
.arco-select-view-value {
|
||||
color: var(--color-text-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -146,4 +146,27 @@ export const TaskStatus = {
|
|||
},
|
||||
};
|
||||
|
||||
export const resourceTypeMap = {
|
||||
[TaskCenterEnum.API_CASE]: {
|
||||
value: TaskCenterEnum.API_CASE,
|
||||
label: 'project.taskCenter.interfaceCase',
|
||||
},
|
||||
[TaskCenterEnum.API_SCENARIO]: {
|
||||
value: TaskCenterEnum.API_SCENARIO,
|
||||
label: 'project.taskCenter.apiScenario',
|
||||
},
|
||||
[TaskCenterEnum.UI_TEST]: {
|
||||
value: TaskCenterEnum.UI_TEST,
|
||||
label: 'project.taskCenter.uiDefaultFile',
|
||||
},
|
||||
[TaskCenterEnum.LOAD_TEST]: {
|
||||
value: TaskCenterEnum.LOAD_TEST,
|
||||
label: 'project.taskCenter.performanceTest',
|
||||
},
|
||||
[TaskCenterEnum.TEST_PLAN]: {
|
||||
value: TaskCenterEnum.TEST_PLAN,
|
||||
label: 'project.taskCenter.testPlan',
|
||||
},
|
||||
};
|
||||
|
||||
export default {};
|
||||
|
|
Loading…
Reference in New Issue