mirror of
https://github.com/dataease/dataease.git
synced 2026-05-23 22:08:34 +08:00
feat: 仪表板编辑时可以进行视图的复制,复制后的视图样式等改变不影响原有视图
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<template v-if="curComponent">
|
||||
<template v-if="!curComponent.isLock">
|
||||
<li v-if="editFilter.includes(curComponent.type)" @click="edit"> {{ $t('panel.edit') }}</li>
|
||||
<!-- <li @click="copy"> {{ $t('panel.copy') }}</li>-->
|
||||
<li @click="copy"> {{ $t('panel.copy') }}</li>
|
||||
<li @click="paste"> {{ $t('panel.paste') }}</li>
|
||||
<li @click="cut"> {{ $t('panel.cut') }}</li>
|
||||
<li @click="deleteComponent"> {{ $t('panel.delete') }}</li>
|
||||
|
||||
@@ -2,6 +2,7 @@ import store from '@/store/index'
|
||||
import toast from '@/components/canvas/utils/toast'
|
||||
import generateID from '@/components/canvas/utils/generateID'
|
||||
import { deepCopy } from '@/components/canvas/utils/utils'
|
||||
import { chartCopy } from '@/api/chart/chart'
|
||||
|
||||
export default {
|
||||
state: {
|
||||
@@ -36,7 +37,18 @@ export default {
|
||||
}
|
||||
|
||||
data.id = generateID()
|
||||
store.commit('addComponent', { component: deepCopy(data) })
|
||||
|
||||
// 如果是用户视图 测先进行底层复制
|
||||
debugger
|
||||
if (data.type === 'view') {
|
||||
chartCopy(data.propValue.viewId).then(res => {
|
||||
const newView = deepCopy(data)
|
||||
newView.propValue.viewId = res.data
|
||||
store.commit('addComponent', { component: newView })
|
||||
})
|
||||
} else {
|
||||
store.commit('addComponent', { component: deepCopy(data) })
|
||||
}
|
||||
if (state.isCut) {
|
||||
state.copyData = null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user