Commit a89b11743f2ccc6016f3f072d5cac8eb15cbe4c4
1 parent
353f979f
fix: DEFECT-876 click row data not render device position
Showing
1 changed file
with
18 additions
and
5 deletions
| 1 | <template> | 1 | <template> | 
| 2 | <div class="wrapper"> | 2 | <div class="wrapper"> | 
| 3 | - <div ref="wrapRef" :style="{ height, width }"> </div> | 3 | + <Spin :spinning="spinning"> | 
| 4 | + <div ref="wrapRef" :style="{ height, width }"> </div> | ||
| 5 | + </Spin> | ||
| 4 | <div class="right-wrap !dark:bg-dark-900"> | 6 | <div class="right-wrap !dark:bg-dark-900"> | 
| 5 | <BasicTable | 7 | <BasicTable | 
| 6 | style="cursor: pointer" | 8 | style="cursor: pointer" | 
| @@ -91,6 +93,7 @@ | @@ -91,6 +93,7 @@ | ||
| 91 | import { defaultSchemas } from './cpns/TimePeriodForm/config'; | 93 | import { defaultSchemas } from './cpns/TimePeriodForm/config'; | 
| 92 | import { QueryWay, SchemaFiled, AggregateDataEnum } from './cpns/TimePeriodForm/config'; | 94 | import { QueryWay, SchemaFiled, AggregateDataEnum } from './cpns/TimePeriodForm/config'; | 
| 93 | import { dateUtil } from '/@/utils/dateUtil'; | 95 | import { dateUtil } from '/@/utils/dateUtil'; | 
| 96 | + import { Spin } from 'ant-design-vue'; | ||
| 94 | 97 | ||
| 95 | interface DeviceInfo { | 98 | interface DeviceInfo { | 
| 96 | alarmStatus: 0 | 1; | 99 | alarmStatus: 0 | 1; | 
| @@ -114,6 +117,7 @@ | @@ -114,6 +117,7 @@ | ||
| 114 | DeviceDetailDrawer, | 117 | DeviceDetailDrawer, | 
| 115 | Loading, | 118 | Loading, | 
| 116 | TimePeriodForm, | 119 | TimePeriodForm, | 
| 120 | + Spin, | ||
| 117 | }, | 121 | }, | 
| 118 | props: { | 122 | props: { | 
| 119 | width: { | 123 | width: { | 
| @@ -155,14 +159,15 @@ | @@ -155,14 +159,15 @@ | ||
| 155 | showSizeChanger: true, | 159 | showSizeChanger: true, | 
| 156 | }, | 160 | }, | 
| 157 | afterFetch: async (data: DeviceInfo[]) => { | 161 | afterFetch: async (data: DeviceInfo[]) => { | 
| 158 | - asyncFn(data); | 162 | + createMarket(data); | 
| 159 | return data; | 163 | return data; | 
| 160 | }, | 164 | }, | 
| 161 | }); | 165 | }); | 
| 162 | 166 | ||
| 163 | - async function asyncFn(data: DeviceInfo[]) { | 167 | + async function createMarket(data: DeviceInfo[]) { | 
| 164 | const BMap = (window as any).BMap; | 168 | const BMap = (window as any).BMap; | 
| 165 | - unref(BMapInstance)?.clearOverlays(); | 169 | + if (!BMap) return; | 
| 170 | + unref(BMapInstance).clearOverlays(); | ||
| 166 | const markerList: MarkerList[] = []; | 171 | const markerList: MarkerList[] = []; | 
| 167 | data.forEach((item) => { | 172 | data.forEach((item) => { | 
| 168 | const { | 173 | const { | 
| @@ -222,6 +227,7 @@ | @@ -222,6 +227,7 @@ | ||
| 222 | myCity.get(myFun); | 227 | myCity.get(myFun); | 
| 223 | } | 228 | } | 
| 224 | 229 | ||
| 230 | + const spinning = ref(false); | ||
| 225 | const createDeviceInfoWindow = async (record: DeviceInfo) => { | 231 | const createDeviceInfoWindow = async (record: DeviceInfo) => { | 
| 226 | const BMap = (window as any).BMap; | 232 | const BMap = (window as any).BMap; | 
| 227 | entityId = record.tbDeviceId; | 233 | entityId = record.tbDeviceId; | 
| @@ -288,7 +294,13 @@ | @@ -288,7 +294,13 @@ | ||
| 288 | }; | 294 | }; | 
| 289 | // 点击表格某一行触发 | 295 | // 点击表格某一行触发 | 
| 290 | const deviceRowClick = async (record) => { | 296 | const deviceRowClick = async (record) => { | 
| 291 | - createDeviceInfoWindow(record); | 297 | + try { | 
| 298 | + spinning.value = true; | ||
| 299 | + await createDeviceInfoWindow(record); | ||
| 300 | + } catch (err) { | ||
| 301 | + } finally { | ||
| 302 | + spinning.value = false; | ||
| 303 | + } | ||
| 292 | }; | 304 | }; | 
| 293 | 305 | ||
| 294 | // 设备信息 | 306 | // 设备信息 | 
| @@ -452,6 +464,7 @@ | @@ -452,6 +464,7 @@ | ||
| 452 | isNull, | 464 | isNull, | 
| 453 | registerDetailDrawer, | 465 | registerDetailDrawer, | 
| 454 | loading, | 466 | loading, | 
| 467 | + spinning, | ||
| 455 | timePeriodRegister, | 468 | timePeriodRegister, | 
| 456 | handleCancelModal, | 469 | handleCancelModal, | 
| 457 | }; | 470 | }; |