代码调整
This commit is contained in:
parent
8223c252fc
commit
3971a33039
@ -21,5 +21,8 @@ export default {
|
||||
createStepInfo: 'Creating Procedure Information',
|
||||
editStepInfo: 'Modifying Step Information',
|
||||
saveStepData: 'Save Step Information',
|
||||
roleSelect: 'role choices'
|
||||
roleSelect: 'role choices',
|
||||
triggerCondition: 'triggering condition',
|
||||
operateCondition: 'operating conditions',
|
||||
completionCondition: 'completion conditions'
|
||||
};
|
||||
|
@ -21,5 +21,8 @@ export default {
|
||||
createStepInfo: '创建步骤信息',
|
||||
editStepInfo: '修改步骤信息',
|
||||
saveStepData: '保存步骤',
|
||||
roleSelect: '角色选择'
|
||||
roleSelect: '角色选择',
|
||||
triggerCondition: '触发条件',
|
||||
operateCondition: '操作条件',
|
||||
completionCondition: '完成条件'
|
||||
};
|
||||
|
@ -1,7 +1,8 @@
|
||||
<template>
|
||||
<div class="train">
|
||||
<div v-show="maskOpen" class="trainMask" />
|
||||
<jlmap-visual ref="jlmapVisual" />
|
||||
<component :is="menus" :selected="selected" />
|
||||
<jlmap-visual ref="jlmapVisual" @onSelect="clickEvent" @onMenu="onContextmenu" />
|
||||
<menu-demon ref="menuDemon" />
|
||||
<voice-chat-box v-if="$route.query.lineCode == '16'" ref="chatbox" :group="group" :user-role="userRole" />
|
||||
<chat-box v-else ref="chatbox" :group="group" :user-role="userRole" />
|
||||
@ -21,6 +22,10 @@ import { getToken } from '@/utils/auth';
|
||||
import chatBox from '@/views/newMap/chatView/chatBox.vue';
|
||||
import VoiceChatBox from '@/views/newMap/chatView/voiceChatBox.vue';
|
||||
import MenuDemon from '@/views/trainingManage/demonMenu.vue';
|
||||
import { getDeviceMenuByDeviceType, MouseEvent } from '@/scripts/ConstDic';
|
||||
import deviceType from '@/jmapNew/constant/deviceType.js';
|
||||
import { EventBus } from '@/scripts/event-bus';
|
||||
|
||||
export default {
|
||||
name: 'TrainingDesign',
|
||||
components: {
|
||||
@ -37,6 +42,8 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
selected: null,
|
||||
menus: null,
|
||||
maskOpen: false
|
||||
};
|
||||
},
|
||||
@ -87,6 +94,13 @@ export default {
|
||||
},
|
||||
'$store.state.socket.simulationOver':function(val) {
|
||||
this.backOut();
|
||||
},
|
||||
'$store.state.map.mapDataLoadedCount': function () {
|
||||
const lineCode = this.$jlmap.lineCode;
|
||||
if (lineCode) {
|
||||
this.menus = this.$theme.loadMenuComponent(lineCode);
|
||||
this.$store.commit('training/notifyGetCommandDefinition', lineCode);
|
||||
}
|
||||
}
|
||||
},
|
||||
async beforeDestroy() {
|
||||
@ -99,14 +113,174 @@ export default {
|
||||
this.initLoadData();
|
||||
},
|
||||
methods: {
|
||||
// 获取设备数据
|
||||
getDeviceByEm(em) {
|
||||
var device = this.$store.getters['map/getDeviceByCode'](em.deviceCode) || null;
|
||||
if (device) {
|
||||
device._viewVal = em.val;
|
||||
}
|
||||
return device;
|
||||
},
|
||||
// 根据皮肤类型转换激活的菜单类型
|
||||
getSelectedByLineCode(device) {
|
||||
const switchSectionIsWitchLineCodeList = ['03'];
|
||||
const lineCode = this.$store.getters['map/lineCode'];
|
||||
if (switchSectionIsWitchLineCodeList.includes(lineCode) && device._type == deviceType.Section) {
|
||||
const section = this.$store.getters['map/getDeviceByCode'](device._code);
|
||||
if (section) {
|
||||
device = this.$store.getters['map/getDeviceByCode'](section.relSwitchCode);
|
||||
}
|
||||
}
|
||||
// 过滤道岔相关区段变成道岔model
|
||||
if (device._type == 'Section' && device.type == '03') {
|
||||
device = this.$store.getters['map/getDeviceByCode'](device.switch.code);
|
||||
}
|
||||
|
||||
return device;
|
||||
},
|
||||
clickEvent(em) {
|
||||
this.$store.dispatch('map/setTrainWindowShow', false);
|
||||
var device = { _type: em.deviceType, _code: em.deviceCode, _event: MouseEvent.Left };
|
||||
|
||||
const lineCode = this.$store.getters['map/lineCode'];
|
||||
if (em.deviceType === 'StationStand' && lineCode === '01') {
|
||||
const menu = getDeviceMenuByDeviceType(device._type) || [];
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: { x: em.clientX, y: em.clientY }, menu: menu });
|
||||
}
|
||||
|
||||
if (em.deviceCode) {
|
||||
device = this.getDeviceByEm(em);
|
||||
}
|
||||
this.selected = { ...device, _event: MouseEvent.Left };
|
||||
this.$store.dispatch('menuOperation/setSelected', {device: this.selected, subType: em.subType});
|
||||
this.$store.dispatch('menuOperation/setLeftClickCount');
|
||||
if (this.$route.query.lineCode == '07') {
|
||||
this.$store.dispatch('menuOperation/setMenuChange', {device: device, subType: em.subType});
|
||||
}
|
||||
this.$store.dispatch('training/emitTipFresh');
|
||||
if (this.$store.state.map.selectDevice && this.$store.state.map.selectDevice.flag && device._type) {
|
||||
if (device._type.toUpperCase() == this.$store.state.map.selectDevice.type.toUpperCase()) {
|
||||
EventBus.$emit('selectDevice', device);
|
||||
} else {
|
||||
const name = this.typeObj[this.$store.state.map.selectDevice.type];
|
||||
const info = '选择的设备类型不正确' + (name ? `,请选择${name}类型` : '');
|
||||
this.$message.info(info);
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
onContextmenu(em) {
|
||||
var menu = null;
|
||||
var device = null;
|
||||
const point = { x: em.clientX, y: em.clientY };
|
||||
const lineCode = this.$store.getters['map/lineCode'];
|
||||
if (em.subType === 'TrainWindow') {
|
||||
if (lineCode != '06') {
|
||||
device = { _type: deviceType.TrainWindow, code: em.deviceCode, _event: MouseEvent.Right };
|
||||
this.$store.dispatch('map/setTrainWindowShow', true);
|
||||
}
|
||||
} else if (em.subType == 'button' && em.deviceType == 'Station') { // 宁波一号线右键显示控制模式
|
||||
const equipment = this.getDeviceByEm(em);
|
||||
this.$store.dispatch('menuOperation/setSelected', {device:equipment, subType: em.subType});
|
||||
menu = getDeviceMenuByDeviceType('StationControl');
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: menu });
|
||||
this.$store.dispatch('training/emitTipFresh');
|
||||
device = this.getDeviceByEm(em);
|
||||
this.selected = { ...device, _event: MouseEvent.Right};
|
||||
return;
|
||||
} else if (em.subType == 'light' && em.deviceType == 'Station') { // 宁波一号线右键显示强制点灯
|
||||
const equipment = this.getDeviceByEm(em);
|
||||
this.$store.dispatch('menuOperation/setSelected', { device: equipment, subType: em.subType });
|
||||
menu = getDeviceMenuByDeviceType('StationLight');
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: menu });
|
||||
this.$store.dispatch('training/emitTipFresh');
|
||||
device = this.getDeviceByEm(em);
|
||||
this.selected = { ...device, _event: MouseEvent.Right};
|
||||
return;
|
||||
} else if (em.subType == 'preReset' && em.deviceType == 'Station') { // 宁波一号线右键显示计轴复位
|
||||
const equipment = this.getDeviceByEm(em);
|
||||
this.$store.dispatch('menuOperation/setSelected', { device: equipment, subType: em.subType });
|
||||
menu = getDeviceMenuByDeviceType('StationPreReset');
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: menu });
|
||||
this.$store.dispatch('training/emitTipFresh');
|
||||
device = this.getDeviceByEm(em);
|
||||
this.selected = { ...device, _event: MouseEvent.Right};
|
||||
return;
|
||||
} else if (em.subType == 'enabled' && em.deviceType == 'Switch') {
|
||||
menu = getDeviceMenuByDeviceType('Enabled');
|
||||
const equipment = this.getDeviceByEm(em);
|
||||
this.$store.dispatch('menuOperation/setSelected', { device: equipment, subType: em.subType });
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: menu });
|
||||
device = this.getDeviceByEm(em);
|
||||
this.selected = { ...device, _event: MouseEvent.Right};
|
||||
return;
|
||||
} else if (em.subType === 'enabled' && em.deviceType === 'Signal') {
|
||||
menu = getDeviceMenuByDeviceType('Enabled');
|
||||
const equipment = this.getDeviceByEm(em);
|
||||
this.$store.dispatch('menuOperation/setSelected', { device: equipment, subType: em.subType });
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: menu});
|
||||
device = this.getDeviceByEm(em);
|
||||
this.selected = { ...device, _event: MouseEvent.Right};
|
||||
return;
|
||||
} else if (em.deviceCode && !this.isScreen) {
|
||||
device = this.getDeviceByEm(em);
|
||||
}
|
||||
if (device) {
|
||||
device = this.getSelectedByLineCode(device);
|
||||
this.selected = { ...device, _event: MouseEvent.Right};
|
||||
if (!this.buttonOperation) {
|
||||
this.$store.dispatch('menuOperation/setSelected', {device: this.selected, subType: em.subType});
|
||||
if (!this.checkShouldPop(device)) {
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: null });
|
||||
} else {
|
||||
if (em.deviceType === 'StationStand' && lineCode === '01') {
|
||||
return;
|
||||
}
|
||||
menu = getDeviceMenuByDeviceType(device._type);
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: menu });
|
||||
}
|
||||
} else if (this.$route.query.ctc) {
|
||||
this.$store.dispatch('menuOperation/setSelected', {device: this.selected, subType: em.subType});
|
||||
menu = getDeviceMenuByDeviceType(device._type);
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: menu });
|
||||
}
|
||||
} else {
|
||||
menu = getDeviceMenuByDeviceType('Cancel');
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: menu });
|
||||
}
|
||||
this.$store.dispatch('training/emitTipFresh');
|
||||
},
|
||||
checkShouldPop(device) {
|
||||
const lineCode = this.$store.getters['map/lineCode'];
|
||||
if (device) {
|
||||
if (device._type === 'Signal') {
|
||||
return device._viewVal === '3';
|
||||
} else if (device._type === 'StationControl' && lineCode == '01') { // 中控模式显示范围
|
||||
return device._viewVal === '1';
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
},
|
||||
initLoadData() { // 加载地图数据
|
||||
if (this.$route.query.group) {
|
||||
loadMapDataById(this.mapId, 'simulation');
|
||||
} else {
|
||||
this.$store.dispatch('training/changeMode', { mode: null });
|
||||
loadMapDataById(this.mapId, 'preview');
|
||||
// this.$store.dispatch('training/changeMode', { mode: null });
|
||||
// loadMapDataById(this.mapId, 'preview');
|
||||
this.endViewLoading();
|
||||
}
|
||||
},
|
||||
// 结束加载状态
|
||||
endViewLoading(isSuccess) {
|
||||
if (!isSuccess) {
|
||||
this.$store.dispatch('map/mapClear');
|
||||
}
|
||||
|
||||
this.$nextTick(() => {
|
||||
EventBus.$emit('viewLoading', false);
|
||||
});
|
||||
},
|
||||
async statusMessage(list) {
|
||||
await this.$store.dispatch('training/updateMapState', list);
|
||||
await this.$store.dispatch('socket/setEquipmentStatus');
|
||||
|
@ -5,7 +5,7 @@
|
||||
<span class="titleStyle">{{ $t('trainingManage.editTagTitle') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog :title="title" :visible.sync="dialogVisible" width="800px" :modal="false" :before-close="doClose" center>
|
||||
<el-dialog :title="title" :visible.sync="dialogVisible" :width="dialogWidth" :modal="false" :close-on-click-modal="false" :before-close="doClose" center :style="{'margin-left': dialogMarginLeft + 'px'}">
|
||||
<div class="stepListBox">
|
||||
<el-button size="small" type="primary" @click="addStep">新增步骤</el-button>
|
||||
<QueryListPage ref="queryListPage" :query-form="queryForm" :query-list="queryList" />
|
||||
@ -37,6 +37,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogWidth: '1100px',
|
||||
tabVisible: false,
|
||||
dialogVisible: false,
|
||||
formModel: {
|
||||
@ -80,6 +81,24 @@ export default {
|
||||
type: 'basic',
|
||||
edit: true
|
||||
},
|
||||
{
|
||||
title: this.$t('trainingManage.triggerCondition'),
|
||||
prop: 'triggerCondition',
|
||||
type: 'basic',
|
||||
edit: true
|
||||
},
|
||||
{
|
||||
title: this.$t('trainingManage.operateCondition'),
|
||||
prop: 'operations',
|
||||
type: 'basic',
|
||||
edit: true
|
||||
},
|
||||
{
|
||||
title: this.$t('trainingManage.completionCondition'),
|
||||
prop: 'completionCondition',
|
||||
type: 'basic',
|
||||
edit: true
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
title: this.$t('global.operate'),
|
||||
@ -101,6 +120,11 @@ export default {
|
||||
const t = this.$t('trainingManage.editTagTitle');
|
||||
return t;
|
||||
},
|
||||
dialogMarginLeft() {
|
||||
const w = this.$store.state.app.width;
|
||||
const ml = (w - parseInt(this.dialogWidth)) / 2;
|
||||
return ml;
|
||||
},
|
||||
group() {
|
||||
return this.$route.query.group;
|
||||
}
|
||||
@ -243,6 +267,15 @@ export default {
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
/deep/ .el-dialog__wrapper {
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
top: auto;
|
||||
right: auto;
|
||||
bottom: auto;
|
||||
left: auto;
|
||||
overflow: visible !important;
|
||||
}
|
||||
.editContentTab{
|
||||
position: absolute;
|
||||
z-index: 10;
|
||||
|
Loading…
Reference in New Issue
Block a user