fix: 修改全局配置展示

This commit is contained in:
MTrun
2022-02-08 19:39:57 +08:00
parent b258b0f651
commit 62f8e389a8
15 changed files with 108 additions and 44 deletions
@@ -0,0 +1,3 @@
import ChartSysSetting from './index.vue'
export { ChartSysSetting }
@@ -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>
@@ -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;
@@ -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>
+4 -4
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>
+1 -1
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[]
// 前置处理函数