Browse Source

change: 优化车辆轨迹显示内容、优化默认选择地图逻辑、优化场景编辑车辆单选跟踪、优化删除按钮样式

guolei 1 năm trước cách đây
mục cha
commit
e3ff6d3cab

+ 43 - 8
src/views/workManagement/components/simulationTable.vue

@@ -7,8 +7,8 @@
 		<el-table class="table-content" ref="multipleTable" :data="tableData" tooltip-effect="dark" style="width: 100%">
 			<el-table-column label="序号">
 				<template slot-scope="scope">
-					<el-radio v-model="currentFactor" :label="getRowIndex(scope.$index)"
-						@change="changeRowIndex(scope.row)"></el-radio>
+					<el-radio v-model="currentIndex" :label="getRowIndex(scope.$index)"
+						@change="changeRowIndex(getRowIndex(scope.$index), scope.row)"></el-radio>
 				</template>
 			</el-table-column>
 			<el-table-column label="选择车辆">
@@ -51,7 +51,7 @@
 		},
 		data() {
 			return {
-				currentFactor: "",
+				currentIndex: null,
 				tableData: [],
 				carList: [],
 				algorithmList: [],
@@ -100,7 +100,13 @@
 		},
 		computed: {
 			getSelectPathText(row) {
-				return (row) => "轨迹" + row.pathSort + " (" + row.pathStartJson.name + "," + row.pathEndJson.name + ")";
+				return (row) => {
+					if (row.pathStartJson.name == null || row.pathEndJson.name == null) {
+						return "请选择轨迹";
+					} else {
+						return "轨迹" + row.pathSort + " (" + row.pathStartJson.name + "," + row.pathEndJson.name + ")"
+					}
+				}
 			}
 		},
 		mounted() {
@@ -125,7 +131,8 @@
 			getRowIndex(rowIndex) {
 				return rowIndex + 1;
 			},
-			changeRowIndex(row) {
+			changeRowIndex(index, row) {
+				this.currentIndex = index;
 				this.selectRow = row;
 				this.$emit("changeRow", row);
 			},
@@ -153,9 +160,20 @@
 				}).then((res) => {
 					if (res.code == 200) {
 						this.tableData = res.info.list;
+						this.initCurrentIndex();
 					}
 				})
 			},
+			initCurrentIndex(){
+				this.currentIndex = null;
+				let length = this.tableData.length;
+				for(let index = 0; index < length; index ++){
+					let record = this.tableData[index];
+					if(record.isSimulationCar == 1){
+						this.currentIndex = this.getRowIndex(index);
+					}
+				}
+			},
 			getCarList() {
 				this.$axios({
 					method: "post",
@@ -196,6 +214,7 @@
 				})
 			},
 			deleteRecord(row) {
+
 				this.$confirm('此操作将删除该记录, 是否继续?', '提示', {
 					confirmButtonText: '确定',
 					cancelButtonText: '取消',
@@ -213,6 +232,7 @@
 						}).then((res) => {
 							if (res.code == 200) {
 								this.removeViewTableRecord(row);
+								this.initCurrentIndex();
 							}
 						})
 					}
@@ -249,7 +269,19 @@
 				})
 			},
 			settingsSimulation() {
-				this.$emit("simulationBtnCallBack", this.selectRow);
+				this.$emit("simulationBtnCallBack", this.selectRow, this.settingsSimulationConfirm);
+			},
+			settingsSimulationConfirm(row) {
+				// this.searchSimulation(row.id)
+			},
+			searchSimulation(id) {
+				let length = this.tableData.length;
+				for (let index = 0; index < length; index++) {
+					let record = this.tableData[index];
+					if(record.id == id){
+						this.currentIndex = this.getRowIndex(index);
+					}
+				}
 			},
 			saveAll(mapId) {
 				this.$axios({
@@ -346,7 +378,8 @@
 	}
 
 	.delete-btn {
-		color: #FFFFFF;
+		background-color: #f56c6c !important;
+		color: #ffffff !important;
 		border-radius: 0.5rem;
 	}
 
@@ -359,7 +392,9 @@
 		height: 100%;
 		overflow-y: scroll;
 	}
-	/deep/ .el-input,/deep/ .el-input__inner{
+
+	/deep/ .el-input,
+	/deep/ .el-input__inner {
 		width: 100px !important;
 	}
 </style>

+ 6 - 4
src/views/workManagement/multimodeSimulationEdit.vue

@@ -65,7 +65,7 @@
 			
 		},
 		methods: {
-			getDefaultMap() {
+			getDefaultMap(defaultMapId) {
 				this.$axios({
 					method: "post",
 					url: this.$api.workManagement.getMultiSimulationSceneDetail,
@@ -76,6 +76,8 @@
 					if (res.code == 200) {
 						if(res.info.mapId){
 							this.openDrive.mapId = res.info.mapId;
+						}else{
+							this.openDrive.mapId = defaultMapId;
 						}
 					}
 				})
@@ -106,8 +108,7 @@
 								if (res.code == 200) {
 									this.mapList = res.info;
 									if (this.mapList.length > 0) {
-										this.openDrive.mapId = this.mapList[0].id;
-										this.getDefaultMap();
+										this.getDefaultMap(this.mapList[0].id);
 									}
 								}
 							})
@@ -116,7 +117,7 @@
 					}
 				})
 			},
-			settingSimulation(row) {
+			settingSimulation(row, callBack) {
 				if (row.id == null || row.id == "") {
 					this.$message({
 						message: '警告哦,请选择一条已保存记录',
@@ -135,6 +136,7 @@
 							}
 						}).then((res) => {
 							if (res.code == 200) {
+								callBack(row);
 								this.$message({
 									message: '设为仿真视角成功',
 									type: 'success'