forked from github/dataease
Merge pull request #11166 from dataease/pr@dev-v2@fix_group
Pr@dev v2@fix group
This commit is contained in:
commit
26dcce3860
@ -33,7 +33,13 @@ const transformIndex = index => {
|
|||||||
return componentData.value.length - 1 - index
|
return componentData.value.length - 1 - index
|
||||||
}
|
}
|
||||||
const areaDataPush = component => {
|
const areaDataPush = component => {
|
||||||
if (component && !component.isLock && component.isShow && component.canvasId === 'canvas-main') {
|
if (
|
||||||
|
component &&
|
||||||
|
!component.isLock &&
|
||||||
|
component.isShow &&
|
||||||
|
component.canvasId === 'canvas-main' &&
|
||||||
|
component.category !== 'hidden'
|
||||||
|
) {
|
||||||
areaData.value.components.push(component)
|
areaData.value.components.push(component)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -63,7 +69,11 @@ const shiftDataPush = curClickIndex => {
|
|||||||
const shiftAreaComponents = componentData.value
|
const shiftAreaComponents = componentData.value
|
||||||
.slice(indexBegin, indexEnd + 1)
|
.slice(indexBegin, indexEnd + 1)
|
||||||
.filter(
|
.filter(
|
||||||
component => !areaDataIdArray.includes(component.id) && !component.isLock && component.isShow
|
component =>
|
||||||
|
!areaDataIdArray.includes(component.id) &&
|
||||||
|
!component.isLock &&
|
||||||
|
component.isShow &&
|
||||||
|
component.category !== 'hidden'
|
||||||
)
|
)
|
||||||
areaData.value.components.push(...shiftAreaComponents)
|
areaData.value.components.push(...shiftAreaComponents)
|
||||||
dvMainStore.setCurComponent({ component: null, index: null })
|
dvMainStore.setCurComponent({ component: null, index: null })
|
||||||
|
@ -1382,7 +1382,6 @@ const groupAreaClickChange = async () => {
|
|||||||
if (areaData.value.components.length > 1) {
|
if (areaData.value.components.length > 1) {
|
||||||
// 重新计算边界
|
// 重新计算边界
|
||||||
composeStore.calcComposeArea()
|
composeStore.calcComposeArea()
|
||||||
const hist2 = dvMainStore.componentData.filter(ele => ele.component === 'GroupArea')
|
|
||||||
if (groupAreaHis.length === 0) {
|
if (groupAreaHis.length === 0) {
|
||||||
// 如果不存在 新建视括组件
|
// 如果不存在 新建视括组件
|
||||||
groupAreaCom = findNewComponent('GroupArea', 'GroupArea')
|
groupAreaCom = findNewComponent('GroupArea', 'GroupArea')
|
||||||
|
@ -260,9 +260,11 @@ function handleCommand(command) {
|
|||||||
|
|
||||||
const reloadLinkage = () => {
|
const reloadLinkage = () => {
|
||||||
// 刷新联动信息
|
// 刷新联动信息
|
||||||
getPanelAllLinkageInfo(dvInfo.value.id).then(rsp => {
|
if (dvInfo.value.id) {
|
||||||
dvMainStore.setNowPanelTrackInfo(rsp.data)
|
getPanelAllLinkageInfo(dvInfo.value.id).then(rsp => {
|
||||||
})
|
dvMainStore.setNowPanelTrackInfo(rsp.data)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const componentMoveIn = component => {
|
const componentMoveIn = component => {
|
||||||
|
@ -142,7 +142,7 @@ export const composeStore = defineStore('compose', {
|
|||||||
|
|
||||||
const components = []
|
const components = []
|
||||||
areaData.components.forEach(component => {
|
areaData.components.forEach(component => {
|
||||||
if (component.component != 'Group') {
|
if (!['Group', 'GroupArea'].includes(component.component)) {
|
||||||
components.push(component)
|
components.push(component)
|
||||||
} else {
|
} else {
|
||||||
// 如果要组合的组件中,已经存在组合数据,则需要提前拆分
|
// 如果要组合的组件中,已经存在组合数据,则需要提前拆分
|
||||||
|
@ -1272,6 +1272,15 @@ export const dvMainStore = defineStore('dataVisualization', {
|
|||||||
mobileLayout: false
|
mobileLayout: false
|
||||||
}
|
}
|
||||||
this.canvasStyleData = { ...deepCopy(DEFAULT_CANVAS_STYLE_DATA_DARK), backgroundColor: null }
|
this.canvasStyleData = { ...deepCopy(DEFAULT_CANVAS_STYLE_DATA_DARK), backgroundColor: null }
|
||||||
|
},
|
||||||
|
removeGroupArea() {
|
||||||
|
// 清理临时组件
|
||||||
|
const groupAreaHis = this.componentData.filter(ele => ele.component === 'GroupArea')
|
||||||
|
if (groupAreaHis && groupAreaHis.length > 0) {
|
||||||
|
groupAreaHis.forEach(ele => {
|
||||||
|
this.deleteComponentById(ele.id)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -154,6 +154,7 @@ export const snapshotStore = defineStore('snapshot', {
|
|||||||
recordSnapshot() {
|
recordSnapshot() {
|
||||||
this.styleChangeTimes = ++this.styleChangeTimes
|
this.styleChangeTimes = ++this.styleChangeTimes
|
||||||
if (dataPrepareState.value) {
|
if (dataPrepareState.value) {
|
||||||
|
dvMainStore.removeGroupArea()
|
||||||
// 添加新的快照
|
// 添加新的快照
|
||||||
const newSnapshot = {
|
const newSnapshot = {
|
||||||
componentData: deepCopy(componentData.value),
|
componentData: deepCopy(componentData.value),
|
||||||
|
@ -329,6 +329,7 @@ export function checkIsBatchOptView(viewId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function canvasSave(callBack) {
|
export async function canvasSave(callBack) {
|
||||||
|
dvMainStore.removeGroupArea()
|
||||||
const componentDataToSave = cloneDeep(componentData.value)
|
const componentDataToSave = cloneDeep(componentData.value)
|
||||||
componentDataToSave.forEach(item => {
|
componentDataToSave.forEach(item => {
|
||||||
if (item.component === 'UserView') {
|
if (item.component === 'UserView') {
|
||||||
|
Loading…
Reference in New Issue
Block a user