mirror of
https://gitee.com/dromara/go-view.git
synced 2026-04-23 00:00:12 +08:00
feat: 新增工具栏模块, 修改系统设置初始化结构
This commit is contained in:
@@ -4,7 +4,7 @@ export enum ChartLayoutStoreEnum {
|
||||
LAYERS = 'layers',
|
||||
CHARTS = 'charts',
|
||||
DETAILS = 'details',
|
||||
ALIGNLINE = 'alignLine',
|
||||
TOOLS = 'tools'
|
||||
}
|
||||
|
||||
export interface ChartLayoutType {
|
||||
@@ -14,6 +14,4 @@ export interface ChartLayoutType {
|
||||
[ChartLayoutStoreEnum.CHARTS]: boolean
|
||||
// 详情设置
|
||||
[ChartLayoutStoreEnum.DETAILS]: boolean
|
||||
// 对齐线
|
||||
[ChartLayoutStoreEnum.ALIGNLINE]: boolean
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ const chartEditStore = useChartEditStore()
|
||||
|
||||
const { GO_CHART_LAYOUT_STORE } = StorageEnum
|
||||
|
||||
const storageChartLayout: ChartLayoutType = getLocalStorage( GO_CHART_LAYOUT_STORE)
|
||||
const storageChartLayout: ChartLayoutType = getLocalStorage(GO_CHART_LAYOUT_STORE)
|
||||
|
||||
// 编辑区域布局和静态设置
|
||||
export const useChartLayoutStore = defineStore({
|
||||
@@ -20,9 +20,7 @@ export const useChartLayoutStore = defineStore({
|
||||
// 图表组件
|
||||
charts: true,
|
||||
// 详情设置
|
||||
details: true,
|
||||
// 对齐线
|
||||
alignLine: true,
|
||||
details: true
|
||||
},
|
||||
getters: {
|
||||
getLayers(): boolean {
|
||||
@@ -33,9 +31,6 @@ export const useChartLayoutStore = defineStore({
|
||||
},
|
||||
getDetails(): boolean {
|
||||
return this.details
|
||||
},
|
||||
getAlignLine(): boolean {
|
||||
return this.alignLine
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
export enum ToolsStatusEnum {
|
||||
DOCK = 'dock',
|
||||
ASIDE = 'aside',
|
||||
}
|
||||
|
||||
export enum SettingStoreEnums {
|
||||
HIDE_PACKAGE_ONE_CATEGORY = 'hidePackageOneCategory',
|
||||
CHANGE_LANG_RELOAD = 'changeLangReload',
|
||||
ASIDE_ALL_COLLAPSED = 'asideAllCollapsed',
|
||||
CHART_MOVE_DISTANCE = 'chartMoveDistance',
|
||||
CHART_ALIGN_RANGE = 'chartAlignRange',
|
||||
CHART_TOOLS_STATUS = 'chartToolsStatus',
|
||||
}
|
||||
|
||||
export interface SettingStoreType {
|
||||
@@ -12,4 +18,5 @@ export interface SettingStoreType {
|
||||
[SettingStoreEnums.ASIDE_ALL_COLLAPSED]: boolean
|
||||
[SettingStoreEnums.CHART_MOVE_DISTANCE]: number
|
||||
[SettingStoreEnums.CHART_ALIGN_RANGE]: number
|
||||
[SettingStoreEnums.CHART_TOOLS_STATUS]: ToolsStatusEnum
|
||||
}
|
||||
|
||||
@@ -1,30 +1,19 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import {
|
||||
hidePackageOneCategory,
|
||||
changeLangReload,
|
||||
asideAllCollapsed,
|
||||
chartAlignRange,
|
||||
chartMoveDistance
|
||||
} from '@/settings/systemSetting'
|
||||
import { systemSetting } from '@/settings/systemSetting'
|
||||
import { asideCollapsedWidth } from '@/settings/designSetting'
|
||||
import { SettingStoreType } from './settingStore.d'
|
||||
import { SettingStoreType, ToolsStatusEnum } from './settingStore.d'
|
||||
import { setLocalStorage, getLocalStorage } from '@/utils'
|
||||
import { StorageEnum } from '@/enums/storageEnum'
|
||||
const { GO_SYSTEM_SETTING_STORE } = StorageEnum
|
||||
|
||||
const storageSetting: SettingStoreType = getLocalStorage(GO_SYSTEM_SETTING_STORE)
|
||||
const storageSetting: SettingStoreType = getLocalStorage(
|
||||
GO_SYSTEM_SETTING_STORE
|
||||
)
|
||||
|
||||
// 全局设置
|
||||
export const useSettingStore = defineStore({
|
||||
id: 'useSettingStore',
|
||||
state: (): SettingStoreType =>
|
||||
storageSetting || {
|
||||
hidePackageOneCategory,
|
||||
changeLangReload,
|
||||
asideAllCollapsed,
|
||||
chartMoveDistance,
|
||||
chartAlignRange,
|
||||
},
|
||||
state: (): SettingStoreType => storageSetting || systemSetting,
|
||||
getters: {
|
||||
getHidePackageOneCategory(): boolean {
|
||||
return this.hidePackageOneCategory
|
||||
@@ -43,14 +32,20 @@ export const useSettingStore = defineStore({
|
||||
},
|
||||
getChartAlignRange(): number {
|
||||
return this.chartAlignRange
|
||||
},
|
||||
getChartToolsStatus(): ToolsStatusEnum {
|
||||
return this.chartToolsStatus
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
setItem<T extends keyof SettingStoreType, K extends SettingStoreType[T]>(key: T, value: K): void {
|
||||
setItem<T extends keyof SettingStoreType, K extends SettingStoreType[T]>(
|
||||
key: T,
|
||||
value: K
|
||||
): void {
|
||||
this.$patch(state => {
|
||||
state[key]= value
|
||||
});
|
||||
state[key] = value
|
||||
})
|
||||
setLocalStorage(GO_SYSTEM_SETTING_STORE, this.$state)
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user