feat(项目管理): 项目管理应用设置误报规则展示调整

This commit is contained in:
xinxin.wu 2024-09-05 10:51:49 +08:00 committed by Craftsman
parent 543909c358
commit a6a09d72e0
4 changed files with 44 additions and 17 deletions

View File

@ -62,7 +62,7 @@
</template> </template>
<script async lang="ts" setup> <script async lang="ts" setup>
import { useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { Message, TableData } from '@arco-design/web-vue'; import { Message, TableData } from '@arco-design/web-vue';
import MsButton from '@/components/pure/ms-button/index.vue'; import MsButton from '@/components/pure/ms-button/index.vue';
@ -97,6 +97,7 @@
const { t } = useI18n(); const { t } = useI18n();
const appStore = useAppStore(); const appStore = useAppStore();
const router = useRouter(); const router = useRouter();
const route = useRoute();
const currentProjectId = computed(() => appStore.currentProjectId); const currentProjectId = computed(() => appStore.currentProjectId);
const addVisible = ref(false); const addVisible = ref(false);
const addLoading = ref(false); const addLoading = ref(false);
@ -207,6 +208,18 @@
dataIndex: 'enable', dataIndex: 'enable',
width: 143, width: 143,
permission: ['PROJECT_APPLICATION_API:UPDATE'], permission: ['PROJECT_APPLICATION_API:UPDATE'],
filterConfig: {
options: [
{
value: true,
label: t('common.enable'),
},
{
value: false,
label: t('common.close'),
},
],
},
}, },
{ {
title: 'project.menu.rule.label', title: 'project.menu.rule.label',
@ -456,7 +469,14 @@
} }
onMounted(() => { onMounted(() => {
setLoadListParams({ projectId: currentProjectId.value }); const { status } = route.query;
const enabledStatus = status === 'all' ? [] : [true];
setLoadListParams({
projectId: currentProjectId.value,
filter: {
enable: [enabledStatus],
},
});
fetchData(); fetchData();
}); });
</script> </script>

View File

@ -107,4 +107,7 @@ export default {
'project.menu.rule.deleteRule': 'Confirm to delete {size} false alert rules?', 'project.menu.rule.deleteRule': 'Confirm to delete {size} false alert rules?',
'project.menu.rule.deleteRuleTip': 'project.menu.rule.deleteRuleTip':
'After deletion, it only takes effect on newly executed test reports. Please be cautious!', 'After deletion, it only takes effect on newly executed test reports. Please be cautious!',
'project.menu.rule.hasBeenEnabled': 'Have been enabled',
'project.menu.rule.bar': 'number',
'project.menu.rule.ruleAlertList': 'List of false alarm rules',
}; };

View File

@ -94,4 +94,7 @@ export default {
'project.menu.rule.enableRuleTip': '启用后,接口返回结果会优先进行误报规则匹配。', 'project.menu.rule.enableRuleTip': '启用后,接口返回结果会优先进行误报规则匹配。',
'project.menu.rule.deleteRule': '确认删除 {size} 条误报规则吗?', 'project.menu.rule.deleteRule': '确认删除 {size} 条误报规则吗?',
'project.menu.rule.deleteRuleTip': '删除后,仅对新执行的测试报告生效,请谨慎操作!', 'project.menu.rule.deleteRuleTip': '删除后,仅对新执行的测试报告生效,请谨慎操作!',
'project.menu.rule.hasBeenEnabled': '已启用',
'project.menu.rule.bar': '条',
'project.menu.rule.ruleAlertList': '误报规则列表',
}; };

View File

@ -130,19 +130,15 @@
<div v-if="record.type === 'API_ERROR_REPORT_RULE'" class="flex w-[100%] flex-row items-center"> <div v-if="record.type === 'API_ERROR_REPORT_RULE'" class="flex w-[100%] flex-row items-center">
<!--接口测试 误报规则 --> <!--接口测试 误报规则 -->
<div class="error-report"> <div class="error-report">
<a-input-number {{ t('project.menu.rule.hasBeenEnabled') }}
v-model="allValueMap['FAKE_ERROR_NUM']" <span class="text-[rgb(var(--primary-5))]" @click="pushFar(true)">
class="w-[120px]" <!-- TODO 待测试字段后台还没有补充 -->
disabled {{ allValueMap['ENABLE_FAKE_ERROR_NUM'] || 0 }}
:placeholder="t('project.menu.pleaseConfig')" </span>
> {{ t('project.menu.rule.bar') }}
<template #append>
<div>{{ t('project.menu.count') }}</div>
</template>
</a-input-number>
</div> </div>
<div class="ml-[8px] cursor-pointer text-[rgb(var(--primary-7))]" @click="pushFar"> <div class="ml-[8px] cursor-pointer font-medium text-[rgb(var(--primary-5))]" @click="pushFar(false)">
{{ t('project.menu.API_ERROR_REPORT_RULE') }} {{ t('project.menu.rule.ruleAlertList') }}
</div> </div>
<a-tooltip :content="t('project.menu.API_ERROR_REPORT_RULE_TIP')" position="right"> <a-tooltip :content="t('project.menu.API_ERROR_REPORT_RULE_TIP')" position="right">
<div> <div>
@ -479,7 +475,7 @@
const noTitleColumns = [ const noTitleColumns = [
{ {
title: '', title: 'project.menu.name',
dataIndex: 'module', dataIndex: 'module',
slotName: 'module', slotName: 'module',
width: 221, width: 221,
@ -845,8 +841,13 @@
relatedCaseDrawerVisible.value = true; relatedCaseDrawerVisible.value = true;
}; };
// //
const pushFar = () => { const pushFar = (isEnable: boolean) => {
router.push({ name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_MENU_MANAGEMENT_ERROR_REPORT_RULE }); router.push({
name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_MENU_MANAGEMENT_ERROR_REPORT_RULE,
query: {
status: isEnable ? 'enable' : 'all',
},
});
}; };
// //