diff --git a/src/settings/designSetting.ts b/src/settings/designSetting.ts index 962fc485..de39ad50 100644 --- a/src/settings/designSetting.ts +++ b/src/settings/designSetting.ts @@ -32,4 +32,7 @@ export const borderRadius = '6px' export const carouselInterval = 4000 // 工作台大屏背景图片大小限制(5M) -export const backgroundImageSize = 5 \ No newline at end of file +export const backgroundImageSize = 5 + +// 数据请求间隔 +export const requestInterval = 30 \ No newline at end of file diff --git a/src/store/modules/chartEditStore/chartEditStore.d.ts b/src/store/modules/chartEditStore/chartEditStore.d.ts index 78353276..7bbc2155 100644 --- a/src/store/modules/chartEditStore/chartEditStore.d.ts +++ b/src/store/modules/chartEditStore/chartEditStore.d.ts @@ -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[] } diff --git a/src/store/modules/chartEditStore/chartEditStore.ts b/src/store/modules/chartEditStore/chartEditStore.ts index bda5db74..48c690aa 100644 --- a/src/store/modules/chartEditStore/chartEditStore.ts +++ b/src/store/modules/chartEditStore/chartEditStore.ts @@ -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 } } }, diff --git a/src/views/chart/ContentConfigurations/components/CanvasPage/components/ChartDataSetting/index.vue b/src/views/chart/ContentConfigurations/components/CanvasPage/components/ChartDataSetting/index.vue index 0154d3c5..94b82f01 100644 --- a/src/views/chart/ContentConfigurations/components/CanvasPage/components/ChartDataSetting/index.vue +++ b/src/views/chart/ContentConfigurations/components/CanvasPage/components/ChartDataSetting/index.vue @@ -2,14 +2,14 @@
@@ -22,14 +22,9 @@ diff --git a/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataAjax/index.vue b/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataAjax/index.vue index fedf4b06..98e1312b 100644 --- a/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataAjax/index.vue +++ b/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataAjax/index.vue @@ -6,6 +6,9 @@ :options="selectOptions" /> + + {{ requestOriginUrl || '暂无' }} + @@ -38,39 +41,34 @@ - 发送地址请求 + 发送请求
diff --git a/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataMatchingAndShow/index.vue b/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataMatchingAndShow/index.vue index 8035da73..5cc42a10 100644 --- a/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataMatchingAndShow/index.vue +++ b/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataMatchingAndShow/index.vue @@ -64,17 +64,15 @@