forked from github/dataease
Merge pull request #12048 from dataease/pr@dev-v2@feat_tab-copy
feat(仪表板、数据大屏): Tab组件支持整页复制 #10828
This commit is contained in:
commit
5c04c49af6
@ -47,6 +47,9 @@
|
||||
>
|
||||
删除
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeHandleCommand('copyCur', tabItem)">
|
||||
复制
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
@ -126,10 +129,12 @@ import DePreview from '@/components/data-visualization/canvas/DePreview.vue'
|
||||
import { useEmitt } from '@/hooks/web/useEmitt'
|
||||
import { getPanelAllLinkageInfo } from '@/api/visualization/linkage'
|
||||
import { dataVTabComponentAdd, groupSizeStyleAdaptor } from '@/utils/style'
|
||||
import { copyStoreWithOut, deepCopyTabItemHelper } from '@/store/modules/data-visualization/copy'
|
||||
const dvMainStore = dvMainStoreWithOut()
|
||||
const { tabMoveInActiveId, bashMatrixInfo, editMode, mobileInPc } = storeToRefs(dvMainStore)
|
||||
const tabComponentRef = ref(null)
|
||||
let carouselTimer = null
|
||||
const copyStore = copyStoreWithOut()
|
||||
|
||||
const props = defineProps({
|
||||
canvasStyleData: {
|
||||
@ -259,6 +264,10 @@ function deleteCur(param) {
|
||||
}
|
||||
}
|
||||
}
|
||||
function copyCur(param) {
|
||||
state.curItem = param
|
||||
element.value.propValue.push(deepCopyTabItemHelper(element.value.id, param))
|
||||
}
|
||||
|
||||
function editCurTitle(param) {
|
||||
state.activeTabName = param.name
|
||||
|
@ -184,6 +184,19 @@ export const copyStore = defineStore('copy', {
|
||||
}
|
||||
})
|
||||
|
||||
export function deepCopyTabItemHelper(tabId, tabItem, idMap) {
|
||||
const result = deepCopy(tabItem)
|
||||
const newComponentId = generateID()
|
||||
result.id = newComponentId
|
||||
result.componentData = []
|
||||
tabItem.componentData.forEach(item => {
|
||||
const newItem = deepCopyHelper(item, idMap)
|
||||
newItem.canvasId = tabId + '--' + newComponentId
|
||||
result.componentData.push(deepCopyHelper(item, idMap))
|
||||
})
|
||||
return result
|
||||
}
|
||||
|
||||
function deepCopyHelper(data, idMap) {
|
||||
const result = deepCopy(data)
|
||||
const newComponentId = generateID()
|
||||
|
Loading…
Reference in New Issue
Block a user