Commit e237a55a4b55088e1e9b5192b681cb4f8ce6303c
1 parent
b2ef0e59
fix(src/packages/): 修改ws绑定单个文本组件,然后有多个,并且进行分组,其他联动组件也分组,然后显示的信息为原始信息,而非过滤函数返回的信息问题
Showing
1 changed file
with
22 additions
and
16 deletions
| 1 | import { defineStore } from "pinia"; | 1 | import { defineStore } from "pinia"; |
| 2 | import { KeyBoundComponentList, SocketComponentRecord, SocketReceiveMessageType, SocketSendMessageItemType, SocketSendMessageType, SocketStoreType, UnsubscribePoolType } from '@/store/external/modules/socketStore.d' | 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 | import { RequestContentTypeEnum } from "@/enums/external/httpEnum"; | 4 | import { RequestContentTypeEnum } from "@/enums/external/httpEnum"; |
| 5 | import { useChartEditStore } from "@/store/modules/chartEditStore/chartEditStore"; | 5 | import { useChartEditStore } from "@/store/modules/chartEditStore/chartEditStore"; |
| 6 | import { pinia } from '@/store' | 6 | import { pinia } from '@/store' |
| @@ -8,7 +8,7 @@ import { cloneDeep } from "lodash"; | @@ -8,7 +8,7 @@ import { cloneDeep } from "lodash"; | ||
| 8 | import { useFilterFn } from "@/hooks/external/useFilterFn"; | 8 | import { useFilterFn } from "@/hooks/external/useFilterFn"; |
| 9 | 9 | ||
| 10 | 10 | ||
| 11 | -const KEYS_SEPARATOR = ',' | 11 | +// const KEYS_SEPARATOR = ',' |
| 12 | const chartEditStore = useChartEditStore(pinia) | 12 | const chartEditStore = useChartEditStore(pinia) |
| 13 | export const useSocketStore = defineStore({ | 13 | export const useSocketStore = defineStore({ |
| 14 | id: 'useSocketStore', | 14 | id: 'useSocketStore', |
| @@ -260,22 +260,28 @@ export const useSocketStore = defineStore({ | @@ -260,22 +260,28 @@ export const useSocketStore = defineStore({ | ||
| 260 | * 修改后的代码 | 260 | * 修改后的代码 |
| 261 | * 修改ws绑定单个文本组件,然后有多个,并且进行分组,显示的信息为原始信息,而非过滤函数返回的信息 | 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 | /** |