fix: 修改 group重叠下方chart 的bug 以及 点击菜单panel未跳第一个panel的问题

This commit is contained in:
zhangyu
2021-12-30 11:33:24 +08:00
parent 8b2e144e59
commit 45283f7084
9 changed files with 28 additions and 27 deletions

View File

@@ -1,6 +1,7 @@
<template>
<div style="width: 100%;height: 100%">
<chartList
v-if="chartInfo.loaded"
ref="chartList"
name="group"
:class="{'show-top':showTopBtn}"
@@ -50,13 +51,15 @@ export default {
},
initChart () {
this.dataList = this.dataList.map(item => {
return {
...item,
// hide: item.name.indexOf(this.filter.searchName) === -1, // 搜索条件
loaded: true
}
})
setTimeout(() => {
this.dataList = this.dataList.map(item => {
return {
...item,
// hide: item.name.indexOf(this.filter.searchName) === -1, // 搜索条件
loaded: true
}
})
}, 100)
}
},
watch: {

View File

@@ -179,14 +179,12 @@ export default {
return svg.node()
},
hexagonOver (that, e) { // 移入六边形
// console.log(that, e)
this.tooltip.title = that.alias
this.tooltip.value = that.showValue
this.tooltip.show = true
this.setPosition(e)
},
hexagonMove (e) { // 六边形内移动
// console.log(e)
if (this.tooltip.show) {
this.setPosition(e)
}

View File

@@ -148,7 +148,6 @@ export default {
let sourceData = null
sourceData = this.oldTableData
orderBy = this.orderBy
console.log(orderBy)
if (!orderBy || !orderBy.order) { // 没有排序 恢复默认值
source = Object.assign([], sourceData)
} else { // 排序之后的顺序
@@ -244,7 +243,6 @@ export default {
},
tableDataSort (orderBy) {
this.orderBy = { order: orderBy.order, prop: orderBy.prop }
console.log(orderBy, this.orderBy)
this.tableData = this.filterShowData(this.tableData)
},
// 本地正序
@@ -266,7 +264,6 @@ export default {
return function (obj1, obj2) {
const val1 = obj1.display[prop + 'display'].replace(/\s*/g, '')
const val2 = obj2.display[prop + 'display'].replace(/\s*/g, '')
console.log(val1, val2, val1 < val2, val2 > val1)
if (val1 < val2) {
return -1
} else if (val1 > val2) {

View File

@@ -117,7 +117,7 @@ export function isClock (type) {
export function getGroupHeight (arr) {
if (arr.length) {
let lastItem = []
let maxY = 0
let maxY = arr[0].y
arr.forEach((children, index) => {
if (maxY == children.y) {
lastItem.push(children)
@@ -132,6 +132,9 @@ export function getGroupHeight (arr) {
maxHeight = last.height
}
})
if (maxY < 0) {
maxY = 0
}
return maxHeight + maxY
} else {
return 1

View File

@@ -131,11 +131,7 @@ export default {
if (colorIndex >= 20) {
const colorRandom = randomcolor()
this.colorList.push(colorRandom)
// console.log(this.colorList.length, this.chartOption.color.length)
// this.chartOption.color.push(colorRandom)
// console.log(this.colorList.length, this.chartOption.color.length)
}
// console.log(name, alias, statistics)
this.legends.push({ name, alias, statistics, color: this.colorList[colorIndex] })
return {
name,
@@ -264,7 +260,6 @@ export default {
chartData: {
deep: true,
handler (n) {
console.log(this.isInit)
if (!this.isInit) {
this.colorList = this.colorList.slice(0, 20)
this.chartOption.color = this.chartOption.color.slice(0, 20)

View File

@@ -375,8 +375,8 @@ export default {
this.chartInfo.height = height + this.headerHPadding
this.chartInfo.h = height + this.headerHPadding
} else {
this.chartInfo.height = this.headerH + height
this.chartInfo.h = this.headerH + height
this.chartInfo.height = height
this.chartInfo.h = height
}
},
showFullscreen (show) {

View File

@@ -210,18 +210,18 @@ export default {
delete params.param.min
delete params.param.max
}
if (!params.x && !params.y) {
params.x = this.chartLastPosition.x + params.span > 12 ? 0 : this.chartLastPosition.x
params.y = this.chartLastPosition.y + 12
}
if (!params.x && !params.y && params.groupId) { // group 内的坐标需要单独计算
params.x = 0
params.y = 999
}
if (this.from === 'endpointQuery') { // endpointQuery 新增 放在最后
if (!params.x && !params.y && this.from === 'endpointQuery') { // endpointQuery 新增 放在最后
params.x = 0
params.y = 999
}
if (!params.x && !params.y) {
params.x = this.chartLastPosition.x + params.span > 12 ? 0 : this.chartLastPosition.x
params.y = this.chartLastPosition.y + 12
}
delete params.panel
if (params.type === 'table') {
delete params.param.tags

View File

@@ -36,7 +36,12 @@ export default {
methods: {
refresh () {
this.containerShow = false
this.$nextTick(() => { this.containerShow = true })
new Promise(resolve => {
this.$router.replace({ path: this.$route.path, query: {} })
resolve()
}).then(() => {
this.$nextTick(() => { this.containerShow = true })
})
}
},
destroyed () {

View File

@@ -821,11 +821,11 @@ export default {
searchTime: { target: this, propertyName: 'searchTime', type: 'jsonParse' },
nowTimeType: { target: this, propertyName: 'nowTimeType', type: 'jsonParse' }
}
this.initQueryFromPath(searchKeys)
setTimeout(() => {
this.showPanel.id = this.panelId
this.filter.panelId = this.panelId
})
this.initQueryFromPath(searchKeys)
if (this.nowTimeType.type) {
this.setSearchTime(this.nowTimeType.type, this.nowTimeType.value, this.nowTimeType)
this.filter.start_time = bus.timeFormate(this.searchTime[0], 'yyyy-MM-dd hh:mm:ss')