fix: 修改全局配置展示

This commit is contained in:
MTrun 2022-02-08 19:39:57 +08:00
parent 6d04bb8eea
commit 9d541d5ac3
15 changed files with 108 additions and 44 deletions

View File

@ -1,4 +1,4 @@
import { echartOptionProfixHandle, publicConfig } from '@/packages/utils'
import { echartOptionProfixHandle, publicConfig } from '@/packages/public'
import { BarCommonConfig } from './index'
import { ConfigType, CreateComponentType } from '@/packages/index.d'
import omit from 'lodash/omit'

View File

@ -1,4 +1,4 @@
import { echartOptionProfixHandle, publicConfig } from '@/packages/utils'
import { echartOptionProfixHandle, publicConfig } from '@/packages/public'
import { BarCrossrangefig } from './index'
import { ConfigType, CreateComponentType } from '@/packages/index.d'
import omit from 'lodash/omit'

View File

@ -1,4 +1,4 @@
import { echartOptionProfixHandle, publicConfig } from '@/packages/utils'
import { echartOptionProfixHandle, publicConfig } from '@/packages/public'
import { LineCommonConfig } from './index'
import { ConfigType, CreateComponentType } from '@/packages/index.d'
import omit from 'lodash/omit'

View File

@ -1,4 +1,4 @@
import { echartOptionProfixHandle, publicConfig } from '@/packages/utils'
import { echartOptionProfixHandle, publicConfig } from '@/packages/public'
import { PieCommonConfig } from './index'
import { ConfigType, CreateComponentType } from '@/packages/index.d'
import omit from 'lodash/omit'

View File

@ -0,0 +1,2 @@
export * from '@/packages/public/chart'
export * from '@/packages/public/publicConfig'

View File

@ -1,2 +0,0 @@
export * from '@/packages/utils/chart'
export * from '@/packages/utils/publicConfig'

View File

