Commit 0e7e6280 authored by xxx's avatar xxx

1

parent 5e7a447f
...@@ -47,6 +47,9 @@ ...@@ -47,6 +47,9 @@
toJavaCoordinates:[], toJavaCoordinates:[],
controlPointId:0, controlPointId:0,
lineData:[], lineData:[],
weilanzuobianData:[],
weilanName:[],
areaColorData:[],
} }
}, },
...@@ -90,6 +93,7 @@ ...@@ -90,6 +93,7 @@
methods: { methods: {
//后台获取数据 //后台获取数据
getCoordinate(data) { getCoordinate(data) {
let that = this;
this.zuobianData = data; this.zuobianData = data;
HttpReq.truckDispatching.apiPathmapQuery({size:9999}).then((res) => { HttpReq.truckDispatching.apiPathmapQuery({size:9999}).then((res) => {
if(res.code == 200){ if(res.code == 200){
...@@ -117,17 +121,40 @@ ...@@ -117,17 +121,40 @@
arr1.push(obj1); arr1.push(obj1);
}); });
this.lineData = arr1; this.lineData = arr1;
this.$nextTick(()=>{
if (this.appendToBody) { //获取电子围栏
document.body.appendChild(this.$el) HttpReq.truckDispatching.screenMapSetUpQuery({size:9999}).then((res) => {
} if(true){;
let data1 = [];
if (this.mapKey) { for(let key in res){
this.initMars3d(this.options) that.weilanName.push(key);
} else { that.areaColorData.push(res[key][0].color);
mars3d.Resource.fetchJson({ url: this.url }).then((data) => { let arrays = [];
this.initMars3d(data.map3d)// 构建地图 res[key].forEach(function(item){
var arr = [];
arr[0] = item.lon;
arr[1] = item.lat;
arr[2] = "500";
arrays.push(arr);
})
data1.push(arrays)
}
that.weilanzuobianData = data1
this.$nextTick(()=>{
if (this.appendToBody) {
document.body.appendChild(this.$el)
}
if (this.mapKey) {
this.initMars3d(this.options)
} else {
mars3d.Resource.fetchJson({ url: this.url }).then((data) => {
this.initMars3d(data.map3d)// 构建地图
})
}
}) })
} }
}) })
}) })
...@@ -164,14 +191,12 @@ ...@@ -164,14 +191,12 @@
}) })
this.$nextTick(()=>{ this.$nextTick(()=>{
this.$notify({ this.$notify({
title: '关键点信息上传成功,即将刷新页面', title: '关键点信息上传成功!',
type: 'success', type: 'success',
duration: 2000, duration: 2000,
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true,
}); });
setTimeout(function (){ this.$parent.resetData();
window.location.reload();
},2000);
}) })
} }
}) })
...@@ -191,14 +216,12 @@ ...@@ -191,14 +216,12 @@
this.$nextTick(()=>{ this.$nextTick(()=>{
if(res.code == 200){ if(res.code == 200){
this.$notify({ this.$notify({
title: '关键点信息上传成功,即将刷新页面', title: '关键点信息上传成功!',
type: 'success', type: 'success',
duration: 2000, duration: 2000,
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true,
}); });
setTimeout(function (){ this.$parent.resetData();
window.location.reload();
},2000);
} }
}) })
}) })
...@@ -238,14 +261,12 @@ ...@@ -238,14 +261,12 @@
}) })
this.$nextTick(()=>{ this.$nextTick(()=>{
this.$notify({ this.$notify({
title: '关键点信息上传成功,即将刷新页面', title: '关键点信息上传成功!',
type: 'success', type: 'success',
duration: 2000, duration: 2000,
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true,
}); });
setTimeout(function (){ this.$parent.resetData();
window.location.reload();
},2000);
}) })
} }
}) })
...@@ -269,14 +290,12 @@ ...@@ -269,14 +290,12 @@
this.$nextTick(()=>{ this.$nextTick(()=>{
if(res.code == 200){ if(res.code == 200){
this.$notify({ this.$notify({
title: '关键点信息上传成功,即将刷新页面', title: '关键点信息上传成功!',
type: 'success', type: 'success',
duration: 2000, duration: 2000,
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true,
}); });
setTimeout(function (){ this.$parent.resetData();
window.location.reload();
},2000);
} }
}) })
}) })
...@@ -300,6 +319,14 @@ ...@@ -300,6 +319,14 @@
// 创建三维地球场景 // 创建三维地球场景
map = new mars3d.Map(`mars3d-container${this.mapKey}`, mapOptions) map = new mars3d.Map(`mars3d-container${this.mapKey}`, mapOptions)
this[`map${this.mapKey}`] = map this[`map${this.mapKey}`] = map
//围栏回显
that.weilanzuobianData.forEach(function(item,index){
var graphicLayer = new mars3d.layer.GraphicLayer();
map.addLayer(graphicLayer);
initLayerManager(graphicLayer,that.weilanName[index]);
that.addGraphic_01(graphicLayer,item,that.weilanName[index],that.areaColorData[index]);
})
//关键点显示 //关键点显示
that.zuobianData.forEach(function(item,index){ that.zuobianData.forEach(function(item,index){
...@@ -342,6 +369,28 @@ ...@@ -342,6 +369,28 @@
}) })
graphicLayer.addGraphic(graphic) graphicLayer.addGraphic(graphic)
}, },
//围栏回显
addGraphic_01(graphicLayer,positions,weilanName,color){
let graphic = new mars3d.graphic.PolygonEntity({
positions: positions,
style: {
color: color,
opacity: 0.5,
outline: true,
outlineWidth: 3,
outlineColor: "#ffffff",
label: {
text: weilanName,
font_size: 18,
color: "#ffffff",
distanceDisplayCondition: true,
distanceDisplayCondition_far: 500000,
distanceDisplayCondition_near: 0,
},
},
});
graphicLayer.addGraphic(graphic); //还可以另外一种写法: graphic.addTo(graphicLayer)
},
//画线 //画线
addDemoGraphic2(graphicLayer,item) { addDemoGraphic2(graphicLayer,item) {
const graphic = new mars3d.graphic.PolylineEntity({ const graphic = new mars3d.graphic.PolylineEntity({
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<el-input-number v-model="query.coefficient" :precision="2" :step="0.1" :min="0" :max="9999" @change="inputInitialFn()"></el-input-number> <el-input-number v-model="query.coefficient" :precision="2" :step="0.1" :min="0" :max="9999" @change="inputInitialFn()"></el-input-number>
<el-button size="mini" type="success" @click="addKeyPoints()" :disabled="addKeyPointsAble">添加路径关键点</el-button> <el-button size="mini" type="success" @click="addKeyPoints()" :disabled="addKeyPointsAble">添加路径关键点</el-button>
<div style="width:62vw;height: 72vh;overflow: hidden;margin-top: 1vh;"> <div style="width:62vw;height: 72vh;overflow: hidden;margin-top: 1vh;">
<mars3dViewerMap :url="configUrl" @onload="onMapload" ref="mars3dViewerMapMethod"/> <mars3dViewerMap :url="configUrl" @onload="onMapload" ref="mars3dViewerMapMethod" :key="shuaxinTimer"/>
</div> </div>
</div> </div>
</div> </div>
...@@ -122,6 +122,8 @@ export default { ...@@ -122,6 +122,8 @@ export default {
faControlPointId:0, faControlPointId:0,
//选择连接点数据 //选择连接点数据
selectConnectPointArray:[], selectConnectPointArray:[],
//重置地图
shuaxinTimer:null,
}; };
}, },
mounted(){ mounted(){
...@@ -440,6 +442,38 @@ export default { ...@@ -440,6 +442,38 @@ export default {
}) })
} }
}, },
//重置数据
resetData(){
//获取各个点的数据
HttpReq.truckDispatching.apiCpointQuery({size:9999}).then((res) => {
if(res.code == 200){
let arr1 = [];
res.data.content.forEach((item,index)=>{
let obj1 = {};
obj1.end = item.name;
obj1.weight = 0;
arr1.push(obj1);
})
this.controlPointData = arr1;
this.shuaxinTimer = new Date().getTime();
this.$refs.mars3dViewerMapMethod.getCoordinate(res.data.content);
//添加路径关键点按钮可否使用
this.addKeyPointsAble = false;
//选择关键点类型
this.activeName = "";
//装卸车点名称
this.entruckingValue1 = [];
this.detrainingValue2 = [];
this.controlPointValue3 = '';
//保存时判断为添加还是修改
this.transmitWay = 'add';
//暂存修改删除时的id
this.faControlPointId = 0;
//选择连接点数据
this.selectConnectPointArray = [];
}
})
},
// 地图构造完成回调 // 地图构造完成回调
onMapload(map) { onMapload(map) {
// 以下为演示代码 // 以下为演示代码
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment