Sfoglia il codice sorgente

添加切换地图刷新页面数据

guolei 1 anno fa
parent
commit
9be16d47bf
1 ha cambiato i file con 36 aggiunte e 12 eliminazioni
  1. 36 12
      src/views/workManagement/multimodeSimulationEdit.vue

+ 36 - 12
src/views/workManagement/multimodeSimulationEdit.vue

@@ -2,7 +2,7 @@
 	<div class="container">
 		<div class="select-map" :class="{'no-interaction': isDisabled}">
 			地图选择:
-			<el-select class="select-content" v-model="openDrive.mapId" placeholder="请选择">
+			<el-select class="select-content" v-model="openDrive.mapId" placeholder="请选择" @change="changeMapId">
 				<el-option v-for="(item, index) in mapList" :key="item.id" :label="item.mapName" :value="item.id">
 				</el-option>
 			</el-select>
@@ -11,7 +11,7 @@
 			<open-drive class="map" ref="openDrive" :mapId="openDrive.mapId" :startPoint="openDrive.pathStartJson"
 				:endPoint="openDrive.pathEndJson" :sections="openDrive.sections"></open-drive>
 			<SimulationTable ref="table" @simulationBtnCallBack="settingSimulation" @openDialog="showDialog"
-				class="table" :sceneId="sceneId" :class="{'no-interaction': isDisabled}"/>
+				class="table" :sceneId="sceneId" :mapId="openDrive.mapId" :class="{'no-interaction': isDisabled}" />
 		</div>
 		<div class="operate" :class="{'no-interaction': isDisabled}">
 			<el-button @click="saveAll" class="btn" type="primary">保存</el-button>
@@ -60,8 +60,29 @@
 		},
 		mounted() {
 			this.getMapList();
+			
 		},
 		methods: {
+			getDefaultMap() {
+				this.$axios({
+					method: "post",
+					url: this.$api.workManagement.getMultiSimulationSceneDetail,
+					data: {
+						"sceneId": this.sceneId
+					}
+				}).then((res) => {
+					if (res.code == 200) {
+						console.log("阿数据",res)
+						let data = res.info;
+						if(data.mapId){
+							this.openDrive.mapId = data.mapId;
+						}
+					}
+				})
+			},
+			changeMapId() {
+				console.log(this.openDrive.mapId);
+			},
 			getMapList() {
 				this.$axios({
 					method: "post",
@@ -86,6 +107,7 @@
 									this.mapList = res.info;
 									if (this.mapList.length > 0) {
 										this.openDrive.mapId = this.mapList[0].id;
+										this.getDefaultMap();
 									}
 								}
 							})
@@ -112,12 +134,12 @@
 								"sceneCarId": row.id,
 							}
 						}).then((res) => {
-							if(res.code == 200){
+							if (res.code == 200) {
 								this.$message({
 									message: '设为仿真视角成功',
 									type: 'success'
 								});
-							}else{
+							} else {
 								this.$message({
 									message: '设为仿真视角失败',
 									type: 'warning'
@@ -154,11 +176,11 @@
 				this.$refs.table.updateRow(data);
 				this.reloadMap();
 			},
-			saveAll(){
+			saveAll() {
 				this.$refs.table.saveAll(this.openDrive.mapId);
 			},
-			back(){
-				
+			back() {
+
 				this.$router.go(-1);
 			}
 		}
@@ -166,11 +188,12 @@
 </script>
 
 <style lang='less' scoped>
-	*{
+	* {
 		margin: 0;
 		padding: 0;
 		box-sizing: content-box;
 	}
+
 	.mainBox {
 		padding-bottom: 0px !important
 	}
@@ -272,12 +295,13 @@
 		top: 0 !important;
 		right: 10rem !important;
 	}
+
 	.no-interaction {
-	  pointer-events: none;
-	  /* 其他样式,比如背景色、边框等 */
-/* 	  background-color: #f0f0f0;
+		pointer-events: none;
+		/* 其他样式,比如背景色、边框等 */
+		/* 	  background-color: #f0f0f0;
 	  border: 1px solid #ccc; */
-/* 	  padding: 10px;
+		/* 	  padding: 10px;
 	  margin: 10px; */
 	}
 </style>