上饶沙盘 列车操作 socket同步调整

This commit is contained in:
fan 2021-11-08 15:57:23 +08:00
parent 2cc79466b4
commit de55f13b9f

View File

@ -13,6 +13,7 @@
:max="55"
:marks="marks"
show-stops
@input="inputSpeed"
@change="changeSpeed"
/>
</el-col>
@ -47,6 +48,7 @@ export default {
leftTrainPic: LeftTrain,
rightTrainPic: RightTrain,
groupNumber: '',
changeSpeedFlag: false,
right: true,
train: null,
marks: {
@ -70,17 +72,23 @@ export default {
this.dialogVisible = false;
},
doShow(val) {
if (this.dialogVisible && this.groupNumber === val.groupNumber) { return; }
const train = this.$store.getters['map/getDeviceByCode'](val.groupNumber);
this.groupNumber = train.groupNumber;
this.train = train;
this.right = !!train.right;
this.speed = train.speed;
if (this.right != train.right) {
this.right = !!train.right;
}
if (this.speed != train.speed && !this.changeSpeedFlag) {
this.speed = train.speed;
}
this.dialogVisible = true;
},
inputSpeed(val) {
this.changeSpeedFlag = true;
},
changeSpeed(val) {
srTrainControl(this.$route.query.group, { groupNumber: this.groupNumber, right: this.right, speed: this.speed }).then(resp => {
}).catch(err => { this.$message.error(err.message); this.speed = this.train.speed; });
}).catch(err => { this.$message.error(err.message); this.speed = this.train.speed; }).finally(() => { this.changeSpeedFlag = false; });
},
adjustDirection(value) {
srTrainControl(this.$route.query.group, { groupNumber: this.groupNumber, right: value === 'right', speed: this.speed }).then(resp => {