<template>
|
<view class="pages-map-task">
|
<view class="no-content" v-if="unlinked">
|
<image class="img" src="/images/image 25.png" alt=" 图片" mode="aspectFit" />
|
<view class="title">车辆连接失败</view>
|
<view class="space">请检查你的网络设置或重新加载</view>
|
</view>
|
<view class="map-content" v-else>
|
<view class="content">
|
|
</view>
|
<view class="bottom">
|
<view class="button-group">
|
<view type="text" class="button" @click="clickTaskSet">
|
<uni-icons class="img" type="gear-filled" size="40" color="#1890FF"></uni-icons>
|
<view class="text"> 设置任务</view>
|
|
</view>
|
<view type="text" class="button" @click="clickTaskRecord">
|
<text class="ico task-list" />
|
<view class="text"> 任务记录</view>
|
|
|
|
</view>
|
</view>
|
|
</view>
|
</view>
|
|
</view>
|
</template>
|
<script>
|
import {
|
showToast,
|
showModal
|
} from "@/comm/utils.js"
|
import {
|
Button
|
} from 'antd-mobile-vue-next'
|
|
import {
|
stations,
|
getAgvState,
|
getMapUrl,
|
} from "@/api/vehicle.js"
|
export default {
|
name: "PagesMapTask",
|
components: {
|
'a-button': Button
|
},
|
data() {
|
return {
|
vehicleIp: "",
|
navigationBarTitle: "地图任务",
|
unlinked: false
|
}
|
},
|
computed: {
|
|
},
|
onLoad(option) {
|
|
this.vehicleIp = option.ip || ""
|
this.loadData()
|
},
|
methods: {
|
setData(obj) {
|
let that = this;
|
let keys = [];
|
let val, data;
|
|
Object.keys(obj).forEach(function(key) {
|
keys = key.split(".");
|
val = obj[key];
|
data = that.$data;
|
keys.forEach(function(key2, index) {
|
if (index + 1 == keys.length) {
|
that.$set(data, key2, val);
|
} else {
|
if (!data[key2]) {
|
that.$set(data, key2, {});
|
}
|
}
|
data = data[key2];
|
});
|
});
|
},
|
async loadData() {
|
try {
|
const info = await getAgvState(this.vehicleIp)
|
this.setData({
|
unlinked: false
|
})
|
} catch (ex) {
|
this.setData({
|
unlinked: true
|
})
|
|
}
|
},
|
clickBack() {
|
const eventChannel = this.getOpenerEventChannel();
|
eventChannel.emit('check_connect', this.unlinked);
|
uni.navigateBack({
|
delta: 1
|
})
|
},
|
closeMenu() {
|
this.$refs.refPopupMenu.close()
|
},
|
|
async loadAgvState() {
|
try {
|
const info = await getAgvState(this.vehicleIp)
|
return info
|
} catch (ex) {
|
this.showError(ex)
|
return {}
|
}
|
},
|
async loadStations() {
|
try {
|
const info = await stations(this.vehicleIp)
|
return info.station_list || []
|
} catch (ex) {
|
this.showError(ex)
|
return []
|
}
|
},
|
clickTaskSet() {
|
uni.navigateTo({
|
url: `/pages/task/list?ip=${this.vehicleIp}`
|
})
|
},
|
clickTaskRecord() {
|
uni.navigateTo({
|
url: `/pages/task/log-list?ip=${this.vehicleIp}`
|
})
|
},
|
showError(ex) {
|
let exStr = JSON.stringify(ex)
|
if (exStr == "{}")
|
exStr = ex
|
let tip = typeof ex.msg == "string" ? ex.msg : exStr
|
showModal(tip, "错误", false)
|
},
|
|
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
.pages-map-task {
|
display: flex;
|
width: 750rpx;
|
height: 100vh;
|
flex-direction: column;
|
background-color: #fff;
|
|
.uni-navbar-container-inner {
|
display: flex;
|
flex: 1;
|
flex-direction: row;
|
align-items: center;
|
justify-content: center;
|
font-size: 40rpx;
|
overflow: hidden;
|
font-weight: 700;
|
color: #333;
|
|
.icon {
|
width: 30rpx;
|
height: 16rpx;
|
}
|
}
|
|
.uni-nav-bar-text {
|
overflow: hidden;
|
white-space: nowrap;
|
text-overflow: ellipsis;
|
}
|
|
.map-content {
|
width: 100%;
|
display: flex;
|
flex-direction: column;
|
flex: 1;
|
|
.loading-overlay {
|
position: fixed;
|
top: 0;
|
left: 0;
|
right: 0;
|
bottom: 0;
|
background-color: rgba(0, 0, 0, 0.5);
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
z-index: 999;
|
|
.loading-content {
|
background-color: #fff;
|
padding: 60rpx 100rpx;
|
border-radius: 20rpx;
|
text-align: center;
|
}
|
|
.loading-spinner {
|
width: 120rpx;
|
height: 120rpx;
|
border: 20rpx solid #f3f3f3;
|
border-top: 20rpx solid #1890FF;
|
border-radius: 50%;
|
animation: spin 1s linear infinite;
|
margin: 0 auto 40rpx;
|
}
|
|
@keyframes spin {
|
0% {
|
transform: rotate(0deg);
|
}
|
|
100% {
|
transform: rotate(360deg);
|
}
|
}
|
|
}
|
|
|
.content {
|
flex: 1;
|
overflow: auto;
|
display: flex;
|
position: relative;
|
|
.fabric {
|
width: 100%;
|
height: 100%;
|
}
|
|
.position {
|
position: absolute;
|
right: 30rpx;
|
bottom: 50rpx;
|
|
.img {
|
width: 65rpx;
|
height: 65rpx;
|
}
|
}
|
}
|
|
.bottom {
|
justify-content: center;
|
align-items: center;
|
margin: auto;
|
margin-bottom: 10px;
|
|
.button-group {
|
display: flex;
|
flex-direction: row;
|
border-radius: 10px;
|
border: 1px solid #fff;
|
font-size: 14px !important;
|
|
.button {
|
margin: 10rpx 20rpx;
|
width: 144rpx !important;
|
height: 144rpx !important;
|
border: 0;
|
display: flex;
|
flex-direction: column;
|
background-color: #00000000;
|
|
.img {
|
margin: auto;
|
width: 72rpx;
|
height: 72rpx;
|
}
|
.ico{
|
margin: auto;
|
font-size:60rpx;
|
color: #1890FF;
|
}
|
.text {
|
margin: auto;
|
|
}
|
}
|
|
}
|
}
|
}
|
|
.no-content {
|
margin-top: 50px;
|
padding: 20rpx 40rpx;
|
align-items: center;
|
text-align: center;
|
display: flex;
|
flex-direction: column;
|
font-size: 30rpx;
|
font-weight: 400;
|
|
|
.title {
|
font-size: 40rpx;
|
margin-bottom: 10rpx;
|
}
|
|
|
}
|
|
.popup-content {
|
display: flex;
|
justify-content: center;
|
flex-direction: column;
|
background-color: transparent;
|
}
|
|
.popup-content-menu {
|
margin-top: 75px;
|
margin-left: 120px;
|
width: 150px;
|
align-items: center;
|
justify-content: center;
|
flex-direction: column;
|
background-color: #fff;
|
border-radius: 5px;
|
border: 1px solid gray;
|
}
|
|
.popup-content-menu-item {
|
display: flex;
|
flex-wrap: nowrap;
|
flex-direction: row !important;
|
align-items: center;
|
padding: 4px 8px;
|
font-size: 16px;
|
|
.img {
|
width: 20px;
|
height: 20px;
|
margin: 5px;
|
}
|
}
|
|
|
}
|
</style>
|