Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/jl-client into test
This commit is contained in:
commit
242840f244
@ -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 ''; }
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
<div v-if="scriptTipMessage!=''" class="scriptTipMessage" :style="{top:offset+'px'}">{{ scriptTipMessage }}</div>
|
||||
</template>
|
||||
<script>
|
||||
import CMD from '@/scripts/cmdPlugin/CommandEnum';
|
||||
import {covertOperate} from './covertOperation.js';
|
||||
export default {
|
||||
name:'ScriptTip',
|
||||
props: {
|
||||
@ -27,33 +27,8 @@ export default {
|
||||
if (val.type == 'Conversation') {
|
||||
this.scriptTipMessage = '请说:' + val.content;
|
||||
} else if (val.type == 'Operation') {
|
||||
const commandName = val.operationType;
|
||||
let deviceName = '';
|
||||
let operateName = {};
|
||||
if (commandName == 'Set_Fault') {
|
||||
operateName.label = '设置故障';
|
||||
} else if (commandName == 'Cancel_Fault') {
|
||||
operateName.label = '取消故障';
|
||||
} else {
|
||||
let device = val.operationType.split('_')[0];
|
||||
const deviceCodeType = ['Signal', 'Switch', 'Section', 'Stand', 'Station'];
|
||||
const deviceTypeName = ['信号机', '道岔', '区段', '站台', '车站'];
|
||||
const deviceCodeTypeParam = ['signalCode', 'switchCode', 'sectionCode', 'standCode', 'stationCode'];
|
||||
const deviceIndex = deviceCodeType.indexOf(device);
|
||||
if (deviceIndex >= 0) {
|
||||
const deviceIns = this.$store.getters['map/getDeviceByCode'](val.operationParamMap[deviceCodeTypeParam[deviceIndex]]);
|
||||
const station = this.$store.getters['map/getDeviceByCode'](deviceIns.stationCode);
|
||||
if (deviceIndex == 3) {
|
||||
deviceName += '车站【' + station.name + '】,';
|
||||
}
|
||||
deviceName += deviceTypeName[deviceIndex] + '【' + deviceIns.name + '】';
|
||||
}
|
||||
if (device == 'CM') {
|
||||
device = 'ControlConvertMenu';
|
||||
}
|
||||
operateName = Object.values(CMD[device]).find(res=>{ return res.value == commandName; });
|
||||
}
|
||||
this.scriptTipMessage = '请找到' + deviceName + ',执行【' + operateName.label + '】操作';
|
||||
this.scriptTipMessage = covertOperate(val.operationType, val.operationParamMap);
|
||||
// this.scriptTipMessage = '请找到' + deviceName + ',执行【' + operateName.label + '】操作';
|
||||
} else if (val.type == 'Over_Conversation') {
|
||||
this.scriptTipMessage = '请结束当前会话';
|
||||
} else if (val.type == 'Start_Conversation' ) {
|
||||
|
Loading…
Reference in New Issue
Block a user