diff --git a/package.json b/package.json
index 50c95c63..af4087b5 100644
--- a/package.json
+++ b/package.json
@@ -24,6 +24,7 @@
"axios": "^0.27.2",
"color": "^4.2.3",
"crypto-js": "^4.1.1",
+ "dayjs": "^1.11.7",
"dom-helpers": "^5.2.1",
"echarts-liquidfill": "^3.1.0",
"echarts-stat": "^1.2.0",
diff --git a/src/assets/images/chart/informations/inputs_date.png b/src/assets/images/chart/informations/inputs_date.png
new file mode 100644
index 00000000..ab866b06
Binary files /dev/null and b/src/assets/images/chart/informations/inputs_date.png differ
diff --git a/src/assets/images/chart/informations/inputs_select.png b/src/assets/images/chart/informations/inputs_select.png
new file mode 100644
index 00000000..66ccdd09
Binary files /dev/null and b/src/assets/images/chart/informations/inputs_select.png differ
diff --git a/src/assets/images/chart/informations/inputs_tab.png b/src/assets/images/chart/informations/inputs_tab.png
new file mode 100644
index 00000000..af13ef81
Binary files /dev/null and b/src/assets/images/chart/informations/inputs_tab.png differ
diff --git a/src/components/Pages/ChartItemSetting/EchartsRendererSetting.vue b/src/components/Pages/ChartItemSetting/EchartsRendererSetting.vue
new file mode 100644
index 00000000..f7624fef
--- /dev/null
+++ b/src/components/Pages/ChartItemSetting/EchartsRendererSetting.vue
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+ {{ item.value }}
+
+
+ {{ item.desc }}
+
+
+
+
+
diff --git a/src/components/Pages/ChartItemSetting/GlobalSetting.vue b/src/components/Pages/ChartItemSetting/GlobalSetting.vue
index 35a74235..a416e69c 100644
--- a/src/components/Pages/ChartItemSetting/GlobalSetting.vue
+++ b/src/components/Pages/ChartItemSetting/GlobalSetting.vue
@@ -1,4 +1,34 @@
+
+
+
+ 全局
+
+
+
+
+
+
+ 所有echarts图表组件默认都将采用所选的渲染器进行渲染
+
+
+
+
+
+
+ 当前
+
+
+
+
+
+
+ 仅当前组件采用指定渲染器渲染
+
+
+
+
+
@@ -283,6 +313,11 @@ import { PropType, computed } from 'vue'
import { GlobalThemeJsonType } from '@/settings/chartThemes/index'
import { axisConfig } from '@/packages/chartConfiguration/echarts/index'
import { CollapseItem, SettingItemBox, SettingItem, GlobalSettingPosition } from '@/components/Pages/ChartItemSetting'
+import { icon } from '@/plugins'
+import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
+import EchartsRendererSetting from './EchartsRendererSetting.vue'
+
+const { HelpOutlineIcon } = icon.ionicons5
const props = defineProps({
optionData: {
@@ -296,6 +331,12 @@ const props = defineProps({
}
})
+const chartEditStore = useChartEditStore()
+const themeSetting = computed(() => {
+ const chartThemeSetting = chartEditStore.getEditCanvasConfig.chartThemeSetting
+ return chartThemeSetting
+})
+
const title = computed(() => {
return props.optionData.title
})
diff --git a/src/components/Pages/ThemeColorSelect/index.vue b/src/components/Pages/ThemeColorSelect/index.vue
index 38c9d819..c81de444 100644
--- a/src/components/Pages/ThemeColorSelect/index.vue
+++ b/src/components/Pages/ThemeColorSelect/index.vue
@@ -36,7 +36,7 @@
@@ -157,6 +157,7 @@ $height: 85vh;
}
}
.model-footer {
+ z-index: 1;
text-align: end;
}
}
diff --git a/src/enums/eventEnum.ts b/src/enums/eventEnum.ts
index 9f05aa57..ca2a835d 100644
--- a/src/enums/eventEnum.ts
+++ b/src/enums/eventEnum.ts
@@ -10,6 +10,29 @@ export enum BaseEvent {
ON_MOUSE_LEAVE = 'mouseleave'
}
+// 组件交互回调事件
+export enum InteractEvents {
+ INTERACT_ON = 'interactOn',
+ INTERACT_COMPONENT_ID = 'interactComponentId',
+ INTERACT_FN = 'interactFn'
+}
+
+// 全局组件交互回调事件触发的类型(当然可以自定义名称)
+export enum InteractEventOn {
+ CLICK = 'click',
+ CHANGE = 'change'
+}
+
+// 确定交互组件触发类型 key名称
+export const COMPONENT_INTERACT_EVENT_KET = 'componentInteractEventKey'
+
+// 交互式组件的触发配置
+export type InteractActionsType = {
+ interactType: InteractEventOn
+ interactName: string
+ componentEmitEvents: { [T: string]: { value: any; label: string }[] }
+}
+
// vue3 生命周期事件
export enum EventLife {
// 渲染之后
diff --git a/src/hooks/index.ts b/src/hooks/index.ts
index 485d433a..7e6b1cc9 100644
--- a/src/hooks/index.ts
+++ b/src/hooks/index.ts
@@ -5,4 +5,5 @@ export * from '@/hooks/useChartDataFetch.hook'
export * from '@/hooks/useSystemInit.hook'
export * from '@/hooks/useChartDataPondFetch.hook'
export * from '@/hooks/useLifeHandler.hook'
-export * from '@/hooks/useLang.hook'
\ No newline at end of file
+export * from '@/hooks/useLang.hook'
+export * from '@/hooks/useChartInteract.hook'
\ No newline at end of file
diff --git a/src/hooks/useCanvasInitOptions.hook.ts b/src/hooks/useCanvasInitOptions.hook.ts
new file mode 100644
index 00000000..d8521eef
--- /dev/null
+++ b/src/hooks/useCanvasInitOptions.hook.ts
@@ -0,0 +1,26 @@
+import { inject, type Ref } from 'vue'
+import { EchartsRenderer } from '@/settings/chartThemes'
+import { SCALE_KEY } from '@/views/preview/hooks/useScale.hook'
+import { use } from 'echarts/core'
+import { CanvasRenderer, SVGRenderer } from 'echarts/renderers'
+
+use([CanvasRenderer, SVGRenderer])
+
+type InitOptions = {
+ renderer: EchartsRenderer
+ devicePixelRatio?: number
+}
+
+// 获取需要给当前echarts组件设置什么初始值
+export function useCanvasInitOptions(option: any, themeSetting: any) {
+ const renderer = option.renderer || themeSetting.renderer
+ const initOptions: InitOptions = { renderer }
+ const scaleRef = inject[>(SCALE_KEY) || { value: { width: 1, height: 1 } }
+
+ if (renderer === 'canvas') {
+ initOptions.devicePixelRatio = Math.ceil(
+ Math.max(window.devicePixelRatio, scaleRef.value.width, scaleRef.value.height)
+ )
+ }
+ return initOptions
+}
diff --git a/src/hooks/useChartDataFetch.hook.ts b/src/hooks/useChartDataFetch.hook.ts
index ed82edf5..cba17e0d 100644
--- a/src/hooks/useChartDataFetch.hook.ts
+++ b/src/hooks/useChartDataFetch.hook.ts
@@ -1,4 +1,4 @@
-import { ref, toRefs, toRaw } from 'vue'
+import { ref, toRefs, toRaw, watch } from 'vue'
import type VChart from 'vue-echarts'
import { customizeHttp } from '@/api/http'
import { useChartDataPondFetch } from '@/hooks/'
@@ -87,8 +87,18 @@ export const useChartDataFetch = (
}
}
- // 立即调用
- fetchFn()
+ // 普通初始化与组件交互处理监听
+ watch(
+ () => targetComponent.request,
+ () => {
+ fetchFn()
+ },
+ {
+ immediate: true,
+ deep: true
+ }
+ )
+
// 定时时间
const time = targetInterval && targetInterval.value ? targetInterval.value : globalRequestInterval.value
// 单位
diff --git a/src/hooks/useChartInteract.hook.ts b/src/hooks/useChartInteract.hook.ts
new file mode 100644
index 00000000..efa2ae73
--- /dev/null
+++ b/src/hooks/useChartInteract.hook.ts
@@ -0,0 +1,40 @@
+import { toRefs } from 'vue'
+import { CreateComponentType } from '@/packages/index.d'
+import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
+
+// 获取类型
+type ChartEditStoreType = typeof useChartEditStore
+
+// Params 参数修改触发 api 更新图表请求
+export const useChartInteract = (
+ chartConfig: CreateComponentType,
+ useChartEditStore: ChartEditStoreType,
+ param: { [T: string]: any },
+ interactEventOn: string
+) => {
+ const chartEditStore = useChartEditStore()
+ const { interactEvents } = chartConfig.events
+ const fnOnEvent = interactEvents.filter(item => {
+ return item.interactOn === interactEventOn
+ })
+
+ if (fnOnEvent.length === 0) return
+ fnOnEvent.forEach(item => {
+ const index = chartEditStore.fetchTargetIndex(item.interactComponentId)
+ if (index === -1) return
+ const { Params, Header } = toRefs(chartEditStore.componentList[index].request.requestParams)
+ Object.keys(item.interactFn).forEach(key => {
+ if (Params.value[key]) {
+ Params.value[key] = param[item.interactFn[key]]
+ }
+ if (Header.value[key]) {
+ Header.value[key] = param[item.interactFn[key]]
+ }
+ })
+ })
+}
+
+// 联动事件触发的 type 变更时,清除当前绑定内容
+export const clearInteractEvent = (chartConfig: CreateComponentType) => {
+
+}
diff --git a/src/packages/components/Charts/Bars/BarCommon/index.vue b/src/packages/components/Charts/Bars/BarCommon/index.vue
index 77f6da02..6c8bcd2d 100644
--- a/src/packages/components/Charts/Bars/BarCommon/index.vue
+++ b/src/packages/components/Charts/Bars/BarCommon/index.vue
@@ -1,6 +1,7 @@
import { ref, nextTick, computed, watch, PropType } from 'vue'
import VChart from 'vue-echarts'
+import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
import { use } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers'
import { BarChart } from 'echarts/charts'
@@ -41,6 +43,8 @@ const props = defineProps({
}
})
+const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
+
use([DatasetComponent, CanvasRenderer, BarChart, GridComponent, TooltipComponent, LegendComponent])
const replaceMergeArr = ref()
diff --git a/src/packages/components/Charts/Bars/BarCrossrange/index.vue b/src/packages/components/Charts/Bars/BarCrossrange/index.vue
index c8d2957a..683d777b 100644
--- a/src/packages/components/Charts/Bars/BarCrossrange/index.vue
+++ b/src/packages/components/Charts/Bars/BarCrossrange/index.vue
@@ -1,6 +1,7 @@
import { ref, nextTick, computed, watch, PropType } from 'vue'
import VChart from 'vue-echarts'
+import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
import { use } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers'
import { BarChart } from 'echarts/charts'
@@ -40,6 +42,8 @@ const props = defineProps({
}
})
+const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
+
use([DatasetComponent, CanvasRenderer, BarChart, GridComponent, TooltipComponent, LegendComponent])
const replaceMergeArr = ref()
diff --git a/src/packages/components/Charts/Lines/LineCommon/index.vue b/src/packages/components/Charts/Lines/LineCommon/index.vue
index 33149e84..c2163eb7 100644
--- a/src/packages/components/Charts/Lines/LineCommon/index.vue
+++ b/src/packages/components/Charts/Lines/LineCommon/index.vue
@@ -1,6 +1,7 @@
import { PropType, computed, watch, ref, nextTick } from 'vue'
import VChart from 'vue-echarts'
+import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
import { use } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers'
import { LineChart } from 'echarts/charts'
@@ -41,6 +43,8 @@ const props = defineProps({
}
})
+const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
+
use([DatasetComponent, CanvasRenderer, LineChart, GridComponent, TooltipComponent, LegendComponent])
const replaceMergeArr = ref()
diff --git a/src/packages/components/Charts/Lines/LineGradientSingle/index.vue b/src/packages/components/Charts/Lines/LineGradientSingle/index.vue
index 0bd33cfe..b96ffa71 100644
--- a/src/packages/components/Charts/Lines/LineGradientSingle/index.vue
+++ b/src/packages/components/Charts/Lines/LineGradientSingle/index.vue
@@ -1,11 +1,12 @@
-
+
diff --git a/src/packages/components/Informations/Inputs/InputsDate/index.ts b/src/packages/components/Informations/Inputs/InputsDate/index.ts
new file mode 100644
index 00000000..ed9200c6
--- /dev/null
+++ b/src/packages/components/Informations/Inputs/InputsDate/index.ts
@@ -0,0 +1,14 @@
+import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
+import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
+
+export const InputsDateConfig: ConfigType = {
+ key: 'InputsDate',
+ chartKey: 'VInputsDate',
+ conKey: 'VCInputsDate',
+ title: '时间选择器',
+ category: ChatCategoryEnum.INPUTS,
+ categoryName: ChatCategoryEnumName.INPUTS,
+ package: PackagesCategoryEnum.INFORMATIONS,
+ chartFrame: ChartFrameEnum.STATIC,
+ image: 'inputs_date.png'
+}
diff --git a/src/packages/components/Informations/Inputs/InputsDate/index.vue b/src/packages/components/Informations/Inputs/InputsDate/index.vue
new file mode 100644
index 00000000..506d03a8
--- /dev/null
+++ b/src/packages/components/Informations/Inputs/InputsDate/index.vue
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
diff --git a/src/packages/components/Informations/Inputs/InputsDate/interact.ts b/src/packages/components/Informations/Inputs/InputsDate/interact.ts
new file mode 100644
index 00000000..a466c989
--- /dev/null
+++ b/src/packages/components/Informations/Inputs/InputsDate/interact.ts
@@ -0,0 +1,64 @@
+import { InteractEventOn, InteractActionsType } from '@/enums/eventEnum'
+
+// 时间组件类型
+export enum ComponentInteractEventEnum {
+ DATE = 'date',
+ DATE_TIME = 'datetime',
+ DATE_RANGE = 'daterange',
+ DATE_TIME_RANGE = 'datetimerange',
+ MONTH = 'month',
+ MONTH_RANGE = 'monthrange',
+ YEAR = 'year',
+ YEAR_RANGE = 'yearrange',
+ QUARTER = 'quarter',
+ QUARTER_RANGE = 'quarterrange'
+}
+
+// 联动参数
+export enum ComponentInteractParamsEnum {
+ DATE = 'date',
+ DATE_START = 'dateStart',
+ DATE_END = 'dateEnd',
+ DATE_RANGE = 'daterange'
+}
+
+const time = [
+ {
+ value: ComponentInteractParamsEnum.DATE,
+ label: '日期'
+ }
+]
+
+const timeRange = [
+ {
+ value: ComponentInteractParamsEnum.DATE_START,
+ label: '开始时间'
+ },
+ {
+ value: ComponentInteractParamsEnum.DATE_END,
+ label: '结束时间'
+ },
+ {
+ value: ComponentInteractParamsEnum.DATE_RANGE,
+ label: '日期范围'
+ }
+]
+
+// 定义组件触发回调事件
+export const interactActions: InteractActionsType[] = [
+ {
+ interactType: InteractEventOn.CHANGE,
+ interactName: '选择完成',
+ componentEmitEvents: {
+ [ComponentInteractEventEnum.DATE]: time,
+ [ComponentInteractEventEnum.DATE_TIME]: time,
+ [ComponentInteractEventEnum.DATE_RANGE]: timeRange,
+ [ComponentInteractEventEnum.MONTH]: time,
+ [ComponentInteractEventEnum.MONTH_RANGE]: timeRange,
+ [ComponentInteractEventEnum.QUARTER]: time,
+ [ComponentInteractEventEnum.QUARTER_RANGE]: timeRange,
+ [ComponentInteractEventEnum.YEAR]: time,
+ [ComponentInteractEventEnum.YEAR_RANGE]: timeRange,
+ }
+ }
+]
diff --git a/src/packages/components/Informations/Inputs/InputsSelect/config.ts b/src/packages/components/Informations/Inputs/InputsSelect/config.ts
new file mode 100644
index 00000000..8a07c5e6
--- /dev/null
+++ b/src/packages/components/Informations/Inputs/InputsSelect/config.ts
@@ -0,0 +1,37 @@
+import cloneDeep from 'lodash/cloneDeep'
+import { PublicConfigClass } from '@/packages/public'
+import { CreateComponentType } from '@/packages/index.d'
+import { chartInitConfig } from '@/settings/designSetting'
+import { COMPONENT_INTERACT_EVENT_KET } from '@/enums/eventEnum'
+import { interactActions, ComponentInteractEventEnum } from './interact'
+import { InputsSelectConfig } from './index'
+
+export const option = {
+ // 时间组件展示类型,必须和 interactActions 中定义的数据一致
+ [COMPONENT_INTERACT_EVENT_KET]: ComponentInteractEventEnum.DATA,
+ // 默认值
+ selectValue: '1',
+ // 暴露配置内容给用户
+ dataset: [
+ {
+ label: '选项1',
+ value: '1'
+ },
+ {
+ label: '选项2',
+ value: '2'
+ },
+ {
+ label: '选项3',
+ value: '3'
+ }
+ ]
+}
+
+export default class Config extends PublicConfigClass implements CreateComponentType {
+ public key = InputsSelectConfig.key
+ public attr = { ...chartInitConfig, w: 260, h: 32, zIndex: -1 }
+ public chartConfig = cloneDeep(InputsSelectConfig)
+ public interactActions = interactActions
+ public option = cloneDeep(option)
+}
diff --git a/src/packages/components/Informations/Inputs/InputsSelect/config.vue b/src/packages/components/Informations/Inputs/InputsSelect/config.vue
new file mode 100644
index 00000000..67472c2f
--- /dev/null
+++ b/src/packages/components/Informations/Inputs/InputsSelect/config.vue
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/packages/components/Informations/Inputs/InputsSelect/index.ts b/src/packages/components/Informations/Inputs/InputsSelect/index.ts
new file mode 100644
index 00000000..8e4d21cb
--- /dev/null
+++ b/src/packages/components/Informations/Inputs/InputsSelect/index.ts
@@ -0,0 +1,14 @@
+import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
+import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
+
+export const InputsSelectConfig: ConfigType = {
+ key: 'InputsSelect',
+ chartKey: 'VInputsSelect',
+ conKey: 'VCInputsSelect',
+ title: '下拉选择器',
+ category: ChatCategoryEnum.INPUTS,
+ categoryName: ChatCategoryEnumName.INPUTS,
+ package: PackagesCategoryEnum.INFORMATIONS,
+ chartFrame: ChartFrameEnum.STATIC,
+ image: 'inputs_select.png'
+}
diff --git a/src/packages/components/Informations/Inputs/InputsSelect/index.vue b/src/packages/components/Informations/Inputs/InputsSelect/index.vue
new file mode 100644
index 00000000..714d4021
--- /dev/null
+++ b/src/packages/components/Informations/Inputs/InputsSelect/index.vue
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
diff --git a/src/packages/components/Informations/Inputs/InputsSelect/interact.ts b/src/packages/components/Informations/Inputs/InputsSelect/interact.ts
new file mode 100644
index 00000000..adc75306
--- /dev/null
+++ b/src/packages/components/Informations/Inputs/InputsSelect/interact.ts
@@ -0,0 +1,27 @@
+import { InteractEventOn, InteractActionsType } from '@/enums/eventEnum'
+
+// 时间组件类型
+export enum ComponentInteractEventEnum {
+ DATA = 'data'
+}
+
+// 联动参数
+export enum ComponentInteractParamsEnum {
+ DATA = 'data'
+}
+
+// 定义组件触发回调事件
+export const interactActions: InteractActionsType[] = [
+ {
+ interactType: InteractEventOn.CHANGE,
+ interactName: '选择完成',
+ componentEmitEvents: {
+ [ComponentInteractEventEnum.DATA]: [
+ {
+ value: ComponentInteractParamsEnum.DATA,
+ label: '选择项'
+ }
+ ]
+ }
+ }
+]
diff --git a/src/packages/components/Informations/Inputs/InputsTab/config.ts b/src/packages/components/Informations/Inputs/InputsTab/config.ts
new file mode 100644
index 00000000..34b444e7
--- /dev/null
+++ b/src/packages/components/Informations/Inputs/InputsTab/config.ts
@@ -0,0 +1,39 @@
+import cloneDeep from 'lodash/cloneDeep'
+import { PublicConfigClass } from '@/packages/public'
+import { CreateComponentType } from '@/packages/index.d'
+import { chartInitConfig } from '@/settings/designSetting'
+import { COMPONENT_INTERACT_EVENT_KET } from '@/enums/eventEnum'
+import { interactActions, ComponentInteractEventEnum } from './interact'
+import { InputsTabConfig } from './index'
+
+export const option = {
+ // 时间组件展示类型,必须和 interactActions 中定义的数据一致
+ [COMPONENT_INTERACT_EVENT_KET]: ComponentInteractEventEnum.DATA,
+ // 默认值
+ tabLabel: '选项1',
+ // 样式
+ tabType: 'segment',
+ // 暴露配置内容给用户
+ dataset: [
+ {
+ label: '选项1',
+ value: '1'
+ },
+ {
+ label: '选项2',
+ value: '2'
+ },
+ {
+ label: '选项3',
+ value: '3'
+ }
+ ]
+}
+
+export default class Config extends PublicConfigClass implements CreateComponentType {
+ public key = InputsTabConfig.key
+ public attr = { ...chartInitConfig, w: 460, h: 32, zIndex: -1 }
+ public chartConfig = cloneDeep(InputsTabConfig)
+ public interactActions = interactActions
+ public option = cloneDeep(option)
+}
diff --git a/src/packages/components/Informations/Inputs/InputsTab/config.vue b/src/packages/components/Informations/Inputs/InputsTab/config.vue
new file mode 100644
index 00000000..39d9cad5
--- /dev/null
+++ b/src/packages/components/Informations/Inputs/InputsTab/config.vue
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/packages/components/Informations/Inputs/InputsTab/index.ts b/src/packages/components/Informations/Inputs/InputsTab/index.ts
new file mode 100644
index 00000000..29276c2c
--- /dev/null
+++ b/src/packages/components/Informations/Inputs/InputsTab/index.ts
@@ -0,0 +1,14 @@
+import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
+import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
+
+export const InputsTabConfig: ConfigType = {
+ key: 'InputsTab',
+ chartKey: 'VInputsTab',
+ conKey: 'VCInputsTab',
+ title: '标签选择器',
+ category: ChatCategoryEnum.INPUTS,
+ categoryName: ChatCategoryEnumName.INPUTS,
+ package: PackagesCategoryEnum.INFORMATIONS,
+ chartFrame: ChartFrameEnum.STATIC,
+ image: 'inputs_tab.png'
+}
diff --git a/src/packages/components/Informations/Inputs/InputsTab/index.vue b/src/packages/components/Informations/Inputs/InputsTab/index.vue
new file mode 100644
index 00000000..d75bde97
--- /dev/null
+++ b/src/packages/components/Informations/Inputs/InputsTab/index.vue
@@ -0,0 +1,53 @@
+
+
+ {{ item.label }}
+
+
+
+
\ No newline at end of file
diff --git a/src/packages/components/Informations/Inputs/InputsTab/interact.ts b/src/packages/components/Informations/Inputs/InputsTab/interact.ts
new file mode 100644
index 00000000..adc75306
--- /dev/null
+++ b/src/packages/components/Informations/Inputs/InputsTab/interact.ts
@@ -0,0 +1,27 @@
+import { InteractEventOn, InteractActionsType } from '@/enums/eventEnum'
+
+// 时间组件类型
+export enum ComponentInteractEventEnum {
+ DATA = 'data'
+}
+
+// 联动参数
+export enum ComponentInteractParamsEnum {
+ DATA = 'data'
+}
+
+// 定义组件触发回调事件
+export const interactActions: InteractActionsType[] = [
+ {
+ interactType: InteractEventOn.CHANGE,
+ interactName: '选择完成',
+ componentEmitEvents: {
+ [ComponentInteractEventEnum.DATA]: [
+ {
+ value: ComponentInteractParamsEnum.DATA,
+ label: '选择项'
+ }
+ ]
+ }
+ }
+]
diff --git a/src/packages/components/Informations/Inputs/index.ts b/src/packages/components/Informations/Inputs/index.ts
new file mode 100644
index 00000000..1f4f22a7
--- /dev/null
+++ b/src/packages/components/Informations/Inputs/index.ts
@@ -0,0 +1,5 @@
+import { InputsDateConfig } from './InputsDate/index'
+import { InputsSelectConfig } from './InputsSelect/index'
+import { InputsTabConfig } from './InputsTab/index'
+
+export default [InputsDateConfig, InputsSelectConfig, InputsTabConfig]
diff --git a/src/packages/components/Informations/Mores/WordCloud/config.vue b/src/packages/components/Informations/Mores/WordCloud/config.vue
index 78934255..90efaabd 100644
--- a/src/packages/components/Informations/Mores/WordCloud/config.vue
+++ b/src/packages/components/Informations/Mores/WordCloud/config.vue
@@ -1,4 +1,5 @@
+
@@ -45,7 +46,7 @@
import { PropType, computed } from 'vue'
import { option, ShapeEnumList } from './config'
// eslint-disable-next-line no-unused-vars
-import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
+import { GlobalSetting, CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
const props = defineProps({
optionData: {
diff --git a/src/packages/components/Informations/Mores/WordCloud/index.vue b/src/packages/components/Informations/Mores/WordCloud/index.vue
index a5c8a592..347b4924 100644
--- a/src/packages/components/Informations/Mores/WordCloud/index.vue
+++ b/src/packages/components/Informations/Mores/WordCloud/index.vue
@@ -1,6 +1,7 @@
import { ref, computed, watch, PropType } from 'vue'
import VChart from 'vue-echarts'
+import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
import 'echarts-wordcloud'
import { use } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers'
@@ -38,6 +40,8 @@ const props = defineProps({
}
})
+const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
+
use([CanvasRenderer, GridComponent, TooltipComponent])
const replaceMergeArr = ref()
diff --git a/src/packages/components/Informations/Texts/TextBarrage/index.ts b/src/packages/components/Informations/Texts/TextBarrage/index.ts
index 95e5016f..245629fd 100644
--- a/src/packages/components/Informations/Texts/TextBarrage/index.ts
+++ b/src/packages/components/Informations/Texts/TextBarrage/index.ts
@@ -1,4 +1,4 @@
-import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d'
+import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum,ChatCategoryEnumName } from '../../index.d'
export const TextBarrageConfig: ConfigType = {
@@ -9,5 +9,6 @@ export const TextBarrageConfig: ConfigType = {
category: ChatCategoryEnum.TEXT,
categoryName: ChatCategoryEnumName.TEXT,
package: PackagesCategoryEnum.INFORMATIONS,
+ chartFrame: ChartFrameEnum.COMMON,
image: 'text_barrage.png'
}
diff --git a/src/packages/components/Informations/Texts/TextCommon/index.ts b/src/packages/components/Informations/Texts/TextCommon/index.ts
index 7adeea94..68009064 100644
--- a/src/packages/components/Informations/Texts/TextCommon/index.ts
+++ b/src/packages/components/Informations/Texts/TextCommon/index.ts
@@ -1,4 +1,4 @@
-import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d'
+import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum,ChatCategoryEnumName } from '../../index.d'
export const TextCommonConfig: ConfigType = {
@@ -9,5 +9,6 @@ export const TextCommonConfig: ConfigType = {
category: ChatCategoryEnum.TEXT,
categoryName: ChatCategoryEnumName.TEXT,
package: PackagesCategoryEnum.INFORMATIONS,
+ chartFrame: ChartFrameEnum.COMMON,
image: 'text_static.png'
}
diff --git a/src/packages/components/Informations/index.d.ts b/src/packages/components/Informations/index.d.ts
index f66a7a0b..ce775044 100644
--- a/src/packages/components/Informations/index.d.ts
+++ b/src/packages/components/Informations/index.d.ts
@@ -1,11 +1,14 @@
export enum ChatCategoryEnum {
TEXT = 'Texts',
TITLE = 'Titles',
+ INPUTS = 'Inputs',
MORE = 'Mores'
}
export enum ChatCategoryEnumName {
TEXT = '文本',
TITLE = '标题',
+ // 控件 => 数据录入
+ INPUTS = '控件',
MORE = '更多'
}
\ No newline at end of file
diff --git a/src/packages/components/Informations/index.ts b/src/packages/components/Informations/index.ts
index 78f5ae12..f3bb9581 100644
--- a/src/packages/components/Informations/index.ts
+++ b/src/packages/components/Informations/index.ts
@@ -1,4 +1,5 @@
import Texts from './Texts'
+import Inputs from './Inputs'
import Mores from './Mores'
-export const InformationList = [...Texts, ...Mores]
+export const InformationList = [...Texts, ...Inputs, ...Mores]
diff --git a/src/packages/index.d.ts b/src/packages/index.d.ts
index d8ef0bdd..f37f7d99 100644
--- a/src/packages/index.d.ts
+++ b/src/packages/index.d.ts
@@ -1,4 +1,4 @@
-import { BaseEvent, EventLife } from '@/enums/eventEnum'
+import { BaseEvent, EventLife, InteractEvents, InteractEventOn, InteractActionsType } from '@/enums/eventEnum'
import type { GlobalThemeJsonType } from '@/settings/chartThemes/index'
import type { RequestConfigType } from '@/store/modules/chartEditStore/chartEditStore.d'
@@ -120,20 +120,26 @@ export interface PublicConfigType {
}
filter?: string
status: StatusType
+ interactActions?: InteractActionsType[],
events: {
baseEvent: {
[K in BaseEvent]?: string
- },
+ }
advancedEvents: {
[K in EventLife]?: string
}
+ interactEvents: {
+ [InteractEvents.INTERACT_ON]: InteractEventOn | undefined
+ [InteractEvents.INTERACT_COMPONENT_ID]: string | undefined
+ [InteractEvents.INTERACT_FN]: { [name: string]: string }
+ }[]
}
}
export interface CreateComponentType extends PublicConfigType, requestConfig {
key: string
chartConfig: ConfigType
- option: GlobalThemeJsonType,
+ option: GlobalThemeJsonType
}
// 组件成组实例类
diff --git a/src/packages/public/publicConfig.ts b/src/packages/public/publicConfig.ts
index 10b3a10b..2a21d71d 100644
--- a/src/packages/public/publicConfig.ts
+++ b/src/packages/public/publicConfig.ts
@@ -102,7 +102,8 @@ export class PublicConfigClass implements PublicConfigType {
advancedEvents: {
[EventLife.VNODE_MOUNTED]: undefined,
[EventLife.VNODE_BEFORE_MOUNT]: undefined
- }
+ },
+ interactEvents: []
}
}
diff --git a/src/router/router-guards.ts b/src/router/router-guards.ts
index bdaa7fb2..5c81c514 100644
--- a/src/router/router-guards.ts
+++ b/src/router/router-guards.ts
@@ -13,6 +13,13 @@ const routerAllowList = [
export function createRouterGuards(router: Router) {
// 前置
router.beforeEach(async (to, from, next) => {
+ // http://localhost:3000/#/chart/preview/792622755697790976?t=123
+ // 把外部动态参数放入window.route.params,后续API动态接口可以用window.route?.params?.t来拼接参数
+ // @ts-ignore
+ if (!window.route) window.route = {params: {}}
+ // @ts-ignore
+ Object.assign(window.route.params, to.query)
+
const Loading = window['$loading'];
Loading && Loading.start();
const isErrorPage = router.getRoutes().findIndex((item) => item.name === to.name);
diff --git a/src/settings/chartThemes/index.ts b/src/settings/chartThemes/index.ts
index 75e79e5c..d66531ee 100644
--- a/src/settings/chartThemes/index.ts
+++ b/src/settings/chartThemes/index.ts
@@ -64,10 +64,13 @@ export const chartColorsSearch = {
roma: ['#e01f54', '#5e4ea5', 'rgba(137, 52, 72, 0.3)', 'rgba(224, 31, 84, 0.5)', 'rgba(94, 78, 165, 0.5)'],
}
+export type EchartsRenderer = 'svg' | 'canvas';
+
// 默认主题详细配置
type ThemeJsonType = typeof themeJson
export interface GlobalThemeJsonType extends Partial {
dataset?: any,
+ renderer?: EchartsRenderer,
[T:string]: any
}
-export const globalThemeJson = {...themeJson, dataset: null,}
+export const globalThemeJson = {...themeJson, dataset: null, renderer: 'svg' as const }
diff --git a/src/settings/designSetting.ts b/src/settings/designSetting.ts
index 5f76b84f..d49ecfb9 100644
--- a/src/settings/designSetting.ts
+++ b/src/settings/designSetting.ts
@@ -44,7 +44,7 @@ export const asideCollapsedWidth = 60
export const maskClosable = false
// 全局边框圆角
-export const borderRadius = '6px'
+export const borderRadius = '4px'
// 轮播间隔
export const carouselInterval = 4000
diff --git a/src/utils/router.ts b/src/utils/router.ts
index 7c04b96f..006b2f76 100644
--- a/src/utils/router.ts
+++ b/src/utils/router.ts
@@ -169,7 +169,8 @@ export const fetchRouteParams = () => {
*/
export const fetchRouteParamsLocation = () => {
try {
- return document.location.hash.split('/').pop() || ''
+ // 防止添加query参数的时候,解析ID异常
+ return document.location.hash.split('?')[0].split('/').pop() || ''
} catch (error) {
window['$message'].warning('查询路由信息失败,请联系管理员!')
return ''
diff --git a/src/views/chart/ContentBox/index.vue b/src/views/chart/ContentBox/index.vue
index 8f7b5e5d..b7d7f78f 100644
--- a/src/views/chart/ContentBox/index.vue
+++ b/src/views/chart/ContentBox/index.vue
@@ -10,7 +10,7 @@
-
+
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 736130c6..68b73edf 100644
--- a/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataAjax/index.vue
+++ b/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataAjax/index.vue
@@ -135,8 +135,9 @@ const sendHandle = async () => {
showMatching.value = true
return
}
- window['$message'].warning('数据异常,请检查参数!')
+ window['$message'].warning('没有拿到返回值,请检查接口!')
} catch (error) {
+ console.error(error);
loading.value = false
window['$message'].warning('数据异常,请检查参数!')
}
diff --git a/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataMonacoEditor/index.vue b/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataMonacoEditor/index.vue
index 205f3328..129b50c1 100644
--- a/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataMonacoEditor/index.vue
+++ b/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataMonacoEditor/index.vue
@@ -132,8 +132,9 @@ const fetchTargetData = async () => {
sourceData.value = res
return
}
- window['$message'].warning('数据异常,请检查参数!')
+ window['$message'].warning('没有拿到返回值,请检查接口!')
} catch (error) {
+ console.error(error);
window['$message'].warning('数据异常,请检查参数!')
}
}
diff --git a/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataPond/index.vue b/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataPond/index.vue
index ed9bc272..b51938dd 100644
--- a/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataPond/index.vue
+++ b/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataPond/index.vue
@@ -114,10 +114,6 @@ const sendHandle = async () => {
}
loading.value = true
try {
- // const res = await customizeHttp(
- // toRaw(pondData.value?.dataPondRequestConfig),
- // toRaw(chartEditStore.getRequestGlobalConfig)
- // )
const res = await customizeHttp(toRaw(targetData.value.request), toRaw(chartEditStore.getRequestGlobalConfig))
loading.value = false
if (res) {
@@ -126,8 +122,9 @@ const sendHandle = async () => {
showMatching.value = true
return
}
- window['$message'].warning('数据异常,请检查参数!')
+ window['$message'].warning('没有拿到返回值,请检查接口!')
} catch (error) {
+ console.error(error);
loading.value = false
window['$message'].warning('数据异常,请检查参数!')
}
diff --git a/src/views/chart/ContentConfigurations/components/ChartData/index.vue b/src/views/chart/ContentConfigurations/components/ChartData/index.vue
index 2915cb0c..a869a396 100644
--- a/src/views/chart/ContentConfigurations/components/ChartData/index.vue
+++ b/src/views/chart/ContentConfigurations/components/ChartData/index.vue
@@ -16,9 +16,10 @@
import { computed } from 'vue'
import { loadAsyncComponent } from '@/utils'
import { SettingItemBox } from '@/components/Pages/ChartItemSetting'
+import { RequestDataTypeEnum } from '@/enums/httpEnum'
+import { ChartFrameEnum } from '@/packages/index.d'
import { useTargetData } from '../hooks/useTargetData.hook'
import { SelectCreateDataType, SelectCreateDataEnum } from './index.d'
-import { RequestDataTypeEnum } from '@/enums/httpEnum'
const ChartDataStatic = loadAsyncComponent(() => import('./components/ChartDataStatic/index.vue'))
const ChartDataAjax = loadAsyncComponent(() => import('./components/ChartDataAjax/index.vue'))
@@ -44,6 +45,9 @@ const selectOptions: SelectCreateDataType[] = [
// 无数据源
const isNotData = computed(() => {
- return typeof targetData.value?.option?.dataset === 'undefined'
+ return (
+ targetData.value.chartConfig?.chartFrame === ChartFrameEnum.STATIC ||
+ typeof targetData.value?.option?.dataset === 'undefined'
+ )
})
diff --git a/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventAdvancedHandle/index.vue b/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventAdvancedHandle/index.vue
index 581fefcb..9310bf6a 100644
--- a/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventAdvancedHandle/index.vue
+++ b/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventAdvancedHandle/index.vue
@@ -1,5 +1,5 @@
-
+
diff --git a/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventBaseHandle/index.vue b/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventBaseHandle/index.vue
index 2defea36..cc2a7525 100644
--- a/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventBaseHandle/index.vue
+++ b/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventBaseHandle/index.vue
@@ -1,5 +1,5 @@
-
+
diff --git a/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventInteraction/index.ts b/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventInteraction/index.ts
new file mode 100644
index 00000000..b0134afa
--- /dev/null
+++ b/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventInteraction/index.ts
@@ -0,0 +1,3 @@
+import ChartEventInteraction from './index.vue'
+
+export { ChartEventInteraction }
\ No newline at end of file
diff --git a/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventInteraction/index.vue b/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventInteraction/index.vue
new file mode 100644
index 00000000..636414ed
--- /dev/null
+++ b/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventInteraction/index.vue
@@ -0,0 +1,243 @@
+
+
+
+
+
+
+
+
+
+ 新增
+
+
+
+
+ ]
+
![暂无数据]()
+
暂无内容
+
+
+
+
+ 关联组件 - {{ cardIndex + 1 }}
+
+
+
+
+
+
+
+
+
+
+
+ 选择目标组件
+
+
+
+
+
+
+
+
+
+ 绑定
+
+
+
+
+
+
+ 不支持「静态组件」和「分组」
+
+
+
+
+
+
+
+
+
+ {{ item }} |
+
+
+
+
+ {{ cItem.value }} |
+ {{ cItem.label }} |
+
+
+
+
+
+ 关联目标组件请求参数
+
+
+
+
+
+
+ 暂无数据
+
+
+
+
+
+
+
+
+
diff --git a/src/views/chart/ContentConfigurations/components/ChartEvent/index.vue b/src/views/chart/ContentConfigurations/components/ChartEvent/index.vue
index 05e5ce4d..6e632cc5 100644
--- a/src/views/chart/ContentConfigurations/components/ChartEvent/index.vue
+++ b/src/views/chart/ContentConfigurations/components/ChartEvent/index.vue
@@ -5,6 +5,7 @@
组件 id:
{{ targetData.id }}
+
@@ -12,6 +13,7 @@
diff --git a/src/views/preview/hooks/useScale.hook.ts b/src/views/preview/hooks/useScale.hook.ts
index 202aaf05..4a5698f5 100644
--- a/src/views/preview/hooks/useScale.hook.ts
+++ b/src/views/preview/hooks/useScale.hook.ts
@@ -1,14 +1,25 @@
-import { ref, onMounted, onUnmounted} from 'vue'
+import { ref, provide, onMounted, onUnmounted } from 'vue'
import { usePreviewFitScale, usePreviewScrollYScale, usePreviewScrollXScale, usePreviewFullScale } from '@/hooks/index'
import type { ChartEditStorageType } from '../index.d'
import { PreviewScaleEnum } from '@/enums/styleEnum'
+export const SCALE_KEY = 'scale-value'
+
export const useScale = (localStorageInfo: ChartEditStorageType) => {
const entityRef = ref()
const previewRef = ref()
const width = ref(localStorageInfo.editCanvasConfig.width)
const height = ref(localStorageInfo.editCanvasConfig.height)
+ const scaleRef = ref({ width: 1, height: 1 })
+
+ provide(SCALE_KEY, scaleRef);
+
+ const updateScaleRef = (scale: { width: number; height: number }) => {
+ // 这里需要解构,保证赋值给scaleRef的为一个新对象
+ // 因为scale始终为同一引用
+ scaleRef.value = { ...scale }
+ }
// 屏幕适配
onMounted(() => {
@@ -18,6 +29,7 @@ export const useScale = (localStorageInfo: ChartEditStorageType) => {
width.value as number,
height.value as number,
previewRef.value,
+ updateScaleRef
)
calcRate()
windowResize()
@@ -35,6 +47,7 @@ export const useScale = (localStorageInfo: ChartEditStorageType) => {
const dom = entityRef.value
dom.style.width = `${width.value * scale.width}px`
dom.style.height = `${height.value * scale.height}px`
+ updateScaleRef(scale)
}
)
calcRate()
@@ -54,6 +67,7 @@ export const useScale = (localStorageInfo: ChartEditStorageType) => {
const dom = entityRef.value
dom.style.width = `${width.value * scale.width}px`
dom.style.height = `${height.value * scale.height}px`
+ updateScaleRef(scale)
}
)
calcRate()
@@ -69,6 +83,7 @@ export const useScale = (localStorageInfo: ChartEditStorageType) => {
width.value as number,
height.value as number,
previewRef.value,
+ updateScaleRef
)
calcRate()
windowResize()
@@ -82,6 +97,7 @@ export const useScale = (localStorageInfo: ChartEditStorageType) => {
return {
entityRef,
- previewRef
+ previewRef,
+ scaleRef
}
}
diff --git a/src/views/preview/utils/storage.ts b/src/views/preview/utils/storage.ts
index 045fac5b..bc8138de 100644
--- a/src/views/preview/utils/storage.ts
+++ b/src/views/preview/utils/storage.ts
@@ -3,6 +3,9 @@ import { ResultEnum } from '@/enums/httpEnum'
import { StorageEnum } from '@/enums/storageEnum'
import { ChartEditStorage } from '@/store/modules/chartEditStore/chartEditStore.d'
import { fetchProjectApi } from '@/api/path'
+import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
+
+const chartEditStore = useChartEditStore()
export interface ChartEditStorageType extends ChartEditStorage {
id: string
@@ -31,6 +34,10 @@ export const getSessionStorageInfo = async () => {
// 本地读取
for (let i = 0; i < storageList.length; i++) {
if (id.toString() === storageList[i]['id']) {
+ const { editCanvasConfig, requestGlobalConfig, componentList } = storageList[i]
+ chartEditStore.editCanvasConfig = editCanvasConfig
+ chartEditStore.requestGlobalConfig = requestGlobalConfig
+ chartEditStore.componentList = componentList
return storageList[i]
}
}