rt-sim-training-client/src/api/rtSimulation.js
2021-06-17 17:52:28 +08:00

114 lines
2.9 KiB
JavaScript

import request from '@/utils/request';
/** 创建仿真 */
export function createSimulation(data) {
return request({
url: `/rtSimulation?mapId=${data.mapId}&prdType=${data.prdType}`,
method: 'post'
});
}
/** 根据仿真group获取仿真基础信息 */
export function getSimulationInfoByGroup(groupId) {
return request({
url: `/common/simulation/${groupId}`,
method: 'get'
});
}
/** 根据仿真group获取仿真地图数据 */
export function getMapDataByGroup(groupId) {
return request({
url: `/rtSimulation/${groupId}/mapData`,
method: 'get'
});
}
/** 仿真发送指令 */
export function sendSimulationCommand(group, memberId, type, data) {
return request({
url: `/common/simulation/${group}/member/${memberId}/operate/${type}`,
method: 'post',
data
});
}
/** 获取仿真成员列表 */
export function getMemberListCommon(group, role) {
if (!role) {
role = '';
}
return request({
url: `/common/simulation/${group}/members?role=${role}`,
method: 'get'
});
}
/** 获取仿真用户列表 */
export function getUserListCommon(group) {
return request({
url: `/common/simulation/${group}/users`,
method: 'get'
});
}
/** 销毁仿真 */
export function destroySimulation(group) {
return request({
url: `/common/simulation/${group}/destroy`,
method: 'delete'
});
}
/** 初始化仿真 */
export function initSimulation(group) {
return request({
url: `/common/simulation/${group}/init`,
method: 'put'
});
}
/** 设置故障 */
export function setSimulationFault(group, data) {
return request({
url: `/common/simulation/${group}/fault`,
method: 'post',
data
});
}
/** 取消故障 */
export function cancelSimulationFault(group, deviceId, faultType) {
return request({
url: `/common/simulation/${group}/device/${deviceId}/fault/${faultType}`,
method: 'delete'
});
}
/** 仿真运行倍速 */
export function timesSpeedPlayback(group, speed) {
return request({
url: `/common/simulation/${group}/updateSpeed/${speed}`,
method: 'put'
});
}
/** 仿真暂停 */
export function simulationPause(group) {
return request({
url: `/common/simulation/${group}/pause`,
method: 'put'
});
}
/** 仿真开始 */
export function simulationStart(group) {
return request({
url: `/common/simulation/${group}/start`,
method: 'put'
});
}
/** 获取存在的仿真列表 */
export function getExistSimulationList(params) {
return request({
url: `/common/simulation/list`,
method: 'get',
params
});
}
/** 获取仿真用户信息 */
export function getSimulationUserInfo(id) {
return request({
url: `/common/simulation/${id}/users`,
method: 'get'
});
}