宁波一号线 键盘操作调整(回车事件)

This commit is contained in:
joylink_cuiweidong 2020-07-29 10:39:58 +08:00
parent ed4b5047bd
commit a13b21613f
4 changed files with 46 additions and 21 deletions

View File

@ -137,6 +137,13 @@ export default {
return ''; return '';
} }
}, },
watch:{
'$store.state.map.keyboardEnterCount': function (val) {
if (this.dialogShow && this.popClass === 'ningbo-01__systerm') {
this.commit();
}
}
},
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
this.$store.dispatch('training/tipReload'); this.$store.dispatch('training/tipReload');

View File

@ -50,8 +50,8 @@ export default {
name: 'SwitchHookLock', name: 'SwitchHookLock',
components: { components: {
NoticeInfo NoticeInfo
}, },
props: { props: {
popClass: { popClass: {
type: String, type: String,
default() { default() {
@ -67,18 +67,25 @@ export default {
operation: '', operation: '',
stationName: '', stationName: '',
switchName: '', switchName: '',
normal:false, normal:false,
targetMemberId: '' targetMemberId: ''
}; };
}, },
computed: { computed: {
...mapGetters('training', [ ...mapGetters('training', [
'memberList' 'memberList'
]), ]),
show() { show() {
return this.dialogShow && !this.$store.state.menuOperation.break; return this.dialogShow && !this.$store.state.menuOperation.break;
} }
}, },
watch:{
'$store.state.map.keyboardEnterCount': function (val) {
if (this.dialogShow && this.popClass === 'ningbo-01__systerm') {
this.commit();
}
}
},
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
this.$store.dispatch('training/tipReload'); this.$store.dispatch('training/tipReload');
@ -91,10 +98,10 @@ export default {
this.switchName = ''; this.switchName = '';
this.stationName = ''; this.stationName = '';
if (selected && selected._type.toUpperCase() === 'Switch'.toUpperCase()) { if (selected && selected._type.toUpperCase() === 'Switch'.toUpperCase()) {
this.switchName = selected.name; this.switchName = selected.name;
const station = this.$store.getters['map/getDeviceByCode'](selected.stationCode); const station = this.$store.getters['map/getDeviceByCode'](selected.stationCode);
if (station) { if (station) {
this.targetMemberId = this.memberList.find(ele => ele.deviceCode == station.code).id; this.targetMemberId = this.memberList.find(ele => ele.deviceCode == station.code).id;
this.stationName = station.name; this.stationName = station.name;
} }
} }
@ -116,20 +123,20 @@ export default {
}, },
commit() { commit() {
this.loading = true; this.loading = true;
const group = this.$route.query.group; const group = this.$route.query.group;
const param = { const param = {
commandType: 'Switch_Hook_Lock', commandType: 'Switch_Hook_Lock',
targetMemberId: this.targetMemberId, targetMemberId: this.targetMemberId,
params: { params: {
switchCode: this.selected.code, switchCode: this.selected.code,
normal: this.normal normal: this.normal
} }
}; };
commitTrainSend(group, param).then(({valid, operate})=>{ commitTrainSend(group, param).then(({valid, operate})=>{
this.doClose(); this.doClose();
}).catch((error) => { }).catch((error) => {
this.$refs.noticeInfo.doShow(error.message); this.$refs.noticeInfo.doShow(error.message);
this.doClose(); this.doClose();
}); });
} }
} }

View File

@ -28,7 +28,7 @@
<div style="overflow: hidden;"> <div style="overflow: hidden;">
<div>道岔</div> <div>道岔</div>
<el-col :span="11"> <el-col :span="11">
<el-select :id="domIdChoose" v-model="messageText2" filterable size="mini" :disabled="disabledConfirm2" @change="SelectChange"> <el-select :id="domIdChoose" ref="selectSwitch" v-model="messageText2" filterable size="mini" :disabled="disabledConfirm2" @change="SelectChange">
<el-option v-for="option in filterSwitchList" :key="option.code" :label="option.name" :value="option.code" /> <el-option v-for="option in filterSwitchList" :key="option.code" :label="option.name" :value="option.code" />
</el-select> </el-select>
</el-col> </el-col>
@ -140,6 +140,17 @@ export default {
return ''; return '';
} }
}, },
watch:{
'$store.state.map.keyboardEnterCount': function (val) {
if (this.dialogShow) {
if (this.disabledConfirm2 && !this.disabledConfirm1) {
this.confirm1();
} else if (this.disabledConfirm1 && !this.disabledConfirm2 ) {
this.confirm2();
}
}
}
},
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
this.$store.dispatch('training/tipReload'); this.$store.dispatch('training/tipReload');
@ -180,7 +191,6 @@ export default {
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
mouseCancelState(this.selected); mouseCancelState(this.selected);
}, },
SelectChange() { SelectChange() {
const operate = { const operate = {
operation: '', operation: '',
@ -197,6 +207,7 @@ export default {
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.selectSwitch.blur();
} }
}).catch(() => { }).catch(() => {
this.$refs.noticeInfo.doShow(); this.$refs.noticeInfo.doShow();

View File

@ -94,11 +94,11 @@ export default {
handler: this.reverse, handler: this.reverse,
cmdType: CMD.Switch.CMD_SWITCH_REVERSE_POSITION cmdType: CMD.Switch.CMD_SWITCH_REVERSE_POSITION
}, },
{ // {
label: '道岔单锁', // label: '',
handler: this.lock, // handler: this.lock,
cmdType: CMD.Switch.CMD_SWITCH_SINGLE_LOCK // cmdType: CMD.Switch.CMD_SWITCH_SINGLE_LOCK
}, // },
{ {
type: 'separator' type: 'separator'
}, },