fix:修改 block 默认高度的问题

This commit is contained in:
zhangyu
2022-01-25 18:43:16 +08:00
parent fa52e1ec4a
commit 9778665d04
3 changed files with 28 additions and 15 deletions

View File

@@ -45,7 +45,7 @@ import { ref } from 'vue'
import { panelTypeAndRouteMapping } from '@/utils/constants'
import { api, getPanelList, getChartList } from '@/utils/api'
import { getNowTime } from '@/utils/date-util'
import {getGroupHeight, getTypeCategory} from "@/views/charts/charts/tools";
import { getGroupHeight, getTypeCategory } from '@/views/charts/charts/tools'
export default {
name: 'Panel',
@@ -119,13 +119,19 @@ export default {
chart.params = {
collpase: false
}
chart.h = getGroupHeight(chart.children) + 2
chart.h = getGroupHeight(chart.children) + 1.5
if (chart.params.collpase) {
chart.h = 1
}
}
if (chart.type === 95) {
chart.h += 0
let sumGroup = 0
chart.children.forEach(item => {
if (item.type === 94) {
sumGroup++
}
})
chart.h += sumGroup * 0.5
}
if (!this.$_.isEmpty(chart.children)) {
chart.children.forEach(c => {

View File

@@ -121,7 +121,7 @@ export default {
if (item.params.collpase) {
item.h = 1
} else {
item.h = getGroupHeight(item.children) + 1
item.h = getGroupHeight(item.children) + 1.5
}
}
})
@@ -129,12 +129,19 @@ export default {
this.emitter.emit('groupParentCalcHeight', { chart, childrenList: this.copyDataList })
},
groupParentCalcHeight (chart, childrenList) {
console.log(chart, childrenList)
setTimeout(() => {
const parent = this.copyDataList.find(chartitem => chartitem.id === chart.parent.id)
const children = parent.children.find(item => item.id === chart.id)
children.h = chart.h
children.params = chart.params
parent.h = getGroupHeight(childrenList) + 2
let sumGroup = 0
childrenList.forEach(item => {
if (item.type === 94) {
sumGroup++
}
})
parent.h = getGroupHeight(childrenList) + sumGroup * 0.5
this.copyDataList = [...this.copyDataList]
}, 100)
}

View File

@@ -24,16 +24,16 @@ export default {
}
},
watch: {
'chartInfo.children': {
immediate: true,
deep: true,
handle (n) {
if (!this.firstShow) {
this.dataList = JSON.parse(JSON.stringify(this.chartInfo.children))
this.firstShow = true
}
}
}
// 'chartInfo.children': {
// immediate: true,
// deep: true,
// handle (n) {
// if (!this.firstShow) {
// this.dataList = JSON.parse(JSON.stringify(this.chartInfo.children))
// this.firstShow = true
// }
// }
// }
},
mounted () {
this.dataList = JSON.parse(JSON.stringify(this.chartInfo.children))