fix: 修复 下拉—关系 逻辑判断错误问题

This commit is contained in:
@changcode
2022-02-17 14:49:19 +08:00
parent f7b338c68d
commit 43a30c1f06
4 changed files with 13 additions and 19 deletions

View File

@@ -2,7 +2,6 @@ import { get } from '@/utils/http'
export default {
data () {
return {
relationshipDataOne: [], // 数据
relationshipDataTow: [], // 数据
relationshipShowOne: false, // 控制 ... 的展示隐藏
@@ -20,7 +19,7 @@ export default {
if (response.code === 200) {
this.relationshipDataOne = response.data.result
// 将请求数据 传入方法中
this.relatedServerWidth(this.relationshipDataOne, refOne)
this.relatedServerWidth(this.relationshipDataOne, refOne, 1)
}
})
},
@@ -29,12 +28,12 @@ export default {
if (response.code === 200) {
this.relationshipDataTow = response.data.result
// 将请求数据 传入方法中
this.relatedServerWidth(this.relationshipDataTow, refTow)
this.relatedServerWidth(this.relationshipDataTow, refTow, 2)
}
})
},
// data => 数据, value => ref
relatedServerWidth (data, value) {
relatedServerWidth (data, value, num) {
// 最大宽度
const relatedServerWidth = this.$refs.relationship.offsetWidth
let sum = 0
@@ -42,12 +41,14 @@ export default {
data.map((item, index) => {
if (this.$refs[value + index]) {
// 每条数据的宽度
const width = this.$refs[value + index].offsetWidth + 30
const width = this.$refs[value + index].offsetWidth + 32
if (width) {
sum += width
if (flag && relatedServerWidth < sum) {
if (flag && sum >= relatedServerWidth && num === 1) {
flag = false
this.relationshipShowOne = true
} else if (flag && sum >= relatedServerWidth && num === 2) {
flag = false
this.relationshipShowTow = true
}
}

View File

@@ -285,11 +285,8 @@ export default {
this.singleValues.chartDatas.splice(1, 1, this.$_.get(n, 'httpResponseLatency'))
this.singleValues.chartDatas.splice(2, 1, this.$_.get(n, 'sslConLatency'))
this.singleValues.chartDatas.splice(3, 1, this.$_.get(n, 'sequenceGapLossPercent'))
this.singleValues.chartDatas.splice(4, 1, this.$_.get(n, 'pktRetransPercent'))
this.$nextTick(() => {
this.getRelatedServerDataOne(this.relatedServerDomainUrl, 'relatedApp')
this.getRelatedServerDataTow(this.relatedServerIpUrl, 'relatedServerApp')
})
this.getRelatedServerDataOne(this.relatedServerDomainUrl, 'relatedApp')
this.getRelatedServerDataTow(this.relatedServerIpUrl, 'relatedServerApp')
}
}
},

View File

@@ -293,10 +293,8 @@ export default {
this.singleValues.chartDatas.splice(2, 1, this.$_.get(n, 'sslConLatency'))
this.singleValues.chartDatas.splice(3, 1, this.$_.get(n, 'sequenceGapLossPercent'))
this.singleValues.chartDatas.splice(4, 1, this.$_.get(n, 'pktRetransPercent'))
this.$nextTick(() => {
this.getRelatedServerDataOne(this.relatedServerAppUrl, 'relatedDomain')
this.getRelatedServerDataTow(this.relatedServerIpUrl, 'relatedServerDomain')
})
this.getRelatedServerDataOne(this.relatedServerAppUrl, 'relatedDomain')
this.getRelatedServerDataTow(this.relatedServerIpUrl, 'relatedServerDomain')
}
}
},

View File

@@ -279,10 +279,8 @@ export default {
this.singleValues.chartDatas.splice(2, 1, this.$_.get(n, 'sslConLatency'))
this.singleValues.chartDatas.splice(3, 1, this.$_.get(n, 'sequenceGapLossPercent'))
this.singleValues.chartDatas.splice(4, 1, this.$_.get(n, 'pktRetransPercent'))
this.$nextTick(() => {
this.getRelatedServerDataOne(this.relatedServerDomainUrl, 'relatedIp')
this.getRelatedServerDataTow(this.relatedServerAppUrl, 'relatedServerIp')
})
this.getRelatedServerDataOne(this.relatedServerDomainUrl, 'relatedIp')
this.getRelatedServerDataTow(this.relatedServerAppUrl, 'relatedServerIp')
}
}
},