Commit 4cd73381 by zhangxw

冒烟 问题

1 parent 8a708d2a
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
</div> </div>
<div v-show="isUploaded"> <div v-show="isUploaded">
<a class="map-cmd-icon location" @click="getLocation"> <a class="map-cmd-icon location" @click="getLocation">
<span class="icon icon-location"></span> <span v-if="!isGetLocation" class="icon icon-location"></span>
<van-loading v-else color="#1989fa" />
</a> </a>
<a class="map-cmd-icon refresh-car" @click="refresh"> <a class="map-cmd-icon refresh-car" @click="refresh">
<span class="icon icon-refresh-car"></span> <span class="icon icon-refresh-car"></span>
...@@ -30,6 +31,7 @@ export default { ...@@ -30,6 +31,7 @@ export default {
const satelActive = ref(null); const satelActive = ref(null);
const roadActive = ref(null); const roadActive = ref(null);
const sharePage = ref(false); const sharePage = ref(false);
const isGetLocation = ref(false);
onMounted(() => {}); onMounted(() => {});
const initMap = (id) => { const initMap = (id) => {
sharePage.value = JSON.parse(localStorage.getItem("sharePage")); sharePage.value = JSON.parse(localStorage.getItem("sharePage"));
...@@ -55,6 +57,7 @@ export default { ...@@ -55,6 +57,7 @@ export default {
let currMarker = null; let currMarker = null;
// 获取定位 // 获取定位
const getLocation = () => { const getLocation = () => {
isGetLocation.value = true;
map.plugin("AMap.Geolocation", function () { map.plugin("AMap.Geolocation", function () {
var geolocation = new window.AMap.Geolocation({ var geolocation = new window.AMap.Geolocation({
enableHighAccuracy: true, enableHighAccuracy: true,
...@@ -69,6 +72,7 @@ export default { ...@@ -69,6 +72,7 @@ export default {
if (currMarker) { if (currMarker) {
currMarker.setMap(null); currMarker.setMap(null);
} }
isGetLocation.value = false;
currMarker = new window.AMap.Marker({ currMarker = new window.AMap.Marker({
position: data.position, position: data.position,
content: '<span class="curr-marker"></span>', content: '<span class="curr-marker"></span>',
...@@ -77,7 +81,9 @@ export default { ...@@ -77,7 +81,9 @@ export default {
}); });
map.setFitView(); map.setFitView();
}); });
window.AMap.event.addListener(geolocation, "error", () => {}); window.AMap.event.addListener(geolocation, "error", () => {
isGetLocation.value = false;
});
}); });
}; };
// 刷新 // 刷新
...@@ -94,6 +100,7 @@ export default { ...@@ -94,6 +100,7 @@ export default {
refresh, refresh,
isUploaded, isUploaded,
sharePage, sharePage,
isGetLocation,
}; };
}, },
}; };
......
...@@ -96,6 +96,7 @@ export default defineComponent({ ...@@ -96,6 +96,7 @@ export default defineComponent({
const routeQuery = route.query; const routeQuery = route.query;
const hasRadiusFence = ref(false); const hasRadiusFence = ref(false);
const hasProviceCityFence = ref(false); const hasProviceCityFence = ref(false);
const adcodeItemName = ref(null);
let district = null; let district = null;
onMounted(() => { onMounted(() => {
AMapLoader.load({ AMapLoader.load({
...@@ -112,7 +113,18 @@ export default defineComponent({ ...@@ -112,7 +113,18 @@ export default defineComponent({
}); });
}); });
// 地图刷新 // 地图刷新
const refreshCb = () => {}; const refreshCb = (map) => {
map.clearMap();
getData(map);
if (hasRadiusFence.value) {
createCircle(currLnglat.value, radiusNum.value);
createPoint(currLnglat.value);
}
if (hasProviceCityFence.value && adcodeItemName.value) {
coverArea(adcodeItemName.value, map);
}
map.setFitView();
};
// 切换围栏类型 // 切换围栏类型
const changeFenceType = (index) => { const changeFenceType = (index) => {
selectedTypeItem.value = index; selectedTypeItem.value = index;
...@@ -132,6 +144,7 @@ export default defineComponent({ ...@@ -132,6 +144,7 @@ export default defineComponent({
val["gpsLocation"].elng, val["gpsLocation"].elng,
val["gpsLocation"].elat val["gpsLocation"].elat
); );
drawMarker(currLnglat.value);
}); });
} else { } else {
Dialog({ message: "暂无数据" }); Dialog({ message: "暂无数据" });
...@@ -162,7 +175,6 @@ export default defineComponent({ ...@@ -162,7 +175,6 @@ export default defineComponent({
currentMap = currentMap currentMap = currentMap
? currentMap ? currentMap
: mapContentRefs.value.init("fenceContainer"); : mapContentRefs.value.init("fenceContainer");
drawMarker(currLnglat.value);
currentMap.setFitView(); currentMap.setFitView();
showSettingDialog.value = false; showSettingDialog.value = false;
hasRadiusFence.value = true; hasRadiusFence.value = true;
...@@ -188,6 +200,7 @@ export default defineComponent({ ...@@ -188,6 +200,7 @@ export default defineComponent({
Toast( Toast(
`设定${proviceCityType.value === 1 ? "跨省" : "跨市"}围栏成功` `设定${proviceCityType.value === 1 ? "跨省" : "跨市"}围栏成功`
); );
adcodeItemName.value = adcodeItem.name;
coverArea(adcodeItem.name, currentMap); coverArea(adcodeItem.name, currentMap);
currentMap.setFitView(); currentMap.setFitView();
hasProviceCityFence.value = true; hasProviceCityFence.value = true;
...@@ -271,6 +284,7 @@ export default defineComponent({ ...@@ -271,6 +284,7 @@ export default defineComponent({
map: currentMap, map: currentMap,
offset: new window.AMap.Pixel(-17, -26), offset: new window.AMap.Pixel(-17, -26),
}); });
currentMap.setFitView();
}; };
// 地图添加圆 // 地图添加圆
const createCircle = (lnglat, radius) => { const createCircle = (lnglat, radius) => {
...@@ -321,6 +335,7 @@ export default defineComponent({ ...@@ -321,6 +335,7 @@ export default defineComponent({
createCircle, createCircle,
hasRadiusFence, hasRadiusFence,
hasProviceCityFence, hasProviceCityFence,
adcodeItemName,
}; };
}, },
}); });
......
...@@ -598,7 +598,7 @@ export default defineComponent({ ...@@ -598,7 +598,7 @@ export default defineComponent({
GET_ALL_CAR_LIST({ GET_ALL_CAR_LIST({
pageSize: 10, pageSize: 10,
pageNumber: pageNumber.value, pageNumber: pageNumber.value,
term: keyWord.value, keyWord: keyWord.value,
}).then((res) => { }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
list.value = list.value.concat(res.data.list); list.value = list.value.concat(res.data.list);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!