fix(接口测试): 接口测试首页饼状图优化

--bug=1020519 --user=宋天阳 【接口测试】接口首页 - 接口数量统计,0个的接口类型在环形统计图里也有颜色占比
https://www.tapd.cn/55049933/s/1314092
This commit is contained in:
song-tianyang 2022-12-08 10:37:24 +08:00 committed by 建国
parent b5b4c510c6
commit d5adce88da
2 changed files with 9 additions and 8 deletions

View File

@ -3,7 +3,6 @@
<slot name="version"></slot>
<ms-search :condition.sync="condition" :base-search-tip="$t('commons.search_by_id_name_tag')" @search="search">
</ms-search>
<ms-table
:data="tableData"
:screen-height="isRelate ? 'calc(100vh - 400px)' : screenHeight"

View File

@ -95,10 +95,10 @@ export default {
borderWidth = 3;
dataIsNotEmpty = true;
protocolData = [
{ value: this.apiData.httpCount, name: 'HTTP' },
{ value: this.apiData.rpcCount, name: 'RPC' },
{ value: this.apiData.tcpCount, name: 'TCP' },
{ value: this.apiData.sqlCount, name: 'SQL' },
{ value: this.apiData.httpCount > 0 ? this.apiData.httpCount : '-', name: 'HTTP' },
{ value: this.apiData.rpcCount > 0 ? this.apiData.rpcCount : '-', name: 'RPC' },
{ value: this.apiData.tcpCount > 0 ? this.apiData.tcpCount : '-', name: 'TCP' },
{ value: this.apiData.sqlCount > 0 ? this.apiData.sqlCount : '-', name: 'SQL' },
];
}
let optionData = {
@ -142,12 +142,14 @@ export default {
},
data: protocolData,
formatter: function (name) {
//name
let singleData = protocolData.filter(function (item) {
return item.name === name;
});
let value = singleData[0].value;
return [`{protocol|${name}}`, `{num|${value}}`].join('');
let showValue = singleData[0].value;
if (showValue === '-') {
showValue = 0;
}
return [`{protocol|${name}}`, `{num|${showValue}}`].join('');
},
},
title: {