Commit 40713fe600e168e3ec1680ae5b6104a3fef7b9bc
Merge branch 'ft' into 'main_dev'
perf(src/packages/): 优化图表地图用户体验 See merge request yunteng/thingskit-view!109
Showing
4 changed files
with
42 additions
and
26 deletions
| ... | ... | @@ -3,6 +3,13 @@ import { onMounted, reactive } from 'vue' |
| 3 | 3 | import { getAreaList } from '@/api/external/common/index' |
| 4 | 4 | import { areaEnum } from '../config' |
| 5 | 5 | |
| 6 | +const props = defineProps({ | |
| 7 | + drillingIn:{ | |
| 8 | + type:Boolean, | |
| 9 | + default:false | |
| 10 | + } | |
| 11 | +}) | |
| 12 | + | |
| 6 | 13 | const emits = defineEmits(['submit']) |
| 7 | 14 | |
| 8 | 15 | const selectOptions = reactive({ |
| ... | ... | @@ -12,7 +19,7 @@ const selectOptions = reactive({ |
| 12 | 19 | }) |
| 13 | 20 | |
| 14 | 21 | const selectValues = reactive({ |
| 15 | - provinceValue: null, | |
| 22 | + provinceValue: 'china', | |
| 16 | 23 | cityValue: null, |
| 17 | 24 | countyValue: null |
| 18 | 25 | }) |
| ... | ... | @@ -60,16 +67,19 @@ const onHandleSubmit = () => { |
| 60 | 67 | :options="selectOptions.provinceOptions" |
| 61 | 68 | /> |
| 62 | 69 | <n-select |
| 70 | + v-if="!props.drillingIn" | |
| 63 | 71 | @change="onHandleSelectCity" |
| 64 | 72 | placeholder="请选择城市" |
| 65 | 73 | v-model:value="selectValues.cityValue" |
| 66 | 74 | :options="selectOptions.cityOptions" |
| 67 | 75 | /> |
| 68 | - <n-select | |
| 76 | + <!-- 保留待用(下钻到区以下) --> | |
| 77 | + <!-- <n-select | |
| 78 | + v-if="!drillingIn" | |
| 69 | 79 | placeholder="请选择区域" |
| 70 | 80 | v-model:value="selectValues.countyValue" |
| 71 | 81 | :options="selectOptions.countryOptions" |
| 72 | - /> | |
| 82 | + /> --> | |
| 73 | 83 | <n-button type="primary" @click="onHandleSubmit">确定</n-button> |
| 74 | 84 | </div> |
| 75 | 85 | </template> | ... | ... |
| ... | ... | @@ -2,18 +2,17 @@ |
| 2 | 2 | <!-- Echarts 全局设置 --> |
| 3 | 3 | <global-setting :optionData="optionData"></global-setting> |
| 4 | 4 | <CollapseItem name="地图" :expanded="true"> |
| 5 | - <SelectCity @submit="onHandleSelectValues" /> | |
| 6 | 5 | <SettingItemBox name="开启下钻"> |
| 7 | 6 | <SettingItem name=""> |
| 8 | 7 | <n-switch v-model:value="optionData.drillingIn" size="small"></n-switch> |
| 9 | 8 | </SettingItem> |
| 10 | 9 | </SettingItemBox> |
| 11 | - <SettingItemBox name="显示返回图标"> | |
| 10 | + <SettingItemBox name="返回图标"> | |
| 12 | 11 | <SettingItem name=""> |
| 13 | - <n-switch v-model:value="optionData.showIcon" size="small"></n-switch> | |
| 12 | + <n-switch v-model:value="optionData.drillingIn" size="small"></n-switch> | |
| 14 | 13 | </SettingItem> |
| 15 | 14 | </SettingItemBox> |
| 16 | - <SettingItemBox name="返回图标颜色"> | |
| 15 | + <SettingItemBox name="图标颜色"> | |
| 17 | 16 | <SettingItem name=""> |
| 18 | 17 | <n-color-picker |
| 19 | 18 | size="small" |
| ... | ... | @@ -22,7 +21,7 @@ |
| 22 | 21 | ></n-color-picker> |
| 23 | 22 | </SettingItem> |
| 24 | 23 | </SettingItemBox> |
| 25 | - <SettingItemBox name="返回图标距离"> | |
| 24 | + <SettingItemBox name="图标距离"> | |
| 26 | 25 | <SettingItem name="距右"> |
| 27 | 26 | <n-input-number |
| 28 | 27 | v-model:value="optionData.iconDistanceRight" |
| ... | ... | @@ -40,6 +39,7 @@ |
| 40 | 39 | ></n-input-number> |
| 41 | 40 | </SettingItem> |
| 42 | 41 | </SettingItemBox> |
| 42 | + <SelectCity :drillingIn="optionData.drillingIn" @submit="onHandleSelectValues" /> | |
| 43 | 43 | <SettingItemBox name="区域颜色"> |
| 44 | 44 | <SettingItem name="0%处颜色"> |
| 45 | 45 | <n-color-picker | ... | ... |
| ... | ... | @@ -89,8 +89,8 @@ const toolBoxOption = ref({ |
| 89 | 89 | watch( |
| 90 | 90 | () => props.chartConfig.option, |
| 91 | 91 | newData => { |
| 92 | - const { iconColor, showIcon, iconDistanceRight, iconDistanceTop } = newData | |
| 93 | - toolBoxOption.value.feature.myFullButton.show = showIcon | |
| 92 | + const { iconColor, drillingIn, iconDistanceRight, iconDistanceTop } = newData | |
| 93 | + toolBoxOption.value.feature.myFullButton.show = drillingIn | |
| 94 | 94 | toolBoxOption.value.feature.myFullButton.iconStyle.color = iconColor |
| 95 | 95 | toolBoxOption.value.right = iconDistanceRight |
| 96 | 96 | toolBoxOption.value.top = iconDistanceTop | ... | ... |
| 1 | 1 | import { defineStore } from "pinia"; |
| 2 | 2 | import { KeyBoundComponentList, SocketComponentRecord, SocketReceiveMessageType, SocketSendMessageItemType, SocketSendMessageType, SocketStoreType, UnsubscribePoolType } from '@/store/external/modules/socketStore.d' |
| 3 | -import { CreateComponentGroupType, CreateComponentType } from "@/packages/index.d"; | |
| 3 | +import { CreateComponentType } from "@/packages/index.d"; | |
| 4 | 4 | import { RequestContentTypeEnum } from "@/enums/external/httpEnum"; |
| 5 | 5 | import { useChartEditStore } from "@/store/modules/chartEditStore/chartEditStore"; |
| 6 | 6 | import { pinia } from '@/store' |
| ... | ... | @@ -8,7 +8,7 @@ import { cloneDeep } from "lodash"; |
| 8 | 8 | import { useFilterFn } from "@/hooks/external/useFilterFn"; |
| 9 | 9 | |
| 10 | 10 | |
| 11 | -const KEYS_SEPARATOR = ',' | |
| 11 | +// const KEYS_SEPARATOR = ',' | |
| 12 | 12 | const chartEditStore = useChartEditStore(pinia) |
| 13 | 13 | export const useSocketStore = defineStore({ |
| 14 | 14 | id: 'useSocketStore', |
| ... | ... | @@ -260,22 +260,28 @@ export const useSocketStore = defineStore({ |
| 260 | 260 | * 修改后的代码 |
| 261 | 261 | * 修改ws绑定单个文本组件,然后有多个,并且进行分组,显示的信息为原始信息,而非过滤函数返回的信息 |
| 262 | 262 | */ |
| 263 | - const target = chartEditStore.getComponentList?.reduce((prev: Array<CreateComponentType | CreateComponentGroupType>, acc) => { | |
| 264 | - acc?.isGroup ? (prev = [...(acc?.groupList as CreateComponentGroupType[])]) : prev?.push(acc) | |
| 265 | - return prev | |
| 266 | - }, []) | |
| 267 | - ?.filter( | |
| 268 | - item => (item?.request?.requestContentType as RequestContentTypeEnum) === RequestContentTypeEnum.WEB_SOCKET | |
| 269 | - ) | |
| 270 | - target.forEach(item => { | |
| 271 | - if (item.id === id) { | |
| 272 | - const _value = this.getComponentValueByKeys(item, value) | |
| 273 | - const { filter } = item | |
| 274 | - const { value: filterValue, reason, flag } = useFilterFn(filter, _value) | |
| 275 | - item.option.dataset = flag ? filterValue : reason | |
| 263 | + chartEditStore.getComponentList.forEach(targetItem => { | |
| 264 | + if (targetItem.isGroup) { | |
| 265 | + //分组 | |
| 266 | + targetItem.groupList?.forEach(groupItem => { | |
| 267 | + if (groupItem.id === id) { | |
| 268 | + const _value = this.getComponentValueByKeys(groupItem, value) | |
| 269 | + const { filter } = groupItem | |
| 270 | + const { value: filterValue, reason, flag } = useFilterFn(filter, _value) | |
| 271 | + groupItem.option.dataset = flag ? filterValue : reason | |
| 272 | + } | |
| 273 | + }) | |
| 274 | + } else { | |
| 275 | + //单个 | |
| 276 | + if (targetItem.id === id) { | |
| 277 | + const _value = this.getComponentValueByKeys(targetItem, value) | |
| 278 | + const { filter } = targetItem | |
| 279 | + const { value: filterValue, reason, flag } = useFilterFn(filter, _value) | |
| 280 | + targetItem.option.dataset = flag ? filterValue : reason | |
| 281 | + } | |
| 276 | 282 | } |
| 283 | + // | |
| 277 | 284 | }) |
| 278 | - // | |
| 279 | 285 | }, |
| 280 | 286 | |
| 281 | 287 | /** | ... | ... |