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

522 lines
12 KiB
JavaScript
Raw Normal View History

2019-07-26 13:32:43 +08:00
import request from '@/utils/request';
/** 获取故障规则列表*/
export function getFailureGenerateRules(params) {
2019-11-07 15:54:49 +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-11-07 15:54:49 +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-11-07 15:54:49 +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-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/${group}/over`,
method: 'put'
});
2019-07-26 13:32:43 +08:00
}
/**
* 退出仿真系统
*/
export function runDiagramQuit(group) {
2019-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/${group}/quit`,
method: 'put'
});
2019-07-26 13:32:43 +08:00
}
/** 获取仿真系统时间*/
export function runDiagramGetTime(group) {
2019-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/${group}/systemTime`,
method: 'get'
});
2019-07-26 13:32:43 +08:00
}
// 查看是否开始按计划行车
export function runDiagramIsStart(group) {
2019-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/${group}/isRunPlanStart`,
method: 'get'
});
2019-07-26 13:32:43 +08:00
}
/**
* 仿真系统CBTC
* @param {*} mapId
*/
2019-12-27 19:36:29 +08:00
export function simulationNotify({ mapId, prdType }) {
2019-11-07 15:54:49 +08:00
return request({
2019-12-27 19:36:29 +08:00
url: `/api/simulation/${mapId}/${prdType}`,
2019-11-07 15:54:49 +08:00
method: 'get'
});
2019-07-26 13:32:43 +08:00
}
/**
* 实训系统CBTC
* @param {*} data
*/
export function trainingNotify({ trainingId }) {
2019-11-07 15:54:49 +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-11-07 15:54:49 +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-11-07 15:54:49 +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-11-07 15:54:49 +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-11-07 15:54:49 +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-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/${statsId}`,
method: 'delete'
});
2019-07-26 13:32:43 +08:00
}
/** 获取用户鼠标左键选中的设备信息*/
export function letfMouseSelectDevice(deviceCode, group) {
2019-11-07 15:54:49 +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-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/${group}/runPlan`,
method: 'get'
});
2019-07-26 13:32:43 +08:00
}
/** 录制脚本仿真*/
2019-08-15 14:06:53 +08:00
export function scriptRecordNotify(scriptId) {
2019-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/scriptWrite/${scriptId}`,
method: 'get'
});
2019-07-26 13:32:43 +08:00
}
/** 保存剧本背景*/
export function saveScriptScenes(group) {
2019-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/${group}/scriptWrite/scenes`,
method: 'put'
});
2019-07-26 13:32:43 +08:00
}
/** 保存录制任务数据*/
export function saveScriptData(group) {
2019-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/${group}/scriptWrite/saveData`,
method: 'put'
});
2019-08-16 09:25:12 +08:00
}
/** 更新任务地图定位信息*/
export function updateMapLocation(group, data) {
2019-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/${group}/scriptWrite/mapLocation`,
method: 'put',
data
});
2019-08-16 09:25:12 +08:00
}
/** 获取剧本编制的所有成员角色*/
export function getScriptMemberData(group) {
2019-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/${group}/scriptWrite/members`,
method: 'get'
});
2019-07-26 13:32:43 +08:00
}
2019-08-21 18:45:16 +08:00
/** 获取剧本出演成员角色 */
export function getScriptPlayMember(group) {
2019-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/${group}/scriptWrite/players`,
method: 'get'
});
2019-08-21 18:45:16 +08:00
}
/** 取消剧本演出成员角色 */
export function cancleScriptMembers(group, data) {
2019-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/${group}/scriptWrite/removePlayers`,
method: 'put',
data
});
2019-08-21 18:45:16 +08:00
}
/** 选择剧本演出成员角色 */
export function selectScriptMembers(group, data) {
2019-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/${group}/scriptWrite/choosePlayers`,
method: 'put',
data
});
2019-08-21 18:45:16 +08:00
}
/** 修改剧本演出成员性别 */
export function modifyScriptMemberSex(group, playerId, data) {
2019-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/${group}/scriptWrite/player/${playerId}?gender=${data.gender}`,
method: 'put'
});
2019-08-21 18:45:16 +08:00
}
2019-07-26 13:32:43 +08:00
/** 清除仿真剧本数据*/
2019-08-16 17:15:20 +08:00
export function dumpScriptData(group) {
2019-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/${group}/scriptWrite/saveData`,
method: 'delete'
});
2019-07-26 13:32:43 +08:00
}
/** 查询录制剧本步骤*/
export function queryScriptStep(group) {
2019-11-07 15:54:49 +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-11-07 15:54:49 +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-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/${group}/scriptWrite/action`,
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-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/${group}/scriptWrite/action/${actionId}`,
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-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/${group}/scriptWrite/action/${actionId}`,
method: 'put',
data
});
2019-07-26 13:32:43 +08:00
}
2019-08-16 09:25:12 +08:00
2019-07-26 13:32:43 +08:00
/** 分页查询存在的仿真 */
export function getExistingSimulation(params) {
2019-11-07 15:54:49 +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-11-07 15:54:49 +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-11-07 15:54:49 +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 getScriptRecord(group) {
2019-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/${group}/scriptWrite`,
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-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/${group}/quest/${questId}?memberId=${memberId}`,
method: 'post'
});
2019-08-16 13:43:46 +08:00
}
/** 加载剧本 */
export function loadScript(scriptId, memberId, group) {
2019-11-07 15:54:49 +08:00
return request({
url: `api/simulation/${group}/script/${scriptId}?memberId=${memberId}`,
method: 'post'
});
2019-08-16 13:43:46 +08:00
}
/** 退出剧本*/
export function quitScript(group) {
2019-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/${group}/script`,
method: 'delete'
});
2019-07-26 13:32:43 +08:00
}
/** 退出任务*/
export function quitQuest(group) {
2019-11-07 15:54:49 +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-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/${group}`,
method: 'get'
});
2019-08-08 10:31:46 +08:00
}
/** 获取可用的设备指令*/
2019-08-20 17:54:40 +08:00
export function getAvailableDeviceCommand(params) {
2019-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/deviceCommand/available`,
method: 'get',
params
});
2019-08-08 10:31:46 +08:00
}
/** 保存/修改任务剧本*/
2019-08-08 14:32:32 +08:00
export function saveTaskScript(group, data) {
2019-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/${group}/questRecord/script`,
method: 'post',
data
});
2019-08-08 14:32:32 +08:00
}
2019-08-19 18:24:06 +08:00
/** 暂停剧本编制的仿真 */
export function scriptPause(group) {
2019-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/${group}/scriptWrite/pause`,
method: 'post'
});
2019-08-19 18:24:06 +08:00
}
/** 恢复仿真运行并执行刚编辑的剧本动作 */
export function executeScript(group) {
2019-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/${group}/scriptWrite/execute`,
method: 'post'
});
2019-08-19 18:24:06 +08:00
}
2019-08-29 13:52:34 +08:00
/** 生成用户自己的当日运行图*/
export function generateDayRunPlan(planId, group) {
2019-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/${group}/loadRunPlan/${planId}`,
method: 'post'
});
2019-08-29 13:52:34 +08:00
}
2019-08-30 09:00:36 +08:00
2019-09-03 18:37:00 +08:00
/** 创建派班计划仿真*/
2019-08-30 09:00:36 +08:00
export function schedulingNotify(params) {
2019-11-07 15:54:49 +08:00
return request({
url: `/api/scheduling/simulation`,
method: 'post',
params
});
2019-08-30 09:00:36 +08:00
}
2019-10-16 14:00:30 +08:00
/** 获取PLC网关 */
export function getPlcGateway(group) {
2019-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/${group}/plcGateway`,
method: 'get'
});
2019-10-16 14:00:30 +08:00
}
/** 处理ibp盘事件 */
export function handlerIbpEvent(group, data) {
2019-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/${group}/ibp/event`,
method: 'post',
data: data
});
2019-10-16 14:00:30 +08:00
}
/** 预览脚本仿真*/
export function scriptDraftRecordNotify(scriptId) {
2019-11-07 15:54:49 +08:00
return request({
url: `/api/simulation/scriptDraft/${scriptId}`,
method: 'get'
});
}
2019-12-30 09:00:16 +08:00
/** 新版地图创建仿真 */
export function createSimulationNew(params) {
return request({
url: `/simulation`,
method: 'get',
params
});
}
/** 新版地图根据仿真group获取仿真基础信息 */
export function getSimulationInfoNew(group) {
return request({
url: `/simulation/${group}`,
method: 'get'
});
}
/** 新版地图根据仿真group获取仿真地图数据 */
export function getNewMapDataByGroup(group) {
return request({
url: `/simulation/${group}/mapData`,
method: 'get'
});
}
/** 新版地图指令操作定义 */
export function newMapOperate(group, operationId, data) {
2019-12-30 09:57:54 +08:00
return request({
url: `/simulation/${group}/operate/${operationId}`,
method: 'post',
data: data
});
2019-12-30 09:00:16 +08:00
}
/** 新版地图根据group获取仿真运行图 */
2020-01-02 09:22:44 +08:00
export function getEveryDayRunPlanNew(group) {
2019-12-30 09:00:16 +08:00
return request({
url: `/simulation/${group}/runPlan`,
method: 'get'
});
}
2020-01-03 15:52:51 +08:00
2020-01-17 11:31:53 +08:00
/** 新版地图按计划行车 */
export function ranAsPlan(data, group) {
return request({
url: `/simulation/${group}/ranAsPlan`,
method: 'post',
data: data
});
}
/** 新版地图清理仿真 */
export function clearSimulation(group) {
return request({
url: `/simulation/${group}/clear`,
method: 'delete'
});
}
2020-01-03 15:52:51 +08:00
/** 查询进路信息*/
export function querySignalStatus(group, params) {
return request({
url: `/api/simulation/${group}/status/signal`,
method: 'get',
params
});
}
2020-02-13 11:19:06 +08:00
/** 获取仿真运行图车次号列表 */
export function getTripNumberList(group) {
return request({
url: `/simulation/${group}/tripNumbers`,
method: 'get'
});
}
/** 根据车次号获取服务号 */
export function getServiceNumbersByTripNum(group, tripNumber) {
return request({
url: `/simulation/${group}/serviceNumber`,
method: 'get',
params: {
tripNumber: tripNumber
}
});
}
2020-02-24 17:04:39 +08:00
/** 根据计划时间获取此时间点可加载的最大列车数量 */
export function getLoadTrainNumber(params, group) {
return request({
url: `/simulation/${group}/loadTrainNumber`,
method: 'get',
params
});
}
/** 推出按计划行车 */
export function exitRunPlan (group) {
return request({
url: `/simulation/${group}/planOver`,
method: 'post'
});
}