refactor(测试计划): 报告状态筛选优化
This commit is contained in:
parent
58140fb2b7
commit
318b7fc950
|
@ -9,17 +9,17 @@ export function reportList(data: TableQueryParams) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除报告
|
// 删除报告
|
||||||
export function reportDelete(moduleType: string, id: string) {
|
export function reportDelete(id: string) {
|
||||||
return MSR.get({ url: `${reportUrl.PlanDeleteUrl}/${id}` });
|
return MSR.get({ url: `${reportUrl.PlanDeleteUrl}/${id}` });
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重命名
|
// 重命名
|
||||||
export function reportRename(moduleType: string, id: string, data: string) {
|
export function reportRename(id: string, data: string) {
|
||||||
return MSR.post({ url: `${reportUrl.PlanReportRenameUrl}/${id}`, data });
|
return MSR.post({ url: `${reportUrl.PlanReportRenameUrl}/${id}`, data });
|
||||||
}
|
}
|
||||||
|
|
||||||
// 批量删除
|
// 批量删除
|
||||||
export function reportBathDelete(moduleType: string, data: TableQueryParams) {
|
export function reportBathDelete(data: TableQueryParams) {
|
||||||
return MSR.post({ url: reportUrl.PlanBatchDeleteUrl, data });
|
return MSR.post({ url: reportUrl.PlanBatchDeleteUrl, data });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="p-[16px]">
|
<div class="p-[16px]">
|
||||||
<div class="flex items-center justify-between">
|
<div class="mb-4 flex items-center justify-between">
|
||||||
<a-radio-group v-model:model-value="showType" type="button" class="file-show-type" @change="changeShowType">
|
<a-radio-group v-model:model-value="showType" type="button" class="file-show-type" @change="changeShowType">
|
||||||
<a-radio value="All">{{ t('report.all') }}</a-radio>
|
<a-radio value="All">{{ t('report.all') }}</a-radio>
|
||||||
<a-radio value="INDEPENDENT">{{ t('report.independent') }}</a-radio>
|
<a-radio value="INDEPENDENT">{{ t('report.independent') }}</a-radio>
|
||||||
|
@ -137,7 +137,7 @@
|
||||||
size="small"
|
size="small"
|
||||||
>
|
>
|
||||||
<a-checkbox v-for="key of statusFilters" :key="key" :value="key">
|
<a-checkbox v-for="key of statusFilters" :key="key" :value="key">
|
||||||
<ExecutionStatus :module-type="moduleType" :status="key" />
|
<ExecutionStatus :module-type="ReportStatusEnum.REPORT_STATUS" :status="key" />
|
||||||
</a-checkbox>
|
</a-checkbox>
|
||||||
</a-checkbox-group>
|
</a-checkbox-group>
|
||||||
</div>
|
</div>
|
||||||
|
@ -179,7 +179,7 @@
|
||||||
size="small"
|
size="small"
|
||||||
>
|
>
|
||||||
<a-checkbox v-for="key of execStatusFilters" :key="key" :value="key">
|
<a-checkbox v-for="key of execStatusFilters" :key="key" :value="key">
|
||||||
<ExecutionStatus :module-type="moduleType" :status="key" />
|
<ExecutionStatus :module-type="ReportStatusEnum.EXEC_STATUS" :status="key" />
|
||||||
</a-checkbox>
|
</a-checkbox>
|
||||||
</a-checkbox-group>
|
</a-checkbox-group>
|
||||||
</div>
|
</div>
|
||||||
|
@ -196,7 +196,7 @@
|
||||||
</a-trigger>
|
</a-trigger>
|
||||||
</template>
|
</template>
|
||||||
<template #status="{ record }">
|
<template #status="{ record }">
|
||||||
<ExecutionStatus :module-type="moduleType" :status="record.status" />
|
<ExecutionStatus :module-type="ReportStatusEnum.REPORT_STATUS" :status="record.status" />
|
||||||
</template>
|
</template>
|
||||||
<template #triggerMode="{ record }">
|
<template #triggerMode="{ record }">
|
||||||
<span>{{ t(TriggerModeLabel[record.triggerMode as keyof typeof TriggerModeLabel]) }}</span>
|
<span>{{ t(TriggerModeLabel[record.triggerMode as keyof typeof TriggerModeLabel]) }}</span>
|
||||||
|
@ -247,7 +247,6 @@
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
const tableStore = useTableStore();
|
const tableStore = useTableStore();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const moduleType = ReportStatusEnum.REPORT_STATUS;
|
|
||||||
const keyword = ref<string>('');
|
const keyword = ref<string>('');
|
||||||
const statusFilterVisible = ref(false);
|
const statusFilterVisible = ref(false);
|
||||||
const execStatusFilterVisible = ref(false);
|
const execStatusFilterVisible = ref(false);
|
||||||
|
@ -375,7 +374,7 @@
|
||||||
|
|
||||||
const rename = async (record: any) => {
|
const rename = async (record: any) => {
|
||||||
try {
|
try {
|
||||||
await reportRename(moduleType, record.id, record.name);
|
await reportRename(record.id, record.name);
|
||||||
Message.success(t('common.updateSuccess'));
|
Message.success(t('common.updateSuccess'));
|
||||||
return true;
|
return true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -391,7 +390,7 @@
|
||||||
},
|
},
|
||||||
showSetting: true,
|
showSetting: true,
|
||||||
selectable: hasAnyPermission(['PROJECT_TEST_PLAN_REPORT:READ+DELETE']),
|
selectable: hasAnyPermission(['PROJECT_TEST_PLAN_REPORT:READ+DELETE']),
|
||||||
heightUsed: 230,
|
heightUsed: 242,
|
||||||
paginationSize: 'mini',
|
paginationSize: 'mini',
|
||||||
showSelectorAll: true,
|
showSelectorAll: true,
|
||||||
},
|
},
|
||||||
|
@ -461,7 +460,7 @@
|
||||||
setLoadListParams({
|
setLoadListParams({
|
||||||
keyword: keyword.value,
|
keyword: keyword.value,
|
||||||
projectId: appStore.currentProjectId,
|
projectId: appStore.currentProjectId,
|
||||||
moduleType,
|
|
||||||
filter: {
|
filter: {
|
||||||
status: statusListFiltersMap.value[showType.value],
|
status: statusListFiltersMap.value[showType.value],
|
||||||
integrated: integratedFilters.value,
|
integrated: integratedFilters.value,
|
||||||
|
@ -517,7 +516,7 @@
|
||||||
},
|
},
|
||||||
onBeforeOk: async () => {
|
onBeforeOk: async () => {
|
||||||
try {
|
try {
|
||||||
await reportBathDelete(moduleType, batchParams.value);
|
await reportBathDelete(batchParams.value);
|
||||||
Message.success(t('apiTestDebug.deleteSuccess'));
|
Message.success(t('apiTestDebug.deleteSuccess'));
|
||||||
resetSelector();
|
resetSelector();
|
||||||
initData();
|
initData();
|
||||||
|
@ -546,7 +545,7 @@
|
||||||
},
|
},
|
||||||
onBeforeOk: async () => {
|
onBeforeOk: async () => {
|
||||||
try {
|
try {
|
||||||
await reportDelete(moduleType, id);
|
await reportDelete(id);
|
||||||
Message.success(t('apiTestDebug.deleteSuccess'));
|
Message.success(t('apiTestDebug.deleteSuccess'));
|
||||||
initData();
|
initData();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -616,16 +615,6 @@
|
||||||
function showReportDetail(id: string, rowIndex: number) {
|
function showReportDetail(id: string, rowIndex: number) {
|
||||||
// 待处理
|
// 待处理
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
|
||||||
() => moduleType,
|
|
||||||
(val) => {
|
|
||||||
if (val) {
|
|
||||||
resetSelector();
|
|
||||||
initData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
|
|
@ -24,15 +24,17 @@
|
||||||
|
|
||||||
const iconTypeStatus: Record<string, any> = {
|
const iconTypeStatus: Record<string, any> = {
|
||||||
[ReportStatusEnum.REPORT_STATUS]: {
|
[ReportStatusEnum.REPORT_STATUS]: {
|
||||||
RUNNING: {
|
SUCCESS: {
|
||||||
icon: 'icon-icon_testing',
|
icon: 'icon-icon_succeed_colorful',
|
||||||
label: 'report.status.running',
|
label: 'report.successful',
|
||||||
color: '!text-[rgb(var(--link-6))]',
|
|
||||||
},
|
},
|
||||||
PENDING: {
|
ERROR: {
|
||||||
icon: 'icon-icon_block_filled',
|
icon: 'icon-icon_close_colorful',
|
||||||
label: 'report.status.pending',
|
label: 'report.failure',
|
||||||
color: '!text-[var(--color-text-input-border)]',
|
},
|
||||||
|
FAKE_ERROR: {
|
||||||
|
icon: 'icon-icon_warning_colorful',
|
||||||
|
label: 'report.fake.error',
|
||||||
},
|
},
|
||||||
DEFAULT: {
|
DEFAULT: {
|
||||||
icon: 'icon-icon_block_filled',
|
icon: 'icon-icon_block_filled',
|
||||||
|
@ -65,10 +67,8 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
function getExecutionResult(): IconType {
|
function getExecutionResult(): IconType {
|
||||||
if (props.status in iconTypeStatus[props.moduleType]) {
|
const moduleConfig = iconTypeStatus[props.moduleType];
|
||||||
return iconTypeStatus[props.moduleType][props.status];
|
return moduleConfig?.[props.status] ?? moduleConfig?.DEFAULT;
|
||||||
}
|
|
||||||
return iconTypeStatus[props.moduleType].DEFAULT;
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ export default {
|
||||||
'report.status.running': '执行中',
|
'report.status.running': '执行中',
|
||||||
'report.status.rerunning': '重跑中',
|
'report.status.rerunning': '重跑中',
|
||||||
'report.status.pending': '未执行',
|
'report.status.pending': '未执行',
|
||||||
'report.stopped': '停止',
|
'report.stopped': '已停止',
|
||||||
'report.trigger.scheduled': '定时执行',
|
'report.trigger.scheduled': '定时执行',
|
||||||
'report.trigger.manual': '手动执行',
|
'report.trigger.manual': '手动执行',
|
||||||
'report.trigger.interface': 'API 执行',
|
'report.trigger.interface': 'API 执行',
|
||||||
|
|
Loading…
Reference in New Issue