自动计算站间距离

This commit is contained in:
zyy 2020-04-16 18:06:36 +08:00
parent 68340271f1
commit aa8ae83299

View File

@ -275,9 +275,24 @@ export default {
this.runLevelId = val.id;
}
}
},
'addModel.startStationCode': function(val) {
if (this.addModel.endStationCode && val) {
this.getStationDistance();
}
},
'addModel.endStationCode': function(val) {
if (this.addModel.startStationCode && val) {
this.getStationDistance();
}
}
},
methods: {
getStationDistance() {
const startStation = this.$store.getters['map/getDeviceByCode'](this.addModel.startStationCode);
const endStation = this.$store.getters['map/getDeviceByCode'](this.addModel.endStationCode);
this.addModel.distance = Math.abs(startStation.kmRange - endStation.kmRange);
},
generateLevel() { //
this.$refs.form.validate(async (valid) => {
if (valid) {