From 43fe4d728a44d3214ecb884576d19a4fc0bf9cc1 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Wed, 26 Aug 2020 17:25:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=89=A7=E6=9C=AC=E6=8F=90=E7=A4=BA=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/covertOperation.js | 127 ++++++++++++++++++ .../scriptDisplay/component/scriptTip.vue | 31 +---- 2 files changed, 130 insertions(+), 28 deletions(-) create mode 100644 src/views/newMap/displayNew/scriptDisplay/component/covertOperation.js diff --git a/src/views/newMap/displayNew/scriptDisplay/component/covertOperation.js b/src/views/newMap/displayNew/scriptDisplay/component/covertOperation.js new file mode 100644 index 000000000..e036f9cc8 --- /dev/null +++ b/src/views/newMap/displayNew/scriptDisplay/component/covertOperation.js @@ -0,0 +1,127 @@ +import CMD from '@/scripts/cmdPlugin/CommandEnum'; +import store from '@/store/index_APP_TARGET'; +// 操作 +export const operateEnum = { + Set_Fault:{ + + }, + Cancel_Fault:{ + + }, + Signal: { + code:'signalCode', + type:'信号机', + Signal_Set_Route:{ + code:'routeCode', + isDevice:true, + isList:false, + name:'进路' + }, + Signal_Open_Auto_Setting:{ + code:'routeCodeList', + isDevice:true, + isList:true, + name:'进路列表' + }, + Signal_Close_Auto_Setting:{ + code:'routeCodeList', + isDevice:true, + isList:true, + name:'进路列表' + } + }, + Switch:{ + code:'switchCode', + type:'道岔', + Switch_Set_Limit_Speed:{ + code:'speedLimitValue', + name:'限速值为' + }, + Switch_Cancel_Limit_Speed:{ + code:'speedLimitValue', + name:'限速值为' + } + }, + Section:{ + code:'sectionCode', + type:'区段', + Section_Set_Limit_Speed:{ + code:'speedLimitValue', + name:'限速值为' + }, + Section_Cancel_Limit_Speed:{ + code:'speedLimitValue', + name:'限速值为' + } + }, + Stand:{ + code:'standCode', + type:'站台' + }, + Station:{ + code:'stationCode', + type:'车站' + }, + Driver:{ + // code:'stationCode', + type:'司机' + } +}; + +// 转换函数 +export function covertOperate(operationType, operationParamMap) { + if (operationType == 'Set_Fault' || operationType == 'Cancel_Fault') { + // covertOperation(operationType); + } else { + const device = operationType.split('_')[0]; + const operateName = Object.values(CMD[device]).find(res=>{ return res.value == operationType; }); + const deviceInfo = covertOperation(device, operationParamMap, operationType); + let tip = '请找到' + deviceInfo.deviceName + ','; + if (deviceInfo.paramName) { + tip += '参数为:' + deviceInfo.paramName + ','; + } + tip += ' 执行【' + operateName.label + '】操作'; + return tip; + } +} + +function covertOperation(deviceType, operationParamMap, operationType) { + let deviceName = ''; + let paramName = ''; + const device = store.getters['map/getDeviceByCode'](operationParamMap[operateEnum[deviceType].code]); + if (device._type == 'StationStand') { + const station = store.getters['map/getDeviceByCode'](device.stationCode); + deviceName += '【车站-' + station.name + '】/'; + } + if (device._type == 'Section') { + if (device.parentCode) { + const parentSection = store.getters['map/getDeviceByCode'](device.parentCode); + deviceName += '【' + operateEnum[deviceType].type + ' ' + parentSection.name + '-' + device.name + '】'; + } + } else { + deviceName += '【' + operateEnum[deviceType].type + ' ' + device.name + '】'; + } + const paramInfo = operateEnum[deviceType][operationType]; + if (paramInfo) { + if (paramInfo.isDevice) { + if (paramInfo.isList) { + paramName += '【' + paramInfo.name + ' '; + } else { + paramName += '【' + paramInfo.name + ' '; + paramName += getRouteNameById(operationParamMap[paramInfo.code]) + '】'; + } + } else { + + } + } + return {deviceName:deviceName, paramName:paramName}; +} + +function getRouteNameById(routeId) { + const routeList = store.state.map.routeList; + const route = routeList.find(route=>{ + return route.code == routeId; + }); + if (route) { return route.name; } else { return ''; } +} + diff --git a/src/views/newMap/displayNew/scriptDisplay/component/scriptTip.vue b/src/views/newMap/displayNew/scriptDisplay/component/scriptTip.vue index c555273c3..27e939399 100644 --- a/src/views/newMap/displayNew/scriptDisplay/component/scriptTip.vue +++ b/src/views/newMap/displayNew/scriptDisplay/component/scriptTip.vue @@ -2,7 +2,7 @@
{{ scriptTipMessage }}