fix: 修改key

This commit is contained in:
mtruning 2022-01-16 22:17:34 +08:00
parent 5550e75893
commit d54c9d2388
36 changed files with 130 additions and 86 deletions

View File

@ -1,3 +1,12 @@
import LoadingComponent from './index.vue'; import type { App } from 'vue'
import LoadingComponent from './index.vue'
import AsyncLoading from './index.vue'
export { LoadingComponent }; // 正常组件
export { LoadingComponent }
// 异步
AsyncLoading.install = (app: App): void => {
app.component('AsyncLoading', AsyncLoading)
}
export { AsyncLoading }

View File

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<Skeleton repeat="3" :load="true"/> <Skeleton :repeat="3" :load="true"/>
</div> </div>
</template> </template>

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d' import { ChatCategoryEnum } from '../../index.d'
export const BarCommonConfig: ConfigType = { export const BarCommonConfig: ConfigType = {
key: 'BarCommon', key: 'VBarCommon',
title: '柱状图', title: '柱状图',
category: ChatCategoryEnum.BAR, category: ChatCategoryEnum.BAR,
node: BarCommon, node: BarCommon,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d' import { ChatCategoryEnum } from '../../index.d'
export const BarCrossrangefig: ConfigType = { export const BarCrossrangefig: ConfigType = {
key: 'BarCrossrange', key: 'VBarCrossrange',
title: '横向柱状图', title: '横向柱状图',
category: ChatCategoryEnum.BAR, category: ChatCategoryEnum.BAR,
node: BarCrossrange, node: BarCrossrange,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d' import { ChatCategoryEnum } from '../../index.d'
export const LineCommonConfig: ConfigType = { export const LineCommonConfig: ConfigType = {
key: 'LineCommon', key: 'VLineCommon',
title: '折线图', title: '折线图',
category: ChatCategoryEnum.LINE, category: ChatCategoryEnum.LINE,
node: LineCommon, node: LineCommon,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d' import { ChatCategoryEnum } from '../../index.d'
export const LineGradientSingleConfig: ConfigType = { export const LineGradientSingleConfig: ConfigType = {
key: 'LineGradientSingle', key: 'VLineGradientSingle',
title: '折线面积图', title: '折线面积图',
category: ChatCategoryEnum.LINE, category: ChatCategoryEnum.LINE,
node: LineGradientSingle, node: LineGradientSingle,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d' import { ChatCategoryEnum } from '../../index.d'
export const LineGradientsConfig: ConfigType = { export const LineGradientsConfig: ConfigType = {
key: 'LineGradientSingle', key: 'VLineGradientSingle',
title: '折线面积图', title: '折线面积图',
category: ChatCategoryEnum.LINE, category: ChatCategoryEnum.LINE,
node: LineGradients, node: LineGradients,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d' import { ChatCategoryEnum } from '../../index.d'
export const MapChineConfig: ConfigType = { export const MapChineConfig: ConfigType = {
key: 'MapChine', key: 'VMapChine',
title: '北京地图', title: '北京地图',
category: ChatCategoryEnum.MAP, category: ChatCategoryEnum.MAP,
node: MapChine, node: MapChine,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d' import { ChatCategoryEnum } from '../../index.d'
export const FunnelConfig: ConfigType = { export const FunnelConfig: ConfigType = {
key: 'Funnel', key: 'VFunnel',
title: '漏斗图', title: '漏斗图',
category: ChatCategoryEnum.MORE, category: ChatCategoryEnum.MORE,
node: Funnel, node: Funnel,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d' import { ChatCategoryEnum } from '../../index.d'
export const HeatmapConfig: ConfigType = { export const HeatmapConfig: ConfigType = {
key: 'Heatmap', key: 'VHeatmap',
title: '热力图', title: '热力图',
category: ChatCategoryEnum.MORE, category: ChatCategoryEnum.MORE,
node: Heatmap, node: Heatmap,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d' import { ChatCategoryEnum } from '../../index.d'
export const PointConfig: ConfigType = { export const PointConfig: ConfigType = {
key: 'Point', key: 'VPoint',
title: '热力图', title: '热力图',
category: ChatCategoryEnum.MORE, category: ChatCategoryEnum.MORE,
node: Point, node: Point,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d' import { ChatCategoryEnum } from '../../index.d'
export const RadarConfig: ConfigType = { export const RadarConfig: ConfigType = {
key: 'Radar', key: 'VRadar',
title: '雷达', title: '雷达',
category: ChatCategoryEnum.MORE, category: ChatCategoryEnum.MORE,
node: Radar, node: Radar,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d' import { ChatCategoryEnum } from '../../index.d'
export const TreeMapConfig: ConfigType = { export const TreeMapConfig: ConfigType = {
key: 'TreeMap', key: 'VTreeMap',
title: '树形分布', title: '树形分布',
category: ChatCategoryEnum.MORE, category: ChatCategoryEnum.MORE,
node: TreeMap, node: TreeMap,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d' import { ChatCategoryEnum } from '../../index.d'
export const VariableConfig: ConfigType = { export const VariableConfig: ConfigType = {
key: 'Variable', key: 'VVariable',
title: '折线面积图', title: '折线面积图',
category: ChatCategoryEnum.MORE, category: ChatCategoryEnum.MORE,
node: Variable, node: Variable,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d' import { ChatCategoryEnum } from '../../index.d'
export const PieCommonConfig: ConfigType = { export const PieCommonConfig: ConfigType = {
key: 'PieCommon', key: 'VPieCommon',
title: '计量图', title: '计量图',
category: ChatCategoryEnum.PIE, category: ChatCategoryEnum.PIE,
node: PieCommon, node: PieCommon,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d' import { ChatCategoryEnum } from '../../index.d'
export const NumberConfig: ConfigType = { export const NumberConfig: ConfigType = {
key: 'Number', key: 'VNumber',
title: '数字翻牌', title: '数字翻牌',
category: ChatCategoryEnum.MORE, category: ChatCategoryEnum.MORE,
node: Number, node: Number,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d' import { ChatCategoryEnum } from '../../index.d'
export const TimeConfig: ConfigType = { export const TimeConfig: ConfigType = {
key: 'Time', key: 'VTime',
title: '时间', title: '时间',
category: ChatCategoryEnum.MORE, category: ChatCategoryEnum.MORE,
node: Time, node: Time,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d' import { ChatCategoryEnum } from '../../index.d'
export const WeatherConfig: ConfigType = { export const WeatherConfig: ConfigType = {
key: 'Weather', key: 'VWeather',
title: '天气', title: '天气',
category: ChatCategoryEnum.MORE, category: ChatCategoryEnum.MORE,
node: Weather, node: Weather,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d' import { ChatCategoryEnum } from '../../index.d'
export const WeatherTimeConfig: ConfigType = { export const WeatherTimeConfig: ConfigType = {
key: 'WeatherTime', key: 'VWeatherTime',
title: '天气和时间', title: '天气和时间',
category: ChatCategoryEnum.MORE, category: ChatCategoryEnum.MORE,
node: WeatherTime, node: WeatherTime,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d' import { ChatCategoryEnum } from '../../index.d'
export const BorderCommonConfig: ConfigType = { export const BorderCommonConfig: ConfigType = {
key: 'BorderCommon', key: 'VBorderCommon',
title: '边框', title: '边框',
category: ChatCategoryEnum.BORDER, category: ChatCategoryEnum.BORDER,
node: BorderCommon, node: BorderCommon,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d' import { ChatCategoryEnum } from '../../index.d'
export const ImageConfig: ConfigType = { export const ImageConfig: ConfigType = {
key: 'Image', key: 'VImage',
title: '图片', title: '图片',
category: ChatCategoryEnum.MORE, category: ChatCategoryEnum.MORE,
node: Image, node: Image,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d' import { ChatCategoryEnum } from '../../index.d'
export const TextCloudConfig: ConfigType = { export const TextCloudConfig: ConfigType = {
key: 'TextCloud', key: 'VTextCloud',
title: '词云', title: '词云',
category: ChatCategoryEnum.MORE, category: ChatCategoryEnum.MORE,
node: TextCloud, node: TextCloud,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d' import { ChatCategoryEnum } from '../../index.d'
export const TextCommonConfig: ConfigType = { export const TextCommonConfig: ConfigType = {
key: 'Text', key: 'VText',
title: '文字', title: '文字',
category: ChatCategoryEnum.TEXT, category: ChatCategoryEnum.TEXT,
node: TextCommon, node: TextCommon,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d' import { ChatCategoryEnum } from '../../index.d'
export const TitleBevelAngleConfig: ConfigType = { export const TitleBevelAngleConfig: ConfigType = {
key: 'TitleBevelAngle', key: 'VTitleBevelAngle',
title: '斜角标题', title: '斜角标题',
category: ChatCategoryEnum.TITLE, category: ChatCategoryEnum.TITLE,
node: TitleBevelAngle, node: TitleBevelAngle,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d' import { ChatCategoryEnum } from '../../index.d'
export const TitleCommonConfig: ConfigType = { export const TitleCommonConfig: ConfigType = {
key: 'Text', key: 'VText',
title: '普通标题', title: '普通标题',
category: ChatCategoryEnum.TITLE, category: ChatCategoryEnum.TITLE,
node: TitleCommon, node: TitleCommon,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d' import { ChatCategoryEnum } from '../../index.d'
export const TitleProConfig: ConfigType = { export const TitleProConfig: ConfigType = {
key: 'TitlePro', key: 'VTitlePro',
title: '中心标题', title: '中心标题',
category: ChatCategoryEnum.TITLE, category: ChatCategoryEnum.TITLE,
node: TitlePro, node: TitlePro,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../index.d' import { ChatCategoryEnum } from '../index.d'
export const TableCategoryConfig: ConfigType = { export const TableCategoryConfig: ConfigType = {
key: 'TableCategory', key: 'VTableCategory',
title: '归类表格', title: '归类表格',
category: ChatCategoryEnum.table, category: ChatCategoryEnum.table,
node: TableCategory, node: TableCategory,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../index.d' import { ChatCategoryEnum } from '../index.d'
export const TableCommonConfig: ConfigType = { export const TableCommonConfig: ConfigType = {
key: 'TableCommon', key: 'VTableCommon',
title: '表格', title: '表格',
category: ChatCategoryEnum.table, category: ChatCategoryEnum.table,
node: TableCommon, node: TableCommon,

View File

View File

@ -58,7 +58,7 @@ export const useChartLayoutStore = defineStore({
;(this as any)[key] = value ;(this as any)[key] = value
setLocalStorage(GO_CHART_LAYOUT_STORE, this.$state) setLocalStorage(GO_CHART_LAYOUT_STORE, this.$state)
}, },
setFilter<T extends keyof ChartLayoutType>(key: T, value: boolean): void { setFilter<T extends keyof ChartLayoutFilterType>(key: T, value: boolean): void {
;(this.filter as any)[key] = value ;(this.filter as any)[key] = value
setLocalStorage(GO_CHART_LAYOUT_STORE, this.$state) setLocalStorage(GO_CHART_LAYOUT_STORE, this.$state)
}, },

14
src/utils/componets.ts Normal file
View File

@ -0,0 +1,14 @@
import { defineAsyncComponent, AsyncComponentLoader } from 'vue'
import { AsyncLoading } from '@/components/LoadingComponent'
/**
* *
* @param loader
* @returns
*/
export const loadAsyncComponent = (loader: AsyncComponentLoader<any>) =>
defineAsyncComponent({
loader,
loadingComponent: AsyncLoading,
delay: 20,
})

View File

@ -4,7 +4,7 @@ import screenfull from 'screenfull'
import debounce from 'lodash/debounce' import debounce from 'lodash/debounce'
/** /**
* * ID * * ID
* @param { Number } randomLength * @param { Number } randomLength
*/ */
export function getUUID(randomLength: number) { export function getUUID(randomLength: number) {

View File

@ -1,76 +1,100 @@
<template> <template>
<ContentBox <n-layout has-sider sider-placement="right">
class="go-content-layers go-boderbox" <n-layout-content>
:class="{ scoped: !chartLayoutStore.getDetails }" <!-- 为了展示折叠的按钮放在了这里 呜呜呜 -->
:showTop="false" <ContentDrag />
:depth="2" </n-layout-content>
> <n-layout-sider
<n-tabs class="tabs-box" size="small" type="segment"> collapse-mode="transform"
<n-tab-pane :collapsed-width="0"
v-for="item in tabList" :width="350"
:key="item.key" :collapsed="collapsed"
:name="item.key" :native-scrollbar="false"
display-directive="show:lazy" show-trigger="bar"
> @collapse="collapsedHindle"
<template #tab> @expand="expandHindle"
<n-space> >
<span>{{ item.title }}</span> <ContentBox class="go-content-layers go-boderbox" :showTop="false" :depth="2">
<n-icon size="16" class="icon-position"> <n-tabs class="tabs-box" size="small" type="segment">
<component :is="item.icon"></component> <n-tab-pane
</n-icon> v-for="item in tabList"
</n-space> :key="item.key"
</template> :name="item.key"
<component :is="item.render"></component> display-directive="show:lazy"
</n-tab-pane> >
</n-tabs> <template #tab>
</ContentBox> <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>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { reactive, shallowRef } from 'vue' import { shallowRef, ref, toRefs, watch } from 'vue'
import { icon } from '@/plugins' import { icon } from '@/plugins'
import { ContentBox } from '../ContentBox/index' import { ContentBox } from '../ContentBox/index'
import { useChartLayoutStore } from '@/store/modules/chartLayoutStore/chartLayoutStore' import { useChartLayoutStore } from '@/store/modules/chartLayoutStore/chartLayoutStore'
import { ChartLayoutStoreEnums } from '@/store/modules/chartLayoutStore/chartLayoutStore.d'
import { Setting } from './components/Setting/index' import { Setting } from './components/Setting/index'
import { Behind } from './components/Behind/index' import { Behind } from './components/Behind/index'
import { ContentDrag } from '../ContentDrag/index'
const chartLayoutStore = useChartLayoutStore() const { getDetails } = toRefs(useChartLayoutStore())
const { setItem } = useChartLayoutStore()
const { CubeIcon, FlashIcon } = icon.ionicons5 const { CubeIcon, FlashIcon } = icon.ionicons5
const tabList = reactive([ const collapsed = ref<boolean>(getDetails.value)
const collapsedHindle = () => {
collapsed.value = true
setItem(ChartLayoutStoreEnums.DETAILS, true)
}
const expandHindle = () => {
collapsed.value = false
setItem(ChartLayoutStoreEnums.DETAILS, false)
}
watch(getDetails, (newData) => {
if (newData) {
collapsedHindle()
} else {
expandHindle()
}
})
const tabList = shallowRef([
{ {
key: 'setting', key: 'setting',
title: '配置项', title: '配置项',
icon: CubeIcon, icon: CubeIcon,
render: shallowRef(Setting) render: Setting
}, },
{ {
key: 'behind', key: 'behind',
title: '后端数据', title: '后端数据',
icon: FlashIcon, icon: FlashIcon,
render: shallowRef(Behind) render: Behind
} }
]) ])
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
$wight: 400px;
@include go(content-layers) { @include go(content-layers) {
width: $wight;
padding: 10px; padding: 10px;
overflow: hidden; overflow: hidden;
@extend .go-transition;
.icon-position { .icon-position {
padding-top: 2px; padding-top: 2px;
} }
&.scoped {
width: 0;
padding: 0;
}
.tabs-box {
/* padding 值 */
width: $wight - 2 * 10;
}
} }
</style> </style>

View File

@ -8,19 +8,9 @@
</template> </template>
</n-button> </n-button>
<n-space> <n-space>
<n-tooltip <n-tooltip v-for="item in btnList" :key="item.key" placement="bottom" trigger="hover">
v-for="item in btnList"
:key="item.key"
placement="bottom"
trigger="hover"
>
<template #trigger> <template #trigger>
<n-button <n-button :type="styleHandle(item)" size="small" ghost @click="clickHandle(item)">
:type="item.select ? 'success' : ''"
size="small"
ghost
@click="clickHandle(item)"
>
<component :is="item.icon"></component> <component :is="item.icon"></component>
</n-button> </n-button>
</template> </template>
@ -69,6 +59,15 @@ const btnList = reactive<ItemType[]>([
} }
]) ])
// store ContentDetails collapsed
const styleHandle = (item: ItemType) => {
if (item.key === ChartLayoutStoreEnums.DETAILS) {
return item.select ? '' : 'success'
}
return item.select ? 'success' : ''
}
const clickHandle = (item: ItemType) => { const clickHandle = (item: ItemType) => {
setItem(item.key, !item.select) setItem(item.key, !item.select)
} }

View File

@ -15,7 +15,6 @@
<n-layout-content content-style="overflow:hidden; display: flex"> <n-layout-content content-style="overflow:hidden; display: flex">
<ContentCharts /> <ContentCharts />
<ContentLayers /> <ContentLayers />
<ContentDrag />
<ContentDetails /> <ContentDetails />
</n-layout-content> </n-layout-content>
</n-layout> </n-layout>
@ -29,7 +28,6 @@ import { HeaderRightBtn } from './components/HeaderRightBtn/index'
import { HeaderTitle } from './components/HeaderTitle/index' import { HeaderTitle } from './components/HeaderTitle/index'
import { ContentLayers } from './components/ContentLayers/index' import { ContentLayers } from './components/ContentLayers/index'
import { ContentCharts } from './components/ContentCharts/index' import { ContentCharts } from './components/ContentCharts/index'
import { ContentDrag } from './components/ContentDrag/index'
import { ContentDetails } from './components/ContentDetails/index' import { ContentDetails } from './components/ContentDetails/index'
</script> </script>