<template>
|
<view class="pages-map">
|
<view class="view-content">
|
<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-show="!unlinked">
|
<view class="text-button-group">
|
<a-button type="primary" class="button" @click="clickStationList">
|
站点列表
|
</a-button>
|
<a-button type="primary" class="button" @click="clickTeachingList">
|
示教路线列表
|
</a-button>
|
</view>
|
</view>
|
</view>
|
<view class="bottom" v-if="!unlinked">
|
|
<view class="bottom-content">
|
<view class="img-button-group">
|
<view fill="none" class="button" @click="clickMapStation">
|
<text class="ico location1"></text>
|
<view class="text"> 添加站点</view>
|
</view>
|
<view type="text" class="button" @click="clickMapEdit">
|
<text class="ico edit-line"></text>
|
<view class="text"> 编辑地图</view>
|
</view>
|
<view type="text" class="button" @click="clickMapTask">
|
<text class="ico task-list"></text>
|
<view class="text">车辆任务</view>
|
|
</view>
|
</view>
|
|
</view>
|
</view>
|
|
</view>
|
</template>
|
<script>
|
import {
|
showToast,
|
showModal
|
} from "@/comm/utils.js"
|
// import OIFabric from "@/components/oi-fabric/index.vue"
|
import {
|
Button
|
} from 'antd-mobile-vue-next'
|
|
import {
|
getAgvState,
|
} from "@/api/vehicle.js"
|
export default {
|
name: "PagesMap",
|
components: {
|
'a-button': Button
|
},
|
data() {
|
return {
|
navigationBarTitle: "",
|
vehicleIp: "",
|
stationList: [],
|
unlinked: true
|
}
|
},
|
computed: {
|
getMaxStationNo() {
|
let num = 0
|
this.stationList.forEach((item) => {
|
if (num < item.stationID) {
|
num = item.stationID
|
}
|
})
|
return num
|
},
|
},
|
watch: {
|
|
},
|
onLoad(option) {
|
const _this = this
|
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
|
})
|
|
}
|
},
|
clickShowMenu() {
|
this.$refs.refPopupMenu.open("top")
|
},
|
clickBack() {
|
uni.navigateBack({
|
delta: 1
|
})
|
|
},
|
clickStationList() {
|
uni.navigateTo({
|
url: `/pages/station/index?ip=${this.vehicleIp}`
|
})
|
},
|
clickTeachingList() {
|
uni.navigateTo({
|
url: `/pages/teaching/list?ip=${this.vehicleIp}`
|
})
|
},
|
clickMapStation() {
|
uni.navigateTo({
|
url: `/pages/station/index?ip=${this.vehicleIp}&isAdd=1`
|
})
|
},
|
clickMapEdit() {
|
uni.navigateTo({
|
url: `/pages/map/edit?ip=${this.vehicleIp}`
|
})
|
},
|
clickMapTask() {
|
uni.navigateTo({
|
url: `/pages/map/task?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 {
|
display: flex;
|
width: 750rpx;
|
height: 100vh;
|
background-color: #fff;
|
position: relative;
|
|
.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;
|
}
|
|
.view-content {
|
position: absolute;
|
top: 0;
|
left: 0;
|
right: 0;
|
bottom: 0;
|
display: flex;
|
flex-direction: column;
|
}
|
|
.map-content {
|
width: 100%;
|
display: flex;
|
flex: 1;
|
margin: auto;
|
|
.text-button-group {
|
display: flex;
|
width: 100%;
|
justify-content: center;
|
align-items: center;
|
flex-direction: column;
|
font-size: 30rpx !important;
|
background-color: #eee;
|
|
.button {
|
margin-top: 20rpx;
|
width: 375rpx;
|
}
|
}
|
|
|
}
|
|
.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;
|
}
|
|
|
}
|
|
.bottom {
|
position: fixed;
|
left: 50rpx;
|
right: 50rpx;
|
bottom: 20rpx;
|
display: flex;
|
|
.bottom-content {
|
display: flex;
|
flex-direction: column;
|
width: 100%;
|
// justify-content: center;
|
// align-items: center;
|
padding: 0 10rpx;
|
padding-bottom: 10rpx;
|
background-color: #fff;
|
border-radius: 10rpx;
|
}
|
|
|
|
}
|
|
.img-button-group {
|
display: flex;
|
//width: 100%;
|
flex-direction: row;
|
border-radius: 10px;
|
border: 1px solid #fff;
|
font-size: 30rpx !important;
|
justify-content: space-around;
|
|
.button {
|
margin: 10rpx 20rpx;
|
|
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: 72rpx;
|
color: #1890FF;
|
}
|
|
.text {
|
margin: auto;
|
|
}
|
}
|
|
}
|
|
|
.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>
|