|
|
|
@ -9,8 +9,7 @@ import configJson from "./map-config.json";
|
|
|
|
|
import { mapGetters } from "vuex";
|
|
|
|
|
import garden from "./garden.json";
|
|
|
|
|
import MarsMap from "@/components/mars-map";
|
|
|
|
|
import { listDept } from "@/api/system/dept.js";
|
|
|
|
|
import { listBuilding } from "@/api/taicangpop/building.js";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
props: {
|
|
|
|
|
xiaoquId: {
|
|
|
|
@ -296,12 +295,12 @@ export default {
|
|
|
|
|
return { yuanName, buildingNumber, buildingColor, image };
|
|
|
|
|
},
|
|
|
|
|
//平面 + 图标
|
|
|
|
|
addbuildingLayer() {
|
|
|
|
|
async addbuildingLayer() {
|
|
|
|
|
let _this = this;
|
|
|
|
|
mars3d.Util.fetchJson({
|
|
|
|
|
let res = await mars3d.Util.fetchJson({
|
|
|
|
|
url:
|
|
|
|
|
this.configUrl + `lib/geoJson/xiaoqu/building${this.xiaoquId}.json`,
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
});
|
|
|
|
|
const arr = mars3d.Util.geoJsonToGraphics(res);
|
|
|
|
|
arr.map((item, index) => {
|
|
|
|
|
const { yuanName, buildingNumber, buildingColor, image } =
|
|
|
|
@ -354,16 +353,11 @@ export default {
|
|
|
|
|
floorNum: item.attr["层数"],
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
point.on(mars3d.EventType.click, async function (e) {
|
|
|
|
|
point.on(mars3d.EventType.click, function (e) {
|
|
|
|
|
let buildingItem = _this.mapLayer.plane.getGraphicByAttr(e.id);
|
|
|
|
|
if (
|
|
|
|
|
_this.mapLayer.tiles3dLayer &&
|
|
|
|
|
_this.mapLayer.tiles3dLayer.show
|
|
|
|
|
) {
|
|
|
|
|
if (_this.mapLayer.tiles3dLayer && _this.mapLayer.tiles3dLayer.show) {
|
|
|
|
|
const geojson = buildingItem.toGeoJSON();
|
|
|
|
|
_this.map
|
|
|
|
|
.getLayerById("dth")
|
|
|
|
|
.loadGeoJSON(geojson, { clear: true });
|
|
|
|
|
_this.map.getLayerById("dth").loadGeoJSON(geojson, { clear: true });
|
|
|
|
|
} else {
|
|
|
|
|
buildingItem.openHighlight({
|
|
|
|
|
color: "#FFA200",
|
|
|
|
@ -373,24 +367,17 @@ export default {
|
|
|
|
|
outlineWidth: 2,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
let deptData = await _this.getDeptId({
|
|
|
|
|
xiaoquId: _this.xiaoquId,
|
|
|
|
|
// _this.$store.commit("CHANGE_QUERY", {
|
|
|
|
|
// buildingid: 20,
|
|
|
|
|
// deptId: 30,
|
|
|
|
|
// });
|
|
|
|
|
_this.$store.dispatch("GetBuildingId", {
|
|
|
|
|
deptName: e.target.attr.yuanName,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let buildingData = await _this.getBuildingId({
|
|
|
|
|
name: e.target.attr.buildingNumber + "幢",
|
|
|
|
|
deptId: deptData.deptId,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
_this.$store.commit("CHANGE_QUERY", {
|
|
|
|
|
buildingid: buildingData.id,
|
|
|
|
|
deptId: deptData.deptId,
|
|
|
|
|
}); //存储全局参数
|
|
|
|
|
});
|
|
|
|
|
this.mapLayer.planePoint.addGraphic(point);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
//小区网格面
|
|
|
|
@ -515,17 +502,6 @@ export default {
|
|
|
|
|
this.map.addLayer(this.geoJsonLayerDTH);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 获取苑id
|
|
|
|
|
async getDeptId(query) {
|
|
|
|
|
let res = await listDept(query);
|
|
|
|
|
return res.data[0];
|
|
|
|
|
},
|
|
|
|
|
//获取楼栋id
|
|
|
|
|
async getBuildingId(query) {
|
|
|
|
|
let res = await listBuilding(query);
|
|
|
|
|
return res.rows[0];
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// handlezs() {
|
|
|
|
|
// // this.mapLayer.zhengsheLayer.show = true;
|
|
|
|
|
// this.addZhengsheLayer();
|
|
|
|
|