NEZ-3450 fix: asset info图表所有内容都为空时 展示原组件

This commit is contained in:
zyh
2024-04-21 13:47:15 +08:00
parent 5fbe102b12
commit 4bc5729771
3 changed files with 16 additions and 4 deletions

View File

@@ -24,8 +24,20 @@ export default {
}
},
methods: {
// 数据全为空 展示原组件
isEmpty (obj) {
return lodash.isEmpty(obj)
let flag = true // 是否为空
for (const key in obj) {
if (obj[key] && (!lodash.isEmpty(obj[key]) || obj[key].length)) {
if (key === 'cpu' && !obj[key].name) {
flag = true
} else {
flag = false
return false
}
}
}
return flag
}
},
watch: {

View File

@@ -31,7 +31,7 @@
<div class="partition"></div>
<div class="legend-value legend-value-agent">
<div class="map-asset">
<div class="progress-title">{{$t('overall.agent')}} {{$t('config.agent.up')}}</div>
<div class="progress-title">{{$t('overall.agent')}} {{$t('dashboard.agentUp')}}</div>
<div class="success-progress progress-box">
<div class="top-progress" :style="{width: (dcStat.agent.up / (dcStat.agent.up + dcStat.agent.down)) * 100 + '%'}"></div>
<div style="width: 100%" class="bottom-progress"></div>
@@ -39,7 +39,7 @@
<div class="success-progress progress-content">{{dcStat.agent.up}}</div>
</div>
<div class="map-asset">
<div class="progress-title">{{$t('overall.agent')}} {{$t('asset.down')}}</div>
<div class="progress-title">{{$t('overall.agent')}} {{$t('dashboard.agentDown')}}</div>
<div class="error-progress progress-box">
<div class="top-progress" :style="{width: (dcStat.agent.down / (dcStat.agent.up + dcStat.agent.down)) * 100 + '%'}"></div>
<div style="width: 100%" class="bottom-progress"></div>

View File

@@ -48,7 +48,7 @@
<div slot="reference" style="width: 80px" @mouseenter="labelHover(JSON.parse(scope.row.statusInfo), 'agent', true, $event)"
@mouseleave="labelHover(JSON.parse(scope.row.statusInfo), 'agent', false)">
<span :class="{'active-icon green-bg':scope.row[item.prop] == '1','active-icon red-bg':scope.row[item.prop] == '0' || scope.row[item.prop] == '-1' || scope.row[item.prop] == '-2'}"></span>
<span>{{scope.row[item.prop] == '1' ? 'UP' : 'Down'}}</span>
<span>{{scope.row[item.prop] == '1' ? 'Up' : 'Down'}}</span>
</div>
<!-- </el-popover> -->
</span>