Commit 7c0a7fedd29be8e9a6155151280f78c1b21907e1

Authored by ww
1 parent 451a7393

perf: remove useless code

@@ -263,93 +263,6 @@ @@ -263,93 +263,6 @@
263 // 点击表格某一行触发 263 // 点击表格某一行触发
264 const deviceRowClick = async (record) => { 264 const deviceRowClick = async (record) => {
265 createDeviceInfoWindow(record); 265 createDeviceInfoWindow(record);
266 - return;  
267 - entityId = record.tbDeviceId;  
268 - globalRecord = record;  
269 - const BMap = (window as any).BMap;  
270 - // const wrapEl = unref(wrapRef);  
271 - // const map = new BMap.Map(wrapEl);  
272 - // if (record.deviceInfo.address) {  
273 - // keys = await getDeviceDataKeys(entityId);  
274 - try {  
275 - deviceAttrs.value = (await getDeviceDataKeys(entityId)) || [];  
276 - } catch (error) {}  
277 -  
278 - const { name, organizationDTO, deviceState, deviceProfile } = record;  
279 - const { longitude, latitude, address } = record.deviceInfo;  
280 - //这里如果没有地理位置 最好设置一个默认位置 不然地图会全蓝  
281 - const point = new BMap.Point(  
282 - longitude == '' ? 104.04666605565338 : longitude,  
283 - latitude == '' ? 30.543516387560476 : latitude  
284 - );  
285 - let options = {  
286 - width: 330, // 信息窗口宽度  
287 - height: 0, // 信息窗口高度  
288 - };  
289 - unref(BMapInstance).centerAndZoom(point, 15);  
290 - unref(BMapInstance).enableScrollWheelZoom(true);  
291 - // 创建信息窗口对象  
292 - const res = await getDeviceActiveTime(entityId);  
293 -  
294 - let { lastUpdateTs } = res[0];  
295 - lastUpdateTs = moment(lastUpdateTs).format('YYYY-MM-DD HH:mm:ss');  
296 - let infoWindow = new BMap.InfoWindow(  
297 - `  
298 - <div style="display:flex;justify-content:space-between; margin:20px 0px;">  
299 - <div style="font-size:16px;font-weight:bold">${name}</div>  
300 - ${  
301 - deviceState === 'INACTIVE'  
302 - ? `<div style="display:flex;align-items:center;"><img style="width:15px;height:15px" src="${djh}" class="mr-1">待激活</div>`  
303 - : deviceState === 'ONLINE'  
304 - ? `<div style="display:flex;align-items:center; ">  
305 - <img style="width:15px;height:15px" src="${online}" class="mr-1">在线</div>`  
306 - : `<div style="display:flex;align-items:center;"><img style="width:15px;height:15px" src="${lx1}" class="mr-1">离线</div>`  
307 - }  
308 - </div>  
309 - <div>所属组织:${organizationDTO.name}</div>  
310 - <div style="margin-top:6px;">接入协议:${deviceProfile.transportType}</div>  
311 - <div style="margin-top:6px;">设备位置:${  
312 - address == '' ? '该设备暂无地理位置' : address  
313 - }</div>  
314 - <div style="margin-top:6px;">${  
315 - deviceState === 'ONLINE' ? '在线' : deviceState === 'INACTIVE' ? '创建' : '离线'  
316 - }时间:${lastUpdateTs}</div>  
317 - <div style="display:flex;justify-content:end; margin-top:10px">  
318 - <button onclick="openDeviceInfoDrawer()" style="margin-right:10px;color:#fff;background-color:#409eff;padding:4px; border-radius:4px;">设备信息</button>  
319 - <button onclick="openHistoryModal()" style="color:#fff;background-color:#409eff;padding:4px; border-radius:4px;">历史数据</button>  
320 - </div>  
321 - `,  
322 - options  
323 - );  
324 -  
325 - unref(BMapInstance).openInfoWindow(infoWindow, unref(BMapInstance).getCenter());  
326 - let preMarker = null;  
327 -  
328 - const rivet = deviceState === 'INACTIVE' ? djx : deviceState === 'ONLINE' ? zx : lx;  
329 - let myIcon = new BMap.Icon(rivet, new BMap.Size(20, 30));  
330 - let marker = new BMap.Marker(point, { icon: myIcon });  
331 - if (marker) {  
332 - unref(BMapInstance).removeOverlay(preMarker);  
333 - }  
334 - unref(BMapInstance).addOverlay(marker);  
335 - //标注监听事件  
336 - marker.addEventListener('click', function (e) {  
337 - const point = e.point;  
338 - unref(BMapInstance).openInfoWindow(infoWindow, point);  
339 - });  
340 - //标注监听事件  
341 - // } else {  
342 - // const point = new BMap.Point(106.63028229687498, 36.06735821600903);  
343 - // let options = {  
344 - // width: 100, // 信息窗口宽度  
345 - // height: 100, // 信息窗口高度  
346 - // title: '提示', // 信息窗口标题  
347 - // };  
348 - // map.centerAndZoom(point, 5);  
349 - // map.enableScrollWheelZoom(true);  
350 - // let infoWindow = new BMap.InfoWindow('该设备暂无地理位置', options); // 创建信息窗口对象  
351 - // map.openInfoWindow(infoWindow, map.getCenter());  
352 - // }  
353 }; 266 };
354 267
355 // 设备信息 268 // 设备信息