Commit ba1c0e099ffd07c46ab33c33c158d08442dc450b

Authored by fengwotao
1 parent 89a0fcff

feat(src/packages): 自定义下拉选择器修改为选择多个

@@ -50,9 +50,9 @@ const onChange = (v: number | number[]) => { @@ -50,9 +50,9 @@ const onChange = (v: number | number[]) => {
50 props.chartConfig, 50 props.chartConfig,
51 useChartEditStore, 51 useChartEditStore,
52 { 52 {
53 - [ComponentInteractParamsEnum.DATE_START]: v[0],  
54 - [ComponentInteractParamsEnum.DATE_END]: v[1],  
55 - [ComponentInteractParamsEnum.DATE_RANGE]: `${v[0]}-${v[1]}` 53 + [ComponentInteractParamsEnum.DATE_START]: v[0] || dayjs().valueOf(),
  54 + [ComponentInteractParamsEnum.DATE_END]: v[1] || dayjs().valueOf(),
  55 + [ComponentInteractParamsEnum.DATE_RANGE]: `${v[0] || dayjs().valueOf()}-${v[1] || dayjs().valueOf()}`
56 }, 56 },
57 InteractEventOn.CHANGE 57 InteractEventOn.CHANGE
58 ) 58 )
@@ -61,7 +61,7 @@ const onChange = (v: number | number[]) => { @@ -61,7 +61,7 @@ const onChange = (v: number | number[]) => {
61 useChartInteract( 61 useChartInteract(
62 props.chartConfig, 62 props.chartConfig,
63 useChartEditStore, 63 useChartEditStore,
64 - { [ComponentInteractParamsEnum.DATE]: v }, 64 + { [ComponentInteractParamsEnum.DATE]: v || dayjs().valueOf() },
65 InteractEventOn.CHANGE 65 InteractEventOn.CHANGE
66 ) 66 )
67 } 67 }
@@ -10,7 +10,7 @@ export const option = { @@ -10,7 +10,7 @@ export const option = {
10 // 时间组件展示类型,必须和 interactActions 中定义的数据一致 10 // 时间组件展示类型,必须和 interactActions 中定义的数据一致
11 [COMPONENT_INTERACT_EVENT_KET]: ComponentInteractEventEnum.DATA, 11 [COMPONENT_INTERACT_EVENT_KET]: ComponentInteractEventEnum.DATA,
12 // 默认值 12 // 默认值
13 - selectValue: '1', 13 + selectValue: [],
14 // 暴露配置内容给用户 14 // 暴露配置内容给用户
15 dataset: [ 15 dataset: [
16 { 16 {
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 <collapse-item name="下拉配置" :expanded="true"> 2 <collapse-item name="下拉配置" :expanded="true">
3 <setting-item-box name="选择项" :alone="true"> 3 <setting-item-box name="选择项" :alone="true">
4 <SettingItem name="选择项"> 4 <SettingItem name="选择项">
5 - <n-select size="small" v-model:value="optionData.selectValue" :options="optionData.dataset" /> 5 + <n-select multiple size="small" v-model:value="optionData.selectValue" :options="optionData.dataset" />
6 </SettingItem> 6 </SettingItem>
7 </setting-item-box> 7 </setting-item-box>
8 <setting-item-box name="文字颜色" :alone="true"> 8 <setting-item-box name="文字颜色" :alone="true">
1 <template> 1 <template>
2 <n-select 2 <n-select
  3 + multiple
3 v-model:value="option.value.selectValue" 4 v-model:value="option.value.selectValue"
4 :options="option.value.dataset" 5 :options="option.value.dataset"
5 :style="`width:${w}px;`" 6 :style="`width:${w}px;`"
@@ -42,7 +43,7 @@ const option = shallowReactive({ @@ -42,7 +43,7 @@ const option = shallowReactive({
42 }) 43 })
43 44
44 // 监听事件改变 45 // 监听事件改变
45 -const onChange = (v: string) => { 46 +const onChange = (v: string[]) => {
46 // 存储到联动数据 47 // 存储到联动数据
47 useChartInteract( 48 useChartInteract(
48 props.chartConfig, 49 props.chartConfig,