fix(接口测试): 接口报告修改细节

This commit is contained in:
teukkk 2024-06-05 10:44:49 +08:00 committed by Craftsman
parent feb23c0abf
commit 8e9bf6fc0d
4 changed files with 26 additions and 9 deletions

View File

@ -6,7 +6,7 @@
<!-- 报告分析报告步骤分析和请求分析开始 --> <!-- 报告分析报告步骤分析和请求分析开始 -->
<div class="analyze mb-1"> <div class="analyze mb-1">
<div class="analyze-item"> <div class="analyze-item">
<div class="block-title">{{ t('report.detail.api.stepAnalysis') }}</div> <div class="block-title">{{ t('report.detail.api.reportAnalysis') }}</div>
<ReportMetricsItem <ReportMetricsItem
v-for="analysisItem in reportAnalysisList" v-for="analysisItem in reportAnalysisList"
:key="analysisItem.name" :key="analysisItem.name"
@ -18,8 +18,8 @@
<div class="block-title">{{ t('report.detail.api.stepAnalysis') }}</div> <div class="block-title">{{ t('report.detail.api.stepAnalysis') }}</div>
<SetReportChart <SetReportChart
:legend-data="stepAnalysisLegendData" :legend-data="stepAnalysisLegendData"
:options="charOptions" :options="stepCharOptions"
:request-total="getIndicators(detail.requestTotal) || 0" :request-total="getIndicators(detail.stepTotal) || 0"
/> />
</div> </div>
<!-- 请求分析 --> <!-- 请求分析 -->
@ -27,7 +27,7 @@
<div class="block-title">{{ t('report.detail.api.requestAnalysis') }}</div> <div class="block-title">{{ t('report.detail.api.requestAnalysis') }}</div>
<SetReportChart <SetReportChart
:legend-data="legendData" :legend-data="legendData"
:options="charOptions" :options="requestCharOptions"
:request-total="getIndicators(detail.requestTotal) || 0" :request-total="getIndicators(detail.requestTotal) || 0"
/> />
</div> </div>
@ -44,6 +44,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue'; import { ref } from 'vue';
import { cloneDeep } from 'lodash-es';
import SetReportChart from './case/setReportChart.vue'; import SetReportChart from './case/setReportChart.vue';
import ReportDetailHeader from './reportDetailHeader.vue'; import ReportDetailHeader from './reportDetailHeader.vue';
@ -154,7 +155,7 @@
const legendData = ref<LegendData[]>([]); const legendData = ref<LegendData[]>([]);
const stepAnalysisLegendData = ref<LegendData[]>([]); const stepAnalysisLegendData = ref<LegendData[]>([]);
const charOptions = ref({ const defaultCharOptions = {
tooltip: { tooltip: {
show: false, show: false,
trigger: 'item', trigger: 'item',
@ -212,7 +213,9 @@
}, },
], ],
}, },
}); };
const stepCharOptions = ref(cloneDeep(defaultCharOptions));
const requestCharOptions = ref(cloneDeep(defaultCharOptions));
const activeTab = ref<'tiled' | 'tab'>('tiled'); const activeTab = ref<'tiled' | 'tab'>('tiled');
function getRote(count: number, countTotal: number) { function getRote(count: number, countTotal: number) {
@ -250,7 +253,7 @@
}, },
]; ];
charOptions.value.series.data = tempArr.map((item: any) => { requestCharOptions.value.series.data = tempArr.map((item: any) => {
return { return {
value: detail.value[item.value] || 0, value: detail.value[item.value] || 0,
name: t(item.label), name: t(item.label),
@ -269,6 +272,18 @@
rote: `${detail.value[item.rateKey] || 0}%`, rote: `${detail.value[item.rateKey] || 0}%`,
}; };
}); });
stepCharOptions.value.series.data = tempArr.map((item: any) => {
const valueName = `step${item.value.charAt(0).toUpperCase() + item.value.slice(1)}`;
return {
value: detail.value[valueName] || 0,
name: t(item.label),
itemStyle: {
color: item.color,
borderWidth: 2,
borderColor: '#ffffff',
},
};
});
stepAnalysisLegendData.value = tempArr.map((item: any) => { stepAnalysisLegendData.value = tempArr.map((item: any) => {
const valueName = `step${item.value.charAt(0).toUpperCase() + item.value.slice(1)}`; const valueName = `step${item.value.charAt(0).toUpperCase() + item.value.slice(1)}`;
return { return {

View File

@ -25,7 +25,8 @@ export default {
'report.detail.api.resContent': 'Response content', 'report.detail.api.resContent': 'Response content',
'report.detail.api.executionTime': 'Execution time', 'report.detail.api.executionTime': 'Execution time',
'report.detail.api.executionTimeTo': 'To', 'report.detail.api.executionTimeTo': 'To',
'report.detail.api.stepAnalysis': 'step Analysis', 'report.detail.api.stepAnalysis': 'Step analysis',
'report.detail.api.reportAnalysis': 'Report analysis',
'report.detail.api.content': 'content', 'report.detail.api.content': 'content',
'report.detail.api.assertStatus': 'status', 'report.detail.api.assertStatus': 'status',
'report.detail.api.totalTime': 'Total report time', 'report.detail.api.totalTime': 'Total report time',

View File

@ -25,6 +25,7 @@ export default {
'report.detail.api.executionTime': '执行时间', 'report.detail.api.executionTime': '执行时间',
'report.detail.api.executionTimeTo': '至', 'report.detail.api.executionTimeTo': '至',
'report.detail.api.stepAnalysis': '步骤分析', 'report.detail.api.stepAnalysis': '步骤分析',
'report.detail.api.reportAnalysis': '报告分析',
'report.detail.api.content': '内容', 'report.detail.api.content': '内容',
'report.detail.api.assertStatus': '状态', 'report.detail.api.assertStatus': '状态',
'report.detail.api.totalTime': '报告总耗时', 'report.detail.api.totalTime': '报告总耗时',

View File

@ -7,7 +7,7 @@
<MsIcon <MsIcon
v-if="props.itemInfo.tip?.length" v-if="props.itemInfo.tip?.length"
type="icon-icon-maybe_outlined" type="icon-icon-maybe_outlined"
class="ml-[8px] text-[var(--color-text-4)] hover:text-[rgb(var(--primary-5))]" class="ml-[8px] text-[var(--color-text-brand)] hover:text-[rgb(var(--primary-5))]"
/> />
</a-tooltip> </a-tooltip>
<MsTag <MsTag