修改代码

This commit is contained in:
lVAL 2020-12-28 17:39:47 +08:00
parent f97a98da21
commit da1fa87021
4 changed files with 36 additions and 29 deletions

View File

@ -80,10 +80,10 @@
</el-row>
<el-row justify="center" class="button-group">
<el-col :span="4" :offset="1">
<el-button :id="domIdConfirm" type="primary" :loading="loading" :disabled="!selected" @click="commit">确定(O)</el-button>
<el-button :id="domIdConfirm" type="primary" :loading="loading" :disabled="!selected" @click="commit(true)">确定(O)</el-button>
</el-col>
<el-col :span="4" :offset="2">
<el-button>应用(A)</el-button>
<el-button :loading="loading" :disabled="!selected" @click="commit(false)">应用(A)</el-button>
</el-col>
<el-col :span="4" :offset="2">
<el-button :id="domIdCancel" @click="cancel">关闭(C)</el-button>
@ -169,11 +169,14 @@ export default {
this.$refs.singleTable.setCurrentRow();
this.$store.dispatch('training/emitTipFresh');
},
commit() {
commit(isClose = false) {
commitOperate(menuOperate.StationStand.setStopTime, {standCode: this.selected.code, parkingTime: this.currentTime, parkingAlwaysValid: false}, 3).then(({valid})=>{
if (valid) {
this.doClose();
isClose && this.doClose();
}
}).catch(_ => {
isClose && this.doClose();
this.$refs.noticeInfo.doShow();
});
},
handleCurrentChange(val) {

View File

@ -130,6 +130,7 @@ export default {
isClose && this.doClose();
}
}).catch((error) => {
console.log(error);
isClose && this.doClose();
this.$refs.noticeInfo.doShow();
});

View File

@ -134,27 +134,27 @@ export default {
this.$refs.singleTable.setCurrentRow();
this.$store.dispatch('training/emitTipFresh');
},
commit(isClose=false) {
const cmd = {
normal: menuOperate.Switch.locate,
reverse: menuOperate.Switch.reverse
}[this.position];
commit(isClose = false) {
const cmd = {
normal: menuOperate.Switch.locate,
reverse: menuOperate.Switch.reverse
}[this.position];
if (cmd) {
commitOperate(cmd, {switchCode: this.selected.code}, 3).then(({valid})=>{
if (valid) {
isClose && this.doClose();
}
}).catch(error => {
isClose && this.doClose();
this.$refs.noticeInfo.doShow();
})
} else {
this.$message.info('未知指令');
}
if (cmd) {
commitOperate(cmd, {switchCode: this.selected.code}, 3).then(({valid})=>{
if (valid) {
isClose && this.doClose();
}
}).catch(_ => {
isClose && this.doClose();
this.$refs.noticeInfo.doShow();
});
} else {
this.$message.info('未知指令');
}
},
handleCurrentChange(val) {
if (!val) { return; }
if (!val) { return; }
commitOperate(menuOperate.Switch.turnout, {code:val.code}).then(({valid, operate})=>{
if (valid) {
const switchEle = this.$store.getters['map/getDeviceByCode'](val.code);

View File

@ -642,13 +642,16 @@ const map = {
mutations: {
// 改变地图数据索引
flushMapRef: (state) => {
state.map.sectionList = [...state.map.sectionList];
state.map.switchList = [...state.map.switchList];
state.map.signalList = [...state.map.signalList];
state.map.stationList = [...state.map.stationList];
state.map.stationStandList = [...state.map.stationStandList];
state.map.trainList = [...state.map.trainList];
state.map.trainWindowList = [...state.map.trainWindowList];
if (state.map) {
state.map.sectionList = [...state.map.sectionList || []];
state.map.switchList = [...state.map.switchList || []];
state.map.signalList = [...state.map.signalList || []];
state.map.stationList = [...state.map.stationList || []];
state.map.standList = [...state.map.standList || []];
state.map.stationStandList = [...state.map.stationStandList || []];
state.map.trainList = [...state.map.trainList || []];
state.map.trainWindowList = [...state.map.trainWindowList || []];
}
},
// 设置地图数据
setMapData: (state, map) => {