组合拆分
This commit is contained in:
parent
64958d398e
commit
377b7d9938
@ -5,15 +5,21 @@ import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
|
|||||||
import { storeToRefs } from 'pinia'
|
import { storeToRefs } from 'pinia'
|
||||||
import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot'
|
import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot'
|
||||||
import Icon from '../icon-custom/src/Icon.vue'
|
import Icon from '../icon-custom/src/Icon.vue'
|
||||||
|
import dvInfoSvg from '@/assets/svg/dv-info.svg'
|
||||||
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
|
import combinationSvg from '@/assets/svg/combinationpage.svg'
|
||||||
|
import scatterSvg from '@/assets/svg/scatterpage.svg'
|
||||||
|
import { composeStoreWithOut } from '@/store/modules/data-visualization/compose'
|
||||||
const dvMainStore = dvMainStoreWithOut()
|
const dvMainStore = dvMainStoreWithOut()
|
||||||
const { canvasCollapse } = storeToRefs(dvMainStore)
|
const { canvasCollapse,curComponent } = storeToRefs(dvMainStore)
|
||||||
let componentNameEdit = ref(false)
|
let componentNameEdit = ref(false)
|
||||||
let inputComponentName = ref({ id: null, name: null })
|
let inputComponentName = ref({ id: null, name: null })
|
||||||
let componentNameInputAttr = ref(null)
|
let componentNameInputAttr = ref(null)
|
||||||
import dvInfoSvg from '@/assets/svg/dv-info.svg'
|
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
|
||||||
const snapshotStore = snapshotStoreWithOut()
|
const snapshotStore = snapshotStoreWithOut()
|
||||||
|
const composeStore = composeStoreWithOut()
|
||||||
|
const { areaData } = storeToRefs(composeStore)
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
const emit = defineEmits(['close', 'rename'])
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
element: {
|
element: {
|
||||||
required: false,
|
required: false,
|
||||||
@ -58,10 +64,13 @@ const props = defineProps({
|
|||||||
type: String as PropType<EditorTheme>,
|
type: String as PropType<EditorTheme>,
|
||||||
default: 'light'
|
default: 'light'
|
||||||
},
|
},
|
||||||
title: String
|
title: String,
|
||||||
|
activePosition: {
|
||||||
|
type: String,
|
||||||
|
default: 'canvas'
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
const { width, asidePosition, sideName, themeInfo, view, themes, element,activePosition } = toRefs(props)
|
||||||
const { width, asidePosition, sideName, themeInfo, view, themes, element } = toRefs(props)
|
|
||||||
const collapseChange = () => {
|
const collapseChange = () => {
|
||||||
canvasCollapse.value[sideName.value] = !canvasCollapse.value[sideName.value]
|
canvasCollapse.value[sideName.value] = !canvasCollapse.value[sideName.value]
|
||||||
}
|
}
|
||||||
@ -122,6 +131,33 @@ const editComponentName = () => {
|
|||||||
const onComponentNameChange = () => {
|
const onComponentNameChange = () => {
|
||||||
snapshotStore.recordSnapshotCache('onComponentNameChange')
|
snapshotStore.recordSnapshotCache('onComponentNameChange')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//组合
|
||||||
|
const combinationclick = () => {
|
||||||
|
if(areaData.value.components.length){
|
||||||
|
composeStore.compose()
|
||||||
|
snapshotStore.recordSnapshotCache('componentCompose')
|
||||||
|
menuOpt('componentCompose')
|
||||||
|
}else{
|
||||||
|
ElMessage.warning('请选择多个组件进行组合!')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//打散
|
||||||
|
const scatterclick= () => {
|
||||||
|
if(curComponent.value['component'] == 'Group'){
|
||||||
|
composeStore.decompose()
|
||||||
|
snapshotStore.recordSnapshotCache('decompose')
|
||||||
|
menuOpt('decompose')
|
||||||
|
}else{
|
||||||
|
ElMessage.warning('请选择组合!')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const menuOpt = optName => {
|
||||||
|
const param = { opt: optName }
|
||||||
|
activePosition.value === 'aside' && emit('close', param)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -168,6 +204,15 @@ const onComponentNameChange = () => {
|
|||||||
</div>
|
</div>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
</div>
|
</div>
|
||||||
|
<div style="display: flex;">
|
||||||
|
<div v-if="!canvasCollapse[sideName] && asidePosition === 'left'">
|
||||||
|
<el-icon title="组合" style="font-size: 16px;margin-right: 8px;cursor: pointer" @click="combinationclick">
|
||||||
|
<Icon><combinationSvg class="svg-icon" /></Icon>
|
||||||
|
</el-icon>
|
||||||
|
<el-icon title="打散" style="font-size: 16px;margin-right: 5px;cursor: pointer" @click="scatterclick">
|
||||||
|
<Icon><scatterSvg class="svg-icon" /></Icon>
|
||||||
|
</el-icon>
|
||||||
|
</div>
|
||||||
<el-icon
|
<el-icon
|
||||||
:title="title"
|
:title="title"
|
||||||
:class="['custom-icon-' + themeInfo, 'collapse-icon-' + themeInfo]"
|
:class="['custom-icon-' + themeInfo, 'collapse-icon-' + themeInfo]"
|
||||||
@ -182,6 +227,7 @@ const onComponentNameChange = () => {
|
|||||||
/>
|
/>
|
||||||
<Fold v-else />
|
<Fold v-else />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
|
</div>
|
||||||
</el-row>
|
</el-row>
|
||||||
<div class="main-content" v-if="!canvasCollapse[sideName]">
|
<div class="main-content" v-if="!canvasCollapse[sideName]">
|
||||||
<el-scrollbar>
|
<el-scrollbar>
|
||||||
|
@ -2040,10 +2040,10 @@ const deleteChartFieldItem = id => {
|
|||||||
><Icon><dvInfoSvg class="svg-icon" /></Icon
|
><Icon><dvInfoSvg class="svg-icon" /></Icon
|
||||||
></el-icon>
|
></el-icon>
|
||||||
</template>
|
</template>
|
||||||
<div style="margin-bottom: 4px; font-size: 14px; color: #646a73">
|
<div style="margin-bottom: 4px; font-size: 14px; color: #fff">
|
||||||
{{ t('visualization.view_id') }}
|
{{ t('visualization.view_id') }}
|
||||||
</div>
|
</div>
|
||||||
<div style="font-size: 14px; color: #1f2329">
|
<div style="font-size: 14px; color: #fff">
|
||||||
{{ view.id }}
|
{{ view.id }}
|
||||||
</div>
|
</div>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
|
Loading…
Reference in New Issue
Block a user