From 5c69a83e90e9eb37fd5630766a794a54a4bfd420 Mon Sep 17 00:00:00 2001 From: luoyp <2456821174@qq.com> Date: Tue, 11 Jul 2023 09:20:18 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=96=B0=E5=A2=9Einput=E8=81=94=E5=8A=A8?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/informations/inputs_input.png | Bin 0 -> 3853 bytes .../Informations/Inputs/InputsInput/config.ts | 24 +++++++ .../Inputs/InputsInput/config.vue | 18 +++++ .../Informations/Inputs/InputsInput/index.ts | 14 ++++ .../Informations/Inputs/InputsInput/index.vue | 63 ++++++++++++++++++ .../Inputs/InputsInput/interact.ts | 27 ++++++++ .../components/Informations/Inputs/index.ts | 3 +- 7 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 src/assets/images/chart/informations/inputs_input.png create mode 100644 src/packages/components/Informations/Inputs/InputsInput/config.ts create mode 100644 src/packages/components/Informations/Inputs/InputsInput/config.vue create mode 100644 src/packages/components/Informations/Inputs/InputsInput/index.ts create mode 100644 src/packages/components/Informations/Inputs/InputsInput/index.vue create mode 100644 src/packages/components/Informations/Inputs/InputsInput/interact.ts diff --git a/src/assets/images/chart/informations/inputs_input.png b/src/assets/images/chart/informations/inputs_input.png new file mode 100644 index 0000000000000000000000000000000000000000..00bc41feb00623b43c2ee1c0ff69f533466746a0 GIT binary patch literal 3853 zcmcInXEpZ4kYMLG<1th#muE+11&~69y$sN3Pv4m4HIBo z1)3*_3h0aIgCW3h$y3|Hhk}Bs<8PzP6lVeh4_SO+k9*a-e_Y>fy^q6?zK)HJt&?b%YCe7X#6O_*cBoh4bZ~HH9sI!Rc(ta6_UPCVCqhvb zex?HKE1@rx@)24bl}p(z3K;iep%G;Mk3W~MFq}lkJAAP*8{eU)BZl$ayGk~9I^M7> zxU)(1{89C{fYX@dQgDx|>$~&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cKSMnhfNMMEif$>Y- zQYNyNCQ2n2P2iMxFoxy_@fDH(03HGfyuGbD!)ILf(_~4ON3%GIuPv|11Clyeui4&9 zwh-DW!Wdq+({RZ_aJ|Yvi0yQYZmh1Z?E=EmwcAoc5?(euqMvsKybH)%?S@4_03g#9 z-OV=huTodKCidcyx$aMq{*4W7v!11XY}Sb3)wxqzl~$n-C2e-Wq~__Fk~wi`Dh69y zYSCb8_o(vohu^~?PD(P*cPVk@#|B6X#VPuB?_*|E6(C4|48X60pkYN?E??{?2Sk_> zs2|jglK{OOqd!%h>`_J_cucSMewXviudHdVJzIz$x7kpBc)pxo(z3fr+@pgkRCQ)I;*jvS(#1*@H9%bNeGGS|zsE`-m6xiX89=EKA-+_C?W zq>Jo>AkB+V?e_tIL+P?#v4$SV-;7zT!#(jiz{{9$0yTL`Im5Hi ztXl(G~$FawQBsBOf* E0K4;$=>Px# literal 0 HcmV?d00001 diff --git a/src/packages/components/Informations/Inputs/InputsInput/config.ts b/src/packages/components/Informations/Inputs/InputsInput/config.ts new file mode 100644 index 00000000..f99c35d7 --- /dev/null +++ b/src/packages/components/Informations/Inputs/InputsInput/config.ts @@ -0,0 +1,24 @@ +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 {InputsInputConfig} from "./index"; + +export const option = { + // 时间组件展示类型,必须和 interactActions 中定义的数据一致 + [COMPONENT_INTERACT_EVENT_KET]: ComponentInteractEventEnum.DATA, + // 默认值 + inputValue: "0", + // 暴露配置内容给用户 + dataset: "" +} + +export default class Config extends PublicConfigClass implements CreateComponentType { + public key = InputsInputConfig.key + public attr = { ...chartInitConfig, w: 260, h: 32, zIndex: -1 } + public chartConfig = cloneDeep(InputsInputConfig) + public interactActions = interactActions + public option = cloneDeep(option) +} \ No newline at end of file diff --git a/src/packages/components/Informations/Inputs/InputsInput/config.vue b/src/packages/components/Informations/Inputs/InputsInput/config.vue new file mode 100644 index 00000000..1c7900ee --- /dev/null +++ b/src/packages/components/Informations/Inputs/InputsInput/config.vue @@ -0,0 +1,18 @@ + + \ No newline at end of file diff --git a/src/packages/components/Informations/Inputs/InputsInput/index.ts b/src/packages/components/Informations/Inputs/InputsInput/index.ts new file mode 100644 index 00000000..ac3ab47e --- /dev/null +++ b/src/packages/components/Informations/Inputs/InputsInput/index.ts @@ -0,0 +1,14 @@ +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' +import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' + +export const InputsInputConfig: ConfigType = { + key: 'InputsInput', + chartKey: 'VInputsInput', + conKey: 'VCInputsInput', + title: '输入框', + category: ChatCategoryEnum.INPUTS, + categoryName: ChatCategoryEnumName.INPUTS, + package: PackagesCategoryEnum.INFORMATIONS, + chartFrame: ChartFrameEnum.STATIC, + image: 'inputs_input.png' +} \ No newline at end of file diff --git a/src/packages/components/Informations/Inputs/InputsInput/index.vue b/src/packages/components/Informations/Inputs/InputsInput/index.vue new file mode 100644 index 00000000..ec2dbd76 --- /dev/null +++ b/src/packages/components/Informations/Inputs/InputsInput/index.vue @@ -0,0 +1,63 @@ + + + + + + + + diff --git a/src/packages/components/Informations/Inputs/InputsInput/interact.ts b/src/packages/components/Informations/Inputs/InputsInput/interact.ts new file mode 100644 index 00000000..d6c070f4 --- /dev/null +++ b/src/packages/components/Informations/Inputs/InputsInput/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 index 1f4f22a7..ad5ceca6 100644 --- a/src/packages/components/Informations/Inputs/index.ts +++ b/src/packages/components/Informations/Inputs/index.ts @@ -1,5 +1,6 @@ import { InputsDateConfig } from './InputsDate/index' import { InputsSelectConfig } from './InputsSelect/index' import { InputsTabConfig } from './InputsTab/index' +import {InputsInputConfig} from './InputsInput/index' -export default [InputsDateConfig, InputsSelectConfig, InputsTabConfig] +export default [InputsDateConfig, InputsSelectConfig, InputsTabConfig,InputsInputConfig] From a17426ceefb42291ed3eca96eeea8fa425dbd05d Mon Sep 17 00:00:00 2001 From: luoyp <2456821174@qq.com> Date: Tue, 11 Jul 2023 09:54:26 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=BB=84=E5=90=88?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Charts/COMBINATIONS/BarLine/config.ts | 76 ++++++++++++++++ .../Charts/COMBINATIONS/BarLine/config.vue | 89 +++++++++++++++++++ .../Charts/COMBINATIONS/BarLine/data.json | 40 +++++++++ .../Charts/COMBINATIONS/BarLine/index.ts | 26 ++++++ .../Charts/COMBINATIONS/BarLine/index.vue | 88 ++++++++++++++++++ .../components/Charts/COMBINATIONS/index.ts | 3 + src/packages/components/Charts/index.d.ts | 2 + src/packages/components/Charts/index.ts | 3 +- 8 files changed, 326 insertions(+), 1 deletion(-) create mode 100644 src/packages/components/Charts/COMBINATIONS/BarLine/config.ts create mode 100644 src/packages/components/Charts/COMBINATIONS/BarLine/config.vue create mode 100644 src/packages/components/Charts/COMBINATIONS/BarLine/data.json create mode 100644 src/packages/components/Charts/COMBINATIONS/BarLine/index.ts create mode 100644 src/packages/components/Charts/COMBINATIONS/BarLine/index.vue create mode 100644 src/packages/components/Charts/COMBINATIONS/index.ts diff --git a/src/packages/components/Charts/COMBINATIONS/BarLine/config.ts b/src/packages/components/Charts/COMBINATIONS/BarLine/config.ts new file mode 100644 index 00000000..b62c4bab --- /dev/null +++ b/src/packages/components/Charts/COMBINATIONS/BarLine/config.ts @@ -0,0 +1,76 @@ +import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public' +import { BarLineConfig } from './index' +import { CreateComponentType } from '@/packages/index.d' +import cloneDeep from 'lodash/cloneDeep' +import dataJson from './data.json' + + +export const includes = ['legend', 'xAxis', 'yAxis', 'grid'] +// 柱状折线组合图 分别定义series +// 写死name可以定义legend显示的名称 +export const barSeriesItem = { + type: 'bar', + barWidth: 15, + label: { + show: true, + position: 'top', + color: '#fff', + fontSize: 12 + }, + itemStyle: { + color: null, + borderRadius: 2 + } +} + +export const lineSeriesItem = { + type: 'line', + symbol: "circle", + label: { + show: true, + position: 'top', + color: '#fff', + fontSize: 12 + }, + symbolSize: 5, //设定实心点的大小 + itemStyle: { + color: '#FFE47A', + borderWidth: 1 + }, + lineStyle: { + type: 'solid', + width: 3, + color: null + } +} + +export const option = { + tooltip: { + show: true, + trigger: 'axis', + axisPointer: { + show: true, + type: 'shadow' + } + }, + legend: { + data:null + }, + xAxis: { + show: true, + type: 'category' + }, + yAxis: { + show: true, + type: 'value' + }, + dataset: { ...dataJson }, + series: [barSeriesItem, lineSeriesItem] +} + +export default class Config extends PublicConfigClass implements CreateComponentType { + public key = BarLineConfig.key + public chartConfig = cloneDeep(BarLineConfig) + // 图表配置项 + public option = echartOptionProfixHandle(option, includes) +} \ No newline at end of file diff --git a/src/packages/components/Charts/COMBINATIONS/BarLine/config.vue b/src/packages/components/Charts/COMBINATIONS/BarLine/config.vue new file mode 100644 index 00000000..f6cd2b28 --- /dev/null +++ b/src/packages/components/Charts/COMBINATIONS/BarLine/config.vue @@ -0,0 +1,89 @@ + + + \ No newline at end of file diff --git a/src/packages/components/Charts/COMBINATIONS/BarLine/data.json b/src/packages/components/Charts/COMBINATIONS/BarLine/data.json new file mode 100644 index 00000000..0bd2f36e --- /dev/null +++ b/src/packages/components/Charts/COMBINATIONS/BarLine/data.json @@ -0,0 +1,40 @@ +{ + "dimensions": ["product", "data1", "data2"], + "source": [ + { + "product": "1月", + "data1": 104, + "data2": 30 + }, + { + "product": "2月", + "data1": 56, + "data2": 56 + }, + { + "product": "3月", + "data1": 136, + "data2": 36 + }, + { + "product": "4月", + "data1": 86, + "data2": 6 + }, + { + "product": "5月", + "data1": 98, + "data2": 10 + }, + { + "product": "6月", + "data1": 86, + "data2": 70 + }, + { + "product": "7月", + "data1": 77, + "data2": 57 + } + ] +} \ No newline at end of file diff --git a/src/packages/components/Charts/COMBINATIONS/BarLine/index.ts b/src/packages/components/Charts/COMBINATIONS/BarLine/index.ts new file mode 100644 index 00000000..c7d23b40 --- /dev/null +++ b/src/packages/components/Charts/COMBINATIONS/BarLine/index.ts @@ -0,0 +1,26 @@ +// 公共类型声明 +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' +// 当前[信息模块]分类声明 +import { ChatCategoryEnum,ChatCategoryEnumName } from '../../index.d' + +export const BarLineConfig: ConfigType = { + // 唯一key,注意!!!文件夹名称需要修改成与当前组件一致!!! + key: 'BarLine', + // 图表组件渲染 Components 格式: V + key + chartKey: 'VBarLine', + // 配置组件渲染 Components 格式: VC + key + conKey: 'VCBarLine', + // 名称 + title: '柱状加折线图', + // 子分类目录 + category: ChatCategoryEnum.COMBINATION, + // 子分类目录 + categoryName: ChatCategoryEnumName.COMBINATION, + // 包分类 + package: PackagesCategoryEnum.CHARTS, + // 组件框架类型 (注意!若此 Echarts 图表不支持 dataset 格式,则使用 ChartFrameEnum.COMMON) + chartFrame: ChartFrameEnum.ECHARTS, + // 图片 (注意!图片存放的路径必须在 src/assets/images/chart/包分类名称/*) + // 文件夹名称需要和包分类名称一致: PackagesCategoryEnum.CHARTS + image: 'bar_x.png' +} \ No newline at end of file diff --git a/src/packages/components/Charts/COMBINATIONS/BarLine/index.vue b/src/packages/components/Charts/COMBINATIONS/BarLine/index.vue new file mode 100644 index 00000000..da15588d --- /dev/null +++ b/src/packages/components/Charts/COMBINATIONS/BarLine/index.vue @@ -0,0 +1,88 @@ + + + \ No newline at end of file diff --git a/src/packages/components/Charts/COMBINATIONS/index.ts b/src/packages/components/Charts/COMBINATIONS/index.ts new file mode 100644 index 00000000..3a131a97 --- /dev/null +++ b/src/packages/components/Charts/COMBINATIONS/index.ts @@ -0,0 +1,3 @@ +import { BarLineConfig } from './BarLine/index' + +export default [BarLineConfig] \ No newline at end of file diff --git a/src/packages/components/Charts/index.d.ts b/src/packages/components/Charts/index.d.ts index c033c296..20da3d56 100644 --- a/src/packages/components/Charts/index.d.ts +++ b/src/packages/components/Charts/index.d.ts @@ -5,6 +5,7 @@ export enum ChatCategoryEnum { LINE = 'Lines', SCATTER = 'Scatters', MAP = 'Maps', + COMBINATION = 'COMBINATIONS', MORE = 'Mores' } @@ -14,5 +15,6 @@ export enum ChatCategoryEnumName { LINE = '折线图', SCATTER = '散点图', MAP = '地图', + COMBINATION = '组合图', MORE = '更多' } diff --git a/src/packages/components/Charts/index.ts b/src/packages/components/Charts/index.ts index 20ffcc66..c1d090e3 100644 --- a/src/packages/components/Charts/index.ts +++ b/src/packages/components/Charts/index.ts @@ -3,6 +3,7 @@ import Pies from './Pies' import Lines from './Lines' import Scatters from './Scatters' import Mores from './Mores' +import COMBINATIONS from './COMBINATIONS' import Maps from './Maps' -export const ChartList = [...Bars, ...Lines, ...Pies, ...Scatters, ...Maps, ...Mores] +export const ChartList = [...Bars, ...Lines, ...Pies, ...Scatters, ...Maps,...COMBINATIONS, ...Mores] From 15c001b5fad792fce2278af4632464904d959e7a Mon Sep 17 00:00:00 2001 From: luoyp <2456821174@qq.com> Date: Wed, 12 Jul 2023 09:42:37 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BB=84=E5=90=88?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Charts/COMBINATIONS/BarLine/index.vue | 42 +++++-------------- 1 file changed, 11 insertions(+), 31 deletions(-) diff --git a/src/packages/components/Charts/COMBINATIONS/BarLine/index.vue b/src/packages/components/Charts/COMBINATIONS/BarLine/index.vue index da15588d..87a9d848 100644 --- a/src/packages/components/Charts/COMBINATIONS/BarLine/index.vue +++ b/src/packages/components/Charts/COMBINATIONS/BarLine/index.vue @@ -7,7 +7,6 @@ import {ref, computed, watch, PropType, nextTick} from 'vue' import VChart from 'vue-echarts' import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook' -import dataJson from './data.json' import { use } from 'echarts/core' import { CanvasRenderer } from 'echarts/renderers' //引入柱状图 折线图 @@ -18,9 +17,6 @@ import { useChartDataFetch } from '@/hooks' import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' import { isPreview } from '@/utils' import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent } from 'echarts/components' -import isObject from "lodash/isObject"; -import cloneDeep from "lodash/cloneDeep"; -import {seriesItem} from "@/packages/components/Charts/Bars/BarCommon/config"; const props = defineProps({ themeSetting: { @@ -42,40 +38,24 @@ const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSe use([DatasetComponent, CanvasRenderer, BarChart, LineChart, GridComponent, TooltipComponent, LegendComponent]) const replaceMergeArr = ref() + const option = computed(() => { return mergeTheme(props.chartConfig.option, props.themeSetting, includes) }) watch( () => props.chartConfig.option.dataset, - (newData: { dimensions: any }, oldData) => { - try { - if (!isObject(newData) || !('dimensions' in newData)) return - if (Array.isArray(newData?.dimensions)) { - const seriesArr = [] - // 对oldData进行判断,防止传入错误数据之后对旧维度判断产生干扰 - // 此处计算的是dimensions的Y轴维度,若是dimensions.length为0或1,则默认为1,排除X轴维度干扰 - const oldDimensions = Array.isArray(oldData?.dimensions)&&oldData.dimensions.length >= 1 ? oldData.dimensions.length : 1; - const newDimensions = newData.dimensions.length >= 1 ? newData.dimensions.length : 1; - const dimensionsGap = newDimensions - oldDimensions; - if (dimensionsGap < 0) { - props.chartConfig.option.series.splice(newDimensions - 1) - } else if (dimensionsGap > 0) { - if(!oldData || !oldData?.dimensions || !Array.isArray(oldData?.dimensions) || !oldData?.dimensions.length ) { - props.chartConfig.option.series=[] - } - for (let i = 0; i < dimensionsGap; i++) { - seriesArr.push(cloneDeep(seriesItem)) - } - props.chartConfig.option.series.push(...seriesArr) - } - replaceMergeArr.value = ['series'] - nextTick(() => { - replaceMergeArr.value = [] - }) + (newData, oldData) => { + if (newData.dimensions.length !== oldData.dimensions.length) { + const seriesArr = [] + for (let i = 0; i < newData.dimensions.length - 1; i++) { + seriesArr.push(barSeriesItem, lineSeriesItem) } - } catch (error) { - console.log(error) + replaceMergeArr.value = ['series'] + props.chartConfig.option.series = seriesArr + nextTick(() => { + replaceMergeArr.value = [] + }) } }, { From fe2f1fb4baa02cebf8195c0efe2bddb9bbc23922 Mon Sep 17 00:00:00 2001 From: luoyp <2456821174@qq.com> Date: Wed, 12 Jul 2023 09:43:45 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BB=84=E5=90=88?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Charts/COMBINATIONS/BarLine/index.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/packages/components/Charts/COMBINATIONS/BarLine/index.ts b/src/packages/components/Charts/COMBINATIONS/BarLine/index.ts index c7d23b40..73e37e66 100644 --- a/src/packages/components/Charts/COMBINATIONS/BarLine/index.ts +++ b/src/packages/components/Charts/COMBINATIONS/BarLine/index.ts @@ -4,23 +4,13 @@ import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/ind import { ChatCategoryEnum,ChatCategoryEnumName } from '../../index.d' export const BarLineConfig: ConfigType = { - // 唯一key,注意!!!文件夹名称需要修改成与当前组件一致!!! key: 'BarLine', - // 图表组件渲染 Components 格式: V + key chartKey: 'VBarLine', - // 配置组件渲染 Components 格式: VC + key conKey: 'VCBarLine', - // 名称 title: '柱状加折线图', - // 子分类目录 category: ChatCategoryEnum.COMBINATION, - // 子分类目录 categoryName: ChatCategoryEnumName.COMBINATION, - // 包分类 package: PackagesCategoryEnum.CHARTS, - // 组件框架类型 (注意!若此 Echarts 图表不支持 dataset 格式,则使用 ChartFrameEnum.COMMON) chartFrame: ChartFrameEnum.ECHARTS, - // 图片 (注意!图片存放的路径必须在 src/assets/images/chart/包分类名称/*) - // 文件夹名称需要和包分类名称一致: PackagesCategoryEnum.CHARTS image: 'bar_x.png' } \ No newline at end of file From 066294ff7e8ea65f5f63a093410c15bd192f69a0 Mon Sep 17 00:00:00 2001 From: luoyp <2456821174@qq.com> Date: Thu, 13 Jul 2023 16:47:19 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Inputs/InputsPagination/config.ts | 26 +++++++ .../Inputs/InputsPagination/config.vue | 18 +++++ .../Inputs/InputsPagination/index.ts | 14 ++++ .../Inputs/InputsPagination/index.vue | 67 +++++++++++++++++++ .../Inputs/InputsPagination/interact.ts | 32 +++++++++ .../components/Informations/Inputs/index.ts | 3 +- 6 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 src/packages/components/Informations/Inputs/InputsPagination/config.ts create mode 100644 src/packages/components/Informations/Inputs/InputsPagination/config.vue create mode 100644 src/packages/components/Informations/Inputs/InputsPagination/index.ts create mode 100644 src/packages/components/Informations/Inputs/InputsPagination/index.vue create mode 100644 src/packages/components/Informations/Inputs/InputsPagination/interact.ts diff --git a/src/packages/components/Informations/Inputs/InputsPagination/config.ts b/src/packages/components/Informations/Inputs/InputsPagination/config.ts new file mode 100644 index 00000000..a520ae39 --- /dev/null +++ b/src/packages/components/Informations/Inputs/InputsPagination/config.ts @@ -0,0 +1,26 @@ +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 {InputsPaginationConfig} from "./index"; + +export const option = { + // 时间组件展示类型,必须和 interactActions 中定义的数据一致 + [COMPONENT_INTERACT_EVENT_KET]: ComponentInteractEventEnum.DATA, + // 默认值 + pageValue:1, + sizeValue:[4,6,8,10], + pageSize:4, + // 暴露配置内容给用户 + dataset: 10 +} + +export default class Config extends PublicConfigClass implements CreateComponentType { + public key = InputsPaginationConfig.key + public attr = { ...chartInitConfig, w: 260, h: 32, zIndex: -1 } + public chartConfig = cloneDeep(InputsPaginationConfig) + public interactActions = interactActions + public option = cloneDeep(option) +} \ No newline at end of file diff --git a/src/packages/components/Informations/Inputs/InputsPagination/config.vue b/src/packages/components/Informations/Inputs/InputsPagination/config.vue new file mode 100644 index 00000000..411b15e9 --- /dev/null +++ b/src/packages/components/Informations/Inputs/InputsPagination/config.vue @@ -0,0 +1,18 @@ + + \ No newline at end of file diff --git a/src/packages/components/Informations/Inputs/InputsPagination/index.ts b/src/packages/components/Informations/Inputs/InputsPagination/index.ts new file mode 100644 index 00000000..acd98aa8 --- /dev/null +++ b/src/packages/components/Informations/Inputs/InputsPagination/index.ts @@ -0,0 +1,14 @@ +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' +import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' + +export const InputsPaginationConfig: ConfigType = { + key: 'InputsPagination', + chartKey: 'VInputsPagination', + conKey: 'VCInputsPagination', + title: '分页', + category: ChatCategoryEnum.INPUTS, + categoryName: ChatCategoryEnumName.INPUTS, + package: PackagesCategoryEnum.INFORMATIONS, + chartFrame: ChartFrameEnum.COMMON, + image: 'inputs_select.png' +} \ No newline at end of file diff --git a/src/packages/components/Informations/Inputs/InputsPagination/index.vue b/src/packages/components/Informations/Inputs/InputsPagination/index.vue new file mode 100644 index 00000000..867642a5 --- /dev/null +++ b/src/packages/components/Informations/Inputs/InputsPagination/index.vue @@ -0,0 +1,67 @@ + + + \ No newline at end of file diff --git a/src/packages/components/Informations/Inputs/InputsPagination/interact.ts b/src/packages/components/Informations/Inputs/InputsPagination/interact.ts new file mode 100644 index 00000000..ebe5dee9 --- /dev/null +++ b/src/packages/components/Informations/Inputs/InputsPagination/interact.ts @@ -0,0 +1,32 @@ +import { InteractEventOn, InteractActionsType } from '@/enums/eventEnum' + +// 时间组件类型 +export enum ComponentInteractEventEnum { + DATA = 'data' +} + +// 联动参数 +export enum ComponentInteractParamsEnum { + DATA = 'data', + DATA2 = 'data2' +} + +// 定义组件触发回调事件 +export const interactActions: InteractActionsType[] = [ + { + interactType: InteractEventOn.CHANGE, + interactName: '选择完成', + componentEmitEvents: { + [ComponentInteractEventEnum.DATA]: [ + { + value: ComponentInteractParamsEnum.DATA, + label: '页数' + }, + { + value: ComponentInteractParamsEnum.DATA2, + label: '选择项2' + } + ] + } + } +] \ No newline at end of file diff --git a/src/packages/components/Informations/Inputs/index.ts b/src/packages/components/Informations/Inputs/index.ts index ad5ceca6..ae401447 100644 --- a/src/packages/components/Informations/Inputs/index.ts +++ b/src/packages/components/Informations/Inputs/index.ts @@ -2,5 +2,6 @@ import { InputsDateConfig } from './InputsDate/index' import { InputsSelectConfig } from './InputsSelect/index' import { InputsTabConfig } from './InputsTab/index' import {InputsInputConfig} from './InputsInput/index' +import { InputsPaginationConfig} from "./InputsPagination/index"; -export default [InputsDateConfig, InputsSelectConfig, InputsTabConfig,InputsInputConfig] +export default [InputsDateConfig, InputsSelectConfig, InputsTabConfig,InputsInputConfig,InputsPaginationConfig]