mirror of
https://gitee.com/dromara/go-view.git
synced 2026-04-23 00:00:12 +08:00
feat: 新增数据请求配置
This commit is contained in:
+29
-5
@@ -1,6 +1,9 @@
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
import { HistoryActionTypeEnum } from '@/store/modules/chartHistoryStore/chartHistoryStore.d'
|
||||
import { ChartColorsNameType, GlobalThemeJsonType } from '@/settings/chartThemes/index'
|
||||
import type {
|
||||
ChartColorsNameType,
|
||||
GlobalThemeJsonType
|
||||
} from '@/settings/chartThemes/index'
|
||||
|
||||
// 编辑画布属性
|
||||
export enum EditCanvasTypeEnum {
|
||||
@@ -10,7 +13,7 @@ export enum EditCanvasTypeEnum {
|
||||
SCALE = 'scale',
|
||||
USER_SCALE = 'userScale',
|
||||
LOCK_SCALE = 'lockScale',
|
||||
IS_DRAG= 'isDrag',
|
||||
IS_DRAG = 'isDrag'
|
||||
}
|
||||
|
||||
// 编辑区域
|
||||
@@ -30,7 +33,7 @@ export type EditCanvasType = {
|
||||
[EditCanvasTypeEnum.IS_DRAG]: boolean
|
||||
}
|
||||
|
||||
// 滤镜
|
||||
// 滤镜/背景色/宽高主题等
|
||||
export enum EditCanvasConfigEnum {
|
||||
WIDTH = 'width',
|
||||
HEIGHT = 'height',
|
||||
@@ -108,14 +111,33 @@ export type RecordChartType = {
|
||||
export enum ChartEditStoreEnum {
|
||||
EDIT_RANGE = 'editRange',
|
||||
EDIT_CANVAS = 'editCanvas',
|
||||
EDIT_CANVAS_CONFIG = 'editCanvasConfig',
|
||||
RIGHT_MENU_SHOW = 'rightMenuShow',
|
||||
MOUSE_POSITION = 'mousePosition',
|
||||
TARGET_CHART = 'targetChart',
|
||||
RECORD_CHART = 'recordChart',
|
||||
// 以下需要存储
|
||||
EDIT_CANVAS_CONFIG = 'editCanvasConfig',
|
||||
REQUEST_CONFIG = 'requestConfig',
|
||||
COMPONENT_LIST = 'componentList'
|
||||
}
|
||||
|
||||
// 数据相关
|
||||
export enum RequestDataTypeEnum {
|
||||
// 静态数据
|
||||
STATIC = 'static',
|
||||
// 请求数据
|
||||
AJAX = 'ajax'
|
||||
}
|
||||
|
||||
// 数据配置
|
||||
export type RequestConfigType = {
|
||||
// 获取数据的方式
|
||||
requestDataType: RequestDataTypeEnum,
|
||||
// 请求源地址
|
||||
requestUrl?: string,
|
||||
requestInterval?: number
|
||||
}
|
||||
|
||||
// Store 类型
|
||||
export interface ChartEditStoreType {
|
||||
[ChartEditStoreEnum.EDIT_CANVAS]: EditCanvasType
|
||||
@@ -124,10 +146,12 @@ export interface ChartEditStoreType {
|
||||
[ChartEditStoreEnum.MOUSE_POSITION]: MousePositionType
|
||||
[ChartEditStoreEnum.TARGET_CHART]: TargetChartType
|
||||
[ChartEditStoreEnum.RECORD_CHART]?: RecordChartType
|
||||
[ChartEditStoreEnum.REQUEST_CONFIG]: RequestConfigType
|
||||
[ChartEditStoreEnum.COMPONENT_LIST]: CreateComponentType[]
|
||||
}
|
||||
|
||||
export interface ChartEditStorage {
|
||||
[ChartEditStoreEnum.EDIT_CANVAS_CONFIG]: EditCanvasConfigType,
|
||||
[ChartEditStoreEnum.EDIT_CANVAS_CONFIG]: EditCanvasConfigType
|
||||
[ChartEditStoreEnum.REQUEST_CONFIG]: RequestConfigType
|
||||
[ChartEditStoreEnum.COMPONENT_LIST]: CreateComponentType[]
|
||||
}
|
||||
@@ -15,6 +15,8 @@ import {
|
||||
MousePositionType,
|
||||
TargetChartType,
|
||||
RecordChartType,
|
||||
RequestConfigType,
|
||||
RequestDataTypeEnum,
|
||||
EditCanvasConfigType
|
||||
} from './chartEditStore.d'
|
||||
|
||||
@@ -82,6 +84,12 @@ export const useChartEditStore = defineStore({
|
||||
// 全局配置
|
||||
chartThemeSetting: globalThemeJson
|
||||
},
|
||||
// 数据请求处理
|
||||
requestConfig: {
|
||||
requestDataType: RequestDataTypeEnum.STATIC,
|
||||
requestUrl: undefined,
|
||||
requestInterval: 10
|
||||
},
|
||||
// 图表数组(需存储给后端)
|
||||
componentList: []
|
||||
}),
|
||||
@@ -104,6 +112,9 @@ export const useChartEditStore = defineStore({
|
||||
getRecordChart(): RecordChartType | undefined {
|
||||
return this.recordChart
|
||||
},
|
||||
getRequestConfig(): RequestConfigType {
|
||||
return this.requestConfig
|
||||
},
|
||||
getComponentList(): CreateComponentType[] {
|
||||
return this.componentList
|
||||
},
|
||||
@@ -111,7 +122,8 @@ export const useChartEditStore = defineStore({
|
||||
getStorageInfo(): ChartEditStorage {
|
||||
return {
|
||||
[ChartEditStoreEnum.EDIT_CANVAS_CONFIG]: this.getEditCanvasConfig,
|
||||
[ChartEditStoreEnum.COMPONENT_LIST]: this.getComponentList
|
||||
[ChartEditStoreEnum.COMPONENT_LIST]: this.getComponentList,
|
||||
[ChartEditStoreEnum.REQUEST_CONFIG]: this.getRequestConfig
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user