自动运行 添加

This commit is contained in:
fan 2023-08-17 10:39:37 +08:00
parent 9bc7126509
commit cad848ce8e

View File

@ -34,6 +34,9 @@
<el-button :disabled="showRight" type="primary" size="mini" icon="el-icon-arrow-right" @click="adjustDirection" />
</el-col>
</el-row>
<el-row style="text-align: center;margin-top: 15px;">
<el-button type="primary" size="mini" @click="handleRun">自动运行</el-button>
</el-row>
</el-dialog>
</template>
@ -41,6 +44,7 @@
import LeftTrain from '@/assets/left_train.png';
import RightTrain from '@/assets/right_train.png';
import { sandTableTrainControl } from '@/api/simulation';
import {menuOperate} from '@/jmapNew/theme/components/utils/menuOperate';
export default {
name: 'TrainOperation',
data() {
@ -119,6 +123,30 @@ export default {
sandTableTrainControl(this.$route.query.group, { groupNumber: this.groupNumber, right: this.right, speed: 0 }).then(resp => {
this.speed = 0;
}).catch(err => { this.$message.error(err.message); });
},
handleRun() {
const step = {
over: true,
operation: menuOperate.Common.trainDrive.operation,
cmdType: menuOperate.Common.trainDrive.cmdType,
param: {
groupNumber: this.groupNumber,
param: {
speedLimit: '',
through: 0,
targetDeviceCode: ''
}
}
};
this.$store.dispatch('trainingNew/next', step).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$messageBox('Failed to set or cancel the fault!');
}
}).catch((error) => {
this.$messageBox(error.message || 'Failed to set or cancel the fault!');
});
}
}
};