diff --git a/src/enums/httpEnum.ts b/src/enums/httpEnum.ts index c51d7e29..4ae7ee6a 100644 --- a/src/enums/httpEnum.ts +++ b/src/enums/httpEnum.ts @@ -15,7 +15,9 @@ export enum RequestDataTypeEnum { // 静态数据 STATIC = 0, // 请求数据 - AJAX = 1 + AJAX = 1, + // 数据池 + Pond = 2 } // 请求主体类型 diff --git a/src/hooks/useLifeHandler.hook.ts b/src/hooks/useLifeHandler.hook.ts index fde94eef..23ed5e00 100644 --- a/src/hooks/useLifeHandler.hook.ts +++ b/src/hooks/useLifeHandler.hook.ts @@ -9,6 +9,8 @@ export const npmPkgs = { echarts } // 组件事件处理 hook export const useLifeHandler = (chartConfig: CreateComponentType | CreateComponentGroupType) => { + if (!chartConfig.events) return {} + // 处理基础事件 const baseEvent: { [key: string]: any } = {} for (const key in chartConfig.events.baseEvent) { diff --git a/src/packages/components/Charts/Bars/CapsuleChart/index.vue b/src/packages/components/Charts/Bars/CapsuleChart/index.vue index 4a0ed72f..87971d01 100644 --- a/src/packages/components/Charts/Bars/CapsuleChart/index.vue +++ b/src/packages/components/Charts/Bars/CapsuleChart/index.vue @@ -2,7 +2,7 @@
import { onMounted, watch, reactive, PropType } from 'vue' -import merge from 'lodash/merge' -import cloneDeep from 'lodash/cloneDeep' import { useChartDataFetch } from '@/hooks' import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' import config, { option } from './config' +import cloneDeep from 'lodash/cloneDeep' type DataProps = { name: string | number @@ -114,12 +113,11 @@ watch( const calcData = (data: any) => { mergeConfig(props.chartConfig.option) - calcCapsuleLengthAndLabelData() } const mergeConfig = (data: any) => { - state.mergedConfig = merge(cloneDeep(state.defaultConfig), data || {}) + state.mergedConfig = cloneDeep(data || {}) } // 数据解析 diff --git a/src/packages/components/Tables/Tables/TableList/index.vue b/src/packages/components/Tables/Tables/TableList/index.vue index 5fd3e02d..24324ec6 100644 --- a/src/packages/components/Tables/Tables/TableList/index.vue +++ b/src/packages/components/Tables/Tables/TableList/index.vue @@ -62,7 +62,7 @@ const status = reactive({ const calcRowsData = () => { let { dataset, rowNum, sort } = status.mergedConfig // @ts-ignore - sort && dataset.sort(({ value: a }, { value: b }) => { + sort &&dataset.sort(({ value: a }, { value: b } ) => { if (a > b) return -1 if (a < b) return 1 if (a === b) return 0 @@ -94,6 +94,7 @@ const calcHeights = (onresize = false) => { const { rowNum, dataset } = status.mergedConfig const avgHeight = h.value / rowNum status.avgHeight = avgHeight + if (!onresize) status.heights = new Array(dataset.length).fill(avgHeight) } @@ -131,12 +132,17 @@ const stopAnimation = () => { const onRestart = async () => { try { if (!status.mergedConfig) return + let { dataset, rowNum, sort } = status.mergedConfig stopAnimation() calcRowsData() - calcHeights(true) - animation(true) + let flag = true + if (dataset.length <= rowNum) { + flag=false + } + calcHeights(flag) + animation(flag) } catch (error) { - console.log(error) + console.error(error) } } diff --git a/src/store/modules/chartLayoutStore/chartLayoutStore.ts b/src/store/modules/chartLayoutStore/chartLayoutStore.ts index b3f0919f..c50bd520 100644 --- a/src/store/modules/chartLayoutStore/chartLayoutStore.ts +++ b/src/store/modules/chartLayoutStore/chartLayoutStore.ts @@ -8,24 +8,25 @@ const chartEditStore = useChartEditStore() const { GO_CHART_LAYOUT_STORE } = StorageEnum -const storageChartLayout: ChartLayoutType = getLocalStorage(GO_CHART_LAYOUT_STORE) +const storageChartLayout: Partial = getLocalStorage(GO_CHART_LAYOUT_STORE) // 编辑区域布局和静态设置 export const useChartLayoutStore = defineStore({ id: 'useChartLayoutStore', - state: (): ChartLayoutType => - storageChartLayout || { - // 图层控制 - layers: true, - // 图表组件 - charts: true, - // 详情设置(收缩为true) - details: false, - // 组件列表展示类型(默认单列) - chartType: ChartModeEnum.SINGLE, - // 图层类型(默认图片) - layerType: LayerModeEnum.THUMBNAIL - }, + state: (): ChartLayoutType => ({ + // 图层控制 + layers: true, + // 图表组件 + charts: true, + // 详情设置(收缩为true) + details: false, + // 组件列表展示类型(默认单列) + chartType: ChartModeEnum.SINGLE, + // 图层类型(默认图片) + layerType: LayerModeEnum.THUMBNAIL, + // 防止值不存在 + ...storageChartLayout + }), getters: { getLayers(): boolean { return this.layers @@ -46,8 +47,8 @@ export const useChartLayoutStore = defineStore({ actions: { setItem(key: T, value: K): void { this.$patch(state => { - state[key]= value - }); + state[key] = value + }) setLocalStorage(GO_CHART_LAYOUT_STORE, this.$state) // 重新计算拖拽区域缩放比例 setTimeout(() => { diff --git a/src/views/chart/ContentCharts/components/ChartsItemBox/index.vue b/src/views/chart/ContentCharts/components/ChartsItemBox/index.vue index e87e0bf6..a5806bce 100644 --- a/src/views/chart/ContentCharts/components/ChartsItemBox/index.vue +++ b/src/views/chart/ContentCharts/components/ChartsItemBox/index.vue @@ -1,35 +1,41 @@ diff --git a/src/views/chart/ContentConfigurations/components/ChartData/index.d.ts b/src/views/chart/ContentConfigurations/components/ChartData/index.d.ts index fb70fe6d..261ae321 100644 --- a/src/views/chart/ContentConfigurations/components/ChartData/index.d.ts +++ b/src/views/chart/ContentConfigurations/components/ChartData/index.d.ts @@ -16,6 +16,7 @@ export enum TimelineTitleEnum { export enum SelectCreateDataEnum { STATIC = '静态数据', AJAX = '动态请求', + Pond = '公共接口', } export interface SelectCreateDataType { diff --git a/src/views/chart/ContentConfigurations/components/ChartData/index.vue b/src/views/chart/ContentConfigurations/components/ChartData/index.vue index 19720a70..2915cb0c 100644 --- a/src/views/chart/ContentConfigurations/components/ChartData/index.vue +++ b/src/views/chart/ContentConfigurations/components/ChartData/index.vue @@ -3,24 +3,27 @@ - - - + + +