Merge pull request #11166 from dataease/pr@dev-v2@fix_group

Pr@dev v2@fix group
This commit is contained in:
王嘉豪 2024-07-24 21:02:15 +08:00 committed by GitHub
commit 26dcce3860
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 29 additions and 7 deletions

View File

@ -33,7 +33,13 @@ const transformIndex = index => {
return componentData.value.length - 1 - index
}
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)
}
}
@ -63,7 +69,11 @@ const shiftDataPush = curClickIndex => {
const shiftAreaComponents = componentData.value
.slice(indexBegin, indexEnd + 1)
.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)
dvMainStore.setCurComponent({ component: null, index: null })

View File

@ -1382,7 +1382,6 @@ const groupAreaClickChange = async () => {
if (areaData.value.components.length > 1) {
//
composeStore.calcComposeArea()
const hist2 = dvMainStore.componentData.filter(ele => ele.component === 'GroupArea')
if (groupAreaHis.length === 0) {
//
groupAreaCom = findNewComponent('GroupArea', 'GroupArea')

View File

@ -260,9 +260,11 @@ function handleCommand(command) {
const reloadLinkage = () => {
//
getPanelAllLinkageInfo(dvInfo.value.id).then(rsp => {
dvMainStore.setNowPanelTrackInfo(rsp.data)
})
if (dvInfo.value.id) {
getPanelAllLinkageInfo(dvInfo.value.id).then(rsp => {
dvMainStore.setNowPanelTrackInfo(rsp.data)
})
}
}
const componentMoveIn = component => {

View File

@ -142,7 +142,7 @@ export const composeStore = defineStore('compose', {
const components = []
areaData.components.forEach(component => {
if (component.component != 'Group') {
if (!['Group', 'GroupArea'].includes(component.component)) {
components.push(component)
} else {
// 如果要组合的组件中已经存在组合数据则需要提前拆分

View File

@ -1272,6 +1272,15 @@ export const dvMainStore = defineStore('dataVisualization', {
mobileLayout: false
}
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)
})
}
}
}
})

View File

@ -154,6 +154,7 @@ export const snapshotStore = defineStore('snapshot', {
recordSnapshot() {
this.styleChangeTimes = ++this.styleChangeTimes
if (dataPrepareState.value) {
dvMainStore.removeGroupArea()
// 添加新的快照
const newSnapshot = {
componentData: deepCopy(componentData.value),

View File

@ -329,6 +329,7 @@ export function checkIsBatchOptView(viewId) {
}
export async function canvasSave(callBack) {
dvMainStore.removeGroupArea()
const componentDataToSave = cloneDeep(componentData.value)
componentDataToSave.forEach(item => {
if (item.component === 'UserView') {