|
@@ -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);
|
|
|
}
|
|
|
}
|