2022-01-06 13:45:51 +08:00
|
|
|
<template>
|
2022-01-16 22:17:34 +08:00
|
|
|
<n-layout has-sider sider-placement="right">
|
|
|
|
<n-layout-content>
|
2022-01-20 21:25:35 +08:00
|
|
|
<!-- 图表拖拽区域 -->
|
|
|
|
<ContentEdit />
|
2022-01-16 22:17:34 +08:00
|
|
|
</n-layout-content>
|
|
|
|
<n-layout-sider
|
|
|
|
collapse-mode="transform"
|
|
|
|
:collapsed-width="0"
|
|
|
|
:width="350"
|
|
|
|
:collapsed="collapsed"
|
|
|
|
:native-scrollbar="false"
|
|
|
|
show-trigger="bar"
|
|
|
|
@collapse="collapsedHindle"
|
|
|
|
@expand="expandHindle"
|
|
|
|
>
|
2022-02-06 01:04:05 +08:00
|
|
|
<ContentBox
|
|
|
|
class="go-content-layers go-boderbox"
|
|
|
|
:showTop="false"
|
|
|
|
:depth="2"
|
|
|
|
>
|
|
|
|
<!-- 画布 -->
|
|
|
|
<n-tabs
|
|
|
|
v-show="!selectTarget"
|
|
|
|
class="tabs-box"
|
|
|
|
size="small"
|
|
|
|
type="segment"
|
|
|
|
>
|
|
|
|
<n-tab-pane size="small" display-directive="show:lazy">
|
|
|
|
<template #tab>
|
|
|
|
<n-space>
|
|
|
|
<span> 页面设置 </span>
|
|
|
|
<n-icon size="16" class="icon-position">
|
|
|
|
<BrowsersOutlineIcon />
|
|
|
|
</n-icon>
|
|
|
|
</n-space>
|
|
|
|
</template>
|
|
|
|
<CanvasPage name="canvas" />
|
|
|
|
</n-tab-pane>
|
|
|
|
</n-tabs>
|
|
|
|
|
|
|
|
<!-- 编辑 -->
|
|
|
|
<n-tabs
|
|
|
|
v-show="selectTarget"
|
|
|
|
class="tabs-box"
|
|
|
|
size="small"
|
|
|
|
type="segment"
|
|
|
|
>
|
2022-01-16 22:17:34 +08:00
|
|
|
<n-tab-pane
|
|
|
|
v-for="item in tabList"
|
|
|
|
:key="item.key"
|
|
|
|
:name="item.key"
|
2022-02-06 01:04:05 +08:00
|
|
|
size="small"
|
2022-01-16 22:17:34 +08:00
|
|
|
display-directive="show:lazy"
|
|
|
|
>
|
|
|
|
<template #tab>
|
|
|
|
<n-space>
|
|
|
|
<span>{{ item.title }}</span>
|
|
|
|
<n-icon size="16" class="icon-position">
|
|
|
|
<component :is="item.icon"></component>
|
|
|
|
</n-icon>
|
|
|
|
</n-space>
|
|
|
|
</template>
|
|
|
|
<component :is="item.render"></component>
|
|
|
|
</n-tab-pane>
|
|
|
|
</n-tabs>
|
|
|
|
</ContentBox>
|
|
|
|
</n-layout-sider>
|
|
|
|
</n-layout>
|
2022-01-06 13:45:51 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2022-02-06 01:04:05 +08:00
|
|
|
import { shallowRef, ref, toRefs, watch, computed, reactive } from 'vue'
|
2022-01-06 13:45:51 +08:00
|
|
|
import { icon } from '@/plugins'
|
2022-02-06 01:04:05 +08:00
|
|
|
import { loadAsyncComponent } from '@/utils'
|
2022-01-06 15:37:44 +08:00
|
|
|
import { ContentBox } from '../ContentBox/index'
|
2022-01-08 21:01:52 +08:00
|
|
|
import { useChartLayoutStore } from '@/store/modules/chartLayoutStore/chartLayoutStore'
|
2022-01-20 21:25:35 +08:00
|
|
|
import { ChartLayoutStoreEnum } from '@/store/modules/chartLayoutStore/chartLayoutStore.d'
|
2022-02-06 01:04:05 +08:00
|
|
|
import { useChartEditStoreStore } from '@/store/modules/chartEditStore/chartEditStore'
|
2022-01-08 21:01:52 +08:00
|
|
|
|
2022-01-16 22:17:34 +08:00
|
|
|
const { getDetails } = toRefs(useChartLayoutStore())
|
|
|
|
const { setItem } = useChartLayoutStore()
|
2022-02-06 01:04:05 +08:00
|
|
|
const chartEditStoreStore = useChartEditStoreStore()
|
|
|
|
|
|
|
|
const { ConstructIcon, FlashIcon, BrowsersOutlineIcon } = icon.ionicons5
|
2022-01-06 15:37:44 +08:00
|
|
|
|
2022-02-06 01:04:05 +08:00
|
|
|
const ContentEdit = loadAsyncComponent(() => import('../ContentEdit/index.vue'))
|
|
|
|
const CanvasPage = loadAsyncComponent(() =>
|
|
|
|
import('./components/CanvasPage/index.vue')
|
|
|
|
)
|
|
|
|
|
|
|
|
const Setting = loadAsyncComponent(() =>
|
|
|
|
import('./components/Setting/index.vue')
|
|
|
|
)
|
|
|
|
const Behind = loadAsyncComponent(() => import('./components/Behind/index.vue'))
|
2022-01-08 21:01:52 +08:00
|
|
|
|
2022-01-16 22:17:34 +08:00
|
|
|
const collapsed = ref<boolean>(getDetails.value)
|
|
|
|
|
|
|
|
const collapsedHindle = () => {
|
|
|
|
collapsed.value = true
|
2022-01-20 21:25:35 +08:00
|
|
|
setItem(ChartLayoutStoreEnum.DETAILS, true)
|
2022-01-16 22:17:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const expandHindle = () => {
|
|
|
|
collapsed.value = false
|
2022-01-20 21:25:35 +08:00
|
|
|
setItem(ChartLayoutStoreEnum.DETAILS, false)
|
2022-01-16 22:17:34 +08:00
|
|
|
}
|
|
|
|
|
2022-02-06 01:04:05 +08:00
|
|
|
const selectTarget = computed(() => {
|
|
|
|
const selectId = chartEditStoreStore.getTargetChart.selectId
|
|
|
|
if (!selectId) return undefined
|
|
|
|
return chartEditStoreStore.componentList[
|
|
|
|
chartEditStoreStore.fetchTargetIndex()
|
|
|
|
]
|
|
|
|
})
|
|
|
|
|
|
|
|
watch(getDetails, newData => {
|
2022-01-16 22:17:34 +08:00
|
|
|
if (newData) {
|
|
|
|
collapsedHindle()
|
|
|
|
} else {
|
|
|
|
expandHindle()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2022-01-19 21:29:04 +08:00
|
|
|
// 页面设置
|
|
|
|
const pageSetting = reactive({
|
|
|
|
key: 'pageSetting',
|
|
|
|
title: '页面设置',
|
2022-02-06 01:04:05 +08:00
|
|
|
render: CanvasPage
|
2022-01-19 21:29:04 +08:00
|
|
|
})
|
|
|
|
|
2022-01-16 22:17:34 +08:00
|
|
|
const tabList = shallowRef([
|
2022-01-08 21:01:52 +08:00
|
|
|
{
|
|
|
|
key: 'setting',
|
2022-01-19 21:29:04 +08:00
|
|
|
title: '设置',
|
2022-02-06 01:04:05 +08:00
|
|
|
icon: ConstructIcon,
|
2022-01-16 22:17:34 +08:00
|
|
|
render: Setting
|
2022-01-08 21:01:52 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'behind',
|
2022-02-04 18:28:02 +08:00
|
|
|
title: '数据',
|
2022-01-10 09:49:08 +08:00
|
|
|
icon: FlashIcon,
|
2022-01-16 22:17:34 +08:00
|
|
|
render: Behind
|
2022-01-08 21:01:52 +08:00
|
|
|
}
|
|
|
|
])
|
2022-01-06 13:45:51 +08:00
|
|
|
</script>
|
2022-01-06 15:37:44 +08:00
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
@include go(content-layers) {
|
|
|
|
padding: 10px;
|
2022-01-08 21:01:52 +08:00
|
|
|
overflow: hidden;
|
2022-01-06 15:37:44 +08:00
|
|
|
.icon-position {
|
|
|
|
padding-top: 2px;
|
|
|
|
}
|
|
|
|
}
|
2022-01-06 13:45:51 +08:00
|
|
|
</style>
|