feat:对接换电页面数据 && 地图找车修改
This commit is contained in:
parent
b4590b35f5
commit
4cd943bb07
@ -32,7 +32,7 @@
|
|||||||
<uni-icons custom-prefix="iconfont" type="icon-ebikeyinlianglabashengyin" color="#0084FF"
|
<uni-icons custom-prefix="iconfont" type="icon-ebikeyinlianglabashengyin" color="#0084FF"
|
||||||
size="16" />
|
size="16" />
|
||||||
</label>
|
</label>
|
||||||
<label style="color: #0084FF;" @click="checkecu('findEbike')">寻车铃</label>
|
<label style="color: #0084FF;" @click="checkecu()">寻车铃</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-top:15px;display:flex;justify-content:space-between;">
|
<div style="margin-top:15px;display:flex;justify-content:space-between;">
|
||||||
@ -48,11 +48,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import * as api from "@/utils/api.js";
|
import {checkEcuBells} from "@/utils/commonApi";
|
||||||
import {
|
|
||||||
ref
|
const props = defineProps(["data"]);
|
||||||
} from 'vue';
|
|
||||||
const props = defineProps(["data"]);
|
|
||||||
|
|
||||||
//查看车辆信息
|
//查看车辆信息
|
||||||
function openBikeInfo() {
|
function openBikeInfo() {
|
||||||
@ -81,25 +79,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
//中控操作
|
//中控操作
|
||||||
function checkecu (url) {
|
function checkecu () {
|
||||||
const {
|
checkEcuBells(props.data)
|
||||||
ecuId,
|
|
||||||
bikeId
|
|
||||||
} = props.data;
|
|
||||||
if (!ecuId) {
|
|
||||||
showModelMessage("请先扫码车辆编号!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
api.callCoreApi(url, {
|
|
||||||
ecuId,
|
|
||||||
bikeId
|
|
||||||
}, 'get').then(res => {
|
|
||||||
const {
|
|
||||||
code,
|
|
||||||
message
|
|
||||||
} = res;
|
|
||||||
showModelMessage(message);
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//完成换电
|
//完成换电
|
||||||
|
|||||||
@ -11,13 +11,19 @@
|
|||||||
<text class="label">车辆编号</text>
|
<text class="label">车辆编号</text>
|
||||||
<view class="value">
|
<view class="value">
|
||||||
<text style="margin-right: 30rpx;">{{ it?.bikeCode || '-' }}</text>
|
<text style="margin-right: 30rpx;">{{ it?.bikeCode || '-' }}</text>
|
||||||
<uni-icons type="sound" size="25" style="position: relative;top: 6rpx;" color="blue"></uni-icons>
|
<uni-icons custom-prefix="iconfont"
|
||||||
|
type="icon-ebikeyinlianglabashengyin"
|
||||||
|
style="position: relative;top:5rpx"
|
||||||
|
color="#0084FF"
|
||||||
|
size="25"
|
||||||
|
@click="checkEcu(it)"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 最新电量 -->
|
<!-- 最新电量 -->
|
||||||
<view class="row">
|
<view class="row">
|
||||||
<text class="label">最新电量</text>
|
<text class="label">最新电量</text>
|
||||||
<text class="value">{{ it?.soc || '-' }}</text>
|
<text class="value">{{ it?.soc }}%</text>
|
||||||
</view>
|
</view>
|
||||||
<!-- 最后骑行时间 -->
|
<!-- 最后骑行时间 -->
|
||||||
<view class="row">
|
<view class="row">
|
||||||
@ -32,14 +38,18 @@
|
|||||||
<!-- 设备位置 -->
|
<!-- 设备位置 -->
|
||||||
<view class="row">
|
<view class="row">
|
||||||
<text class="label">设备位置</text>
|
<text class="label">设备位置</text>
|
||||||
<view>
|
<view
|
||||||
|
class="value"
|
||||||
|
@click="navigator.to('/pages/map/map-findbike',{
|
||||||
|
longitude:it.longitude,
|
||||||
|
latitude:it.latitude
|
||||||
|
})"
|
||||||
|
>
|
||||||
<view>查看地图</view>
|
<view>查看地图</view>
|
||||||
<view style="color: darkgrey;font-size: 28rpx;">{{ (it?.longitude || '-') + ',' + (it?.latitude || '-')}}</view>
|
<view style="color: darkgrey;font-size: 26rpx;">{{ (it?.longitude || '-') + ',' + (it?.latitude || '-')}}</view>
|
||||||
</view>
|
</view>
|
||||||
<uni-icons type="right" size="20" class="arrows" color="grey"></uni-icons>
|
<uni-icons type="right" size="20" class="arrows" color="grey"></uni-icons>
|
||||||
</view>
|
</view>
|
||||||
<!-- 删除 -->
|
|
||||||
<uni-icons type="trash" size="25" class="deleteBtn" color="orange"></uni-icons>
|
|
||||||
</view>
|
</view>
|
||||||
<view style="width: 100%;height: 100rpx;"></view>
|
<view style="width: 100%;height: 100rpx;"></view>
|
||||||
<!-- 确认接单按钮 -->
|
<!-- 确认接单按钮 -->
|
||||||
@ -56,6 +66,7 @@ import { ref } from 'vue';
|
|||||||
import { onLoad } from '@dcloudio/uni-app';
|
import { onLoad } from '@dcloudio/uni-app';
|
||||||
import navigator from '@/utils/navigator.js';
|
import navigator from '@/utils/navigator.js';
|
||||||
import EmptyComponent from '@/components/empty-component/empty-component.vue';
|
import EmptyComponent from '@/components/empty-component/empty-component.vue';
|
||||||
|
import {checkEcuBells} from "@/utils/commonApi";
|
||||||
|
|
||||||
const orderList = ref([]);
|
const orderList = ref([]);
|
||||||
|
|
||||||
@ -64,6 +75,11 @@ onLoad((options) => {
|
|||||||
orderList.value = changeBatteryArr
|
orderList.value = changeBatteryArr
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const checkEcu = (it) => {
|
||||||
|
checkEcuBells(it)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@ -25,9 +25,7 @@
|
|||||||
border-radius: 15px;
|
border-radius: 15px;
|
||||||
background-color: #35374dc2;
|
background-color: #35374dc2;
|
||||||
color: white;"
|
color: white;"
|
||||||
@click="navigator.to('/pages/devops/takeOrders/takeOrders',{
|
@click="navigatePageByOrder"
|
||||||
changeBatteryArr,
|
|
||||||
})"
|
|
||||||
>
|
>
|
||||||
当前范围内可接单车辆
|
当前范围内可接单车辆
|
||||||
<label style="margin-left: 5px;">{{orderCount}}</label>
|
<label style="margin-left: 5px;">{{orderCount}}</label>
|
||||||
@ -209,7 +207,7 @@
|
|||||||
<map :style="{width: '100%',height:height}" show-location id="mapRef" ref="mapRef" :scale="scale"
|
<map :style="{width: '100%',height:height}" show-location id="mapRef" ref="mapRef" :scale="scale"
|
||||||
:markers="markers" :longitude="mapcenter.longitude" :latitude="mapcenter.latitude" :circles="circles"
|
:markers="markers" :longitude="mapcenter.longitude" :latitude="mapcenter.latitude" :circles="circles"
|
||||||
:polygons="polygons" :polyline="polylines" @markertap="markerTap" @labeltap="markerTap"
|
:polygons="polygons" :polyline="polylines" @markertap="markerTap" @labeltap="markerTap"
|
||||||
@regionchange="regionchange" />
|
@regionchange="regionchange" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -888,7 +886,6 @@
|
|||||||
markers.value=oData.arrPoints;
|
markers.value=oData.arrPoints;
|
||||||
}
|
}
|
||||||
const {icnt_2,icnt_0,icnt_1,changeBattery}=oData;
|
const {icnt_2,icnt_0,icnt_1,changeBattery}=oData;
|
||||||
console.log(changeBattery);
|
|
||||||
changeBatteryArr.value=changeBattery;
|
changeBatteryArr.value=changeBattery;
|
||||||
return {icnt_2,icnt_0,icnt_1};
|
return {icnt_2,icnt_0,icnt_1};
|
||||||
}
|
}
|
||||||
@ -980,6 +977,25 @@
|
|||||||
url:"/pages/warehouse/vehicledispatch/vehicledispatch"
|
url:"/pages/warehouse/vehicledispatch/vehicledispatch"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//接单类型页面跳转
|
||||||
|
const navigatePageByOrder = () => {
|
||||||
|
const {
|
||||||
|
lx
|
||||||
|
} = selRight.value;
|
||||||
|
switch(lx){
|
||||||
|
case "hd":
|
||||||
|
navigator.to('/pages/devops/takeOrders/takeOrders',{
|
||||||
|
changeBatteryArr:changeBatteryArr.value,
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
case "dd":
|
||||||
|
break;
|
||||||
|
case "wx":
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<map id="mapRef" ref="mapRef" show-location style="width: 100%;height: 100vh;" :scale="scale" :markers="markers"
|
<map id="mapRef" ref="mapRef" show-location style="width: 100%;height: 100vh;" :scale="scale" :markers="markers"
|
||||||
:longitude="mapcenter.longitude" :latitude="mapcenter.latitude"/>
|
:longitude="mapcenter.longitude" :latitude="mapcenter.latitude" :polyline="polylines"/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -27,9 +27,16 @@
|
|||||||
onLoad
|
onLoad
|
||||||
} from "@dcloudio/uni-app";
|
} from "@dcloudio/uni-app";
|
||||||
import {
|
import {
|
||||||
ref,onMounted,getCurrentInstance
|
ref,
|
||||||
|
onMounted,
|
||||||
|
getCurrentInstance,
|
||||||
|
nextTick
|
||||||
} from "vue";
|
} from "vue";
|
||||||
import * as map from "@/utils/map.js";
|
import * as map from "@/utils/map.js";
|
||||||
|
import AMapWX from "@/utils/amap-wx.130";
|
||||||
|
var amapsdk = new AMapWX({
|
||||||
|
key: map.sdkKey
|
||||||
|
});
|
||||||
|
|
||||||
const mapRef=ref("mapRef");
|
const mapRef=ref("mapRef");
|
||||||
let oMap=null;
|
let oMap=null;
|
||||||
@ -38,9 +45,11 @@
|
|||||||
const mapcenter=ref({
|
const mapcenter=ref({
|
||||||
longitude:"",latitude:""
|
longitude:"",latitude:""
|
||||||
})
|
})
|
||||||
|
const polylines = ref([]);
|
||||||
|
|
||||||
onMounted(()=>{
|
onMounted(()=>{
|
||||||
oMap= map.getMap("mapRef",getCurrentInstance());
|
oMap= map.getMap("mapRef",getCurrentInstance());
|
||||||
|
pathPlanning()
|
||||||
});
|
});
|
||||||
|
|
||||||
onLoad((option) => {
|
onLoad((option) => {
|
||||||
@ -66,12 +75,55 @@
|
|||||||
//定位
|
//定位
|
||||||
const getLocation = () => {
|
const getLocation = () => {
|
||||||
map.getLoalcation(oMap, (res) => {
|
map.getLoalcation(oMap, (res) => {
|
||||||
const {
|
const {
|
||||||
latitude,
|
latitude,
|
||||||
longitude
|
longitude
|
||||||
} = res;
|
} = res;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//路线规划
|
||||||
|
const pathPlanning = () => {
|
||||||
|
|
||||||
|
map.getLoalcation(oMap, (res) => {
|
||||||
|
const {
|
||||||
|
latitude: slat,
|
||||||
|
longitude: slng
|
||||||
|
} = res;
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
mapsdk:amapsdk,
|
||||||
|
slng,
|
||||||
|
slat,
|
||||||
|
elng:mapcenter.value.longitude,
|
||||||
|
elat:mapcenter.value.latitude,
|
||||||
|
success: (res) => {
|
||||||
|
let {
|
||||||
|
arrPoint,
|
||||||
|
distance
|
||||||
|
} = res;
|
||||||
|
|
||||||
|
oMap.includePoints({
|
||||||
|
points: arrPoint,
|
||||||
|
padding: [50, 50, 50, 50], // 视野边缘与点的间距
|
||||||
|
success: () => {
|
||||||
|
polylines.value = [map.addLine("#1082FF", arrPoint)]
|
||||||
|
console.log(oMap)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
fail: (res) => {
|
||||||
|
console.log("fail", res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
map.direction(options)
|
||||||
|
|
||||||
|
},null, true)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
25
ebike-maintenance/utils/commonApi.js
Normal file
25
ebike-maintenance/utils/commonApi.js
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import * as api from "./api";
|
||||||
|
import {showModelMessage,showMessage} from "./tools";
|
||||||
|
|
||||||
|
//寻车铃声启动
|
||||||
|
export function checkEcuBells (item) {
|
||||||
|
const {ecuId,bikeId} = item;
|
||||||
|
if (!ecuId) {
|
||||||
|
showModelMessage("请先扫码车辆编号!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.showLoading({
|
||||||
|
title:'正在操作'
|
||||||
|
});
|
||||||
|
api.callCoreApi('findEbike', {
|
||||||
|
ecuId,
|
||||||
|
bikeId
|
||||||
|
}, 'get').then(res => {
|
||||||
|
const {
|
||||||
|
code,
|
||||||
|
message
|
||||||
|
} = res;
|
||||||
|
uni.hideLoading();
|
||||||
|
showMessage('指令已下达','success',2000)
|
||||||
|
})
|
||||||
|
}
|
||||||
@ -6,7 +6,7 @@ import config from "./config.js";
|
|||||||
|
|
||||||
const imgPath = config.imgPath;
|
const imgPath = config.imgPath;
|
||||||
|
|
||||||
export const sdkKey = '1f8f159583f28dfba6eb06deb55e3b56';
|
export const sdkKey = '1f8f159583f28dfba6eb06deb55e3b56';//高德key
|
||||||
|
|
||||||
export const getMap = (mapid, instance) => {
|
export const getMap = (mapid, instance) => {
|
||||||
return uni.createMapContext(mapid, {
|
return uni.createMapContext(mapid, {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user