<template> <view class=""> <view class="check-message-detail"> <view class="detail-content"> <view class="detail-item" > <text class="title">设备类型</text> <text>{{info.deviceTypeName}}</text> </view> <view class="detail-item" > <text class="title">设备编号</text> <text>{{info.devcode}}</text> </view> <view class="detail-item" > <text class="title">设备位置</text> <text>{{info.position}}</text> </view> <view class="detail-item" > <text class="title">井编号</text> <text>{{wellInfo.wellCode}}</text> </view> <view class="detail-item" > <text class="title">井类型</text> <text>{{wellInfo.wellTypeName}}</text> </view> <view class="detail-item" > <text class="title">井名称</text> <text>{{wellInfo.wellName}}</text> </view> <view class="detail-item" > <text class="title">设备状态</text> <text :style="{color: info.color}">{{info.onlineStateName}}</text> </view> <view class="detail-item" > <text class="title">安装时间</text> <text>{{info.installDate}}</text> </view> <view class="detail-item" > <text class="title">设备图片</text> <image :src="imgUrl" mode="widthFix" style="width: 160rpx;"></image> </view> <view class="detail-item" > <text class="title">设备经纬度</text> <view> <view> {{wellInfo.coordinateY}} </view> <view> {{wellInfo.coordinateX}} </view> </view> </view> <view class="map-info"> <map :show-location='true' :scale="3" style="width: 100%; height:100%;" :latitude="latitude" :longitude="longitude" :markers="marker"></map> </view> </view> </view> </view> </template> <script> import { getDeviceDetail, getWellInfo } from '@/api/check.js' export default { data() { return { latitude: '',//纬度 longitude: '',//经度 marker: [ { id:0, latitude: '',//纬度 longitude: '',//经度 iconPath: '../../static/checkIcon/manhole-line.png', //显示的图标 rotate:0, // 旋转度数 width:30, //宽 height:40, //高 // title:'我在这里',//标注点名 alpha:0.5, //透明度 // callout:{//自定义标记点上方的气泡窗口 点击有效 // content:'天宝大厦',//文本 // color:'#ffffff',//文字颜色 // fontSize:14,//文本大小 // borderRadius:15,//边框圆角 // borderWidth:'10', // bgColor:'#e51860',//背景颜色 // display:'ALWAYS',//常显 // }, }], info: uni.getStorageSync('checkrow') ||{}, wellInfo: {}, imgUrl:'' } }, async onLoad() { wx.getLocation({ type:'gcj02', success:(res)=>{ this.latitude = res.latitude; this.longitude= res.longitude; }, fail: (err) => { console.log(err,'地理位置错误') } }) const res = await getWellInfo({id:this.info.wellId}) this.wellInfo = res if(this.info.deviceTypeName === '燃气智能监测终端'){ this.imgUrl = '../../static/checkIcon/gas-terminal.jpg' }else if (this.info.deviceTypeName === '井盖状态监测仪') { this.imgUrl = '../../static/checkIcon/manhole.jpg' }else if (this.info.deviceTypeName === '液位监测仪') { this.imgUrl = '../../static/checkIcon/liquid.jpg' } // 将获取的值赋值给markers this.marker[0].latitude = res.coordinateY this.marker[0].longitude = res.coordinateX if (this.info.onlineStateName === '在线') { if(this.info.deviceTypeName === '燃气智能监测终端'){ this.marker[0].iconPath = '../../static/checkIcon/gas-line.png' }else if (this.info.deviceTypeName === '井盖状态监测仪') { this.marker[0].iconPath = '../../static/checkIcon/manhole-line.png' }else if (this.info.deviceTypeName === '液位监测仪') { this.marker[0].iconPath = '../../static/checkIcon/level-line.png' } }else if (this.info.onlineStateName === '离线'){ if(this.info.deviceTypeName === '燃气智能监测终端'){ this.marker[0].iconPath = '../../static/checkIcon/gas-offine.png' }else if (this.info.deviceTypeName === '井盖状态监测仪') { this.marker[0].iconPath = '../../static/checkIcon/manhole-offline.png' }else if (this.info.deviceTypeName === '液位监测仪') { this.marker[0].iconPath = '../../static/checkIcon/level-offline.png' } }else { if(this.info.deviceTypeName === '燃气智能监测终端'){ this.marker[0].iconPath = '../../static/checkIcon/gas-report.png' }else if (this.info.deviceTypeName === '井盖状态监测仪') { this.marker[0].iconPath = '../../static/checkIcon/manhole-report.png' }else if (this.info.deviceTypeName === '液位监测仪') { this.marker[0].iconPath = '../../static/checkIcon/level-report.png' } } } } </script> <style lang="scss" scoped> .check-message-detail { padding: 18rpx; height: 100%; .title { font-weight: 600; } .detail-content { padding: 22rpx; background-color: #fff; border-radius: 10rpx; } .detail-item { display: flex; justify-content: space-between; margin-bottom: 44rpx; } } .map-info { width: 100%; height: 460rpx; } </style>