diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index df9665b..b4a3e9d 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -176,6 +176,7 @@
@@ -699,8 +700,9 @@ export default {
- 附近人员
- 附近水源
+ 附近人员
+ 附近水源
+ 周边物资
删除火点
@@ -745,7 +747,7 @@ export default {
// 物资
wuzi(item) {
this.endLngLat = item;
- this.goodsVisible = !this.goodsVisible;
+ this.goodsVisible = true;
},
// 监控
jiankong(e) {
diff --git a/src/views/home/widget/goodsbox.vue b/src/views/home/widget/goodsbox.vue
index c42e909..860b9c0 100644
--- a/src/views/home/widget/goodsbox.vue
+++ b/src/views/home/widget/goodsbox.vue
@@ -42,8 +42,10 @@
{{
item.street
}}
- 类型:{{ item.name }}
- 距离:{{ item.distance }}km
+ {{
+ item.name
+ }}
+ {{ item.distance }}km
预计到达时间:{{ item.time }}分钟
@@ -73,7 +75,7 @@ import { getMethodCommon } from "../../../api/common";
const areaName = localStorage.getItem("areaName");
export default {
name: "monitorbox",
- props: ["endLngLat",'firePopup'],
+ props: ["endLngLat", "firePopup", "visible"],
data() {
return {
startLngLat: null,
@@ -102,6 +104,14 @@ export default {
}
},
},
+ visible: {
+ handler(newVal, oldVal) {
+ console.log('newVal: ', newVal);
+ if (newVal == false) {
+ this.close();
+ }
+ },
+ },
},
created() {
this.getWuziList();
@@ -162,11 +172,22 @@ export default {
getWuziList() {
getMethodCommon("/FirePrevention/Loadwuzichubei", this.listQuery).then(
(res) => {
- this.goodsListData = res.data;
- this.getNestPoint(this.endLngLat[0], this.endLngLat[1]).then(wz=>{
- this.nestWuziPoints = wz
- this.radioChange();
- })
+ if (!res.data.length) {
+ this.goodsGraphicLayerArr.forEach((item) => {
+ this.goodsGraphicLayer.removeGraphic(item);
+ });
+ if (this.pathPointGraphicLayer) {
+ this.pathPointGraphicLayer.clear();
+ }
+ } else {
+ this.goodsListData = res.data;
+ this.getNestPoint(this.endLngLat[0], this.endLngLat[1]).then(
+ (wz) => {
+ this.nestWuziPoints = wz;
+ this.radioChange();
+ }
+ );
+ }
}
);
},
@@ -175,7 +196,7 @@ export default {
let from = turf.point([lng, lat]);
let nestWuziPoints = [];
await this.goodsListData.forEach((item, index) => {
- let geom = parse(item.geom)
+ let geom = parse(item.geom);
let to = turf.point(geom.coordinates);
let options = { units: "kilometers" };
let distance = turf.distance(from, to, options);
@@ -184,20 +205,25 @@ export default {
distance: distance.toFixed(2),
time: this.getAroundTime(distance.toFixed(2) * 60 + 5 * 60),
info: item.info,
+ name: item.name,
};
nestWuziPoints.push(obj);
});
nestWuziPoints.sort((a, b) => {
return a.distance - b.distance;
});
- return nestWuziPoints
+ return nestWuziPoints;
},
//估算时间 平均60km/h
getAroundTime(a) {
var h = parseInt(a / 3600);
var m = parseInt((a % 3600) / 60);
var s = parseInt((a % 3600) % 60);
- return h + "小时" + m + "分" + s + "秒";
+ if (h > 0) {
+ return h + "小时" + m + "分" + s + "秒";
+ } else {
+ return m + "分" + s + "秒";
+ }
},
flyToPosition(item) {
this.startLngLat = item.lngLat;
@@ -222,7 +248,7 @@ export default {
if (LineString == null || LineString == "null") {
this.$message({
type: "warning",
- message: "距离太近,没有找到合适的路线",
+ message: "没有找到合适的路线",
});
if (this.pathPointGraphicLayer) {
this.pathPointGraphicLayer.clear();
@@ -345,50 +371,21 @@ export default {
});
},
addGoodsLayer() {
- this.goodsGraphicLayerArr.forEach((item) => {
- this.goodsGraphicLayer.removeGraphic(item);
- });
- this.goodsGraphicLayerArr = [];
-
if (this.goodsGraphicLayer == null) {
this.goodsGraphicLayer = new mars3d.layer.GraphicLayer();
window.globalmap.addLayer(this.goodsGraphicLayer);
}
+
+ this.goodsGraphicLayerArr.forEach((graphic) => {
+ this.goodsGraphicLayer.removeGraphic(graphic);
+ });
+ this.goodsGraphicLayerArr = [];
this.goodsListData.forEach((item, index) => {
- let graphic = new mars3d.graphic.DivGraphic({
- position: parse(item.geom).coordinates,
+ let graphic = new mars3d.graphic.BillboardEntity({
+ position: [item.lngLat[0], item.lngLat[1]],
style: {
- html: `
-
-
-
-
-
-
-
-
-
-
${item.name}
-
-
-
归属信息:
-
${item.street}
-
-
-
-
物资信息:
-
- ${item.info}
-
-
-
-
-
-
-
-
-
-
`,
+ image: "img/wuzichubei.png",
+ scale:0.7,
horizontalOrigin: Cesium.HorizontalOrigin.LEFT,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
distanceDisplayCondition: new Cesium.DistanceDisplayCondition(
@@ -398,12 +395,12 @@ export default {
scaleByDistance: new Cesium.NearFarScalar(1000, 1.0, 200000, 0.2),
clampToGround: true,
},
- pointerEvents: true,
+ pointerEvents: false,
});
-
- this.goodsGraphicLayer.addGraphic(graphic);
this.goodsGraphicLayerArr.push(graphic);
+ this.goodsGraphicLayer.addGraphic(graphic);
});
+ window.globalmap.addLayer(this.goodsGraphicLayer);
},
},
};