Selaa lähdekoodia

修改轨迹名称数据显示

guolei 1 vuosi sitten
vanhempi
commit
c4b7b38017

+ 44 - 15
src/views/workManagement/components/pathDialog.vue

@@ -4,7 +4,8 @@
 		<el-form ref="form" :model="selectRecord" label-width="100px" size="mini">
 			<el-form-item label="选择轨迹">
 				<el-select v-model="dataParams.pathId" @change="switchTrack">
-					<el-option v-for="item in trackList" :key="item.id" :label="item.id" :value="item.id">
+					<el-option v-for="item in trackList" :key="item.id" :label="getPathName(item.pathSort)"
+						:value="item.id">
 					</el-option>
 				</el-select>
 			</el-form-item>
@@ -52,14 +53,16 @@
 				dataParams: {
 					pathId: "",
 					pathStartJson: {},
-					pathEndJson:{}
-				}
+					pathEndJson: {}
+				},
+				preStartPointName: "",
+				preEndPointName: ""
 			};
 		},
 		props: {
 			open: {
 				type: Boolean,
-				default: () => false
+				default: _ => false
 			},
 			params: {
 				type: Object,
@@ -67,19 +70,24 @@
 			}
 
 		},
+		computed: {
+			getPathName() {
+				return id => "轨迹" + id;
+			}
+		},
 		methods: {
-			checkOption(pathId, pointName, type){
-				if(!this.dataParams.selectedPoints[pathId]){
+			checkOption(pathId, pointName, type) {
+				if (!this.dataParams.selectedPoints[pathId]) {
 					return false;
 				}
-				
-				if(!this.dataParams.selectedPoints[pathId][type]){
+
+				if (!this.dataParams.selectedPoints[pathId][type]) {
 					return false;
 				}
 				return this.dataParams.selectedPoints[pathId][type].includes(pointName);
 			},
 			isEmptyJson(obj) {
-			    return Object.keys(obj).length === 0;
+				return Object.keys(obj).length === 0;
 			},
 			getMapDetails(mapId) {
 				this.$axios({
@@ -90,6 +98,7 @@
 					}
 				}).then((res) => {
 					if (res.code == 200 && res.info) {
+						console.log(res.info.path)
 						this.trackList = res.info.path;
 						this.switchTrack(this.params.pathId);
 					}
@@ -102,21 +111,38 @@
 						this.selectTrack = elem;
 					}
 				});
-				if(!isFirst){
+				if (!isFirst) {
 					this.dataParams.pathStartJson = {};
 					this.dataParams.pathEndJson = {};
 				}
 				this.changeMap();
 
 			},
-			switchStartPoint() {
+			switchStartPoint(newVal) {
+				console.log(this.selectTrack)
+				let pointNames = this.dataParams.selectedPoints[this.selectTrack.id]["start"];
+				let searchIndex = pointNames.indexOf(this.preStartPointName);
+				if (searchIndex != -1) {
+					pointNames.splice(searchIndex, 1);
+				}
+				pointNames.push(newVal.name)
+				this.preStartPointName = newVal.name;
 				this.changeMap();
 			},
-			switchEndPoint() {
+			switchEndPoint(newVal) {
+				let pointNames = this.dataParams.selectedPoints[this.selectTrack.id]["end"];
+				let searchIndex = pointNames.indexOf(this.preEndPointName);
+				if (searchIndex != -1) {
+					pointNames.splice(searchIndex, 1);
+				}
+				pointNames.push(newVal.name)
+				this.preEndPointName = newVal.name;
 				this.changeMap();
 			},
 			changeMap() {
-				let data = Object.assign({}, this.dataParams, {sections: this.selectTrack.sections})
+				let data = Object.assign({}, this.dataParams, {
+					sections: this.selectTrack.sections
+				})
 				data.pathStartJson.type = "start";
 				data.pathEndJson.type = "end";
 				this.$emit("change", data);
@@ -126,7 +152,8 @@
 			},
 			onSubmit() {
 				this.$emit("onSubmit", Object.assign({}, this.dataParams, {
-					sections: this.selectTrack.sections
+					sections: this.selectTrack.sections,
+					pathSort: this.selectTrack.pathSort
 				}));
 			}
 		},
@@ -134,7 +161,9 @@
 			params: {
 				handler(newVal, oldVal) {
 					this.selectTrack = {},
-					this.dataParams = JSON.parse(JSON.stringify(newVal));
+						this.dataParams = JSON.parse(JSON.stringify(newVal));
+					this.preStartPointName = this.dataParams.pathStartJson.name;
+					this.preEndPointName = this.dataParams.pathEndJson.name;
 					this.getMapDetails(newVal.mapId);
 				}
 			}

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

@@ -96,7 +96,7 @@
 		},
 		computed: {
 			getSelectPathText(row) {
-				return (row) => row.pathId + " (" + row.pathStartJson.name + "," + row.pathEndJson.name + ")";
+				return (row) => "轨迹" + row.pathSort + " (" + row.pathStartJson.name + "," + row.pathEndJson.name + ")";
 			}
 		},
 		mounted() {
@@ -113,15 +113,10 @@
 
 			},
 			updateRow(data) {
-				// this.showRow = Object.assign({}, this.showRow, {
-				// 	pathId: data.pathId,
-				// 	pathStartJson: data.pathStartJson,
-				// 	pathEndJson: data.pathEndJson
-				// })
 				this.showRow.pathId = data.pathId;
 				this.showRow.pathStartJson = data.pathStartJson;
 				this.showRow.pathEndJson = data.pathEndJson;
-				this.collectSelectedPoints(this.tableData);
+				this.showRow.pathSort = data.pathSort;
 			},
 			getRowIndex(rowIndex) {
 				return rowIndex + 1;
@@ -132,6 +127,7 @@
 			},
 			showDialog(row) {
 				this.showRow = row;
+				this.collectSelectedPoints(this.tableData);
 				let data = {
 					pathId: row.pathId,
 					pathStartJson: row.pathStartJson,
@@ -152,7 +148,6 @@
 				}).then((res) => {
 					if (res.code == 200) {
 						this.tableData = res.info.list;
-						this.collectSelectedPoints(this.tableData);
 					}
 				})
 			},
@@ -177,6 +172,7 @@
 				})
 			},
 			collectSelectedPoints(dataList) {
+				this.collectPointsSelected = {};
 				dataList.forEach((elem, index) => {
 					if (elem.pathId) {
 						if (!this.collectPointsSelected[elem.pathId]) {
@@ -184,13 +180,13 @@
 						}
 						let tarckSelected = this.collectPointsSelected[elem.pathId];
 						if (!tarckSelected.start) {
-							tarckSelected.start = new Set();
+							tarckSelected.start = [];
 						}
-						tarckSelected.start.add(elem.pathStartJson.name);
+						tarckSelected.start.push(elem.pathStartJson.name);
 						if (!tarckSelected.end) {
-							tarckSelected.end = new Set();
+							tarckSelected.end = [];
 						}
-						tarckSelected.end.add(elem.pathEndJson.name);
+						tarckSelected.end.push(elem.pathEndJson.name);
 					}
 				})
 			},
@@ -212,8 +208,6 @@
 						}).then((res) => {
 							if (res.code == 200) {
 								this.removeViewTableRecord(row);
-								this.collectSelectedPoints(this.tableData);
-								//this.getSceneCarList();
 							}
 						})
 					}

+ 0 - 1
src/views/workManagement/multimodeSimulation.vue

@@ -137,7 +137,6 @@
 				this.openDrive = data;
 			},
 			showDialog(data) {
-				console.log(data)
 				this.isDisabled = true;
 				this.dialog.dialogOpen = true;
 				this.dialog.dialogParam = Object.assign({}, data, {