889 lines
20 KiB
Vue
Raw Normal View History

2025-04-14 10:57:27 +08:00
<template>
<div class="divHead">
2025-05-16 15:23:21 +08:00
<label :class="selRight.index==index?'divHeadSel':''" v-for="(item,index) in arrRight" :key="index"
2025-04-23 16:03:22 +08:00
@click="queryOrders(item.lx,index)">
2025-04-14 10:57:27 +08:00
{{item.name}}
</label>
</div>
<div style="">
<div class="divTag">
<uni-row>
<uni-col :span="8">
<label class="divbgColor mapFont"
style="padding: 5px 10px;border-radius:15px;font-weight: bold;border: 1px solid #80808061;"
@click="onShowDrawer">
<label style="margin-left: 5px;">
<uni-icons custom-prefix="iconfont" type="icon-ebikeqiehuan" :color="iconcolor"
:size="iconsize" />
</label>
切区
</label>
</uni-col>
<uni-col :span="14">
<label style="padding: 5px 15px;border-radius: 15px;background-color: #35374dc2;color: white;">
当前范围内可接单车辆
<label style="margin-left: 5px;">{{orderCount}}</label>
</label>
</uni-col>
</uni-row>
</div>
<div class="divLowerLeft">
<div class="divBtn">
<div style="padding: 10px 10px 5px 10px;">
<uni-icons custom-prefix="iconfont" type="icon-ebikejia" :color="iconcolor" :size="iconsize"
@click="onZoom('out')" />
</div>
<div style="padding: 5px 10px 10px 10px;">
<uni-icons custom-prefix="iconfont" type="icon-ebikejian" :color="iconcolor" :size="iconsize"
@click="onZoom('in')" />
</div>
</div>
<div class="divBtn">
<div class="divBtnTitle" @click="getLocation">
<uni-icons custom-prefix="iconfont" type="icon-ebikedingwei2" :color="iconcolor" :size="iconsize" />
<div>定位</div>
</div>
<div class="divBtnTitle" @click="refreshArea">
<uni-icons custom-prefix="iconfont" type="icon-ebikeshuaxin" :color="iconcolor" :size="iconsize" />
<div>刷新</div>
</div>
<div class="divBtnTitle" style="padding-bottom: 10px;" @click="()=>{showMore=!showMore}">
<uni-icons custom-prefix="iconfont" type="icon-ebikea-gengduo3x" :color="iconcolor"
:size="iconsize" />
<div>更多</div>
</div>
</div>
<div v-if="showMore" class="divLowerLeftMore">
<div class="divBtn divLowerLeftMoreBtn" @click="showRegionData">
<uni-icons custom-prefix="iconfont" type="icon-ebikeP" :color="showRegion?showColor:iconcolor"
:size="iconsize" />
<div :style="{color:showRegion?showColor:iconcolor}">站点</div>
</div>
<div class="divBtn divLowerLeftMoreBtn" @click="showBikeData">
<uni-icons custom-prefix="iconfont" type="icon-ebikedianpingchechongdianzhuang"
:color="showBike?showColor:iconcolor" :size="iconsize" />
<div :style="{color:showBike?showColor:iconcolor}">车辆</div>
</div>
</div>
</div>
<div class="divLowerRight">
2025-05-16 15:23:21 +08:00
<div v-show="selRight.lx=='hd'" @click="changeBatteries">
2025-04-14 10:57:27 +08:00
<uni-icons type="scan" :color="iconcolor" :size="iconsize" />
2025-05-16 15:23:21 +08:00
<div>换电</div>
</div>
<div v-show="selRight.lx=='dd'" @click="changeBatteries">
<uni-icons type="scan" :color="iconcolor" :size="iconsize" />
<div>调度</div>
2025-04-14 10:57:27 +08:00
</div>
</div>
<div class="divBottom">
<div class="divBottomBack">
2025-04-21 18:48:15 +08:00
<div v-show="showQC">
<uni-row>
<uni-col :span="8">
<div class="divQuantity">
<div class="divQuantityCount" :style="{color:color_down}">{{q_cnt0}}</div>
<div>
<label>
<uni-icons custom-prefix="iconfont" type="icon-ebikedianliang"
:color="color_down" :size="iconsize" />
</label>
低电量
</div>
2025-04-14 10:57:27 +08:00
</div>
2025-04-21 18:48:15 +08:00
</uni-col>
<uni-col :span="8">
<div class="divQuantity">
<div class="divQuantityCount" :style="{color:color_middle}">{{q_cnt2}}</div>
<div>
2025-05-16 15:23:21 +08:00
<label>
<uni-icons custom-prefix="iconfont" type="icon-ebikedianliang1"
2025-04-21 18:48:15 +08:00
:color="color_middle" :size="iconsize" />
</label>
中电量
</div>
2025-04-14 10:57:27 +08:00
</div>
</uni-col>
2025-04-21 18:48:15 +08:00
<uni-col :span="8">
<div class="divQuantity">
<div class="divQuantityCount" :style="{color:color_high}">{{q_cnt}}</div>
<div>
<label><uni-icons custom-prefix="iconfont" type="icon-ebikedianliang2"
:color="color_high" :size="iconsize" />
</label>
高电量
</div>
</div>
2025-04-14 10:57:27 +08:00
</uni-col>
2025-04-21 18:48:15 +08:00
2025-04-14 10:57:27 +08:00
</uni-row>
2025-05-16 15:23:21 +08:00
<div class="divSlider">
<div style="text-align: right;">电量筛选</div>
<div style="flex: 1;">
<slider show-value block-size="20" :value="quantityCount" :active-color="quantityColor"
:block-color="quantityColor" @change="quantityChange" />
</div>
2025-04-21 18:48:15 +08:00
</div>
</div>
2025-05-16 15:23:21 +08:00
<div v-show="showBikeInfo" style="padding: 0px 10px;">
<div style="position:absolute;right:10px;top: -5px;" @click="colseBikeInfo">
2025-04-23 16:03:22 +08:00
<uni-icons custom-prefix="iconfont" type="icon-ebikeguanbi" size="20" color="#777777" />
</div>
2025-05-16 15:23:21 +08:00
<devops-home-bikeinfo :data="dataBikeInfo" />
2025-04-23 16:03:22 +08:00
</div>
2025-05-16 15:23:21 +08:00
<div v-show="showDD">
<div class="divFlex">
<div>
<div class="divCount">
{{dd_count.sxjg}}
</div>
<div class="divCountLabel">
筛选结果
</div>
</div>
<div>
<div class="divCount" :style="{color:color_down}">
{{dd_count.ccyyq}}
</div>
<div class="divCountLabel">
超出运营区域
2025-04-23 16:03:22 +08:00
2025-05-16 15:23:21 +08:00
</div>
</div>
<div>
<div class="divCount" :style="{color:color_middle}">
{{dd_count.bztcq}}
</div>
<div class="divCountLabel">
不在停车区
</div>
</div>
2025-04-21 18:48:15 +08:00
</div>
2025-05-16 15:23:21 +08:00
<div class="divSlider">
<div>无单筛选</div>
<div style="flex: 1;">
<slider show-value block-size="20" :max="showDD_LX_Max" :value="dd_selvalue"
@change="changeDDSelvalue" />
</div>
<div @click="changeDDLX">
<label class="divSliderLable" v-show="showDD_LX===1"> 天数</label>
<label class="divSliderLable" v-show="showDD_LX===2"> 小时</label>
2025-04-21 18:48:15 +08:00
</div>
</div>
2025-04-23 16:03:22 +08:00
2025-05-16 15:23:21 +08:00
</div>
2025-04-21 18:48:15 +08:00
2025-04-14 10:57:27 +08:00
</div>
</div>
<uni-drawer ref="showArea" mode="right" :width="300">
<div class="divArea">
<div v-for="(item,index) in arrAreaData" :key="index">
<div style="margin-bottom: 10px;padding-left: 10px;">
<label style="font-size: 1.2rem;">{{item.city}}</label>
</div>
<uni-row>
<uni-col :span="12" v-for="(data,indexd) in item.country" :key="indexd">
<div style="padding:2px 10px;margin-bottom:5px;">
<div style="line-height:30px;text-align:center;border-radius:20rpx;background-color:#8080801a;color:#056cec;"
@click="clickArea(data)">
{{data.name}}
</div>
</div>
</uni-col>
</uni-row>
</div>
</div>
</uni-drawer>
2025-05-22 17:36:59 +08:00
<map :style="{width: '100%',height:height}" show-location id="mapRef" ref="mapRef" :scale="scale"
2025-04-23 16:03:22 +08:00
:markers="markers" :longitude="mapcenter.longitude" :latitude="mapcenter.latitude" :circles="circles"
2025-05-07 16:05:17 +08:00
:polygons="polygons" :polyline="polylines" @markertap="markerTap" @labeltap="markerTap"
@regionchange="regionchange" />
2025-04-14 10:57:27 +08:00
</div>
</template>
<script setup>
2025-05-22 17:36:59 +08:00
import AMapWX from "@/utils/amap-wx.130.js";
2025-04-14 10:57:27 +08:00
import * as map from "@/utils/map.js";
import {
ref,
onMounted,
getCurrentInstance
} from 'vue';
import {
showModelMessage
} from "@/utils/tools.js";
import * as api from "@/utils/api.js";
import {
findIndex,
find
} from "lodash";
2025-04-29 16:45:27 +08:00
import {
useSelarea
} from "@/stores/selarea.js";
2025-05-22 17:36:59 +08:00
import config from "@/utils/config.js";
2025-04-15 14:55:48 +08:00
2025-05-22 17:36:59 +08:00
var amapsdk = new AMapWX({
2025-04-14 10:57:27 +08:00
key: map.sdkKey
});
2025-04-21 18:48:15 +08:00
const systemInfo = uni.getSystemInfoSync();
2025-04-23 16:03:22 +08:00
const height = (systemInfo.screenHeight - systemInfo.statusBarHeight - 95) + "px";
2025-04-14 10:57:27 +08:00
//权限
const arrRight = ref([{
name: "换电",
2025-05-16 15:23:21 +08:00
lx: "hd"
2025-04-14 10:57:27 +08:00
},
{
name: "调度",
2025-05-16 15:23:21 +08:00
lx: "dd"
2025-04-14 10:57:27 +08:00
},
{
name: "维修",
2025-05-16 15:23:21 +08:00
lx: "wx"
2025-04-14 10:57:27 +08:00
}
]);
2025-05-16 15:23:21 +08:00
const selRight = ref({
index: 0,
...arrRight.value[0]
});
2025-04-14 10:57:27 +08:00
const mapRef = ref("mapRef");
let mapContext = null;
const iconsize = 16;
const iconcolor = "#6f7777";
const showArea = ref(null);
const mapcenter = ref({
longitude: null,
latitude: null
});
2025-04-21 18:48:15 +08:00
const scale = ref(15);
2025-04-14 10:57:27 +08:00
const markers = ref([]); //点
const polygons = ref([]); //面
2025-04-23 16:03:22 +08:00
const polylines = ref([]);
2025-04-14 10:57:27 +08:00
const circles = ref([]); //圆
2025-04-23 16:03:22 +08:00
let arrMakers = [];
2025-04-15 14:55:48 +08:00
2025-04-14 10:57:27 +08:00
const orderCount = ref(0); //接单数量
const quantityCount = ref(100); // 电量
const color_down = "#EF4B4D"; //低电量
const color_middle = "#F29710"; //中电量
const color_high = "#3DB71A"; //高电量
const quantityColor = ref(color_high);
2025-04-21 18:48:15 +08:00
const q_cnt = ref(0);
const q_cnt0 = ref(0);
const q_cnt2 = ref(0);
2025-04-23 16:03:22 +08:00
const showQC = ref(true);
2025-05-16 15:23:21 +08:00
const showBikeInfo = ref(false);
const dataBikeInfo = ref({
2025-04-23 16:03:22 +08:00
bikeCode: "",
arrTag: [],
time: "",
color: "",
soc: "",
distance: "",
icon: ""
2025-04-21 18:48:15 +08:00
})
2025-05-16 15:23:21 +08:00
const showDD = ref(false);
const showDD_LX = ref(1); // 1天数 2小时
const showDD_LX_Max = ref(7);
const dd_count = ref({
sxjg: 0, //筛选结果
ccyyq: 0, //超出语音区域
bztcq: 0 //不在停车区
});
const dd_selvalue = ref(0); //筛选值
2025-04-14 10:57:27 +08:00
let locationPoint = null; //当前行政区划
const arrAreaData = ref(null); //行政区划
const mapData_opt = []; //运营区数据
let selArea = null; //选中行政区划
2025-04-29 16:45:27 +08:00
const selAreaStore = useSelarea();
2025-04-14 10:57:27 +08:00
const showMore = ref(false); //显示更多
const showBike = ref(true); //显示车辆
const showRegion = ref(false); //显示站点
const showColor = "#1088FD";
2025-05-22 17:36:59 +08:00
let arrTestData=[];
2025-04-14 10:57:27 +08:00
2025-05-16 15:23:21 +08:00
function changeDDSelvalue(e) {
const {
detail: {
value
}
} = e;
dd_selvalue = value;
showModelMessage("该功能暂未实现!");
}
//调度查询类型
function changeDDLX() {
let lx = 1;
let max = 7;
if (showDD_LX.value == 1) {
lx = 2;
max = 120;
}
showDD_LX.value = lx;
showDD_LX_Max.value = max;
}
2025-04-14 10:57:27 +08:00
//加载后
onMounted(() => {
mapContext = map.getMap("mapRef", getCurrentInstance());
2025-05-22 17:36:59 +08:00
// getLocation();
// setTimeout(()=>{
// generatePoints(1000);
// },2000);
// return;
2025-04-15 14:55:48 +08:00
getZone((arrData) => {
2025-04-14 10:57:27 +08:00
//获取当前定位
map.getLoalcation(mapContext, (res) => {
const {
latitude: lat,
longitude: lng
} = res;
mapcenter.value = {
latitude: lat,
longitude: lng
};
2025-05-22 17:36:59 +08:00
map.reverseGeocoder(amapsdk, lng, lat, (res) => {
const{name,formatted_address,adcode,province,city,district}=res;
// const {
// ad_info: {
// adcode,
// city,
// district
// }
// } = res;
2025-04-14 10:57:27 +08:00
const data = {
id: adcode,
name: district,
lat,
lng
};
2025-05-22 17:36:59 +08:00
console.log("66666666666666666666",data)
2025-04-14 10:57:27 +08:00
locationPoint = {
city: "当前定位" + city,
country: [data]
}
2025-04-21 18:48:15 +08:00
arrData = arrData || [];
2025-04-15 14:55:48 +08:00
arrData.splice(0, 0, locationPoint);
arrAreaData.value = arrData;
2025-04-14 10:57:27 +08:00
changeArea(data);
}, (res) => {
showModelMessage("切换区域失败!");
});
})
});
});
2025-05-22 17:36:59 +08:00
function generatePoints(count) {
const points = []
const centerLng = mapcenter.value.longitude
const centerLat = mapcenter.value.latitude
for (let i = 0; i < count; i++) {
// 在中心点附近随机生成点
const lng = centerLng + (Math.random() - 0.5) * 0.002
const lat = centerLat + (Math.random() - 0.5) * 0.002
const data={
longitude:lng,
latitude:lat,
soc:Math.floor(Math.random()*100)
}
points.push(map.addMarker_Q(i,data));
arrTestData.push(data);
}
markers.value = points;
}
2025-04-14 10:57:27 +08:00
//获取行政区划
2025-04-15 14:55:48 +08:00
function getZone(callback) {
2025-04-14 10:57:27 +08:00
api.callOperateApi("ebikeRegion/getZone", null, "get").then((res) => {
2025-04-15 14:55:48 +08:00
const arrData = [];
2025-04-14 10:57:27 +08:00
const {
code,
data,
message
} = res;
2025-04-15 14:55:48 +08:00
if (code != 200) {
2025-04-14 10:57:27 +08:00
showModelMessage(message);
2025-04-21 18:48:15 +08:00
if (callback) callback(arrData);
2025-04-15 14:55:48 +08:00
return;
2025-04-21 18:48:15 +08:00
}
2025-04-15 14:55:48 +08:00
if (data && data.length > 0) {
data.map(item => {
const {
id,
name,
lng,
lat,
cityName
} = item;
let index = findIndex(arrData, {
city: cityName
});
let oData = arrData[index];
const obj = {
id,
name,
lat,
lng
};
if (index == "-1") {
index = 0;
oData = {
city: cityName,
country: [obj]
}
} else {
oData["country"].push(obj);
}
arrData[index] = oData;
});
}
if (locationPoint) {
arrData.splice(0, 0, locationPoint);
2025-04-14 10:57:27 +08:00
}
2025-04-21 18:48:15 +08:00
if (callback) callback(arrData);
2025-04-14 10:57:27 +08:00
});
}
//定位
2025-04-15 14:55:48 +08:00
function getLocation() {
2025-04-14 10:57:27 +08:00
map.getLoalcation(mapContext, (res) => {
const {
latitude,
longitude
} = res;
2025-05-22 17:36:59 +08:00
mapcenter.value={
longitude:longitude,
latitude:latitude
}
scale.value = 15;
2025-04-14 10:57:27 +08:00
})
}
//显示区域
2025-04-15 14:55:48 +08:00
function onShowDrawer() {
2025-04-14 10:57:27 +08:00
showArea.value.open();
}
//切换区域
2025-04-15 14:55:48 +08:00
function clickArea(data) {
2025-04-14 10:57:27 +08:00
changeArea(data);
showArea.value.close();
}
2025-04-15 14:55:48 +08:00
function changeArea(data, refresh) {
2025-04-14 10:57:27 +08:00
const {
id,
lng,
lat
} = data;
selArea = data;
2025-04-29 16:45:27 +08:00
selAreaStore.setValue(id);
2025-04-14 10:57:27 +08:00
const zoneId = id;
mapcenter.value = {
latitude: lat,
longitude: lng
};
let mapDataIndex = findIndex(mapData_opt, {
zoneId
});
if (!refresh) {
if (mapDataIndex > -1) {
loadMapData(mapData_opt[mapDataIndex]);
return;
}
}
uni.showLoading({
title: '加载中'
});
2025-04-29 16:45:27 +08:00
map.getOperation(zoneId, (res) => {
uni.hideLoading();
if (!res) return;
const {
arrRegionID,
arrCircles,
arrPolygons,
arrData
} = res;
let mapdata = {
zoneId,
arrCircles,
arrPolygons,
arrData
};
polygons.value = arrPolygons;
circles.value = arrCircles;
mapDataIndex = mapDataIndex == -1 ? mapData_opt.length : mapDataIndex;
mapData_opt[mapDataIndex] = mapdata;
//站点
if (arrRegionID.length == 0) return;
map.getRegionData(arrRegionID, (res) => {
const {
arrData,
arrCircles,
arrPolygons
} = res;
mapdata = {
...mapdata,
regionData: {
arrData,
arrCircles,
arrPolygons
}
};
mapData_opt[mapDataIndex] = mapdata;
loadMapRegionData(showRegion.value, mapdata);
})
//车辆
map.getBikeData(arrRegionID, (res) => {
const {
arrData,
arrPoints,
icnt,
icnt_0,
icnt_2
} = res;
mapdata = {
...mapdata,
bikeData: {
arrData,
arrPoints
}
};
mapData_opt[mapDataIndex] = mapdata;
q_cnt.value = icnt;
q_cnt0.value = icnt_0;
q_cnt2.value = icnt_2;
arrMakers = arrData;
loadMapBikeData(showBike.value, mapdata);
})
})
2025-04-14 10:57:27 +08:00
}
//地图数据
2025-04-15 14:55:48 +08:00
function loadMapData(data) {
2025-04-14 10:57:27 +08:00
loadMapBikeData(showBike.value, data);
loadMapRegionData(showRegion.value, data);
}
//显示隐藏车辆
2025-04-15 14:55:48 +08:00
function showBikeData() {
2025-04-14 10:57:27 +08:00
const show = !showBike.value
showBike.value = show;
const {
id
} = selArea;
const data = find(mapData_opt, {
zoneId: id
});
if (!data) return;
loadMapBikeData(show, data);
};
2025-04-15 14:55:48 +08:00
function loadMapBikeData(show, data) {
2025-04-14 10:57:27 +08:00
const {
bikeData
} = data;
if (show) {
if (bikeData) {
const {
arrData,
arrPoints
} = bikeData;
markers.value = arrPoints;
return;
}
}
markers.value = [];
}
//显示隐藏站点
2025-04-15 14:55:48 +08:00
function showRegionData() {
2025-04-14 10:57:27 +08:00
const show = !showRegion.value;
showRegion.value = show;
const {
id
} = selArea;
const data = find(mapData_opt, {
zoneId: id
});
if (!data) return;
2025-04-15 14:55:48 +08:00
loadMapRegionData(show, data);
2025-04-14 10:57:27 +08:00
}
2025-04-15 14:55:48 +08:00
function loadMapRegionData(show, data) {
2025-04-14 10:57:27 +08:00
const {
arrCircles,
arrPolygons,
regionData
} = data;
if (show) {
if (regionData) {
polygons.value = [...arrPolygons, ...regionData.arrPolygons];
circles.value = [...arrCircles, ...regionData.arrCircles];
return;
}
}
polygons.value = arrPolygons;
circles.value = arrCircles;
};
//刷新
2025-04-15 14:55:48 +08:00
function refreshArea() {
2025-04-14 10:57:27 +08:00
changeArea(selArea, true);
}
//缩放
2025-04-15 14:55:48 +08:00
function onZoom(lx) {
2025-04-14 10:57:27 +08:00
switch (lx) {
case "out":
scale.value = scale.value + 1;
break;
case "in":
scale.value = scale.value - 1;
break;
}
}
//电量筛选
2025-04-15 14:55:48 +08:00
function quantityChange(e) {
2025-04-14 10:57:27 +08:00
const {
detail: {
value
}
} = e;
quantityCount.value = value;
2025-04-23 16:03:22 +08:00
const {
color
} = getQCIcon(value);
quantityColor.value = color;
2025-05-22 17:36:59 +08:00
//测试
const arrPoint=[];
arrTestData.map((item,index)=>{
const {
soc
} = item;
if (soc > value) return;
arrPoint.push(map.addMarker_Q(index, item));
})
markers.value = arrPoint;
return;
2025-04-21 18:48:15 +08:00
const {
id
} = selArea;
const data = find(mapData_opt, {
zoneId: id
});
if (!data) {
markers.value = [];
return;
}
const arrPoints = [];
const {
bikeData
} = data;
if (!bikeData) return;
const {
arrData
} = bikeData;
2025-04-23 16:03:22 +08:00
arrMakers = [];
2025-04-21 18:48:15 +08:00
arrData.map((item, index) => {
2025-04-23 16:03:22 +08:00
const {
soc
} = item;
if (soc > value) return;
2025-04-21 18:48:15 +08:00
arrMakers.push(item);
arrPoints.push(map.addMarker_Q(index, item));
});
markers.value = arrPoints;
2025-04-14 10:57:27 +08:00
}
2025-04-23 16:03:22 +08:00
function getQCIcon(value) {
let scolor = "";
let icon = "";
if (value <= 20) {
scolor = color_down;
icon = "icon-ebikedianliang";
} else if (value <= 60) {
scolor = color_middle;
icon = "icon-ebikedianliang1";
} else {
scolor = color_high;
icon = "icon-ebikedianliang2";
}
return {
color: scolor,
icon
};
}
2025-05-16 15:23:21 +08:00
//换电
2025-04-15 14:55:48 +08:00
function changeBatteries() {
2025-05-16 15:23:21 +08:00
uni.navigateTo({
url: "/pages/devops/changebatteries/changebatteries"
})
2025-04-14 10:57:27 +08:00
}
//查询工单
2025-04-29 16:45:27 +08:00
function queryOrders(lx, index) {
2025-05-16 15:23:21 +08:00
selRight.value = {
index,
...arrRight.value[index]
}
switch (index) {
case 0:
showDD.value = false;
showQC.value = true;
showBikeInfo.value = false;
break;
case 1:
showDD.value = true;
showQC.value = false;
showBikeInfo.value = false;
break;
}
2025-04-14 10:57:27 +08:00
}
2025-04-21 18:48:15 +08:00
2025-04-23 16:03:22 +08:00
2025-04-21 18:48:15 +08:00
//关闭电量信息
2025-05-16 15:23:21 +08:00
function colseBikeInfo() {
const {
lx
} = selRight.value;
switch (lx) {
case "dd":
showDD.value = true;
break;
case "hd":
showQC.value = true;
break;
}
showBikeInfo.value = false;
dataBikeInfo.value=null;
2025-04-21 18:48:15 +08:00
}
2025-04-23 16:03:22 +08:00
function markerTap(e) {
const {
markerId
} = e.detail;
const selMarker = arrMakers[markerId];
2025-05-07 16:05:17 +08:00
if (!selMarker) {
console.log("markerTap未找到点")
return;
}
2025-04-23 16:03:22 +08:00
const {
updatedAt,
bikeCode,
soc,
state,
usageStatus,
longitude: elng,
latitude: elat
} = selMarker;
2025-05-16 15:23:21 +08:00
if (bikeCode == dataBikeInfo.value.bikeCode) {
2025-04-23 16:03:22 +08:00
return;
}
map.getLoalcation(mapContext, (res) => {
const {
latitude: slat,
longitude: slng
} = res;
const options = {
2025-05-22 17:36:59 +08:00
mapsdk:amapsdk,
2025-04-23 16:03:22 +08:00
slng,
slat,
elng,
elat,
success: (res) => {
let {
arrPoint,
distance
} = res;
const {
color,
icon
} = getQCIcon(soc);
showQC.value = false;
2025-05-16 15:23:21 +08:00
showDD.value = false;
showBikeInfo.value = true;
dataBikeInfo.value = {
2025-04-23 16:03:22 +08:00
...selMarker,
bikeCode: bikeCode,
arrTag: [{
title: "低电量",
type: "red"
}, {
title: "待使用",
type: "green"
}],
time: updatedAt,
color,
soc: soc,
distance: distance,
2025-05-16 15:23:21 +08:00
icon,
rightlx: selRight.value.lx
2025-04-23 16:03:22 +08:00
}
mapContext.includePoints({
points: arrPoint,
padding: [50, 50, 50, 50], // 视野边缘与点的间距
success: () => {
polylines.value = [map.addLine("#1082FF", arrPoint)]
}
});
},
fail: (res) => {
console.log("fail", res);
}
}
map.direction(options)
}, null, true);
2025-04-21 18:48:15 +08:00
}
2025-05-07 16:05:17 +08:00
function regionchange(e) {
const {
2025-05-16 15:23:21 +08:00
type,
causedBy,
2025-05-22 17:36:59 +08:00
region,
scale
2025-05-07 16:05:17 +08:00
} = e.detail;
if (type != "end") return;
2025-05-16 15:23:21 +08:00
const minLat = region.southwest.latitude;
const maxLat = region.northeast.latitude;
const minLng = region.southwest.longitude;
const maxLng = region.northeast.longitude;
2025-05-22 17:36:59 +08:00
const arrPoints=markers.value.filter(item=>{
const{longitude:lng,latitude:lat}=item;
return lng<=maxLng&&lng>=minLng&&lat>=minLat&&lat<=maxLat;
});
console.log("000000000000000000",Date.now(),e.detail,arrPoints)
2025-05-07 16:05:17 +08:00
}
2025-04-14 10:57:27 +08:00
</script>
<style scoped>
@import url("home.css");
</style>