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

379 lines
8.0 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'
// });
// }
/** 录制脚本仿真*/
export function scriptRecordNotify(questId) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/questRecord/${questId}`,
method: 'get'
});
2019-07-26 13:32:43 +08:00
}
/** 保存剧本背景*/
export function saveScriptScenes(group) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/${group}/questRecord/scenes`,
method: 'post'
});
2019-07-26 13:32:43 +08:00
}
/** 保存录制任务数据*/
export function saveScriptData(group) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/${group}/questRecord`,
method: 'post'
});
2019-07-26 13:32:43 +08:00
}
/** 清除仿真剧本数据*/
export function dumpScriptData(scriptId) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/${scriptId}/clearScriptRecord`,
method: 'post'
});
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
}
/** 根据成员角色查询设备列表*/
export function getDevicesByRole(group, params) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/${group}/role/devices`,
method: 'get',
params
});
2019-07-26 13:32:43 +08:00
}
/** 获取任务录制的成员角色列表 */
export function getMembersByGroup(group) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/${group}/questRecord/members`,
method: 'get'
});
2019-07-26 13:32:43 +08:00
}
/** 添加任务角色成员 */
export function postQuestMember(group, data) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/${group}/questRecord/member`,
method: 'post',
data
});
2019-07-26 13:32:43 +08:00
}
/** 删除任务角色成员 */
export function deleteQuestMember(group, memberId) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/${group}/questRecord/member/${memberId}`,
method: 'delete'
});
2019-07-26 13:32:43 +08:00
}
// /** 添加/修改任务角色行为 */
export function postMemberBehavior(group, memberId, data) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/${group}/questRecord/${memberId}/behavior`,
method: 'post',
data
});
2019-07-26 13:32:43 +08:00
}
/** 删除任务角色行为 */
export function deleteMemberBehavior(group, memberId, behaviorId) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/${group}/questRecord/${memberId}/behavior/${behaviorId}`,
method: 'delete'
});
2019-07-26 13:32:43 +08:00
}
/** 删除任务角色行为动作 */
export function deleteMemberBehaviorAction(group, memberId, behaviorId, actionId) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/${group}/questRecord/${memberId}/behavior/${behaviorId}/action/${actionId}`,
method: 'delete'
});
2019-07-26 13:32:43 +08:00
}
/** 添加/修改任务角色行为动作 */
export function postMemberBehaviorAction(group, memberId, behaviorId, data) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/${group}/questRecord/${memberId}/behavior/${behaviorId}/action`,
method: 'post',
data
});
2019-07-26 13:32:43 +08:00
}
/** 添加/修改任务目标条件*/
export function postTargetConditionAction(group, data) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/${group}/questRecord/targetCondition`,
method: 'post',
data
});
2019-07-26 13:32:43 +08:00
}
/** 删除任务目标条件*/
export function deleteTargetConditionAction(group, tcId) {
2019-08-08 14:32:32 +08:00
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
}
/** 根据设备类型获取设备条件列表 */
export function getDeviceCoditionByDeviceType(params) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/deviceType/conditions`,
method: 'get',
params
});
2019-07-26 13:32:43 +08:00
}
/** 获取任务录制的数据*/
export function getQuestRecord(group) {
2019-08-08 14:32:32 +08:00
return request({
url: `/api/simulation/${group}/questRecord`,
method: 'get'
});
2019-07-26 13:32:43 +08:00
}
/** 加载任务*/
2019-08-12 19:30:50 +08:00
export function loadQuest(questId, memberId, group) {
return request({
url: `/api/simulation/${group}/quest/${questId}?memberId=${memberId}`,
method: 'post'
});
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
});
}