rt-sim-training-client/src/api/simulation.js

438 lines
9.4 KiB
JavaScript
Raw Normal View History

2019-07-26 13:32:43 +08:00
import request from '@/utils/request';
/** 获取故障规则列表*/
export function getFailureGenerateRules(params) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/failureGenerateRules`,
method: 'get',
params: params
});
2019-07-26 13:32:43 +08:00
}
/** 设置自动故障*/
export function setFailureMode(data, group) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/${group}/failureMode`,
method: 'post',
data: data
});
2019-07-26 13:32:43 +08:00
}
/**
* 仿真系统按计划行车
*/
export function runDiagramStart(params, group) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/${group}/start`,
method: 'put',
params: params
});
2019-07-26 13:32:43 +08:00
}
/**
* 仿真系统结束计划行车
*/
export function runDiagramOver(group) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/${group}/over`,
method: 'put'
});
2019-07-26 13:32:43 +08:00
}
/**
* 退出仿真系统
*/
export function runDiagramQuit(group) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/${group}/quit`,
method: 'put'
});
2019-07-26 13:32:43 +08:00
}
/** 获取仿真系统时间*/
export function runDiagramGetTime(group) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/${group}/systemTime`,
method: 'get'
});
2019-07-26 13:32:43 +08:00
}
// 查看是否开始按计划行车
export function runDiagramIsStart(group) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/${group}/isRunPlanStart`,
method: 'get'
});
2019-07-26 13:32:43 +08:00
}
/**
* 仿真系统CBTC
* @param {*} mapId
*/
export function simulationNotify({ mapId, code }) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/${mapId}/${code}`,
method: 'get'
});
2019-07-26 13:32:43 +08:00
}
/**
* 大屏系统CBTC
* @param {*} mapId
*/
export function bitScreenNotify({ mapId }) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/bigScreen/${mapId}`,
method: 'get'
});
2019-07-26 13:32:43 +08:00
}
/**
* 实训系统CBTC
* @param {*} data
*/
export function trainingNotify({ trainingId }) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/training/${trainingId}`,
method: 'get'
});
2019-07-26 13:32:43 +08:00
}
/**
* 考试系统CBTC
* @param {*} data
*/
export function examNotify({ examId }) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/exam/${examId}`,
method: 'get'
});
2019-07-26 13:32:43 +08:00
}
2019-08-08 14:32:32 +08:00
/** 获取用户实训列表*/
2019-07-26 13:32:43 +08:00
export function getSimulationList(data) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/stats`,
method: 'get',
params: data
});
2019-07-26 13:32:43 +08:00
}
2019-08-08 14:32:32 +08:00
/** 添加用户仿真数据*/
2019-07-26 13:32:43 +08:00
export function postSimulationStats(data) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/stats`,
method: 'post',
data: data
});
2019-07-26 13:32:43 +08:00
}
2019-08-08 14:32:32 +08:00
/** 更新用户仿真数据*/
2019-07-26 13:32:43 +08:00
export function putSimulationStats(data) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/${data.id}/stats`,
method: 'put',
data: data
});
2019-07-26 13:32:43 +08:00
}
2019-08-08 14:32:32 +08:00
/** 删除用户仿真数据*/
2019-07-26 13:32:43 +08:00
export function deleteSimulationStats(statsId) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/${statsId}`,
method: 'delete'
});
2019-07-26 13:32:43 +08:00
}
/** 获取用户鼠标左键选中的设备信息*/
export function letfMouseSelectDevice(deviceCode, group) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/${group}/device/${deviceCode}`,
method: 'get'
});
2019-07-26 13:32:43 +08:00
}
/** 获取每日运行图*/
export function getEveryDayRunPlanData(group) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/${group}/runPlan`,
method: 'get'
});
2019-07-26 13:32:43 +08:00
}
/** 生成手机同步仿真二维码*/
// export function getSimulationQrCodeUrl(group) {
// return request({
// url: `/api/simulation/${group}/qrCode`,
// method: 'post'
// });
// }
/** 录制脚本仿真*/
2019-08-15 14:06:53 +08:00
export function scriptRecordNotify(scriptId) {
2019-08-08 14:32:32 +08:00
return request({
2019-08-15 14:06:53 +08:00
url: `/api/simulation/scriptWrite/${scriptId}`,
2019-08-08 14:32:32 +08:00
method: 'get'
});
2019-07-26 13:32:43 +08:00
}
/** 保存剧本背景*/
export function saveScriptScenes(group) {
2019-08-08 14:32:32 +08:00
return request({
2019-08-16 09:25:12 +08:00
url: `/api/simulation/${group}/scriptWrite/scenes`,
method: 'put'
2019-08-08 14:32:32 +08:00
});
2019-07-26 13:32:43 +08:00
}
/** 保存录制任务数据*/
export function saveScriptData(group) {
2019-08-08 14:32:32 +08:00
return request({
2019-08-16 09:25:12 +08:00
url: `/api/simulation/${group}/scriptWrite/saveData`,
method: 'put'
});
}
/** 更新任务地图定位信息*/
export function updateMapLocation(group, data) {
return request({
url: `/api/simulation/${group}/scriptWrite/mapLocation`,
method: 'put',
data
});
}
/** 获取剧本编制的所有成员角色*/
export function getScriptMemberData(group) {
return request({
url: `/api/simulation/${group}/scriptWrite/members`,
method: 'get'
2019-08-08 14:32:32 +08:00
});
2019-07-26 13:32:43 +08:00
}
/** 清除仿真剧本数据*/
2019-08-16 17:15:20 +08:00
export function dumpScriptData(group) {
2019-08-08 14:32:32 +08:00
return request({
2019-08-16 17:15:20 +08:00
url: `/api/simulation/${group}/scriptWrite/saveData`,
method: 'delete'
2019-08-08 14:32:32 +08:00
});
2019-07-26 13:32:43 +08:00
}
/** 查询录制剧本步骤*/
export function queryScriptStep(group) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/${group}/scriptRecordStage`,
method: 'get'
});
2019-07-26 13:32:43 +08:00
}
/** 获取指定时间里可加载列车的个数*/
export function getDesignatedTimeTrainNum(params, group) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/${group}/plan/trainNum`,
method: 'get',
params
});
2019-07-26 13:32:43 +08:00
}
2019-08-16 09:25:12 +08:00
/** 添加剧本动作 */
export function addScriptAction(group, data) {
2019-08-08 14:32:32 +08:00
return request({
2019-08-16 09:25:12 +08:00
url: `/api/simulation/${group}/scriptWrite/action`,
2019-08-08 14:32:32 +08:00
method: 'post',
data
});
2019-07-26 13:32:43 +08:00
}
2019-08-16 09:25:12 +08:00
/** 删除剧本动作 */
export function deleteScriptAction(group, actionId) {
2019-08-08 14:32:32 +08:00
return request({
2019-08-16 09:25:12 +08:00
url: `/api/simulation/${group}/scriptWrite/action/${actionId}`,
2019-08-08 14:32:32 +08:00
method: 'delete'
});
2019-07-26 13:32:43 +08:00
}
2019-08-16 09:25:12 +08:00
/** 修改剧本动作 */
export function modifyScriptAction(group, actionId, data) {
2019-08-08 14:32:32 +08:00
return request({
2019-08-16 09:25:12 +08:00
url: `/api/simulation/${group}/scriptWrite/action/${actionId}`,
method: 'put',
2019-08-08 14:32:32 +08:00
data
});
2019-07-26 13:32:43 +08:00
}
2019-08-16 09:25:12 +08:00
// /** 根据成员角色查询设备列表*/
// export function getDevicesByRole(group, params) {
// return request({
// url: `/api/simulation/${group}/role/devices`,
// method: 'get',
// params
// });
// }
// /** 获取任务录制的成员角色列表 */
// export function getMembersByGroup(group) {
// return request({
// url: `/api/simulation/${group}/questRecord/members`,
// method: 'get'
// });
// }
// /** 添加任务角色成员 */
// export function postQuestMember(group, data) {
// return request({
// url: `/api/simulation/${group}/questRecord/member`,
// method: 'post',
// data
// });
// }
// /** 删除任务角色成员 */
// export function deleteQuestMember(group, memberId) {
// return request({
// url: `/api/simulation/${group}/questRecord/member/${memberId}`,
// method: 'delete'
// });
// }
// // /** 添加/修改任务角色行为 */
// export function postMemberBehavior(group, memberId, data) {
// return request({
// url: `/api/simulation/${group}/questRecord/${memberId}/behavior`,
// method: 'post',
// data
// });
// }
// /** 删除任务角色行为 */
// export function deleteMemberBehavior(group, memberId, behaviorId) {
// return request({
// url: `/api/simulation/${group}/questRecord/${memberId}/behavior/${behaviorId}`,
// method: 'delete'
// });
// }
// /** 删除任务角色行为动作 */
// export function deleteMemberBehaviorAction(group, memberId, behaviorId, actionId) {
// return request({
// url: `/api/simulation/${group}/questRecord/${memberId}/behavior/${behaviorId}/action/${actionId}`,
// method: 'delete'
// });
// }
// /** 添加/修改任务角色行为动作 */
// export function postMemberBehaviorAction(group, memberId, behaviorId, data) {
// return request({
// url: `/api/simulation/${group}/questRecord/${memberId}/behavior/${behaviorId}/action`,
// method: 'post',
// data
// });
// }
// /** 添加/修改任务目标条件*/
// export function postTargetConditionAction(group, data) {
// return request({
// url: `/api/simulation/${group}/questRecord/targetCondition`,
// method: 'post',
// data
// });
// }
// /** 删除任务目标条件*/
// export function deleteTargetConditionAction(group, tcId) {
// return request({
// url: `/api/simulation/${group}/questRecord/targetCondition/${tcId}`,
// method: 'delete'
// });
// }
2019-07-26 13:32:43 +08:00
/** 分页查询存在的仿真 */
export function getExistingSimulation(params) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/manage/page`,
method: 'get',
params
});
2019-07-26 13:32:43 +08:00
}
/** 删除存在的仿真 */
export function deleteExistingSimulation(group) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/manage/${group}`,
method: 'delete'
});
2019-07-26 13:32:43 +08:00
}
/** 根据设备类型获取设备列表 */
export function getDeviceCodeByDeviceType(group, params) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/${group}/deviceType/devices`,
method: 'get',
params
});
2019-07-26 13:32:43 +08:00
}
2019-08-16 09:25:12 +08:00
// /** 根据设备类型获取设备条件列表 */
// export function getDeviceCoditionByDeviceType(params) {
// return request({
// url: `/api/simulation/deviceType/conditions`,
// method: 'get',
// params
// });
// }
/** 获取任务录制的数据 */
export function getScriptRecord(group) {
2019-08-08 14:32:32 +08:00
return request({
2019-08-16 09:25:12 +08:00
url: `/api/simulation/${group}/scriptWrite`,
2019-08-08 14:32:32 +08:00
method: 'get'
});
2019-07-26 13:32:43 +08:00
}
/** 加载任务*/
2019-08-12 19:30:50 +08:00
export function loadQuest(questId, memberId, group) {
2019-08-16 13:43:46 +08:00
return request({
url: `/api/simulation/${group}/quest/${questId}?memberId=${memberId}`,
method: 'post'
});
}
/** 加载剧本 */
export function loadScript(scriptId, memberId, group) {
return request({
url: `api/simulation/${group}/script/${scriptId}?memberId=${memberId}`,
method: 'post'
});
}
/** 退出剧本*/
export function quitScript(group) {
return request({
url: `/api/simulation/${group}/script`,
method: 'delete'
});
2019-07-26 13:32:43 +08:00
}
/** 退出任务*/
export function quitQuest(group) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/${group}/quest`,
method: 'put'
});
2019-07-26 13:32:43 +08:00
}
/** 根据group获取仿真对象*/
export function getSimulationInfo(group) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/${group}`,
method: 'get'
});
2019-08-08 10:31:46 +08:00
}
/** 获取可用的设备指令*/
export function getAvailableDeviceCommand() {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/deviceCommand/available`,
method: 'get'
});
2019-08-08 10:31:46 +08:00
}
/** 保存/修改任务剧本*/
2019-08-08 14:32:32 +08:00
export function saveTaskScript(group, data) {
return request({
url: `/api/simulation/${group}/questRecord/script`,
method: 'post',
data
});
}