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 46e5a15033
commit 7981856b25
2 changed files with 9 additions and 8 deletions

View File

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

View File

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