定位设备接口调试

This commit is contained in:
BianLzhaoMin 2024-08-06 15:31:07 +08:00
parent 0be2776cf6
commit fbe5aa49be
4 changed files with 67 additions and 10 deletions

View File

@ -61,6 +61,14 @@ export function getTypeList(params = {}) {
params,
})
}
// 获取绑定IOT列表 /iotMachine/getTypeList
export function getTypeListApi(params = {}) {
return request({
url: '/material/iotMachine/getTypeList',
method: 'get',
params,
})
}
// 绑定详情 /iotMachine/getRecordList
export function getRecordList(params = {}) {
@ -79,3 +87,8 @@ export function getRecordListAll(params = {}) {
params,
})
}
/** 获取机具设备的位置信息 */
export const getIotDeviceLocationApi = (data) => {
return request.post('/material/iotMachine/getLocation', data)
}

View File

@ -118,6 +118,7 @@
</template>
<script>
import { getIotDeviceLocationApi } from '@/api/store/iotManagement.js'
export default {
name: 'MapDialog',
props: {
@ -131,6 +132,11 @@ export default {
type: String,
default: () => '',
},
//
iotCode: {
type: String,
default: () => '',
},
},
data() {
return {
@ -176,23 +182,49 @@ export default {
],
count: 0,
trackAni: null, //
calLon: '',
calLat: '',
}
},
mounted() {
console.log('地图弹框组件被创建--')
// this.getEquipmentInfo()
Promise.all([this.getIotDeviceLocation()])
.then((res) => {
this.initMap()
})
.catch((err) => {
console.log(err, '失败')
})
// this.getIotDeviceLocation()
},
beforeDestroy() {
/** 组件销毁之前 先清除地图实例 */
// 1.
if (this.trackAni) {
this.trackAni.cancel()
}
// 2.
this.map.clearOverlays()
this.map.destroy()
this.map = null
console.log('地图弹框组件销毁了---', this.map)
},
methods: {
/** 获取当前设备的信息 */
async getIotDeviceLocation() {
if (this.iotCode) {
const { data: res } = await getIotDeviceLocationApi({
iotId: this.iotCode,
})
//
this.calLon = res.callon
this.calLat = res.callat
}
},
/** 查看行程 */
handlePreviewTrip() {
let pointList = []
@ -209,13 +241,13 @@ export default {
// 线
polyline.setStrokeColor('#EA3323') // 线 #EA3323
// polyline.setStrokeWeight(2) // 线
let trackAni = new BMapGLLib.TrackAnimation(this.map, polyline, {
this.trackAni = new BMapGLLib.TrackAnimation(this.map, polyline, {
overallView: true, //
tilt: 30, // 55
duration: 5000, // 10000ms
delay: 2000, // 0ms
duration: 3000, // 10000ms
delay: 500, // 0ms
})
trackAni.start()
this.trackAni.start()
//
this.triggerMovement()
},
@ -246,9 +278,11 @@ export default {
},
//
initMap() {
console.log('地图初始化--')
this.$nextTick(() => {
this.map = new BMapGL.Map('container') //
let point = new BMapGL.Point(117.14, 31.87) //
// let point = new BMapGL.Point(this.calLon, this.calLat) //
this.map.centerAndZoom(point, 15) //
this.map.enableScrollWheelZoom(true) //
this.map.setHeading(64.5) //

View File

@ -537,6 +537,7 @@
v-if="mapDialogVisible"
:deviceName="deviceName"
:deviceType="deviceType"
:iotCode="iotCode"
@handelCloseDialog="handelCloseDialog"
/>
</div>
@ -560,6 +561,7 @@ import { getProLists } from '@/api/base/base'
import { imgUpLoad } from '@/api/system/upload'
import { getTypeList } from '@/api/store/warehousing'
import { listHouseTree } from '@/api/store/shelves'
import { getTypeListApi } from '@/api/store/iotManagement.js'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import QRCode from 'qrcodejs2'
@ -647,6 +649,7 @@ export default {
mapDialogVisible: false,
deviceName: '',
deviceType: '',
iotCode: '',
}
},
created() {
@ -847,9 +850,16 @@ export default {
}
},
//
handleMap(row) {
async handleMap(row) {
this.deviceName = row.specificationType
this.deviceType = row.maStatusName
// iot
const res = await getTypeListApi({ maCode: row.maCode })
if (res.rows.length > 0) {
this.iotCode = res.rows[0].iotCode
}
// console.log(res, 'iot')
this.mapDialogVisible = true
},
handlePush() {

View File

@ -46,7 +46,7 @@ module.exports = {
// target: `http://10.40.92.81:8080`, //韩/
// target: `http://192.168.2.81:28080`,//旭/
// target: `http://192.168.2.248:28080`, //帅
target: `http://192.168.2.246:28080`, //福
target: `http://192.168.2.246:49080`, //福
//******** 注意事项 ********* */
//1.全局替换qrUrl二维码扫码提供的网址-发布服务器的地址target;