剧本提示代码调整

This commit is contained in:
joylink_cuiweidong 2020-08-26 18:42:00 +08:00
parent f2df9fb453
commit df2f5705c4

View File

@ -56,7 +56,50 @@ export const operateEnum = {
}, },
Stand:{ Stand:{
code:'standCode', code:'standCode',
type:'站台' type:'站台',
Stand_Set_Park_Time:{
isList:true,
params:[
{
code:'parkingTime',
name:'控制方式',
result:[
{data:-1, name:'自动', judge:'='},
{data:-1, name:'人工', judge:'>', showUnit:'秒'}
]
},
{
code:'parkingAlwaysValid',
name:'有效次数',
result:[
{data:true, name:'一直有效', judge:'='},
{data:false, name:'一次有效', judge:'='}
]
}
]
},
Stand_Set_Run_Time:{
isList:true,
params:[
{
code:'runLevelTime',
name:'区间运行时间',
result:[
{data:0, name:'自动', judge:'='},
{data:0, name:'非自动', judge:'>', showUnit:'秒'}
]
},
{
code:'runLevelTimeForever',
name:'有效次数',
result:[
{data:true, name:'一直有效', judge:'='},
{data:false, name:'一次有效', judge:'='}
]
}
]
}
}, },
Station:{ Station:{
code:'stationCode', code:'stationCode',
@ -77,10 +120,10 @@ export function covertOperate(operationType, operationParamMap) {
const operateName = Object.values(CMD[device]).find(res=>{ return res.value == operationType; }); const operateName = Object.values(CMD[device]).find(res=>{ return res.value == operationType; });
const deviceInfo = covertOperation(device, operationParamMap, operationType); const deviceInfo = covertOperation(device, operationParamMap, operationType);
let tip = '请找到' + deviceInfo.deviceName + ''; let tip = '请找到' + deviceInfo.deviceName + '';
if (deviceInfo.paramName) {
tip += '参数为:' + deviceInfo.paramName + '';
}
tip += ' 执行【' + operateName.label + '】操作'; tip += ' 执行【' + operateName.label + '】操作';
if (deviceInfo.paramName) {
tip += ',参数为:' + deviceInfo.paramName;
}
return tip; return tip;
} }
} }
@ -111,7 +154,39 @@ function covertOperation(deviceType, operationParamMap, operationType) {
paramName += getRouteNameById(operationParamMap[paramInfo.code]) + '】'; paramName += getRouteNameById(operationParamMap[paramInfo.code]) + '】';
} }
} else { } else {
if (paramInfo.isList) {
const params = paramInfo.params;
if (params && params.length > 0) {
paramName += '【';
params.forEach(param=>{
paramName += ' ' + param.name;
const data = operationParamMap[param.code];
param.result.forEach(result=>{
switch (result.judge) {
case '=': {
if (data == result.data) {
paramName += '为' + result.name;
if (result.showUnit) {
paramName += ',值为' + data + result.showUnit;
}
}
break;
} case '>': {
if (data > result.data) {
paramName += '为' + result.name;
if (result.showUnit) {
paramName += ',值为' + data + result.showUnit;
}
}
break;
}
}
});
paramName += ',';
});
paramName += '】';
}
}
} }
} }
return {deviceName:deviceName, paramName:paramName}; return {deviceName:deviceName, paramName:paramName};