代码调整
This commit is contained in:
parent
534fa3d106
commit
429c208f62
@ -1,40 +1,58 @@
|
||||
<template>
|
||||
<div v-if="isShowBtn" id="menuButtons_box" class="menu menuButton" :style="{left: point.x+'px', top: point.y+'px' }">
|
||||
<!-- style="height: 45px;" -->
|
||||
<button :id="Switch.locate.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Switch.locate.button.operation, ['Switch'])">
|
||||
<button :id="Switch.locate.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Switch.locate.button.operation)">
|
||||
<span class="buttonColor">总定</span>
|
||||
</button>
|
||||
<button :id="Switch.reverse.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Switch.reverse.button.operation, ['Switch'])">
|
||||
<button :id="Switch.reverse.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Switch.reverse.button.operation)">
|
||||
<span class="buttonColor">总反</span>
|
||||
</button>
|
||||
<button :id="Switch.lock.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Switch.lock.button.operation, ['Switch'])">
|
||||
<button :id="Switch.lock.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Switch.lock.button.operation)">
|
||||
<span class="buttonColor">单锁</span>
|
||||
</button>
|
||||
<button :id="Switch.unlock.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Switch.unlock.button.operation, ['Switch'])">
|
||||
<button :id="Switch.unlock.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Switch.unlock.button.operation)">
|
||||
<span class="buttonColor">单解</span>
|
||||
</button>
|
||||
<button :id="Switch.block.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Switch.block.button.operation, ['Switch'])">
|
||||
<button :id="Switch.block.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Switch.block.button.operation)">
|
||||
<span class="buttonColor">岔封</span>
|
||||
</button>
|
||||
<button :id="Switch.unblock.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Switch.unblock.button.operation, ['Switch'])">
|
||||
<button :id="Switch.unblock.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Switch.unblock.button.operation)">
|
||||
<span class="buttonColor">岔解</span>
|
||||
</button>
|
||||
<button :id="Signal.lock.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Signal.lock.button.operation)">
|
||||
<span class="buttonColor">钮封</span>
|
||||
</button>
|
||||
<button :id="Signal.unlock.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Signal.unlock.button.operation)">
|
||||
<span class="buttonColor">钮解</span>
|
||||
</button>
|
||||
<button :id="Command.cancel.clearMbm.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Command.cancel.clearMbm.operation)">
|
||||
<span class="buttonColor">取消</span>
|
||||
</button>
|
||||
<button :id="Section.fault.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Section.fault.button.operation)">
|
||||
<span class="buttonColor">区解</span>
|
||||
</button>
|
||||
<password-box ref="password" pop-class="fuzhou-01__systerm" @checkOver="passWordCommit" />
|
||||
<!-- @checkOver="passWordCommit" -->
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import PasswordBox from '@/jmapNew/theme/components/menus/childDialog/passwordInputBox';
|
||||
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
|
||||
import OperationHandler from '@/scripts/cmdPlugin/OperationHandler';
|
||||
import Handler from '@/scripts/cmdPlugin/Handler';
|
||||
import CMD from '@/scripts/cmdPlugin/CommandEnum';
|
||||
export default {
|
||||
name:'MenuDeplotButton',
|
||||
components: {
|
||||
PasswordBox
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
point: {
|
||||
x: 130,
|
||||
y: 0
|
||||
},
|
||||
commandTypeList: [],
|
||||
operation: '0',
|
||||
deviceList: [],
|
||||
buttonDownColor: '#A8A8A8',
|
||||
buttonUpColor: '#F0F0F0',
|
||||
@ -45,35 +63,133 @@ export default {
|
||||
Switch() {
|
||||
return OperationEvent.Switch;
|
||||
},
|
||||
Signal() {
|
||||
return OperationEvent.Signal;
|
||||
},
|
||||
Command() {
|
||||
return OperationEvent.Command;
|
||||
},
|
||||
Section() {
|
||||
return OperationEvent.Section;
|
||||
},
|
||||
isShowBtn() {
|
||||
return this.$store.state.training.prdType == '09';
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'$store.state.menuOperation.buttonOperation': function (val, old) {
|
||||
this.updateButtonShow(val, old);
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.resetMbmButton();
|
||||
},
|
||||
methods:{
|
||||
updateButtonShow(val, old) {
|
||||
if (old) {
|
||||
// 恢复旧按钮显示
|
||||
const domId = OperationHandler.getDomIdByOperation(old);
|
||||
const dom = document.getElementById(domId);
|
||||
if (dom) {
|
||||
dom.disabled = false;
|
||||
dom.style.backgroundColor = this.buttonUpColor;
|
||||
}
|
||||
}
|
||||
if (val) {
|
||||
// 新按钮按下效果
|
||||
const domId = OperationHandler.getDomIdByOperation(val);
|
||||
const dom = document.getElementById(domId);
|
||||
if (dom) {
|
||||
dom.disabled = true;
|
||||
dom.style.backgroundColor = this.buttonDownColor;
|
||||
}
|
||||
}
|
||||
},
|
||||
passWordCommit(data) {
|
||||
let operate = {};
|
||||
if (data.overNext) {
|
||||
operate = {
|
||||
over: true,
|
||||
code: data.code,
|
||||
operation: data.operation,
|
||||
cmdType: this.cmdType,
|
||||
param: data.param
|
||||
};
|
||||
|
||||
} else if (data.nextCmdType) {
|
||||
operate = {
|
||||
over: true,
|
||||
operation: data.operation,
|
||||
cmdType: data.nextCmdType
|
||||
};
|
||||
} else {
|
||||
operate = {
|
||||
operation: data.operateNext
|
||||
};
|
||||
}
|
||||
this.trainingOperation(operate);
|
||||
|
||||
},
|
||||
// 执行操作
|
||||
trainingOperation(operate) {
|
||||
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.error(error);
|
||||
this.$refs.noticeInfo.doShow();
|
||||
});
|
||||
},
|
||||
resetMbmButton() {
|
||||
this.commandTypeList = [];
|
||||
this.$store.dispatch('menuOperation/setButtonOperation', null);
|
||||
Handler.clear(); // 清空操作组
|
||||
},
|
||||
buttonDown(operation, commandTypeList) {
|
||||
buttonDown(operation) {
|
||||
// 清空当前的选择的设备
|
||||
this.deviceList = [];
|
||||
if (operation != this.Command.cancel.clearMbm.operation) {
|
||||
const operate = {
|
||||
operation: operation
|
||||
};
|
||||
|
||||
const operate = {
|
||||
start: true,
|
||||
operation: operation
|
||||
};
|
||||
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.commandTypeList = [];
|
||||
this.$store.dispatch('menuOperation/setButtonOperation', null);
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
Handler.clear(); // 清空操作组
|
||||
}
|
||||
});
|
||||
// 以下 会弹出密码框 (总人解,区故解,道岔解封,解封按钮,总取消,引导总锁) 待修改
|
||||
const operationList = [
|
||||
// this.Signal.humanTrainRoute.button.operation,
|
||||
this.Section.fault.button.operation
|
||||
// this.Switch.unlock.button.operation,
|
||||
// this.MixinCommand.unblock.button.operation,
|
||||
// this.Station.guideLock.button.operation
|
||||
// // this.MixinCommand.totalCancel.button.operation
|
||||
];
|
||||
|
||||
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.operation = operation;
|
||||
this.$store.dispatch('menuOperation/setButtonOperation', operation); // 按钮菜单是否被按下
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
// 判断是否需要 弹窗密码框
|
||||
if (operationList.includes(operation)) {
|
||||
operate['operateNext'] = this.Command.close.password.operation;
|
||||
this.$refs.password.doShow(operate);
|
||||
}
|
||||
this.$store.dispatch('training/emitTipFresh');
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
const operate = {
|
||||
start: true,
|
||||
operation: operation
|
||||
};
|
||||
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/setButtonOperation', null);
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
Handler.clear(); // 清空操作组
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -90,11 +206,13 @@ export default {
|
||||
padding-top:5px;
|
||||
padding-bottom:5px;
|
||||
outline:none;
|
||||
border-right-color:#A8A8A8;
|
||||
border-bottom: none;
|
||||
border-left:none;
|
||||
}
|
||||
.menu {
|
||||
background-color: $bg;
|
||||
position: fixed;
|
||||
border: 1px solid gray;
|
||||
z-index: 10;
|
||||
display: block;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user