fix:修改新增的问题

This commit is contained in:
zhangyu
2021-12-17 16:39:22 +08:00
parent 5d74bc7828
commit d1c6a8c8b0
2 changed files with 10 additions and 4 deletions

View File

@@ -86,7 +86,7 @@
<script> <script>
import VueGridLayout from 'vue-grid-layout' import VueGridLayout from 'vue-grid-layout'
import { fromRoute } from '@/components/common/js/constants' import { fromRoute } from '@/components/common/js/constants'
import { getGroupHeight, getLayoutPosition } from './chart/tools' import {getGroupHeight, getLayoutPosition, isGroup} from './chart/tools'
import panelChart from '@/components/chart/panelChart' import panelChart from '@/components/chart/panelChart'
import bus from '@/libs/bus' import bus from '@/libs/bus'
import groupData from '@/components/chart/tempGroup' import groupData from '@/components/chart/tempGroup'
@@ -289,8 +289,10 @@ export default {
this.firstInit = true this.firstInit = true
this.gridLayoutLoading = true this.gridLayoutLoading = true
this.noData = !n || n.length < 1 this.noData = !n || n.length < 1
if (!this.isGroup) {
const position = getLayoutPosition(n) const position = getLayoutPosition(n)
this.$store.commit('setChartLastPosition', position) this.$store.commit('setChartLastPosition', position)
}
const tempList = n.map(item => { const tempList = n.map(item => {
let param = '' let param = ''
let height = '' let height = ''

View File

@@ -174,10 +174,14 @@ export default {
if (!params.groupId) { if (!params.groupId) {
params.groupId = 0 params.groupId = 0
} }
if (!params.x || !params.y) { if (!params.x && !params.y) {
params.x = this.chartLastPosition.x + params.span > 12 ? 0 : this.chartLastPosition.x params.x = this.chartLastPosition.x + params.span > 12 ? 0 : this.chartLastPosition.x
params.y = this.chartLastPosition.y + 12 params.y = this.chartLastPosition.y + 12
} }
if (!params.x && !params.y && params.groupId) { // group 内的坐标需要单独计算
params.x = 0
params.y = 999
}
delete params.panel delete params.panel
if (params.type === 'table') { if (params.type === 'table') {
delete params.param.tags delete params.param.tags