Commit 5d56a5496a7aefdbd49ed0933e3c374f930930b0
Merge branch 'dev-fix-ww' into 'main_dev'
fix(dynamic request): 修复socket无法连接 See merge request yunteng/thingskit-view!53
Showing
2 changed files
with
10 additions
and
7 deletions
@@ -33,7 +33,7 @@ export const useSocketStore = defineStore({ | @@ -33,7 +33,7 @@ export const useSocketStore = defineStore({ | ||
33 | const { keys } = Params | 33 | const { keys } = Params |
34 | return { | 34 | return { |
35 | componentId: id, | 35 | componentId: id, |
36 | - keys: keys.split(KEYS_SEPARATOR) | 36 | + keys: keys as unknown as string[] |
37 | } | 37 | } |
38 | }) | 38 | }) |
39 | }, | 39 | }, |
@@ -149,8 +149,8 @@ export const useSocketStore = defineStore({ | @@ -149,8 +149,8 @@ export const useSocketStore = defineStore({ | ||
149 | const { requestContentType, requestParams } = request | 149 | const { requestContentType, requestParams } = request |
150 | if ((requestContentType as RequestContentTypeEnum) === RequestContentTypeEnum.WEB_SOCKET) { | 150 | if ((requestContentType as RequestContentTypeEnum) === RequestContentTypeEnum.WEB_SOCKET) { |
151 | const { Params } = requestParams | 151 | const { Params } = requestParams |
152 | - const { entityId = '', keys = '' } = Params | ||
153 | - return this.updateConnectionPool(entityId, keys.split(KEYS_SEPARATOR), componentId) | 152 | + const { entityId = '', keys = [] } = Params |
153 | + return this.updateConnectionPool(entityId, keys as string[], componentId) | ||
154 | } | 154 | } |
155 | }, | 155 | }, |
156 | 156 | ||
@@ -197,8 +197,8 @@ export const useSocketStore = defineStore({ | @@ -197,8 +197,8 @@ export const useSocketStore = defineStore({ | ||
197 | getComponentValueByKeys(targetComponent: CreateComponentType, value: SocketReceiveMessageType) { | 197 | getComponentValueByKeys(targetComponent: CreateComponentType, value: SocketReceiveMessageType) { |
198 | const { request: { requestParams } } = targetComponent | 198 | const { request: { requestParams } } = targetComponent |
199 | const { Params } = requestParams | 199 | const { Params } = requestParams |
200 | - const { keys = '' } = Params | ||
201 | - const targetComponentBindKeys = keys.split(KEYS_SEPARATOR) | 200 | + const { keys = [] } = Params |
201 | + const targetComponentBindKeys = keys as unknown as string[] | ||
202 | 202 | ||
203 | const _value = cloneDeep(value) || { data: {}, latestValues: {} } | 203 | const _value = cloneDeep(value) || { data: {}, latestValues: {} } |
204 | _value.data = targetComponentBindKeys.reduce((prev, next) => { | 204 | _value.data = targetComponentBindKeys.reduce((prev, next) => { |
@@ -238,7 +238,6 @@ export const useSocketStore = defineStore({ | @@ -238,7 +238,6 @@ export const useSocketStore = defineStore({ | ||
238 | const { subscriptionId, data } = value | 238 | const { subscriptionId, data } = value |
239 | const keys = Object.keys(data) | 239 | const keys = Object.keys(data) |
240 | const componentIds = this.getNeedUpdateComponentsIdBySubscribeId(subscriptionId, keys) | 240 | const componentIds = this.getNeedUpdateComponentsIdBySubscribeId(subscriptionId, keys) |
241 | - console.log(componentIds) | ||
242 | componentIds?.forEach((targetComponentId) => { | 241 | componentIds?.forEach((targetComponentId) => { |
243 | this.updateComponentById(targetComponentId as string, value) | 242 | this.updateComponentById(targetComponentId as string, value) |
244 | }) | 243 | }) |
@@ -377,14 +377,17 @@ export const useDynamicPublicForm = (paramsItemList: Ref<ParamsItemType[]>) => { | @@ -377,14 +377,17 @@ export const useDynamicPublicForm = (paramsItemList: Ref<ParamsItemType[]>) => { | ||
377 | const schemas = toFormSchemas(key, required, value, mores) | 377 | const schemas = toFormSchemas(key, required, value, mores) |
378 | return [...prev, ...schemas] | 378 | return [...prev, ...schemas] |
379 | }, [] as DynamicFormSchema[]) | 379 | }, [] as DynamicFormSchema[]) |
380 | + console.log(result) | ||
380 | return result | 381 | return result |
381 | }) | 382 | }) |
382 | 383 | ||
383 | const createForm = async () => { | 384 | const createForm = async () => { |
385 | + console.log('enter') | ||
384 | await getBuiltInVariable() | 386 | await getBuiltInVariable() |
385 | await getOrgOption() | 387 | await getOrgOption() |
386 | getDeviceProfileOption() | 388 | getDeviceProfileOption() |
387 | getDeviceOption() | 389 | getDeviceOption() |
390 | + clearParams() | ||
388 | } | 391 | } |
389 | 392 | ||
390 | const setParams = (Params: Recordable = {}) => { | 393 | const setParams = (Params: Recordable = {}) => { |
@@ -414,7 +417,8 @@ export const useDynamicPublicForm = (paramsItemList: Ref<ParamsItemType[]>) => { | @@ -414,7 +417,8 @@ export const useDynamicPublicForm = (paramsItemList: Ref<ParamsItemType[]>) => { | ||
414 | 417 | ||
415 | const clearParams = () => { | 418 | const clearParams = () => { |
416 | Object.keys(params).forEach(key => { | 419 | Object.keys(params).forEach(key => { |
417 | - Reflect.deleteProperty(params, key) | 420 | + // Reflect.deleteProperty(params, key) |
421 | + params[key] = null | ||
418 | }) | 422 | }) |
419 | params[BuiltInVariable.SELECT_TIME_AGGREGATION] = {} | 423 | params[BuiltInVariable.SELECT_TIME_AGGREGATION] = {} |
420 | } | 424 | } |