@ -43,7 +43,8 @@ import {
ClipboardOutline as ClipboardOutlineIcon,
BrowsersOutline as BrowsersOutlineIcon,
Cut as CutIcon,
Square as SquareIcon
Square as SquareIcon,
ColorPalette as ColorPaletteIcon,
} from '@vicons/ionicons5'
import {
@ -59,6 +60,7 @@ import {
DownToBottom as DownToBottomIcon,
StackedMove as StackedMoveIcon,
PaintBrush as PaintBrushIcon,
ComposerEdit as ZAxisIcon,
} from '@vicons/carbon'
const ionicons5 = {
@ -150,7 +152,10 @@ const ionicons5 = {
// 剪贴
CutIcon,
// 正方形
SquareIcon
SquareIcon,
// 色彩选择
ColorPaletteIcon,
ZAxisIcon
}
const carbon = {
@ -178,6 +183,8 @@ const carbon = {
StackedMoveIcon,
// 清空剪切板(刷子)
PaintBrushIcon,
// 坐标轴
ZAxisIcon
}
// https://www.xicons.org/#/ 还有很多

View File

@ -0,0 +1,3 @@
import ChartSysSetting from './index.vue'
export { ChartSysSetting }

View File

@ -0,0 +1,15 @@
<template>
<div class="go-canvas-chart-color">
图表全局设置
</div>
</template>
<script setup lang="ts">
</script>
<style lang="scss" scoped>
@include go(canvas-chart-color) {
}
</style>

View File

@ -1,33 +1,29 @@
<template>
<div class="go-canvas-chart-color">
<n-collapse :default-expanded-names="['1']">
<n-collapse-item title="主题选择" name="1">
<n-card
v-for="(value, key) in chartColors"
:key="key"
class="card-box"
:class="{ selected: key === selectName }"
size="small"
hoverable
embedded
@click="selectTheme(key)"
>
<div class="go-flex-items-center">
<n-text>{{ chartColorsName[key] }}</n-text>
<span
class="theme-color-item"
v-for="colorItem in fetchShowColors(value.color)"
:key="colorItem"
:style="{ backgroundColor: colorItem }"
/>
</div>
<div
class="theme-bottom"
:style="{ backgroundImage: chartColorsshow[key] }"
></div>
</n-card>
</n-collapse-item>
</n-collapse>
<n-card
v-for="(value, key) in chartColors"
:key="key"
class="card-box"
:class="{ selected: key === selectName }"
size="small"
hoverable
embedded
@click="selectTheme(key)"
>
<div class="go-flex-items-center">
<n-text>{{ chartColorsName[key] }}</n-text>
<span
class="theme-color-item"
v-for="colorItem in fetchShowColors(value.color)"
:key="colorItem"
:style="{ backgroundColor: colorItem }"
/>
</div>
<div
class="theme-bottom"
:style="{ backgroundImage: chartColorsshow[key] }"
></div>
</n-card>
</div>
</template>
@ -67,6 +63,7 @@ const selectTheme = (theme: string) => {
<style lang="scss" scoped>
@include go(canvas-chart-color) {
padding-top: 20px;
.card-box {
cursor: pointer;
margin-top: 15px;

View File

@ -94,8 +94,26 @@
<n-divider />
<!-- 主题选择 -->
<ChartTheme />
<!-- 主题选择和全局配置 -->
<n-tabs v-show="!selectTarget" class="tabs-box" size="small" type="segment">
<n-tab-pane
v-for="item in globalTabList"
:key="item.key"
:name="item.key"
size="small"
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>
</div>
</template>
@ -103,9 +121,14 @@
import { ref, nextTick, onMounted } from 'vue'
import { useChartEditStoreStore } from '@/store/modules/chartEditStore/chartEditStore'
import { EditCanvasConfigEnum } from '@/store/modules/chartEditStore/chartEditStore.d'
import { UploadCustomRequestOptions, UploadFileInfo } from 'naive-ui'
import { UploadCustomRequestOptions } from 'naive-ui'
import { ChartTheme } from './components/ChartTheme/index'
import { ChartSysSetting } from './components/ChartSysSetting/index'
import { fileTobase64 } from '@/utils'
import { icon } from '@/plugins'
const { ColorPaletteIcon } = icon.ionicons5
const { ZAxisIcon } = icon.carbon
const chartEditStoreStore = useChartEditStoreStore()
const canvasConfig = chartEditStoreStore.getEditCanvasConfig
@ -113,6 +136,22 @@ const canvasConfig = chartEditStoreStore.getEditCanvasConfig
const uploadFileListRef = ref()
const switchSelectColorLoading = ref(false)
//
const globalTabList = [
{
key: 'ChartTheme',
title: '主题',
icon: ColorPaletteIcon,
render: ChartTheme
},
{
key: 'ChartSysSetting',
title: '轴线',
icon: ZAxisIcon,
render: ChartSysSetting
},
]
//
const validator = (x: number) => x > 50
@ -214,5 +253,8 @@ const customRequest = (options: UploadCustomRequestOptions) => {
}
}
}
.icon-position {
padding-top: 2px;
}
}
</style>

View File

@ -124,16 +124,16 @@ watch(getDetails, newData => {
})
//
const globalTabList = reactive([
const globalTabList = [
{
key: 'pageSetting',
title: '页面配置',
icon: DesktopOutlineIcon,
render: CanvasPage
}
])
]
const canvasTabList = shallowRef([
const canvasTabList = [
{
key: 'ChartSetting',
title: '定制',
@ -146,7 +146,7 @@ const canvasTabList = shallowRef([
icon: FlashIcon,
render: ChartBehind
}
])
]
</script>
<style lang="scss" scoped>

View File

@ -132,7 +132,7 @@ const handleContextMenu = (e: MouseEvent, item: CreateComponentType) => {
* @param menuConfig
* @returns
*/
export const useContextMenu = (menuConfig: {
export const useContextMenu = (menuConfig?: {
// 自定义右键配置
selfOptions?: MenuOptionsItemType[]
// 前置处理函数