Commit e11c627247938c39b5fab6def01e5555b98b60e8

Authored by xp.Huang
2 parents c2a73d18 f92e12f2

Merge branch 'fix/map/08-01' into 'main_dev'

fix: 修复设备地理位置,当点击弹窗时,接口未调用或者接口返回空,导致前端取值取不到,页面阻塞报错,弹窗内容无法显示的问题

See merge request yunteng/thingskit-view!278
... ... @@ -123,9 +123,14 @@ const createInfoWindow = async (extraInfo: dataExtraInfoType) => {
123 123 devicePartInfo.name = name
124 124 devicePartInfo.deviceProfileId = deviceProfileId
125 125 if (tbDeviceId.startsWith('@')) return //假的模拟数据则终止
  126 + let deviceLastUpdateTs = null
126 127 const res = await getDeviceActiveTime(tbDeviceId) //查询设备最后离线时间
127   - let { lastUpdateTs } = res[0]
128   - const lastUpdateFormatTs = dayjs(lastUpdateTs).format('YYYY-MM-DD HH:mm:ss')
  128 + if (!res) {
  129 + deviceLastUpdateTs = null
  130 + } else {
  131 + deviceLastUpdateTs = res[0]['lastUpdateTs']
  132 + }
  133 + const lastUpdateFormatTs = deviceLastUpdateTs ? dayjs(deviceLastUpdateTs).format('YYYY-MM-DD HH:mm:ss'): ''
129 134 //以render方式渲染小组件里的边框组件
130 135 const BorderInstance = await import(`../../../../Decorates/Borders/${mpBorderConfig.value.value}/index.vue`)
131 136 const config = await import(`../../../../Decorates/Borders/${mpBorderConfig.value.value}/config.ts`)
... ... @@ -194,11 +199,11 @@ const handleOpenDrawer = async () => {
194 199 }
195 200
196 201 onMounted(() => {
197   - ;(window as any).handleOpenDrawer = handleOpenDrawer
  202 + (window as any).handleOpenDrawer = handleOpenDrawer
198 203 })
199 204
200 205 onUnmounted(() => {
201   - ;(window as any).handleOpenDrawer = null
  206 + (window as any).handleOpenDrawer = null
202 207 })
203 208
204 209 //地图鼠标hover
... ...