diff --git a/src/assets/css/components/views/charts2/linkDirectionGrid.scss b/src/assets/css/components/views/charts2/linkDirectionGrid.scss index dcb343ce..caac356f 100644 --- a/src/assets/css/components/views/charts2/linkDirectionGrid.scss +++ b/src/assets/css/components/views/charts2/linkDirectionGrid.scss @@ -113,7 +113,7 @@ $blue: #046ECA; .block-content-item-value { display: flex; - width: 145px; + min-width: 75px; font-weight: 600; } } diff --git a/src/views/charts2/charts/linkMonitor/LinkDirectionGrid.vue b/src/views/charts2/charts/linkMonitor/LinkDirectionGrid.vue index 15aa44a8..373281f1 100644 --- a/src/views/charts2/charts/linkMonitor/LinkDirectionGrid.vue +++ b/src/views/charts2/charts/linkMonitor/LinkDirectionGrid.vue @@ -118,6 +118,8 @@ export default { linkId: egressLink.linkId, egressUsage: egressUsage, ingressUsage: ingressUsage, + popoverWidth: this.computeWidth(egressUsage, ingressUsage, 'popover'), + valueWidth: this.computeWidth(egressUsage, ingressUsage, 'value'), totalBitsRate: d.totalBitsRate, ...d }) @@ -129,6 +131,8 @@ export default { linkId: egressLink.linkId, egressUsage: egressUsage, ingressUsage: ingressUsage, + popoverWidth: this.computeWidth(egressUsage, ingressUsage, 'popover'), + valueWidth: this.computeWidth(egressUsage, ingressUsage, 'value'), totalBitsRate: d.totalBitsRate, ...d }] @@ -182,6 +186,8 @@ export default { nextHop: egressLink.nextHop, egressUsage: egressUsage, ingressUsage: ingressUsage, + popoverWidth: this.computeWidth(egressUsage, ingressUsage, 'popover'), + valueWidth: this.computeWidth(egressUsage, ingressUsage, 'value'), totalBitsRate: d.totalBitsRate, ...d }) @@ -195,6 +201,8 @@ export default { nextHop: ingressLink.nextHop, egressUsage: egressUsage, ingressUsage: ingressUsage, + popoverWidth: this.computeWidth(egressUsage, ingressUsage, 'popover'), + valueWidth: this.computeWidth(egressUsage, ingressUsage, 'value'), totalBitsRate: d.totalBitsRate, ...d }] @@ -204,7 +212,6 @@ export default { }) this.gridData2 = gridData2 - console.log('打印下一跳数据', gridData2) } else { this.isNoData = true } @@ -240,6 +247,26 @@ export default { npmScore = 6 } return npmScore + }, + /** + * 计算popover弹窗和右侧数据模块的宽度 + * 弹窗最小宽度为360px,右侧数据最小宽度为75px,右侧数据每大一位,popover弹窗宽度增加7px + */ + computeWidth (egress, ingress, flag) { + let width = 0 + let length = 0 + + const egressUsage = JSON.stringify(parseFloat((egress * 100).toFixed(2))) + const ingressUsage = JSON.stringify(parseFloat((ingress * 100).toFixed(2))) + length = egressUsage.length + ingressUsage.length - 1 + + if (flag === 'popover') { + width = 360 + length * 7 + } else { + width = 75 + length * 7 + } + + return width } } } diff --git a/src/views/charts2/charts/linkMonitor/LinkDirectionGrid/PopoverContent.vue b/src/views/charts2/charts/linkMonitor/LinkDirectionGrid/PopoverContent.vue index 9f1e9cf5..7638fb4b 100644 --- a/src/views/charts2/charts/linkMonitor/LinkDirectionGrid/PopoverContent.vue +++ b/src/views/charts2/charts/linkMonitor/LinkDirectionGrid/PopoverContent.vue @@ -21,7 +21,7 @@