Commit f92e12f290304eb07c7824e7321afe883b9b7cd1

Authored by fengtao
Committed by xp.Huang
1 parent c2a73d18

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

@@ -123,9 +123,14 @@ const createInfoWindow = async (extraInfo: dataExtraInfoType) => { @@ -123,9 +123,14 @@ const createInfoWindow = async (extraInfo: dataExtraInfoType) => {
123 devicePartInfo.name = name 123 devicePartInfo.name = name
124 devicePartInfo.deviceProfileId = deviceProfileId 124 devicePartInfo.deviceProfileId = deviceProfileId
125 if (tbDeviceId.startsWith('@')) return //假的模拟数据则终止 125 if (tbDeviceId.startsWith('@')) return //假的模拟数据则终止
  126 + let deviceLastUpdateTs = null
126 const res = await getDeviceActiveTime(tbDeviceId) //查询设备最后离线时间 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 //以render方式渲染小组件里的边框组件 134 //以render方式渲染小组件里的边框组件
130 const BorderInstance = await import(`../../../../Decorates/Borders/${mpBorderConfig.value.value}/index.vue`) 135 const BorderInstance = await import(`../../../../Decorates/Borders/${mpBorderConfig.value.value}/index.vue`)
131 const config = await import(`../../../../Decorates/Borders/${mpBorderConfig.value.value}/config.ts`) 136 const config = await import(`../../../../Decorates/Borders/${mpBorderConfig.value.value}/config.ts`)
@@ -194,11 +199,11 @@ const handleOpenDrawer = async () => { @@ -194,11 +199,11 @@ const handleOpenDrawer = async () => {
194 } 199 }
195 200
196 onMounted(() => { 201 onMounted(() => {
197 - ;(window as any).handleOpenDrawer = handleOpenDrawer 202 + (window as any).handleOpenDrawer = handleOpenDrawer
198 }) 203 })
199 204
200 onUnmounted(() => { 205 onUnmounted(() => {
201 - ;(window as any).handleOpenDrawer = null 206 + (window as any).handleOpenDrawer = null
202 }) 207 })
203 208
204 //地图鼠标hover 209 //地图鼠标hover