列车操作调整

This commit is contained in:
fan 2023-06-02 17:32:58 +08:00
parent 0df4ffdcf6
commit 228b4aadc3

View File

@ -25,13 +25,13 @@
</el-row> </el-row>
<el-row style="margin-top: 40px"> <el-row style="margin-top: 40px">
<el-col :span="3" :offset="7" style="text-align: right;"> <el-col :span="3" :offset="7" style="text-align: right;">
<el-button :type="right?'':'primary'" size="mini" icon="el-icon-arrow-left" @click="adjustDirection('left')" /> <el-button :disabled="!showRight" type="primary" size="mini" icon="el-icon-arrow-left" @click="adjustDirection" />
</el-col> </el-col>
<el-col :span="3" style="text-align: center;"> <el-col :span="3" style="text-align: center;">
<img style="width: 50px" :src="trainPic"> <img style="width: 50px" :src="trainPic">
</el-col> </el-col>
<el-col :span="3"> <el-col :span="3">
<el-button :type="right?'primary':''" size="mini" icon="el-icon-arrow-right" @click="adjustDirection('right')" /> <el-button :disabled="showRight" type="primary" size="mini" icon="el-icon-arrow-right" @click="adjustDirection" />
</el-col> </el-col>
</el-row> </el-row>
</el-dialog> </el-dialog>
@ -70,6 +70,9 @@ export default {
}; };
}, },
computed: { computed: {
showRight() {
return (this.right && !this.reversal) || (!this.right && this.reversal);
},
trainPic() { trainPic() {
if ((this.right && this.reversal) || (!this.right && !this.reversal)) { if ((this.right && this.reversal) || (!this.right && !this.reversal)) {
return this.leftTrainPic; return this.leftTrainPic;
@ -107,9 +110,9 @@ export default {
sandTableTrainControl(this.$route.query.group, { groupNumber: this.groupNumber, right: this.right, speed: this.speed }).then(resp => { sandTableTrainControl(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; }).finally(() => { this.changeSpeedFlag = false; }); }).catch(err => { this.$message.error(err.message); this.speed = this.train.speed; }).finally(() => { this.changeSpeedFlag = false; });
}, },
adjustDirection(value) { adjustDirection() {
sandTableTrainControl(this.$route.query.group, { groupNumber: this.groupNumber, right: value === 'right', speed: this.speed }).then(resp => { sandTableTrainControl(this.$route.query.group, { groupNumber: this.groupNumber, right: !this.right, speed: this.speed }).then(resp => {
this.right = value === 'right'; this.right = !this.right;
}).catch(err => { this.$message.error(err.message); }); }).catch(err => { this.$message.error(err.message); });
}, },
brakeTrain() { brakeTrain() {