mirror of
https://gitee.com/dromara/go-view.git
synced 2026-04-23 00:00:12 +08:00
fix: 修改data模块的数据调用和全局设定
This commit is contained in:
+12
-6
@@ -118,7 +118,7 @@ export enum ChartEditStoreEnum {
|
||||
RECORD_CHART = 'recordChart',
|
||||
// 以下需要存储
|
||||
EDIT_CANVAS_CONFIG = 'editCanvasConfig',
|
||||
REQUEST_CONFIG = 'requestConfig',
|
||||
REQUEST_GLOBAL_CONFIG = 'requestGlobalConfig',
|
||||
COMPONENT_LIST = 'componentList',
|
||||
}
|
||||
|
||||
@@ -130,15 +130,21 @@ export enum RequestDataTypeEnum {
|
||||
AJAX = 1,
|
||||
}
|
||||
|
||||
// 数据配置
|
||||
// 全局的图表请求配置
|
||||
export type RequestGlobalConfigType = {
|
||||
// 请求源地址
|
||||
requestOriginUrl?: string
|
||||
// 轮询时间
|
||||
requestInterval?: number
|
||||
}
|
||||
// 单个图表请求配置
|
||||
export type RequestConfigType = {
|
||||
// 获取数据的方式
|
||||
requestDataType: RequestDataTypeEnum
|
||||
// 请求方式 get/post/del/put/patch
|
||||
requestHttpType: RequestHttpEnum
|
||||
// 请求源地址
|
||||
// 去除源的 url
|
||||
requestUrl?: string
|
||||
requestInterval?: number
|
||||
}
|
||||
|
||||
// Store 类型
|
||||
@@ -149,12 +155,12 @@ export interface ChartEditStoreType {
|
||||
[ChartEditStoreEnum.MOUSE_POSITION]: MousePositionType
|
||||
[ChartEditStoreEnum.TARGET_CHART]: TargetChartType
|
||||
[ChartEditStoreEnum.RECORD_CHART]?: RecordChartType
|
||||
[ChartEditStoreEnum.REQUEST_CONFIG]: RequestConfigType
|
||||
[ChartEditStoreEnum.REQUEST_GLOBAL_CONFIG]: RequestGlobalConfigType
|
||||
[ChartEditStoreEnum.COMPONENT_LIST]: CreateComponentType[]
|
||||
}
|
||||
|
||||
export interface ChartEditStorage {
|
||||
[ChartEditStoreEnum.EDIT_CANVAS_CONFIG]: EditCanvasConfigType
|
||||
[ChartEditStoreEnum.REQUEST_CONFIG]: RequestConfigType
|
||||
[ChartEditStoreEnum.REQUEST_GLOBAL_CONFIG]: RequestGlobalConfigType
|
||||
[ChartEditStoreEnum.COMPONENT_LIST]: CreateComponentType[]
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { CreateComponentType } from '@/packages/index.d'
|
||||
import debounce from 'lodash/debounce'
|
||||
import cloneDeep from 'lodash/cloneDeep'
|
||||
import { defaultTheme, globalThemeJson } from '@/settings/chartThemes/index'
|
||||
import { RequestHttpEnum } from '@/enums/httpEnum'
|
||||
import { requestInterval } from '@/settings/designSetting'
|
||||
// 记录记录
|
||||
import { useChartHistoryStoreStore } from '@/store/modules/chartHistoryStore/chartHistoryStore'
|
||||
import { HistoryActionTypeEnum, HistoryItemType, HistoryTargetTypeEnum } from '@/store/modules/chartHistoryStore/chartHistoryStore.d'
|
||||
@@ -16,8 +16,7 @@ import {
|
||||
MousePositionType,
|
||||
TargetChartType,
|
||||
RecordChartType,
|
||||
RequestConfigType,
|
||||
RequestDataTypeEnum,
|
||||
RequestGlobalConfigType,
|
||||
EditCanvasConfigType
|
||||
} from './chartEditStore.d'
|
||||
|
||||
@@ -86,11 +85,9 @@ export const useChartEditStore = defineStore({
|
||||
chartThemeSetting: globalThemeJson
|
||||
},
|
||||
// 数据请求处理(需存储给后端)
|
||||
requestConfig: {
|
||||
requestDataType: RequestDataTypeEnum.STATIC,
|
||||
requestHttpType: RequestHttpEnum.GET,
|
||||
requestUrl: undefined,
|
||||
requestInterval: 10
|
||||
requestGlobalConfig: {
|
||||
requestOriginUrl: '',
|
||||
requestInterval: requestInterval
|
||||
},
|
||||
// 图表数组(需存储给后端)
|
||||
componentList: []
|
||||
@@ -114,8 +111,8 @@ export const useChartEditStore = defineStore({
|
||||
getRecordChart(): RecordChartType | undefined {
|
||||
return this.recordChart
|
||||
},
|
||||
getRequestConfig(): RequestConfigType {
|
||||
return this.requestConfig
|
||||
getRequestGlobalConfig(): RequestGlobalConfigType {
|
||||
return this.requestGlobalConfig
|
||||
},
|
||||
getComponentList(): CreateComponentType[] {
|
||||
return this.componentList
|
||||
@@ -125,7 +122,7 @@ export const useChartEditStore = defineStore({
|
||||
return {
|
||||
[ChartEditStoreEnum.EDIT_CANVAS_CONFIG]: this.getEditCanvasConfig,
|
||||
[ChartEditStoreEnum.COMPONENT_LIST]: this.getComponentList,
|
||||
[ChartEditStoreEnum.REQUEST_CONFIG]: this.getRequestConfig
|
||||
[ChartEditStoreEnum.REQUEST_GLOBAL_CONFIG]: this.getRequestGlobalConfig
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user