修改代码

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>
<el-row justify="center" class="button-group"> <el-row justify="center" class="button-group">
<el-col :span="4" :offset="1"> <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>
<el-col :span="4" :offset="2"> <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>
<el-col :span="4" :offset="2"> <el-col :span="4" :offset="2">
<el-button :id="domIdCancel" @click="cancel">关闭(C)</el-button> <el-button :id="domIdCancel" @click="cancel">关闭(C)</el-button>
@ -169,11 +169,14 @@ export default {
this.$refs.singleTable.setCurrentRow(); this.$refs.singleTable.setCurrentRow();
this.$store.dispatch('training/emitTipFresh'); 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})=>{ commitOperate(menuOperate.StationStand.setStopTime, {standCode: this.selected.code, parkingTime: this.currentTime, parkingAlwaysValid: false}, 3).then(({valid})=>{
if (valid) { if (valid) {
this.doClose(); isClose && this.doClose();
} }
}).catch(_ => {
isClose && this.doClose();
this.$refs.noticeInfo.doShow();
}); });
}, },
handleCurrentChange(val) { handleCurrentChange(val) {

View File

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

View File

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

View File

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