Commit 05d4aa0216e373434d40d916d5cd0023f509e763

Authored by ww
1 parent 8c3e912e

fix(dynamic request): 修复socket无法连接

... ... @@ -33,7 +33,7 @@ export const useSocketStore = defineStore({
33 33 const { keys } = Params
34 34 return {
35 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 149 const { requestContentType, requestParams } = request
150 150 if ((requestContentType as RequestContentTypeEnum) === RequestContentTypeEnum.WEB_SOCKET) {
151 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 197 getComponentValueByKeys(targetComponent: CreateComponentType, value: SocketReceiveMessageType) {
198 198 const { request: { requestParams } } = targetComponent
199 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 203 const _value = cloneDeep(value) || { data: {}, latestValues: {} }
204 204 _value.data = targetComponentBindKeys.reduce((prev, next) => {
... ... @@ -238,7 +238,6 @@ export const useSocketStore = defineStore({
238 238 const { subscriptionId, data } = value
239 239 const keys = Object.keys(data)
240 240 const componentIds = this.getNeedUpdateComponentsIdBySubscribeId(subscriptionId, keys)
241   - console.log(componentIds)
242 241 componentIds?.forEach((targetComponentId) => {
243 242 this.updateComponentById(targetComponentId as string, value)
244 243 })
... ...
... ... @@ -377,14 +377,17 @@ export const useDynamicPublicForm = (paramsItemList: Ref<ParamsItemType[]>) => {
377 377 const schemas = toFormSchemas(key, required, value, mores)
378 378 return [...prev, ...schemas]
379 379 }, [] as DynamicFormSchema[])
  380 + console.log(result)
380 381 return result
381 382 })
382 383
383 384 const createForm = async () => {
  385 + console.log('enter')
384 386 await getBuiltInVariable()
385 387 await getOrgOption()
386 388 getDeviceProfileOption()
387 389 getDeviceOption()
  390 + clearParams()
388 391 }
389 392
390 393 const setParams = (Params: Recordable = {}) => {
... ... @@ -414,7 +417,8 @@ export const useDynamicPublicForm = (paramsItemList: Ref<ParamsItemType[]>) => {
414 417
415 418 const clearParams = () => {
416 419 Object.keys(params).forEach(key => {
417   - Reflect.deleteProperty(params, key)
  420 + // Reflect.deleteProperty(params, key)
  421 + params[key] = null
418 422 })
419 423 params[BuiltInVariable.SELECT_TIME_AGGREGATION] = {}
420 424 }
... ...