修改代码

This commit is contained in:
ival 2019-11-18 14:44:01 +08:00
parent f2dd239467
commit 50e9a242e7
37 changed files with 2972 additions and 3132 deletions

View File

@ -2,74 +2,74 @@ import request from '@/utils/request';
/** 根据皮肤获取地图版本信息*/ /** 根据皮肤获取地图版本信息*/
export function getPublishMapVersion(skinCode) { export function getPublishMapVersion(skinCode) {
return request({ return request({
url: `/api/map/skin/${skinCode}/version`, url: `/api/map/skin/${skinCode}/version`,
method: 'get' method: 'get'
}); });
} }
/** 根据皮肤获取发布地图详细内容*/ /** 根据皮肤获取发布地图详细内容*/
export function getPublishMapDetail(skinCode) { export function getPublishMapDetail(skinCode) {
const datad = request({ const datad = request({
url: `/api/map/skin/${skinCode}/details`, url: `/api/map/skin/${skinCode}/details`,
method: 'get' method: 'get'
}); });
return datad.then(); return datad.then();
} }
/** 根据地图id获取地图信息*/ /** 根据地图id获取地图信息*/
export function getPublishMapInfo(mapId) { export function getPublishMapInfo(mapId) {
return request({ return request({
url: `/api/map/${mapId}`, url: `/api/map/${mapId}`,
method: 'get' method: 'get'
}); });
} }
/** 获取草稿地图详细内容*/ /** 获取草稿地图详细内容*/
export function getMapDetail(id) { export function getMapDetail(id) {
return request({ return request({
url: `/api/mapBuild/${id}/mapDataDetail`, url: `/api/mapBuild/${id}/mapDataDetail`,
method: 'get' method: 'get'
}); });
} }
/** 创建地图3d数据*/ /** 创建地图3d数据*/
export function set3dMapData(data) { export function set3dMapData(data) {
return request({ return request({
url: `/api/mapBuild/3dMapData`, url: `/api/mapBuild/3dMapData`,
method: 'post', method: 'post',
data: data data: data
}); });
} }
/** 通过地图id获取地图3d数据*/ /** 通过地图id获取地图3d数据*/
export function get3dMapData(mapId) { export function get3dMapData(mapId) {
return request({ return request({
url: `/api/mapBuild/3dMapData/${mapId}`, url: `/api/mapBuild/3dMapData/${mapId}`,
method: 'get' method: 'get'
}); });
} }
/** 更新地图3d数据*/ /** 更新地图3d数据*/
export function update3dMapData(data) { export function update3dMapData(data) {
return request({ return request({
url: `/api/mapBuild/3dMapData/${data.id}`, url: `/api/mapBuild/3dMapData/${data.id}`,
method: 'put', method: 'put',
data: data data: data
}); });
} }
/** 获取模型资源列表*/ /** 获取模型资源列表*/
export function loadmap3dModel() { export function loadmap3dModel() {
return request({ return request({
url: `/api/map3dModel/all`, url: `/api/map3dModel/all`,
method: 'get' method: 'get'
}); });
} }
export function getPublish3dMapDetail(skinCode) { export function getPublish3dMapDetail(skinCode) {
const datad = request({ const datad = request({
url: `/api/map/${skinCode}/3dMapData`, url: `/api/map/${skinCode}/3dMapData`,
method: 'get' method: 'get'
}); });
return datad.then(); return datad.then();
} }

View File

@ -2,272 +2,272 @@ import request from '@/utils/request';
/** 获取地图树形类表*/ /** 获取地图树形类表*/
export function getMapTree() { export function getMapTree() {
return request({ return request({
url: '/api/mapBuild/tree', url: '/api/mapBuild/tree',
method: 'get' method: 'get'
}); });
} }
/** 草稿地图列表*/ /** 草稿地图列表*/
export function listMap() { export function listMap() {
return request({ return request({
url: '/api/mapBuild/list', url: '/api/mapBuild/list',
method: 'get' method: 'get'
}); });
} }
/** 获取草稿地图详细内容*/ /** 获取草稿地图详细内容*/
export function getMapDetail(id) { export function getMapDetail(id) {
return request({ return request({
url: `/api/mapBuild/${id}/mapDataDetail`, url: `/api/mapBuild/${id}/mapDataDetail`,
method: 'get' method: 'get'
}); });
} }
/** 新建草稿地图*/ /** 新建草稿地图*/
export function newMap(data) { export function newMap(data) {
return request({ return request({
url: '/api/mapBuild/create', url: '/api/mapBuild/create',
method: 'post', method: 'post',
data: data data: data
}); });
} }
/** 更新草稿地图*/ /** 更新草稿地图*/
export function updateMap(data) { export function updateMap(data) {
return request({ return request({
url: `/api/mapBuild/${data.id}`, url: `/api/mapBuild/${data.id}`,
method: 'put', method: 'put',
data: data data: data
}); });
} }
/** 删除草稿地图*/ /** 删除草稿地图*/
export function deleteMap(data) { export function deleteMap(data) {
return request({ return request({
url: `/api/mapBuild/delete/${data}`, url: `/api/mapBuild/delete/${data}`,
method: 'delete' method: 'delete'
}); });
} }
/** 保存草稿地图*/ /** 保存草稿地图*/
export function saveMap(data) { export function saveMap(data) {
return request({ return request({
url: `/api/mapBuild/${data.mapId}/saveElements`, url: `/api/mapBuild/${data.mapId}/saveElements`,
method: 'post', method: 'post',
data: data data: data
}); });
} }
/** 草稿地图另存为*/ /** 草稿地图另存为*/
export function saveAsMap(data) { export function saveAsMap(data) {
return request({ return request({
url: `/api/mapBuild/${data.id}/saveAs`, url: `/api/mapBuild/${data.id}/saveAs`,
method: 'post', method: 'post',
data: { data: {
name: data.name name: data.name
} }
}); });
} }
/** 使用发布地图新建草稿地图*/ /** 使用发布地图新建草稿地图*/
export function newUsePublishMap(data) { export function newUsePublishMap(data) {
return request({ return request({
url: '/api/mapBuild/createFrom', url: '/api/mapBuild/createFrom',
method: 'post', method: 'post',
data: data data: data
}); });
} }
/** 发布地图*/ /** 发布地图*/
export function publishMap(data) { export function publishMap(data) {
return request({ return request({
url: `/api/mapBuild/${data.id}/publish`, url: `/api/mapBuild/${data.id}/publish`,
method: 'post', method: 'post',
data: data data: data
}); });
} }
/** 草稿地图数据导入*/ /** 草稿地图数据导入*/
export function postBuildMapImport(data) { export function postBuildMapImport(data) {
return request({ return request({
url: `/api/mapBuild/import`, url: `/api/mapBuild/import`,
method: 'post', method: 'post',
data: data, data: data,
time: 60000 time: 60000
}); });
} }
/** 查询进路列表*/ /** 查询进路列表*/
export function listRouteRoute(mapId, params) { export function listRouteRoute(mapId, params) {
return request({ return request({
url: `/api/mapBuild/${mapId}/route`, url: `/api/mapBuild/${mapId}/route`,
method: 'get', method: 'get',
params: params params: params
}); });
} }
/** 查询进路地图列表*/ /** 查询进路地图列表*/
export function listRouteMapRoute(mapId) { export function listRouteMapRoute(mapId) {
return request({ return request({
url: `/api/mapBuild/${mapId}/route/all`, url: `/api/mapBuild/${mapId}/route/all`,
method: 'get' method: 'get'
}); });
} }
/** 查询进路明细*/ /** 查询进路明细*/
export function queryRouteRouteDetail(data) { export function queryRouteRouteDetail(data) {
return request({ return request({
url: `/api/mapBuild/route/${data.id}`, url: `/api/mapBuild/route/${data.id}`,
method: 'get' method: 'get'
}); });
} }
/** 创建进路*/ /** 创建进路*/
export function createRouteRoute(data) { export function createRouteRoute(data) {
return request({ return request({
url: `/api/mapBuild/route`, url: `/api/mapBuild/route`,
method: 'post', method: 'post',
data: data data: data
}); });
} }
/** 删除进路*/ /** 删除进路*/
export function deleteRouteRoute(id) { export function deleteRouteRoute(id) {
return request({ return request({
url: `/api/mapBuild/route/${id}`, url: `/api/mapBuild/route/${id}`,
method: 'delete' method: 'delete'
}); });
} }
/** 更新进路*/ /** 更新进路*/
export function updateRouteRoute(data) { export function updateRouteRoute(data) {
return request({ return request({
url: `/api/mapBuild/route/${data.id}`, url: `/api/mapBuild/route/${data.id}`,
method: 'put', method: 'put',
data: data data: data
}); });
} }
/** 创建联动道岔*/ /** 创建联动道岔*/
export function createLinkageSwitch(data) { export function createLinkageSwitch(data) {
return request({ return request({
url: `/api/mapBuild/switchCoupled`, url: `/api/mapBuild/switchCoupled`,
method: 'post', method: 'post',
data: data data: data
}); });
} }
/** 删除联动道岔*/ /** 删除联动道岔*/
export function deleteLinkageSwitch(coupleId) { export function deleteLinkageSwitch(coupleId) {
return request({ return request({
url: `/api/mapBuild/switchCoupled/${coupleId}`, url: `/api/mapBuild/switchCoupled/${coupleId}`,
method: 'delete' method: 'delete'
}); });
} }
/** get联动道岔列表*/ /** get联动道岔列表*/
export function listLinkageSwitch(mapId, params) { export function listLinkageSwitch(mapId, params) {
return request({ return request({
url: `/api/mapBuild/${mapId}/switchCoupled`, url: `/api/mapBuild/${mapId}/switchCoupled`,
method: 'get', method: 'get',
params: params params: params
}); });
} }
/** 草稿地图数据校验*/ /** 草稿地图数据校验*/
export function verifyMap(id) { export function verifyMap(id) {
return request({ return request({
url: `/api/mapBuild/${id}/checkData`, url: `/api/mapBuild/${id}/checkData`,
method: 'get' method: 'get'
}); });
} }
/** 分页查询交路数据*/ /** 分页查询交路数据*/
export function listRouting(mapId, params) { export function listRouting(mapId, params) {
return request({ return request({
url: `/api/mapBuild/${mapId}/routing`, url: `/api/mapBuild/${mapId}/routing`,
method: 'get', method: 'get',
params: params params: params
}); });
} }
/** 创建交路*/ /** 创建交路*/
export function addRouting(data) { export function addRouting(data) {
return request({ return request({
url: `/api/mapBuild/routing`, url: `/api/mapBuild/routing`,
method: 'post', method: 'post',
data: data data: data
}); });
} }
/** 删除交路*/ /** 删除交路*/
export function deleteRouting(routingId) { export function deleteRouting(routingId) {
return request({ return request({
url: `/api/mapBuild/routing/${routingId}`, url: `/api/mapBuild/routing/${routingId}`,
method: 'delete' method: 'delete'
}); });
} }
/** 获取交路详情*/ /** 获取交路详情*/
export function getRouting(routingId) { export function getRouting(routingId) {
return request({ return request({
url: `/api/mapBuild/routing/${routingId}`, url: `/api/mapBuild/routing/${routingId}`,
method: 'get' method: 'get'
}); });
} }
/** 更新交路*/ /** 更新交路*/
export function updateRouting(data) { export function updateRouting(data) {
return request({ return request({
url: `/api/mapBuild/routing/${data.id}`, url: `/api/mapBuild/routing/${data.id}`,
method: 'put', method: 'put',
data: data data: data
}); });
} }
// 创建自动信号 // 创建自动信号
export function postAutoSignal(data) { export function postAutoSignal(data) {
return request({ return request({
url: `/api/mapBuild/autoSignal`, url: `/api/mapBuild/autoSignal`,
method: 'post', method: 'post',
data: data data: data
}); });
} }
// 删除自动信号 // 删除自动信号
export function delAutoSignal(autoSignalId) { export function delAutoSignal(autoSignalId) {
return request({ return request({
url: `/api/mapBuild/autoSignal/${autoSignalId}`, url: `/api/mapBuild/autoSignal/${autoSignalId}`,
method: 'delete' method: 'delete'
}); });
} }
// 删除自动信号 // 删除自动信号
export function getAutoSignalList(mapId, params) { export function getAutoSignalList(mapId, params) {
return request({ return request({
url: `/api/mapBuild/${mapId}/autoSignal`, url: `/api/mapBuild/${mapId}/autoSignal`,
method: 'get', method: 'get',
params params
}); });
} }
// 获取自动信号 // 获取自动信号
export function getAutoSignalDetail(autoSignalId) { export function getAutoSignalDetail(autoSignalId) {
return request({ return request({
url: `/api/mapBuild/autoSignal/${autoSignalId}`, url: `/api/mapBuild/autoSignal/${autoSignalId}`,
method: 'get' method: 'get'
}); });
} }
// 更新自动信号 // 更新自动信号
export function putAutoSignal(data) { export function putAutoSignal(data) {
return request({ return request({
url: `/api/mapBuild/autoSignal/${data.autoSignalId}`, url: `/api/mapBuild/autoSignal/${data.autoSignalId}`,
method: 'put', method: 'put',
data: data data: data
}); });
} }
export function getListByCityCode(cityCode) { export function getListByCityCode(cityCode) {
return request({ return request({
url: `/api/mapBuild/${cityCode}/list`, url: `/api/mapBuild/${cityCode}/list`,
method: 'get' method: 'get'
}); });
} }

View File

@ -2,43 +2,43 @@ import request from '@/utils/request';
/** 获取路径单元列表*/ /** 获取路径单元列表*/
export function getRouteUnitList(id, data) { export function getRouteUnitList(id, data) {
return request({ return request({
url: `/api/mapBuild/${id}/routeUnit`, url: `/api/mapBuild/${id}/routeUnit`,
method: 'get', method: 'get',
params: data params: data
}); });
} }
/** 创建路径单元*/ /** 创建路径单元*/
export function addRouteUnit(data) { export function addRouteUnit(data) {
return request({ return request({
url: `/api/mapBuild/routeUnit`, url: `/api/mapBuild/routeUnit`,
method: 'post', method: 'post',
data: data data: data
}); });
} }
/** 删除路径单元*/ /** 删除路径单元*/
export function delRouteUnit(id) { export function delRouteUnit(id) {
return request({ return request({
url: `/api/mapBuild/routeUnit/${id}`, url: `/api/mapBuild/routeUnit/${id}`,
method: 'DELETE' method: 'DELETE'
}); });
} }
/** 获取路径单元*/ /** 获取路径单元*/
export function getRouteUnit(id) { export function getRouteUnit(id) {
return request({ return request({
url: `/api/mapBuild/routeUnit/${id}`, url: `/api/mapBuild/routeUnit/${id}`,
method: 'get' method: 'get'
}); });
} }
/** 更新路径单元*/ /** 更新路径单元*/
export function setRouteUnit(data) { export function setRouteUnit(data) {
return request({ return request({
url: `/api/mapBuild/routeUnit/${data.id}`, url: `/api/mapBuild/routeUnit/${data.id}`,
method: 'put', method: 'put',
data: data data: data
}); });
} }

View File

@ -1,49 +1,49 @@
import request from '@/utils/request'; import request from '@/utils/request';
export function list(dicId, params) { export function list(dicId, params) {
return request({ return request({
url: `/api/dictionary/${dicId}/detail/list`, url: `/api/dictionary/${dicId}/detail/list`,
method: 'get', method: 'get',
params: params params: params
}); });
} }
export function checkDicDetailCodeExist(dicId, code) { export function checkDicDetailCodeExist(dicId, code) {
return request({ return request({
url: `/api/dictionary/${dicId}/detail/checkExistByCode`, url: `/api/dictionary/${dicId}/detail/checkExistByCode`,
method: 'get', method: 'get',
params: { params: {
code: code code: code
} }
}); });
} }
export function getData(dicId, id) { export function getData(dicId, id) {
return request({ return request({
url: `/api/dictionary/${dicId}/detail/${id}`, url: `/api/dictionary/${dicId}/detail/${id}`,
method: 'get' method: 'get'
}); });
} }
export function create(dicId, data) { export function create(dicId, data) {
return request({ return request({
url: `/api/dictionary/${dicId}/detail/create`, url: `/api/dictionary/${dicId}/detail/create`,
method: 'post', method: 'post',
data: data data: data
}); });
} }
export function del(dicId, id) { export function del(dicId, id) {
return request({ return request({
url: `/api/dictionary/${dicId}/detail/delete/${id}`, url: `/api/dictionary/${dicId}/detail/delete/${id}`,
method: 'delete' method: 'delete'
}); });
} }
export function update(dicId, data) { export function update(dicId, data) {
return request({ return request({
url: `/api/dictionary/${dicId}/detail/update/${data.id}`, url: `/api/dictionary/${dicId}/detail/update/${data.id}`,
method: 'put', method: 'put',
data: data data: data
}); });
} }

View File

@ -2,127 +2,127 @@ import request from '@/utils/request';
/** 获取商品信息 */ /** 获取商品信息 */
export function getCommodityDetailByParams(data) { export function getCommodityDetailByParams(data) {
return request({ return request({
url: `/api/goods/detail`, url: `/api/goods/detail`,
method: 'get', method: 'get',
params: data params: data
}); });
} }
/** /**
* 获取商品明细列表 * 获取商品明细列表
*/ */
export function getCommodityList(params) { export function getCommodityList(params) {
return request({ return request({
url: '/api/goods', url: '/api/goods',
method: 'get', method: 'get',
params: params params: params
}); });
} }
/** /**
* 保存商品明细列表 * 保存商品明细列表
*/ */
export function saveCommodityList(params) { export function saveCommodityList(params) {
return request({ return request({
url: '/api/goods', url: '/api/goods',
method: 'post', method: 'post',
data: params data: params
}); });
} }
/** /**
* 删除商品明细 * 删除商品明细
*/ */
export function delCommodity(id) { export function delCommodity(id) {
return request({ return request({
url: `/api/goods/${id}`, url: `/api/goods/${id}`,
method: 'delete' method: 'delete'
}); });
} }
/** /**
* 获取商品地图产品课程列表 * 获取商品地图产品课程列表
*/ */
export function getMapLesson() { export function getMapLesson() {
return request({ return request({
url: `/api/goods/tree`, url: `/api/goods/tree`,
method: 'get' method: 'get'
}); });
} }
/** /**
* 获取商品地图产品课程列表 * 获取商品地图产品课程列表
*/ */
export function getCommodityDetailById(id) { export function getCommodityDetailById(id) {
return request({ return request({
url: `/api/goods/${id}`, url: `/api/goods/${id}`,
method: 'get' method: 'get'
}); });
} }
/** /**
* 获取商品地图产品课程列表 * 获取商品地图产品课程列表
*/ */
export function updataCommodityList(data) { export function updataCommodityList(data) {
return request({ return request({
url: `/api/goods/${data.id}`, url: `/api/goods/${data.id}`,
method: 'put', method: 'put',
data: data data: data
}); });
} }
/** /**
* 设置失效或有效切换 * 设置失效或有效切换
*/ */
export function setCommodityStatus(id) { export function setCommodityStatus(id) {
return request({ return request({
url: `/api/goods/${id}/status`, url: `/api/goods/${id}/status`,
method: 'put' method: 'put'
}); });
} }
/** 获取试用时长*/ /** 获取试用时长*/
export function getGoodsTryUse(data) { export function getGoodsTryUse(data) {
return request({ return request({
url: `/api/goods/tryUse`, url: `/api/goods/tryUse`,
method: 'get', method: 'get',
params: data params: data
}); });
} }
/** 设置试用时长*/ /** 设置试用时长*/
export function setGoodsTryUse(data) { export function setGoodsTryUse(data) {
return request({ return request({
url: `/api/goods/${data.goodsId}/tryUse`, url: `/api/goods/${data.goodsId}/tryUse`,
method: 'put', method: 'put',
data: { data: {
time: data.time time: data.time
} }
}); });
} }
/** 获取商品列表*/ /** 获取商品列表*/
export function getGoodsList() { export function getGoodsList() {
return request({ return request({
url: `/api/goods/list`, url: `/api/goods/list`,
method: 'get' method: 'get'
}); });
} }
// 通过权限判断有无商品 // 通过权限判断有无商品
export function getPermissionGoods(id) { export function getPermissionGoods(id) {
return request({ return request({
url: `/api/goods/list/permissionIds?permissionIds=${id}`, url: `/api/goods/list/permissionIds?permissionIds=${id}`,
method: 'get' method: 'get'
}); });
} }
// 创建商品 // 创建商品
export function postsPermissionGoods(data) { export function postsPermissionGoods(data) {
return request({ return request({
url: `/api/goods`, url: `/api/goods`,
method: 'post', method: 'post',
data: data data: data
}); });
} }

View File

@ -2,17 +2,17 @@ import request from '@/utils/request';
/** 获取组织/企业数据*/ /** 获取组织/企业数据*/
export function getOrganizationList() { export function getOrganizationList() {
return request({ return request({
url: '/api/organization', url: '/api/organization',
method: 'get' method: 'get'
}); });
} }
/** 添加组织/企业*/ /** 添加组织/企业*/
export function addOrganization(data) { export function addOrganization(data) {
return request({ return request({
url: '/api/organization', url: '/api/organization',
method: 'post', method: 'post',
data: data data: data
}); });
} }

View File

@ -2,34 +2,34 @@ import request from '@/utils/request';
/** 创建实训生成任务*/ /** 创建实训生成任务*/
export function addAutoGenerateTask(data) { export function addAutoGenerateTask(data) {
return request({ return request({
url: `/api/task`, url: `/api/task`,
method: 'post', method: 'post',
data: data data: data
}); });
} }
/** get任务列表*/ /** get任务列表*/
export function getTaskList(param) { export function getTaskList(param) {
return request({ return request({
url: '/api/task', url: '/api/task',
method: 'get', method: 'get',
params: param params: param
}); });
} }
/** 开始任务*/ /** 开始任务*/
export function postTask(data) { export function postTask(data) {
return request({ return request({
url: `/api/task/${data.id}/execute`, url: `/api/task/${data.id}/execute`,
method: 'post' method: 'post'
}); });
} }
/** 开始任务*/ /** 开始任务*/
export function postTaskCancel(id) { export function postTaskCancel(id) {
return request({ return request({
url: `/api/task/${id}/cancel`, url: `/api/task/${id}/cancel`,
method: 'post' method: 'post'
}); });
} }

View File

@ -2,75 +2,75 @@ import request from '@/utils/request';
/** 获取用户试题列表*/ /** 获取用户试题列表*/
export function generateExamList(examId) { export function generateExamList(examId) {
return request({ return request({
url: `/api/userExam/${examId}/generate`, url: `/api/userExam/${examId}/generate`,
method: 'get' method: 'get'
}); });
} }
/** 刷新考题列表*/ /** 刷新考题列表*/
export function refreshExamList(userExamId) { export function refreshExamList(userExamId) {
return request({ return request({
url: `/api/userExam/${userExamId}`, url: `/api/userExam/${userExamId}`,
method: 'get' method: 'get'
}); });
} }
/** 提交一个考题*/ /** 提交一个考题*/
export function finishOneExamQuestion(data) { export function finishOneExamQuestion(data) {
return request({ return request({
url: '/api/userExam/finish', url: '/api/userExam/finish',
method: 'put', method: 'put',
data: data data: data
}); });
} }
/** 考试完成提交*/ /** 考试完成提交*/
export function submitExam(examId) { export function submitExam(examId) {
return request({ return request({
url: `/api/userExam/${examId}/submit`, url: `/api/userExam/${examId}/submit`,
method: 'put' method: 'put'
}); });
} }
/** 获取用户考试列表*/ /** 获取用户考试列表*/
export function getPublishExam(data) { export function getPublishExam(data) {
return request({ return request({
url: `/api/userExam/list`, url: `/api/userExam/list`,
method: 'get', method: 'get',
params: data params: data
}); });
} }
/** 删除用户考试*/ /** 删除用户考试*/
export function delPublishExam(id) { export function delPublishExam(id) {
return request({ return request({
url: `/api/userExam/${id}`, url: `/api/userExam/${id}`,
method: 'delete' method: 'delete'
}); });
} }
/** 删除用户实训*/ /** 删除用户实训*/
export function delTrainingList() { export function delTrainingList() {
return request({ return request({
url: `/api/userExam/list`, url: `/api/userExam/list`,
method: 'delet' method: 'delet'
}); });
} }
/** 设置试卷失效 */ /** 设置试卷失效 */
export function setExamGive(id) { export function setExamGive(id) {
return request({ return request({
url: `/api/userExam/${id}/abandon`, url: `/api/userExam/${id}/abandon`,
method: 'put' method: 'put'
}); });
} }
export function updateExam(data) { export function updateExam(data) {
return request({ return request({
url: `/api/userExam/${data.id}`, url: `/api/userExam/${data.id}`,
method: 'put', method: 'put',
data: data data: data
}); });
} }

View File

@ -3,65 +3,65 @@ import request from '@/utils/request';
/** 分页查询仿真记录*/ /** 分页查询仿真记录*/
export function getSimulationRelpayList(params) { export function getSimulationRelpayList(params) {
return request({ return request({
url: `/api/simulationRecord`, url: `/api/simulationRecord`,
method: 'get', method: 'get',
params: params params: params
}); });
} }
// 删除回放 // 删除回放
export function delSimulationRecord(replayId) { export function delSimulationRecord(replayId) {
return request({ return request({
url: `/api/simulationRecord/${replayId}`, url: `/api/simulationRecord/${replayId}`,
method: 'delete' method: 'delete'
}); });
} }
/** 回放*/ /** 回放*/
export function simulationRelpay(replayId) { export function simulationRelpay(replayId) {
return request({ return request({
url: `/api/simulationRecord/${replayId}/playBack`, url: `/api/simulationRecord/${replayId}/playBack`,
method: 'get' method: 'get'
}); });
} }
// 结束回放 // 结束回放
export function putsSimulationRecord(replayId) { export function putsSimulationRecord(replayId) {
return request({ return request({
url: `/api/simulationRecord/${replayId}/over`, url: `/api/simulationRecord/${replayId}/over`,
method: 'put' method: 'put'
}); });
} }
// 暂停回放 // 暂停回放
export function putsSimulationRecordPause(replayId) { export function putsSimulationRecordPause(replayId) {
return request({ return request({
url: `/api/simulationRecord/${replayId}/pause`, url: `/api/simulationRecord/${replayId}/pause`,
method: 'put' method: 'put'
}); });
} }
// 播放回放 // 播放回放
export function putsSimulationRecordPlay(replayId) { export function putsSimulationRecordPlay(replayId) {
return request({ return request({
url: `/api/simulationRecord/${replayId}/play`, url: `/api/simulationRecord/${replayId}/play`,
method: 'put' method: 'put'
}); });
} }
// 设置速度回放 // 设置速度回放
export function putsSimulationRecordPlaySpeed(replayId, speed) { export function putsSimulationRecordPlaySpeed(replayId, speed) {
return request({ return request({
url: `/api/simulationRecord/${replayId}/playSpeed?playSpeed=${speed}`, url: `/api/simulationRecord/${replayId}/playSpeed?playSpeed=${speed}`,
method: 'put' method: 'put'
}); });
} }
// 播放 // 播放
export function putsSimulationRecordplayTime(replayId, offsetSeconds) { export function putsSimulationRecordplayTime(replayId, offsetSeconds) {
return request({ return request({
url: `/api/simulationRecord/${replayId}/playTime?offsetSeconds=${offsetSeconds}`, url: `/api/simulationRecord/${replayId}/playTime?offsetSeconds=${offsetSeconds}`,
method: 'put' method: 'put'
}); });
} }

View File

@ -2,88 +2,88 @@ import request from '@/utils/request';
// 课程列表 // 课程列表
export function getLessonList(code) { export function getLessonList(code) {
return request({ return request({
url: '/api/stats/lesson/list', url: '/api/stats/lesson/list',
method: 'get', method: 'get',
params: { params: {
wmCode: code wmCode: code
} }
}); });
} }
// 课程内实训数据统计 // 课程内实训数据统计
export function getLessonTimeChart(data) { export function getLessonTimeChart(data) {
return request({ return request({
url: `/api/stats/lesson/${data.id}/stats`, url: `/api/stats/lesson/${data.id}/stats`,
method: 'get', method: 'get',
params: { params: {
wmCode: data.code wmCode: data.code
} }
}); });
} }
// 查询参与考试的课程列表 // 查询参与考试的课程列表
export function getExamTree(code) { export function getExamTree(code) {
return request({ return request({
url: '/api/stats/exam/lessonList', url: '/api/stats/exam/lessonList',
method: 'get', method: 'get',
params: { params: {
wmCode: code wmCode: code
} }
}); });
} }
// 查询参与考试的试题列表 // 查询参与考试的试题列表
export function getstatsExamList(data) { export function getstatsExamList(data) {
return request({ return request({
url: `/api/stats/exam/${data.lessonId}/list`, url: `/api/stats/exam/${data.lessonId}/list`,
method: 'get', method: 'get',
params: { params: {
wmCode: data.code wmCode: data.code
} }
}); });
} }
// 个人考试数据统计 // 个人考试数据统计
export function getExamChart(data) { export function getExamChart(data) {
return request({ return request({
url: `/api/stats/exam/${data.examId}/stats`, url: `/api/stats/exam/${data.examId}/stats`,
method: 'get', method: 'get',
params: { params: {
wmCode: data.code wmCode: data.code
} }
}); });
} }
// 个人关注地图数据统计列表 // 个人关注地图数据统计列表
export function getRelevanceMapList(code) { export function getRelevanceMapList(code) {
return request({ return request({
url: `/api/user/subscribe`, url: `/api/user/subscribe`,
method: 'get', method: 'get',
params: { params: {
wmCode: code wmCode: code
} }
}); });
} }
// 仿真地图下产品列表 // 仿真地图下产品列表
export function getSimulationPrdList(mapId, code) { export function getSimulationPrdList(mapId, code) {
return request({ return request({
url: `/api/stats/simulation/${mapId}/prdList`, url: `/api/stats/simulation/${mapId}/prdList`,
method: 'get', method: 'get',
params: { params: {
wmCode: code wmCode: code
} }
}); });
} }
// 个人仿真数据统计 // 个人仿真数据统计
export function getSimulationTimeChart(data) { export function getSimulationTimeChart(data) {
return request({ return request({
url: `/api/stats/simulation/${data.mapId}/stats`, url: `/api/stats/simulation/${data.mapId}/stats`,
method: 'get', method: 'get',
params: { params: {
wmCode: data.code wmCode: data.code
} }
}); });
} }

View File

@ -1,9 +1,9 @@
import request from '@/utils/request'; import request from '@/utils/request';
export function getList(params) { export function getList(params) {
return request({ return request({
url: '/table/list', url: '/table/list',
method: 'get', method: 'get',
params params
}); });
} }

View File

@ -352,7 +352,7 @@ export function Jl3dDriving(updatemmi, sound) {
trainlisttest.list[code].speeds = data.body[i].speed; trainlisttest.list[code].speeds = data.body[i].speed;
trainlisttest.list[code].speeds = 0; trainlisttest.list[code].speeds = 0;
// trainlisttest.list[code].startmark = 1; // trainlisttest.list[code].startmark = 1;
}else { } else {
trainlisttest.list[code].speeds = data.body[i].speed; trainlisttest.list[code].speeds = data.body[i].speed;
trainlisttest.list[code].speeds = parseFloat(data.body[i].speed * 10 / 36 / 24 / trainlisttest.list[code].len); trainlisttest.list[code].speeds = parseFloat(data.body[i].speed * 10 / 36 / 24 / trainlisttest.list[code].len);
} }
@ -491,7 +491,7 @@ export function Jl3dDriving(updatemmi, sound) {
// console.log(trainlisttest.list[code].nextcurve.points); // console.log(trainlisttest.list[code].nextcurve.points);
// console.log("========================="); // console.log("=========================");
}else { } else {
let nextcode; let nextcode;
if (data.body[i].directionType == '02') { if (data.body[i].directionType == '02') {
if (rails.linkrail[data.body[i].linkCode].lineleft) { if (rails.linkrail[data.body[i].linkCode].lineleft) {

View File

@ -6,439 +6,439 @@ import router from '@/router';
// 定于仿真socket接口 // 定于仿真socket接口
export function Jlmap3dSubscribe(worker) { export function Jlmap3dSubscribe(worker) {
const scope = this; const scope = this;
this.map = null; this.map = null;
const webworker = worker; const webworker = worker;
var trainlisttest = null; var trainlisttest = null;
var sectionlist = null; var sectionlist = null;
var signallist = null; var signallist = null;
var stationstandlist = null; var stationstandlist = null;
var sectionlist = null; var sectionlist = null;
var materials = null; var materials = null;
var actions = null; var actions = null;
var scenes = null; var scenes = null;
var code = null; var code = null;
this.teststomp = new StompClient(); this.teststomp = new StompClient();
this.topic = displayTopic; this.topic = displayTopic;
const header = { group: router.currentRoute.query.group, 'X-Token': getToken() }; const header = { group: router.currentRoute.query.group, 'X-Token': getToken() };
this.updatamap = function (mapdata, materiallist, nowaction, scene) { this.updatamap = function (mapdata, materiallist, nowaction, scene) {
// console.log(mapdata); // console.log(mapdata);
scope.map = mapdata; scope.map = mapdata;
trainlisttest = this.map.trainlisttest; trainlisttest = this.map.trainlisttest;
sectionlist = this.map.sectionlist; sectionlist = this.map.sectionlist;
signallist = this.map.signallist; signallist = this.map.signallist;
stationstandlist = this.map.stationstandlist; stationstandlist = this.map.stationstandlist;
sectionlist = this.map.sectionlist; sectionlist = this.map.sectionlist;
materials = materiallist; materials = materiallist;
scenes = scene; scenes = scene;
actions = nowaction; actions = nowaction;
}; };
this.socketon = function (topic) { this.socketon = function (topic) {
try { try {
// console.log("teststomp"); // console.log("teststomp");
scope.teststomp.subscribe(topic, callback, header); scope.teststomp.subscribe(topic, callback, header);
} catch (error) { } catch (error) {
console.error('websocket订阅失败'); console.error('websocket订阅失败');
} }
}; };
this.socketoff = function (topic) { this.socketoff = function (topic) {
scope.teststomp.unsubscribe(topic); scope.teststomp.unsubscribe(topic);
}; };
// 仿真socket接口回调函数 // 仿真socket接口回调函数
function callback(Response) { function callback(Response) {
// 对象化数据 // 对象化数据
const data = JSON.parse(Response.body); const data = JSON.parse(Response.body);
// 遍历后台数据 // 遍历后台数据
// 判断消息类型 // 判断消息类型
// if(data.type == "Simulation_TrainPosition"){ // if(data.type == "Simulation_TrainPosition"){
// //
// //
// } // }
if (data.type == 'Simulation_DeviceStatus') { if (data.type == 'Simulation_DeviceStatus') {
if (data.body.length < 200) { if (data.body.length < 200) {
for (let i = data.body.length - 1; i >= 0; i--) { for (let i = data.body.length - 1; i >= 0; i--) {
if (data.body[i]._type == 'Train') { if (data.body[i]._type == 'Train') {
// console.log(data.body[i]); // console.log(data.body[i]);
// 遍历列车对象组 // 遍历列车对象组
// console.log(data.body[i]); // console.log(data.body[i]);
if (trainlisttest) { if (trainlisttest) {
code = data.body[i].code; code = data.body[i].code;
// 剔除不显示的车 // 剔除不显示的车
// 找到对应列车 // 找到对应列车
if (trainlisttest.list[code]) { if (trainlisttest.list[code]) {
// 车门开关验证 // 车门开关验证
// if(data.body[i].directionType == "02"){ // if(data.body[i].directionType == "02"){
if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '01') { if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '01') {
// console.log("close"); // console.log("close");
trainlisttest.list[code].doorStatus = '01'; trainlisttest.list[code].doorStatus = '01';
for (let an = actions[code].top.length - 1; an >= 0; an--) { for (let an = actions[code].top.length - 1; an >= 0; an--) {
actions[code].top[an].reset(); actions[code].top[an].reset();
actions[code].top[an].time = actions[code].top[an]._clip.duration; actions[code].top[an].time = actions[code].top[an]._clip.duration;
actions[code].top[an].timeScale = -1; actions[code].top[an].timeScale = -1;
actions[code].top[an].play(); actions[code].top[an].play();
} }
} else if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '02') { } else if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '02') {
// console.log("open"); // console.log("open");
trainlisttest.list[code].doorStatus = '02'; trainlisttest.list[code].doorStatus = '02';
for (let an = actions[code].top.length - 1; an >= 0; an--) { for (let an = actions[code].top.length - 1; an >= 0; an--) {
actions[code].top[an].reset(); actions[code].top[an].reset();
actions[code].top[an].time = 0; actions[code].top[an].time = 0;
actions[code].top[an].timeScale = 1; actions[code].top[an].timeScale = 1;
actions[code].top[an].play(); actions[code].top[an].play();
} }
} }
// }else{ // }else{
// if(trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == "01"){ // if(trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == "01"){
// //console.log("close"); // //console.log("close");
// trainlisttest.list[code].doorStatus = "01"; // trainlisttest.list[code].doorStatus = "01";
// for(let an=actions[code].down.length-1;an>=0;an--){ // for(let an=actions[code].down.length-1;an>=0;an--){
// actions[code].down[an].reset(); // actions[code].down[an].reset();
// actions[code].down[an].time = actions[code].top[an]._clip.duration; // actions[code].down[an].time = actions[code].top[an]._clip.duration;
// actions[code].down[an].timeScale = -1; // actions[code].down[an].timeScale = -1;
// actions[code].down[an].play(); // actions[code].down[an].play();
// } // }
// }else if(trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == "02"){ // }else if(trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == "02"){
// //console.log("open"); // //console.log("open");
// trainlisttest.list[code].doorStatus = "02"; // trainlisttest.list[code].doorStatus = "02";
// for(let an=actions[code].down.length-1;an>=0;an--){ // for(let an=actions[code].down.length-1;an>=0;an--){
// actions[code].down[an].reset(); // actions[code].down[an].reset();
// actions[code].down[an].time = 0; // actions[code].down[an].time = 0;
// actions[code].down[an].timeScale = 1; // actions[code].down[an].timeScale = 1;
// actions[code].down[an].play(); // actions[code].down[an].play();
// } // }
// } // }
// } // }
// 遍历获取所在轨道 // 遍历获取所在轨道
if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == false) { if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == false) {
trainlisttest.group.add(trainlisttest.list[code]); trainlisttest.group.add(trainlisttest.list[code]);
if (sectionlist.sections.datalist[data.body[i].sectionCode].code) { if (sectionlist.sections.datalist[data.body[i].sectionCode].code) {
trainlisttest.list[code].position.y = 0; trainlisttest.list[code].position.y = 0;
trainlisttest.list[code].progress = 0; trainlisttest.list[code].progress = 0;
trainlisttest.list[code].oldoffset = data.body[i].sectionOffsetPercent; trainlisttest.list[code].oldoffset = data.body[i].sectionOffsetPercent;
trainlisttest.list[code].dispose = false; trainlisttest.list[code].dispose = false;
if (data.body[i].directionType == '02') { if (data.body[i].directionType == '02') {
trainlisttest.list[code].status = '02'; trainlisttest.list[code].status = '02';
trainlisttest.list[code].rotation.y = 0; trainlisttest.list[code].rotation.y = 0;
} else if (data.body[i].directionType == '03') { } else if (data.body[i].directionType == '03') {
trainlisttest.list[code].status = '03'; trainlisttest.list[code].status = '03';
trainlisttest.list[code].rotation.y = Math.PI; trainlisttest.list[code].rotation.y = Math.PI;
} }
} }
} else if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == true) { } else if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == true) {
trainlisttest.group.remove(trainlisttest.list[code]); trainlisttest.group.remove(trainlisttest.list[code]);
trainlisttest.list[code].progress = null; trainlisttest.list[code].progress = null;
trainlisttest.list[code].dispose = true; trainlisttest.list[code].dispose = true;
} else if (trainlisttest.list[code].dispose == data.body[i].dispose && data.body[i].dispose == false) { } else if (trainlisttest.list[code].dispose == data.body[i].dispose && data.body[i].dispose == false) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].code) { if (sectionlist.sections.datalist[data.body[i].sectionCode].code) {
if (trainlisttest.list[code].nowcode != data.body[i].sectionCode || trainlisttest.list[code].nextcode != data.body[i].nextSectionCode) { if (trainlisttest.list[code].nowcode != data.body[i].sectionCode || trainlisttest.list[code].nextcode != data.body[i].nextSectionCode) {
trainlisttest.list[code].nowcode = data.body[i].sectionCode; trainlisttest.list[code].nowcode = data.body[i].sectionCode;
trainlisttest.list[code].nextcode = data.body[i].nextSectionCode; trainlisttest.list[code].nextcode = data.body[i].nextSectionCode;
const vexlist = []; const vexlist = [];
const endrotation = null; const endrotation = null;
if (data.body[i].directionType == '02') { // 向右 if (data.body[i].directionType == '02') { // 向右
if (trainlisttest.list[code].status != data.body[i].directionType) { if (trainlisttest.list[code].status != data.body[i].directionType) {
console.log(trainlisttest.list[code].position); console.log(trainlisttest.list[code].position);
console.log(trainlisttest.list[code].children[5].matrixWorld); console.log(trainlisttest.list[code].children[5].matrixWorld);
trainlisttest.list[code].position.x = trainlisttest.list[code].children[5].matrixWorld.elements[12]; trainlisttest.list[code].position.x = trainlisttest.list[code].children[5].matrixWorld.elements[12];
trainlisttest.list[code].children[0].position.z = trainlisttest.list[code].children[0].matrixWorld.elements[14]; trainlisttest.list[code].children[0].position.z = trainlisttest.list[code].children[0].matrixWorld.elements[14];
trainlisttest.list[code].children[1].position.z = trainlisttest.list[code].children[1].matrixWorld.elements[14]; trainlisttest.list[code].children[1].position.z = trainlisttest.list[code].children[1].matrixWorld.elements[14];
trainlisttest.list[code].children[2].position.z = trainlisttest.list[code].children[2].matrixWorld.elements[14]; trainlisttest.list[code].children[2].position.z = trainlisttest.list[code].children[2].matrixWorld.elements[14];
trainlisttest.list[code].children[3].position.z = trainlisttest.list[code].children[3].matrixWorld.elements[14]; trainlisttest.list[code].children[3].position.z = trainlisttest.list[code].children[3].matrixWorld.elements[14];
trainlisttest.list[code].children[4].position.z = trainlisttest.list[code].children[4].matrixWorld.elements[14]; trainlisttest.list[code].children[4].position.z = trainlisttest.list[code].children[4].matrixWorld.elements[14];
trainlisttest.list[code].children[5].position.z = trainlisttest.list[code].children[5].matrixWorld.elements[14]; trainlisttest.list[code].children[5].position.z = trainlisttest.list[code].children[5].matrixWorld.elements[14];
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x > sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) { if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x > sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14])); vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
for (let m = sectionlist.sections.datalist[data.body[i].sectionCode].rail.length - 1; m >= 0; m--) { for (let m = sectionlist.sections.datalist[data.body[i].sectionCode].rail.length - 1; m >= 0; m--) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x > trainlisttest.list[code].position.x) { if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x > trainlisttest.list[code].position.x) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]); vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
} }
} }
} else { } else {
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14])); vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
for (let m = 0; m < sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) { for (let m = 0; m < sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x > trainlisttest.list[code].position.x) { if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x > trainlisttest.list[code].position.x) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]); vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
} }
} }
} }
} else { } else {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x > sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) { if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x > sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
for (let m = sectionlist.sections.datalist[data.body[i].sectionCode].rail.length - 1; m >= 0; m--) { for (let m = sectionlist.sections.datalist[data.body[i].sectionCode].rail.length - 1; m >= 0; m--) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]); vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
} }
} else { } else {
for (let m = 0; m < sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) { for (let m = 0; m < sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]); vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
} }
} }
} }
trainlisttest.list[code].status = '02'; trainlisttest.list[code].status = '02';
trainlisttest.list[code].rotation.y = 0; trainlisttest.list[code].rotation.y = 0;
} else if (data.body[i].directionType == '03') { // 向左 } else if (data.body[i].directionType == '03') { // 向左
if (trainlisttest.list[code].status != data.body[i].directionType) { if (trainlisttest.list[code].status != data.body[i].directionType) {
trainlisttest.list[code].position.x = trainlisttest.list[code].children[5].matrixWorld.elements[12]; trainlisttest.list[code].position.x = trainlisttest.list[code].children[5].matrixWorld.elements[12];
trainlisttest.list[code].children[0].position.z = trainlisttest.list[code].children[0].matrixWorld.elements[14]; trainlisttest.list[code].children[0].position.z = trainlisttest.list[code].children[0].matrixWorld.elements[14];
trainlisttest.list[code].children[1].position.z = trainlisttest.list[code].children[1].matrixWorld.elements[14]; trainlisttest.list[code].children[1].position.z = trainlisttest.list[code].children[1].matrixWorld.elements[14];
trainlisttest.list[code].children[2].position.z = trainlisttest.list[code].children[2].matrixWorld.elements[14]; trainlisttest.list[code].children[2].position.z = trainlisttest.list[code].children[2].matrixWorld.elements[14];
trainlisttest.list[code].children[3].position.z = trainlisttest.list[code].children[3].matrixWorld.elements[14]; trainlisttest.list[code].children[3].position.z = trainlisttest.list[code].children[3].matrixWorld.elements[14];
trainlisttest.list[code].children[4].position.z = trainlisttest.list[code].children[4].matrixWorld.elements[14]; trainlisttest.list[code].children[4].position.z = trainlisttest.list[code].children[4].matrixWorld.elements[14];
trainlisttest.list[code].children[5].position.z = trainlisttest.list[code].children[5].matrixWorld.elements[14]; trainlisttest.list[code].children[5].position.z = trainlisttest.list[code].children[5].matrixWorld.elements[14];
// //
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x < sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) { if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x < sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14])); vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
for (let m = sectionlist.sections.datalist[data.body[i].sectionCode].rail.length - 1; m >= 0; m--) { for (let m = sectionlist.sections.datalist[data.body[i].sectionCode].rail.length - 1; m >= 0; m--) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x < trainlisttest.list[code].position.x) { if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x < trainlisttest.list[code].position.x) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]); vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
} }
} }
} else { } else {
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14])); vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
for (let m = 0; m < sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) { for (let m = 0; m < sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x < trainlisttest.list[code].position.x) { if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x < trainlisttest.list[code].position.x) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]); vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
} }
} }
} }
} else { } else {
// //
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x < sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) { if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x < sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
for (let m = sectionlist.sections.datalist[data.body[i].sectionCode].rail.length - 1; m >= 0; m--) { for (let m = sectionlist.sections.datalist[data.body[i].sectionCode].rail.length - 1; m >= 0; m--) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]); vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
} }
} else { } else {
for (let m = 0; m < sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) { for (let m = 0; m < sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]); vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
} }
} }
} }
trainlisttest.list[code].status = '03'; trainlisttest.list[code].status = '03';
trainlisttest.list[code].rotation.y = Math.PI; trainlisttest.list[code].rotation.y = Math.PI;
} }
trainlisttest.list[code].curve = new THREE.CatmullRomCurve3(vexlist); trainlisttest.list[code].curve = new THREE.CatmullRomCurve3(vexlist);
// console.log(trainlisttest.list[code].curve.points); // console.log(trainlisttest.list[code].curve.points);
// console.log(data.body[i].speed) // console.log(data.body[i].speed)
// console.log(sectionlist.sections.datalist[data.body[i].sectionCode].distance); // console.log(sectionlist.sections.datalist[data.body[i].sectionCode].distance);
trainlisttest.list[code].speeds = data.body[i].speed * 10 / 36 / 11 / sectionlist.sections.datalist[data.body[i].sectionCode].distance; trainlisttest.list[code].speeds = data.body[i].speed * 10 / 36 / 11 / sectionlist.sections.datalist[data.body[i].sectionCode].distance;
trainlisttest.list[code].progress = 0; trainlisttest.list[code].progress = 0;
} }
// console.log("speed"); // console.log("speed");
// console.log(data.body[i].speed); // console.log(data.body[i].speed);
// console.log(trainlisttest.list[code].speed); // console.log(trainlisttest.list[code].speed);
if (data.body[i].speed != trainlisttest.list[code].speed) { if (data.body[i].speed != trainlisttest.list[code].speed) {
trainlisttest.list[code].speed = data.body[i].speed; trainlisttest.list[code].speed = data.body[i].speed;
trainlisttest.list[code].speeds = data.body[i].speed * 10 / 36 / 11 / sectionlist.sections.datalist[data.body[i].sectionCode].distance; trainlisttest.list[code].speeds = data.body[i].speed * 10 / 36 / 11 / sectionlist.sections.datalist[data.body[i].sectionCode].distance;
// if(trainlisttest.list[code].speeds > 0.1){ // if(trainlisttest.list[code].speeds > 0.1){
// console.log(data.body[i]); // console.log(data.body[i]);
// console.log(data.body[i].speed) // console.log(data.body[i].speed)
// console.log(sectionlist.sections.datalist[data.body[i].sectionCode].distance); // console.log(sectionlist.sections.datalist[data.body[i].sectionCode].distance);
// console.log(trainlisttest.list[code].speeds); // console.log(trainlisttest.list[code].speeds);
// } // }
} }
} }
} }
} }
} }
} }
// 0xFFFFFF // 0xFFFFFF
// 0xCD0000 红 // 0xCD0000 红
// 0xEEEE00 黄 // 0xEEEE00 黄
// 0x32CD32 绿 // 0x32CD32 绿
if (data.body[i]._type == 'Signal') { if (data.body[i]._type == 'Signal') {
if (signallist) { if (signallist) {
code = data.body[i].code; code = data.body[i].code;
if (data.body[i].lightType == '01') { if (data.body[i].lightType == '01') {
if (signallist.list[code].mesh.code) { if (signallist.list[code].mesh.code) {
signallist.list[code].mesh.status = data.body[i].status; signallist.list[code].mesh.status = data.body[i].status;
// 55 // 55
// 33 // 33
// 77 // 77
// 关闭 // 关闭
if (data.body[i].status == '01') { if (data.body[i].status == '01') {
signallist.list[code].mesh.children[0].material.map = materials[3]; signallist.list[code].mesh.children[0].material.map = materials[3];
signallist.list[code].mesh.children[0].material.map.needsUpdate = true; signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
signallist.list[code].mesh.children[1].material.map = materials[0]; signallist.list[code].mesh.children[1].material.map = materials[0];
signallist.list[code].mesh.children[1].material.map.needsUpdate = true; signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
signallist.list[code].mesh.children[2].material.map = materials[3]; signallist.list[code].mesh.children[2].material.map = materials[3];
signallist.list[code].mesh.children[2].material.map.needsUpdate = true; signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
} }
// 开放 // 开放
if (data.body[i].status == '02') { if (data.body[i].status == '02') {
if (data.body[i].switchLocateType == '01') { if (data.body[i].switchLocateType == '01') {
signallist.list[code].mesh.children[0].material.map = materials[2]; signallist.list[code].mesh.children[0].material.map = materials[2];
signallist.list[code].mesh.children[0].material.map.needsUpdate = true; signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
signallist.list[code].mesh.children[1].material.map = materials[3]; signallist.list[code].mesh.children[1].material.map = materials[3];
signallist.list[code].mesh.children[1].material.map.needsUpdate = true; signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
signallist.list[code].mesh.children[2].material.map = materials[3]; signallist.list[code].mesh.children[2].material.map = materials[3];
signallist.list[code].mesh.children[2].material.map.needsUpdate = true; signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
} }
if (data.body[i].switchLocateType == '02') { if (data.body[i].switchLocateType == '02') {
signallist.list[code].mesh.children[0].material.map = materials[3]; signallist.list[code].mesh.children[0].material.map = materials[3];
signallist.list[code].mesh.children[0].material.map.needsUpdate = true; signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
signallist.list[code].mesh.children[1].material.map = materials[3]; signallist.list[code].mesh.children[1].material.map = materials[3];
signallist.list[code].mesh.children[1].material.map.needsUpdate = true; signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
signallist.list[code].mesh.children[2].material.map = materials[1]; signallist.list[code].mesh.children[2].material.map = materials[1];
signallist.list[code].mesh.children[2].material.map.needsUpdate = true; signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
} }
} }
// 引导 // 引导
if (data.body[i].status == '03') { if (data.body[i].status == '03') {
signallist.list[code].mesh.children[0].material.map = materials[3]; signallist.list[code].mesh.children[0].material.map = materials[3];
signallist.list[code].mesh.children[0].material.map.needsUpdate = true; signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
signallist.list[code].mesh.children[1].material.map = materials[0]; signallist.list[code].mesh.children[1].material.map = materials[0];
signallist.list[code].mesh.children[1].material.map.needsUpdate = true; signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
signallist.list[code].mesh.children[2].material.map = materials[1]; signallist.list[code].mesh.children[2].material.map = materials[1];
signallist.list[code].mesh.children[2].material.map.needsUpdate = true; signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
} }
// 封锁 // 封锁
if (data.body[i].status == '04') { if (data.body[i].status == '04') {
signallist.list[code].mesh.children[0].material.map = materials[3]; signallist.list[code].mesh.children[0].material.map = materials[3];
signallist.list[code].mesh.children[0].material.map.needsUpdate = true; signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
signallist.list[code].mesh.children[1].material.map = materials[3]; signallist.list[code].mesh.children[1].material.map = materials[3];
signallist.list[code].mesh.children[1].material.map.needsUpdate = true; signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
signallist.list[code].mesh.children[2].material.map = materials[3]; signallist.list[code].mesh.children[2].material.map = materials[3];
signallist.list[code].mesh.children[2].material.map.needsUpdate = true; signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
} }
// 故障 // 故障
if (data.body[i].status == '05') { if (data.body[i].status == '05') {
signallist.list[code].mesh.children[0].material.map = materials[3]; signallist.list[code].mesh.children[0].material.map = materials[3];
signallist.list[code].mesh.children[0].material.map.needsUpdate = true; signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
signallist.list[code].mesh.children[1].material.map = materials[3]; signallist.list[code].mesh.children[1].material.map = materials[3];
signallist.list[code].mesh.children[1].material.map.needsUpdate = true; signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
signallist.list[code].mesh.children[2].material.map = materials[3]; signallist.list[code].mesh.children[2].material.map = materials[3];
signallist.list[code].mesh.children[2].material.map.needsUpdate = true; signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
} }
} }
} else if (data.body[i].lightType == '01') { } else if (data.body[i].lightType == '01') {
if (signallist.list[code].mesh.code) { if (signallist.list[code].mesh.code) {
signallist.list[code].mesh.children[0].material.map = materials[3]; signallist.list[code].mesh.children[0].material.map = materials[3];
signallist.list[code].mesh.children[0].material.map.needsUpdate = true; signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
signallist.list[code].mesh.children[1].material.map = materials[3]; signallist.list[code].mesh.children[1].material.map = materials[3];
signallist.list[code].mesh.children[1].material.map.needsUpdate = true; signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
signallist.list[code].mesh.children[2].material.map = materials[3]; signallist.list[code].mesh.children[2].material.map = materials[3];
signallist.list[code].mesh.children[2].material.map.needsUpdate = true; signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
} }
} }
} }
} }
if (data.body[i]._type == 'StationStand') { if (data.body[i]._type == 'StationStand') {
if (actions) { if (actions) {
code = data.body[i].code; code = data.body[i].code;
if (data.body[i].screenDoorOpenStatus == '02' && actions[code].status == '01') { if (data.body[i].screenDoorOpenStatus == '02' && actions[code].status == '01') {
actions[code].status = '00'; actions[code].status = '00';
} }
if (data.body[i].screenDoorOpenStatus == '02' && actions[code].status == '00') { if (data.body[i].screenDoorOpenStatus == '02' && actions[code].status == '00') {
actions[code].status = '02'; actions[code].status = '02';
actions[code].action.reset(); actions[code].action.reset();
actions[code].action.time = 0; actions[code].action.time = 0;
actions[code].action.timeScale = 1; actions[code].action.timeScale = 1;
actions[code].action.play(); actions[code].action.play();
} }
if (data.body[i].screenDoorOpenStatus == '01' && actions[code].status == '02') { if (data.body[i].screenDoorOpenStatus == '01' && actions[code].status == '02') {
actions[code].status = '00'; actions[code].status = '00';
} }
if (data.body[i].screenDoorOpenStatus == '01' && actions[code].status == '00') { if (data.body[i].screenDoorOpenStatus == '01' && actions[code].status == '00') {
actions[code].status = '01'; actions[code].status = '01';
actions[code].action.reset(); actions[code].action.reset();
actions[code].action.time = actions[code].action._clip.duration; actions[code].action.time = actions[code].action._clip.duration;
actions[code].action.timeScale = -1; actions[code].action.timeScale = -1;
actions[code].action.play(); actions[code].action.play();
} }
} }
} }
if (data.body[i]._type == 'Switch') { if (data.body[i]._type == 'Switch') {
if (sectionlist) { if (sectionlist) {
code = data.body[i].code; code = data.body[i].code;
for (let j = sectionlist.switchs.modellist.length - 1; j >= 0; j--) { for (let j = sectionlist.switchs.modellist.length - 1; j >= 0; j--) {
if (sectionlist.switchs.modellist[j].code == code) { if (sectionlist.switchs.modellist[j].code == code) {
if (sectionlist.switchs.modellist[j].locateType != data.body[i].locateType) { if (sectionlist.switchs.modellist[j].locateType != data.body[i].locateType) {
if (data.body[i].locateType == '02') { if (data.body[i].locateType == '02') {
sectionlist.switchs.modellist[j].locateType = data.body[i].locateType; sectionlist.switchs.modellist[j].locateType = data.body[i].locateType;
actions[sectionlist.switchs.modellist[j].code].reset(); actions[sectionlist.switchs.modellist[j].code].reset();
actions[sectionlist.switchs.modellist[j].code].time = 0; actions[sectionlist.switchs.modellist[j].code].time = 0;
actions[sectionlist.switchs.modellist[j].code].timeScale = 1; actions[sectionlist.switchs.modellist[j].code].timeScale = 1;
actions[sectionlist.switchs.modellist[j].code].play(); actions[sectionlist.switchs.modellist[j].code].play();
} else if (data.body[i].locateType == '01') { } else if (data.body[i].locateType == '01') {
sectionlist.switchs.modellist[j].locateType = data.body[i].locateType; sectionlist.switchs.modellist[j].locateType = data.body[i].locateType;
actions[sectionlist.switchs.modellist[j].code].reset(); actions[sectionlist.switchs.modellist[j].code].reset();
actions[sectionlist.switchs.modellist[j].code].time = actions[sectionlist.switchs.modellist[j].code]._clip.duration; actions[sectionlist.switchs.modellist[j].code].time = actions[sectionlist.switchs.modellist[j].code]._clip.duration;
actions[sectionlist.switchs.modellist[j].code].timeScale = -1; actions[sectionlist.switchs.modellist[j].code].timeScale = -1;
actions[sectionlist.switchs.modellist[j].code].play(); actions[sectionlist.switchs.modellist[j].code].play();
} }
} }
// console.log(sectionlist.group[j].name); // console.log(sectionlist.group[j].name);
j = 0; j = 0;
} }
} }
} }
} }
} }
} else if (data.body.length > 200) { } else if (data.body.length > 200) {
} }
} }
} }
} }

View File

@ -13,138 +13,138 @@ import { runDiagramQuit } from '@/api/simulation';
import { EventBus } from '@/scripts/event-bus'; import { EventBus } from '@/scripts/event-bus';
export default { export default {
name: 'CancelMenu', name: 'CancelMenu',
components: { components: {
PopMenu PopMenu
}, },
data() { data() {
return { return {
menu: [], menu: [],
menuNormal: [], menuNormal: [],
menuScreen: [ menuScreen: [
{ {
label: '放大地图', label: '放大地图',
handler: this.magnifyMap, handler: this.magnifyMap,
disabled: false disabled: false
}, },
{ {
label: '缩小地图', label: '缩小地图',
handler: this.shrinkMap, handler: this.shrinkMap,
disabled: false disabled: false
}, },
{ {
label: '返回', label: '返回',
handler: this.back, handler: this.back,
disabled: false disabled: false
} }
] ]
}; };
}, },
computed: { computed: {
...mapGetters('map', [ ...mapGetters('map', [
'stationList' 'stationList'
]), ]),
isScreen() { // isScreen() { //
return this.$route.params.mode === 'dp' || return this.$route.params.mode === 'dp' ||
this.$store.state.training.roles == 'BigScreen'; this.$store.state.training.roles == 'BigScreen';
}, },
group() { group() {
return this.$route.query.group; return this.$route.query.group;
} }
}, },
watch: { watch: {
'$store.state.menuOperation.buttonOperation': function (val, old) { '$store.state.menuOperation.buttonOperation': function (val, old) {
if (!this.isScreen && this.menu && this.menu.length > 1) { if (!this.isScreen && this.menu && this.menu.length > 1) {
this.menu[0].disabled = true; this.menu[0].disabled = true;
this.menu[1].disabled = !((this.menu[1] && val)); this.menu[1].disabled = !((this.menu[1] && val));
} }
}, },
'$store.state.menuOperation.menuCount': function (val) { '$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Cancel)) { if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Cancel)) {
this.doShow(this.$store.state.menuOperation.menuPosition); this.doShow(this.$store.state.menuOperation.menuPosition);
} else { } else {
this.doClose(); this.doClose();
} }
} }
}, },
methods: { methods: {
clickEvent() { clickEvent() {
const self = this; const self = this;
window.onclick = function (e) { window.onclick = function (e) {
self.doClose(); self.doClose();
}; };
}, },
initMenu() { initMenu() {
this.menuNormal = []; this.menuNormal = [];
// this.stationList.forEach(station => { // this.stationList.forEach(station => {
// if (station.code === station.concentrateStationCode) { // if (station.code === station.concentrateStationCode) {
// let node = { // let node = {
// label: station.name, // label: station.name,
// children: [] // children: []
// } // }
// //
// this.stationList.forEach(elem => { // this.stationList.forEach(elem => {
// if (elem.visible) { // if (elem.visible) {
// let next = elem; // let next = elem;
// while (next.code != next.concentrateStationCode || !next.concentrateStationCode) { // while (next.code != next.concentrateStationCode || !next.concentrateStationCode) {
// next = this.$store.getters['map/getDeviceByCode'](next.concentrateStationCode); // next = this.$store.getters['map/getDeviceByCode'](next.concentrateStationCode);
// } // }
// //
// if (station.code == next.code) { // if (station.code == next.code) {
// node.children.push({ // node.children.push({
// code: elem.code, // code: elem.code,
// label: elem.name, // label: elem.name,
// handler: this.mapLocation, // handler: this.mapLocation,
// }); // });
// } // }
// } // }
// }) // })
// //
// this.menuNormal.push(node); // this.menuNormal.push(node);
// } // }
// }); // });
if (this.isScreen) { if (this.isScreen) {
this.menu = [...this.menuScreen]; this.menu = [...this.menuScreen];
} }
// else { // else {
// this.menu = [...this.menuNormal]; // this.menu = [...this.menuNormal];
// } // }
}, },
doShow(point) { doShow(point) {
this.clickEvent(); this.clickEvent();
this.initMenu(); this.initMenu();
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) { if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
this.$refs.popMenu.resetShowPosition(point); this.$refs.popMenu.resetShowPosition(point);
} }
}, },
doClose() { doClose() {
if (this.$refs && this.$refs.popMenu) { if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.close(); this.$refs.popMenu.close();
} }
}, },
// //
mapLocation(item) { mapLocation(item) {
if (item) { if (item) {
this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: item.code }); this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: item.code });
this.doClose(); this.doClose();
} }
}, },
// //
magnifyMap() { magnifyMap() {
this.$store.dispatch('menuOperation/handleMagnifyCount'); this.$store.dispatch('menuOperation/handleMagnifyCount');
}, },
// //
shrinkMap() { shrinkMap() {
this.$store.dispatch('menuOperation/handleShrinkCount'); this.$store.dispatch('menuOperation/handleShrinkCount');
}, },
// //
async back() { async back() {
await runDiagramQuit(this.group); await runDiagramQuit(this.group);
EventBus.$emit('trainingSubscribeStop'); EventBus.$emit('trainingSubscribeStop');
history.go(-1); history.go(-1);
exitFullscreen(); exitFullscreen();
} }
} }
}; };
</script> </script>

View File

@ -242,126 +242,126 @@
<script> <script>
import { MapDeviceType, OperationEvent, getDomIdByOperation } from '@/scripts/ConstDic'; import { MapDeviceType, OperationEvent, getDomIdByOperation } from '@/scripts/ConstDic';
import OperateHandler from '@/scripts/plugin/trainingOperateHandler'; import OperateHandler from '@/scripts/plugin/OperateHandler';
export default { export default {
name: 'MapButtonMenu', name: 'MapButtonMenu',
data() { data() {
return { return {
point: { point: {
x: -1000, x: -1000,
y: -1000 y: -1000
}, },
operation: '0', operation: '0',
buttonName: '', buttonName: '',
buttonDownColor: '#A8A8A8', buttonDownColor: '#A8A8A8',
buttonUpColor: '#DCDCDC', buttonUpColor: '#DCDCDC',
width: 58, width: 58,
tempData: null, tempData: null,
offset: {} offset: {}
}; };
}, },
computed: { computed: {
Switch() { Switch() {
return OperationEvent.Switch; return OperationEvent.Switch;
}, },
Section() { Section() {
return OperationEvent.Section; return OperationEvent.Section;
}, },
Signal() { Signal() {
return OperationEvent.Signal; return OperationEvent.Signal;
}, },
isShowBtn() { isShowBtn() {
return this.$store.state.training.prdType == '01'; return this.$store.state.training.prdType == '01';
} }
}, },
watch: { watch: {
'$store.state.config.canvasOffsetCount': function (val) { '$store.state.config.canvasOffsetCount': function (val) {
this.resetPosition(); this.resetPosition();
}, },
'$store.state.menuOperation.buttonOperation': function (val, old) { '$store.state.menuOperation.buttonOperation': function (val, old) {
this.updateButtonShow(val, old); this.updateButtonShow(val, old);
}, },
'$store.state.menuOperation.selectedCount': function (val) { '$store.state.menuOperation.selectedCount': function (val) {
this.selectedChange(); this.selectedChange();
} }
}, },
mounted() { mounted() {
this.resetPosition(); this.resetPosition();
}, },
methods: { methods: {
resetPosition() { resetPosition() {
this.$nextTick(() => { this.$nextTick(() => {
const canvasOffset = this.$store.state.config.canvasOffset; const canvasOffset = this.$store.state.config.canvasOffset;
this.point = { this.point = {
x: canvasOffset.x + 20, x: canvasOffset.x + 20,
y: canvasOffset.y + this.$store.state.config.height - 65 y: canvasOffset.y + this.$store.state.config.height - 65
}; };
this.$store.dispatch('training/tipReload'); this.$store.dispatch('training/tipReload');
}); });
}, },
updateButtonShow(val, old) { updateButtonShow(val, old) {
if (old) { if (old) {
// //
const domId = getDomIdByOperation(old); const domId = getDomIdByOperation(old);
const dom = document.getElementById(domId); const dom = document.getElementById(domId);
if (dom) { if (dom) {
dom.disabled = false; dom.disabled = false;
dom.style.backgroundColor = this.buttonUpColor; dom.style.backgroundColor = this.buttonUpColor;
} }
} }
if (val) { if (val) {
// //
const domId = getDomIdByOperation(val); const domId = getDomIdByOperation(val);
const dom = document.getElementById(domId); const dom = document.getElementById(domId);
if (dom) { if (dom) {
dom.disabled = true; dom.disabled = true;
dom.style.backgroundColor = this.buttonDownColor; dom.style.backgroundColor = this.buttonDownColor;
} }
} }
}, },
buttonDown(operation) { buttonDown(operation) {
const operate = { const operate = {
type: 'mbm', type: 'mbm',
operation: operation operation: operation
}; };
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/setButtonOperation', operation); // this.$store.dispatch('menuOperation/setButtonOperation', operation); //
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
} }
}); });
}, },
selectedChange() { selectedChange() {
// //
if (this.$store.state.menuOperation.buttonOperation) { if (this.$store.state.menuOperation.buttonOperation) {
const model = this.$store.state.menuOperation.selected; const model = this.$store.state.menuOperation.selected;
if (model) { if (model) {
const deviceType = MapDeviceType[model._type]; const deviceType = MapDeviceType[model._type];
const operate = { const operate = {
send: true, send: true,
model: model, model: model,
code: model.code, code: model.code,
type: deviceType.type, type: deviceType.type,
operation: this.$store.state.menuOperation.buttonOperation, operation: this.$store.state.menuOperation.buttonOperation,
tempData: this.tempData tempData: this.tempData
}; };
this.$store.dispatch('training/next', operate).then(({ valid, response }) => { this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) { if (valid) {
if (response) { if (response) {
this.tempData = response.data; this.tempData = response.data;
} }
} }
}); });
} else { } else {
OperateHandler.cleanOperates(); OperateHandler.cleanOperates();
this.$store.dispatch('menuOperation/setButtonOperation', null); this.$store.dispatch('menuOperation/setButtonOperation', null);
} }
} }
} }
} }
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -13,137 +13,137 @@ import { runDiagramQuit } from '@/api/simulation';
import { EventBus } from '@/scripts/event-bus'; import { EventBus } from '@/scripts/event-bus';
export default { export default {
name: 'CancelMenu', name: 'CancelMenu',
components: { components: {
PopMenu PopMenu
}, },
data() { data() {
return { return {
menu: [], menu: [],
menuNormal: [], menuNormal: [],
menuScreen: [ menuScreen: [
{ {
label: '放大地图', label: '放大地图',
handler: this.magnifyMap, handler: this.magnifyMap,
disabled: false disabled: false
}, },
{ {
label: '缩小地图', label: '缩小地图',
handler: this.shrinkMap, handler: this.shrinkMap,
disabled: false disabled: false
}, },
{ {
label: '返回', label: '返回',
handler: this.back, handler: this.back,
disabled: false disabled: false
} }
] ]
}; };
}, },
computed: { computed: {
...mapGetters('map', [ ...mapGetters('map', [
'stationList' 'stationList'
]), ]),
isScreen() { // isScreen() { //
return this.$route.params.mode === 'dp' || return this.$route.params.mode === 'dp' ||
this.$store.state.training.roles == 'BigScreen'; this.$store.state.training.roles == 'BigScreen';
}, },
group() { group() {
return this.$route.query.group; return this.$route.query.group;
} }
}, },
watch: { watch: {
'$store.state.menuOperation.buttonOperation': function (val, old) { '$store.state.menuOperation.buttonOperation': function (val, old) {
if (!this.isScreen && this.menu && this.menu.length > 1) { if (!this.isScreen && this.menu && this.menu.length > 1) {
this.menu[0].disabled = true; this.menu[0].disabled = true;
this.menu[1].disabled = !((this.menu[1] && val)); this.menu[1].disabled = !((this.menu[1] && val));
} }
}, },
'$store.state.menuOperation.menuCount': function (val) { '$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Cancel)) { if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Cancel)) {
this.doShow(this.$store.state.menuOperation.menuPosition); this.doShow(this.$store.state.menuOperation.menuPosition);
} else { } else {
this.doClose(); this.doClose();
} }
} }
}, },
methods: { methods: {
clickEvent() { clickEvent() {
const self = this; const self = this;
window.onclick = function (e) { window.onclick = function (e) {
self.doClose(); self.doClose();
}; };
}, },
initMenu() { initMenu() {
this.menuNormal = []; this.menuNormal = [];
// this.stationList.forEach(station => { // this.stationList.forEach(station => {
// if (station.code === station.concentrateStationCode) { // if (station.code === station.concentrateStationCode) {
// let node = { // let node = {
// label: station.name, // label: station.name,
// children: [] // children: []
// } // }
// //
// this.stationList.forEach(elem => { // this.stationList.forEach(elem => {
// if (elem.visible) { // if (elem.visible) {
// let next = elem; // let next = elem;
// while (next.code != next.concentrateStationCode || !next.concentrateStationCode) { // while (next.code != next.concentrateStationCode || !next.concentrateStationCode) {
// next = this.$store.getters['map/getDeviceByCode'](next.concentrateStationCode); // next = this.$store.getters['map/getDeviceByCode'](next.concentrateStationCode);
// } // }
// //
// if (station.code == next.code) { // if (station.code == next.code) {
// node.children.push({ // node.children.push({
// code: elem.code, // code: elem.code,
// label: elem.name, // label: elem.name,
// handler: this.mapLocation, // handler: this.mapLocation,
// }); // });
// } // }
// } // }
// }) // })
// //
// this.menuNormal.push(node); // this.menuNormal.push(node);
// } // }
// }); // });
if (this.isScreen) { if (this.isScreen) {
this.menu = [...this.menuScreen]; this.menu = [...this.menuScreen];
} }
// else { // else {
// this.menu = [...this.menuNormal]; // this.menu = [...this.menuNormal];
// } // }
}, },
doShow(point) { doShow(point) {
this.clickEvent(); this.clickEvent();
this.initMenu(); this.initMenu();
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) { if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
this.$refs.popMenu.resetShowPosition(point); this.$refs.popMenu.resetShowPosition(point);
} }
}, },
doClose() { doClose() {
if (this.$refs && this.$refs.popMenu) { if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.close(); this.$refs.popMenu.close();
} }
}, },
// //
mapLocation(item) { mapLocation(item) {
if (item) { if (item) {
this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: item.code }); this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: item.code });
this.doClose(); this.doClose();
} }
}, },
// //
magnifyMap() { magnifyMap() {
this.$store.dispatch('menuOperation/handleMagnifyCount'); this.$store.dispatch('menuOperation/handleMagnifyCount');
}, },
// //
shrinkMap() { shrinkMap() {
this.$store.dispatch('menuOperation/handleShrinkCount'); this.$store.dispatch('menuOperation/handleShrinkCount');
}, },
// //
async back() { async back() {
await runDiagramQuit(this.group); await runDiagramQuit(this.group);
EventBus.$emit('trainingSubscribeStop'); EventBus.$emit('trainingSubscribeStop');
history.go(-1); history.go(-1);
exitFullscreen(); exitFullscreen();
} }
} }
}; };
</script> </script>

View File

@ -109,7 +109,7 @@
<script> <script>
import { MapDeviceType, OperationEvent, getDomIdByOperation } from '@/scripts/ConstDic'; import { MapDeviceType, OperationEvent, getDomIdByOperation } from '@/scripts/ConstDic';
import OperateHandler from '@/scripts/plugin/trainingOperateHandler'; import OperateHandler from '@/scripts/plugin/OperateHandler';
import { deepAssign } from '@/utils/index'; import { deepAssign } from '@/utils/index';
import PasswordBox from './dialog/childDialog/passwordInputBox.vue'; import PasswordBox from './dialog/childDialog/passwordInputBox.vue';

View File

@ -13,92 +13,92 @@ import { runDiagramQuit } from '@/api/simulation';
import { EventBus } from '@/scripts/event-bus'; import { EventBus } from '@/scripts/event-bus';
export default { export default {
name: 'CancelMenu', name: 'CancelMenu',
components: { components: {
PopMenu PopMenu
}, },
data() { data() {
return { return {
menu: [], menu: [],
menuScreen: [ menuScreen: [
{ {
label: '放大地图', label: '放大地图',
handler: this.magnifyMap, handler: this.magnifyMap,
disabled: false disabled: false
}, },
{ {
label: '缩小地图', label: '缩小地图',
handler: this.shrinkMap, handler: this.shrinkMap,
disabled: false disabled: false
}, },
{ {
label: '返回', label: '返回',
handler: this.back, handler: this.back,
disabled: false disabled: false
} }
] ]
}; };
}, },
computed: { computed: {
...mapGetters('map', [ ...mapGetters('map', [
'stationList' 'stationList'
]), ]),
isScreen() { // isScreen() { //
return this.$route.params.mode === 'dp' || return this.$route.params.mode === 'dp' ||
this.$store.state.training.roles == 'BigScreen'; this.$store.state.training.roles == 'BigScreen';
}, },
group() { group() {
return this.$route.query.group; return this.$route.query.group;
} }
}, },
watch: { watch: {
'$store.state.menuOperation.menuCount': function (val) { '$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Cancel)) { if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Cancel)) {
this.doShow(this.$store.state.menuOperation.menuPosition); this.doShow(this.$store.state.menuOperation.menuPosition);
} else { } else {
this.doClose(); this.doClose();
} }
} }
}, },
methods: { methods: {
clickEvent() { clickEvent() {
const self = this; const self = this;
window.onclick = function (e) { window.onclick = function (e) {
self.doClose(); self.doClose();
}; };
}, },
initMenu() { initMenu() {
if (this.isScreen) { if (this.isScreen) {
this.menu = [...this.menuScreen]; this.menu = [...this.menuScreen];
} }
}, },
doShow(point) { doShow(point) {
this.clickEvent(); this.clickEvent();
this.initMenu(); this.initMenu();
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) { if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
this.$refs.popMenu.resetShowPosition(point); this.$refs.popMenu.resetShowPosition(point);
} }
}, },
doClose() { doClose() {
if (this.$refs && this.$refs.popMenu) { if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.close(); this.$refs.popMenu.close();
} }
}, },
// //
magnifyMap() { magnifyMap() {
this.$store.dispatch('menuOperation/handleMagnifyCount'); this.$store.dispatch('menuOperation/handleMagnifyCount');
}, },
// //
shrinkMap() { shrinkMap() {
this.$store.dispatch('menuOperation/handleShrinkCount'); this.$store.dispatch('menuOperation/handleShrinkCount');
}, },
// //
async back() { async back() {
await runDiagramQuit(this.group); await runDiagramQuit(this.group);
EventBus.$emit('trainingSubscribeStop'); EventBus.$emit('trainingSubscribeStop');
history.go(-1); history.go(-1);
exitFullscreen(); exitFullscreen();
} }
} }
}; };
</script> </script>

View File

@ -13,138 +13,138 @@ import { runDiagramQuit } from '@/api/simulation';
import { EventBus } from '@/scripts/event-bus'; import { EventBus } from '@/scripts/event-bus';
export default { export default {
name: 'CancelMenu', name: 'CancelMenu',
components: { components: {
PopMenu PopMenu
}, },
data() { data() {
return { return {
menu: [], menu: [],
menuNormal: [], menuNormal: [],
menuScreen: [ menuScreen: [
{ {
label: '放大地图', label: '放大地图',
handler: this.magnifyMap, handler: this.magnifyMap,
disabled: false disabled: false
}, },
{ {
label: '缩小地图', label: '缩小地图',
handler: this.shrinkMap, handler: this.shrinkMap,
disabled: false disabled: false
}, },
{ {
label: '返回', label: '返回',
handler: this.back, handler: this.back,
disabled: false disabled: false
} }
] ]
}; };
}, },
computed: { computed: {
...mapGetters('map', [ ...mapGetters('map', [
'stationList' 'stationList'
]), ]),
isScreen() { // isScreen() { //
return this.$route.params.mode === 'dp' || return this.$route.params.mode === 'dp' ||
this.$store.state.training.roles == 'BigScreen'; this.$store.state.training.roles == 'BigScreen';
}, },
group() { group() {
return this.$route.query.group; return this.$route.query.group;
} }
}, },
watch: { watch: {
'$store.state.menuOperation.buttonOperation': function (val, old) { '$store.state.menuOperation.buttonOperation': function (val, old) {
if (!this.isScreen && this.menu && this.menu.length > 1) { if (!this.isScreen && this.menu && this.menu.length > 1) {
// this.menu[0].disabled = (this.menu[0] && val) ? true : true; // this.menu[0].disabled = (this.menu[0] && val) ? true : true;
// this.menu[1].disabled = !((this.menu[1] && val)); // this.menu[1].disabled = !((this.menu[1] && val));
} }
}, },
'$store.state.menuOperation.menuCount': function (val) { '$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Cancel)) { if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Cancel)) {
this.doShow(this.$store.state.menuOperation.menuPosition); this.doShow(this.$store.state.menuOperation.menuPosition);
} else { } else {
this.doClose(); this.doClose();
} }
} }
}, },
methods: { methods: {
clickEvent() { clickEvent() {
const self = this; const self = this;
window.onclick = function (e) { window.onclick = function (e) {
self.doClose(); self.doClose();
}; };
}, },
initMenu() { initMenu() {
// this.menuNormal = []; // this.menuNormal = [];
// this.stationList.forEach(station => { // this.stationList.forEach(station => {
// if (station.code === station.concentrateStationCode) { // if (station.code === station.concentrateStationCode) {
// let node = { // let node = {
// label: station.name, // label: station.name,
// children: [] // children: []
// } // }
// this.stationList.forEach(elem => { // this.stationList.forEach(elem => {
// if (elem.visible) { // if (elem.visible) {
// let next = elem; // let next = elem;
// while (next.code != next.concentrateStationCode || !next.concentrateStationCode) { // while (next.code != next.concentrateStationCode || !next.concentrateStationCode) {
// next = this.$store.getters['map/getDeviceByCode'](next.concentrateStationCode); // next = this.$store.getters['map/getDeviceByCode'](next.concentrateStationCode);
// } // }
// if (station.code == next.code) { // if (station.code == next.code) {
// node.children.push({ // node.children.push({
// code: elem.code, // code: elem.code,
// label: elem.name, // label: elem.name,
// handler: this.mapLocation, // handler: this.mapLocation,
// }); // });
// } // }
// } // }
// }) // })
// this.menuNormal.push(node); // this.menuNormal.push(node);
// } // }
// }); // });
if (this.isScreen) { if (this.isScreen) {
this.menu = [...this.menuScreen]; this.menu = [...this.menuScreen];
} }
// else { // else {
// this.menu = [...this.menuNormal]; // this.menu = [...this.menuNormal];
// } // }
}, },
doShow(point) { doShow(point) {
this.clickEvent(); this.clickEvent();
this.initMenu(); this.initMenu();
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) { if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
this.$refs.popMenu.resetShowPosition(point); this.$refs.popMenu.resetShowPosition(point);
} }
}, },
doClose() { doClose() {
if (this.$refs && this.$refs.popMenu) { if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.close(); this.$refs.popMenu.close();
} }
}, },
// //
mapLocation(item) { mapLocation(item) {
if (item) { if (item) {
this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: item.code }); this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: item.code });
this.doClose(); this.doClose();
} }
}, },
// //
magnifyMap() { magnifyMap() {
this.$store.dispatch('menuOperation/handleMagnifyCount'); this.$store.dispatch('menuOperation/handleMagnifyCount');
}, },
// //
shrinkMap() { shrinkMap() {
this.$store.dispatch('menuOperation/handleShrinkCount'); this.$store.dispatch('menuOperation/handleShrinkCount');
}, },
// //
async back() { async back() {
await runDiagramQuit(this.group); await runDiagramQuit(this.group);
EventBus.$emit('trainingSubscribeStop'); EventBus.$emit('trainingSubscribeStop');
history.go(-1); history.go(-1);
exitFullscreen(); exitFullscreen();
} }
} }
}; };
</script> </script>

View File

@ -86,7 +86,7 @@ import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic'; import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import ConfirmTrain from './childDialog/confirmTrain'; import ConfirmTrain from './childDialog/confirmTrain';
import NoticeInfo from './childDialog/childDialog/noticeInfo'; import NoticeInfo from './childDialog/childDialog/noticeInfo';
import OperateHandler from '@/scripts/plugin/trainingOperateHandler'; import OperateHandler from '@/scripts/plugin/OperateHandler';
export default { export default {
name: 'TrainControl', name: 'TrainControl',

View File

@ -5,23 +5,23 @@ const CancelLimitOperation = OperationEvent.LimitControl;
const CancelLimitType = MapDeviceType.LimitControl.type; const CancelLimitType = MapDeviceType.LimitControl.type;
export default { export default {
test: function (operates) { test: function (operates) {
const operateType = getOperateTypeBy('LimitControl', operates[0].operation); const operateType = getOperateTypeBy('LimitControl', operates[0].operation);
if (operateType) { if (operateType) {
return true; return true;
} else { } else {
return false; return false;
} }
}, },
convert: function (operates) { convert: function (operates) {
if (operates && operates.length) { if (operates && operates.length) {
const operation = operates[0].operation; const operation = operates[0].operation;
switch (operation) { switch (operation) {
case CancelLimitOperation.CancelAllLimit.menu.operation: return handleMenuCancelAllLimit(operates); case CancelLimitOperation.CancelAllLimit.menu.operation: return handleMenuCancelAllLimit(operates);
} }
} }
} }
}; };
/** /**
@ -29,17 +29,17 @@ export default {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuCancelAllLimit(operates) { function handleMenuCancelAllLimit(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === CancelLimitType && operate.code) { if (operate.type === CancelLimitType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: CancelLimitOperation.CancelAllLimit.event operation: CancelLimitOperation.CancelAllLimit.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }

View File

@ -7,121 +7,121 @@ const MixinCommandOperation = OperationEvent.MixinCommand;
const StationControlOperation = OperationEvent.StationControl; const StationControlOperation = OperationEvent.StationControl;
export default { export default {
test: function (operates) { test: function (operates) {
const operateType = getOperateTypeBy('MixinCommand', operates[0].operation); const operateType = getOperateTypeBy('MixinCommand', operates[0].operation);
if (operateType) { if (operateType) {
return true; return true;
} else { } else {
return false; return false;
} }
}, },
convert: function (operates) { convert: function (operates) {
if (operates && operates.length) { if (operates && operates.length) {
switch (operates[0].operation) { switch (operates[0].operation) {
case MixinCommandOperation.remoteControl.mbar.operation: return handleMenuRemoteControl(operates); case MixinCommandOperation.remoteControl.mbar.operation: return handleMenuRemoteControl(operates);
case MixinCommandOperation.block.button.operation: return handleBlockButton(operates); case MixinCommandOperation.block.button.operation: return handleBlockButton(operates);
case MixinCommandOperation.unblock.button.operation: return handleUnblockButton(operates); case MixinCommandOperation.unblock.button.operation: return handleUnblockButton(operates);
// case MixinCommandOperation.remoteControl.mbar.operation: return handleMenuRemoteControl(operates); // case MixinCommandOperation.remoteControl.mbar.operation: return handleMenuRemoteControl(operates);
// case MixinCommandOperation.remoteControl.mbar.operation: return handleMenuRemoteControl(operates); // case MixinCommandOperation.remoteControl.mbar.operation: return handleMenuRemoteControl(operates);
} }
} }
} }
}; };
/** /**
* 控制模式操作 * 控制模式操作
*/ */
function handleMenuRemoteControl(operates) { function handleMenuRemoteControl(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
const operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (checkOperationIsCurrentOperate(operate.operation, StationControlOperation.requestStationControl)) { if (checkOperationIsCurrentOperate(operate.operation, StationControlOperation.requestStationControl)) {
return handleMenuRequestCentralControl(operates); return handleMenuRequestCentralControl(operates);
} else if (checkOperationIsCurrentOperate(operate.operation, StationControlOperation.requestCentralControl)) { } else if (checkOperationIsCurrentOperate(operate.operation, StationControlOperation.requestCentralControl)) {
return handleMenuRequestStationControl(operates); return handleMenuRequestStationControl(operates);
} else if (checkOperationIsCurrentOperate(operate.operation, StationControlOperation.emergencyStationControl)) { } else if (checkOperationIsCurrentOperate(operate.operation, StationControlOperation.emergencyStationControl)) {
return handleMenuEmergencyStationControl(operates); return handleMenuEmergencyStationControl(operates);
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
// 封锁操作 // 封锁操作
function handleBlockButton(operates) { function handleBlockButton(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type == MapDeviceType.Signal.type) { // 信号机 封锁 if (operate.type == MapDeviceType.Signal.type) { // 信号机 封锁
return handleButtonLock(operate); return handleButtonLock(operate);
} else if (operate.type == MapDeviceType.Switch.type) { // 道岔封锁 } else if (operate.type == MapDeviceType.Switch.type) { // 道岔封锁
return handleButtonBlock(operate); return handleButtonBlock(operate);
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
// 信号封锁 按钮操作 // 信号封锁 按钮操作
function handleButtonLock(operate) { function handleButtonLock(operate) {
if (operate.code) { if (operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: OperationEvent.Signal.lock.event operation: OperationEvent.Signal.lock.event
}; };
} }
return { error: true }; return { error: true };
} }
// 信号机解封 按钮操作 // 信号机解封 按钮操作
function handleButtonUnlock(operate) { function handleButtonUnlock(operate) {
if (operate.code) { if (operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: OperationEvent.Signal.unlock.event operation: OperationEvent.Signal.unlock.event
}; };
} }
return { error: true }; return { error: true };
} }
// 道岔封锁 按钮操作 // 道岔封锁 按钮操作
function handleButtonBlock(operate) { function handleButtonBlock(operate) {
if (operate.code) { if (operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: OperationEvent.Switch.block.event operation: OperationEvent.Switch.block.event
}; };
} }
return { error: true }; return { error: true };
} }
// 道岔解封 按钮操作 // 道岔解封 按钮操作
function handleButtonUnblock(operate) { function handleButtonUnblock(operate) {
if (operate.code) { if (operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: OperationEvent.Switch.unblock.event operation: OperationEvent.Switch.unblock.event
}; };
} }
return { error: true }; return { error: true };
} }
// 解封操作 // 解封操作
function handleUnblockButton(operates) { function handleUnblockButton(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type == MapDeviceType.Signal.type) { // 信号机 解封 if (operate.type == MapDeviceType.Signal.type) { // 信号机 解封
return handleButtonUnlock(operate); return handleButtonUnlock(operate);
} else if (operate.type == MapDeviceType.Switch.type) { // 道岔封锁 } else if (operate.type == MapDeviceType.Switch.type) { // 道岔封锁
return handleButtonUnblock(operate); return handleButtonUnblock(operate);
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }

View File

@ -7,52 +7,52 @@ const SectionOperation = OperationEvent.Section;
const SectionType = MapDeviceType.Section.type; const SectionType = MapDeviceType.Section.type;
export default { export default {
test: function (operates) { test: function (operates) {
const operateType = getOperateTypeBy('Section', operates[0].operation); const operateType = getOperateTypeBy('Section', operates[0].operation);
if (operateType) { if (operateType) {
return true; return true;
} else { } else {
return false; return false;
} }
}, },
convert: function (operates) { convert: function (operates) {
if (operates && operates.length) { if (operates && operates.length) {
const operation = operates[0].operation; const operation = operates[0].operation;
switch (operation) { switch (operation) {
case SectionOperation.cancelStoppage.menu.operation: return handleMenuCancelStopPage(operates); case SectionOperation.cancelStoppage.menu.operation: return handleMenuCancelStopPage(operates);
case SectionOperation.stoppage.menu.operation: return handleMenuFailure(operates); case SectionOperation.stoppage.menu.operation: return handleMenuFailure(operates);
case SectionOperation.alxeFailure.menu.operation: return handleMenuAlxeFailure(operates); case SectionOperation.alxeFailure.menu.operation: return handleMenuAlxeFailure(operates);
case SectionOperation.fault.menu.operation: return handleMenuFault(operates); case SectionOperation.fault.menu.operation: return handleMenuFault(operates);
case SectionOperation.fault.button.operation: return handleButtonFault(operates); case SectionOperation.fault.button.operation: return handleButtonFault(operates);
case SectionOperation.lock.menu.operation: return handleMenuLock(operates); case SectionOperation.lock.menu.operation: return handleMenuLock(operates);
case SectionOperation.unlock.menu.operation: return handleMenuUnlock(operates); case SectionOperation.unlock.menu.operation: return handleMenuUnlock(operates);
case SectionOperation.split.menu.operation: return handleMenuSplit(operates); case SectionOperation.split.menu.operation: return handleMenuSplit(operates);
case SectionOperation.active.menu.operation: return handleMenuActive(operates); case SectionOperation.active.menu.operation: return handleMenuActive(operates);
case SectionOperation.setSpeed.menu.operation: return handleMenuSetSpeed(operates); case SectionOperation.setSpeed.menu.operation: return handleMenuSetSpeed(operates);
case SectionOperation.cancelSpeed.menu.operation: return handleMenuCancelSpeed(operates); case SectionOperation.cancelSpeed.menu.operation: return handleMenuCancelSpeed(operates);
case SectionOperation.axlePreReset.menu.operation: return handleMenuAxlePreReset(operates); case SectionOperation.axlePreReset.menu.operation: return handleMenuAxlePreReset(operates);
case SectionOperation.axlePreReset.button.operation: return handleButtonAxlePreReset(operates); case SectionOperation.axlePreReset.button.operation: return handleButtonAxlePreReset(operates);
case SectionOperation.detail.menu.operation: return handleMenuDetail(operates); case SectionOperation.detail.menu.operation: return handleMenuDetail(operates);
case SectionOperation.newtrain.menu.operation: return handleMenuNewTrain(operates); case SectionOperation.newtrain.menu.operation: return handleMenuNewTrain(operates);
case SectionOperation.alxeEffective.menu.operation: return handleMenuAlxeEffective(operates); case SectionOperation.alxeEffective.menu.operation: return handleMenuAlxeEffective(operates);
case SectionOperation.setLimitSpeed.menu.operation: return handleMenuSetLimitSpeed(operates); case SectionOperation.setLimitSpeed.menu.operation: return handleMenuSetLimitSpeed(operates);
} }
} }
} }
}; };
/** /**
@ -60,19 +60,19 @@ export default {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuCancelStopPage(operates) { function handleMenuCancelStopPage(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SectionType && operate.code) { if (operate.type === SectionType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SectionOperation.cancelStoppage.event operation: SectionOperation.cancelStoppage.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -80,19 +80,19 @@ function handleMenuCancelStopPage(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuFailure(operates) { function handleMenuFailure(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SectionType && operate.code) { if (operate.type === SectionType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SectionOperation.stoppage.event operation: SectionOperation.stoppage.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -100,19 +100,19 @@ function handleMenuFailure(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuAlxeFailure(operates) { function handleMenuAlxeFailure(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SectionType && operate.code) { if (operate.type === SectionType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SectionOperation.alxeFailure.event operation: SectionOperation.alxeFailure.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -120,28 +120,28 @@ function handleMenuAlxeFailure(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuFault(operates) { function handleMenuFault(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SectionType && operate.code) { if (operate.type === SectionType && operate.code) {
if (operate.code) { if (operate.code) {
let val = ''; let val = '';
const counter = store.getters['map/getCounterBySectionCode'](operate.code, '01'); const counter = store.getters['map/getCounterBySectionCode'](operate.code, '01');
if (counter) { if (counter) {
val = localStore.get(counter.code); val = localStore.get(counter.code);
} }
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SectionOperation.fault.event, operation: SectionOperation.fault.event,
val: val val: val
}; };
} }
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -149,20 +149,20 @@ function handleMenuFault(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuLock(operates) { function handleMenuLock(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SectionType && operate.code) { if (operate.type === SectionType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SectionOperation.lock.event, operation: SectionOperation.lock.event,
val: operates[operates.length - 1].val val: operates[operates.length - 1].val
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -170,20 +170,20 @@ function handleMenuLock(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuUnlock(operates) { function handleMenuUnlock(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SectionType && operate.code) { if (operate.type === SectionType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SectionOperation.unlock.event, operation: SectionOperation.unlock.event,
val: operates[operates.length - 1].val val: operates[operates.length - 1].val
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -191,20 +191,20 @@ function handleMenuUnlock(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuSplit(operates) { function handleMenuSplit(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SectionType && operate.code) { if (operate.type === SectionType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SectionOperation.split.event, operation: SectionOperation.split.event,
val: operates[operates.length - 1].val val: operates[operates.length - 1].val
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -212,20 +212,20 @@ function handleMenuSplit(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuActive(operates) { function handleMenuActive(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SectionType && operate.code) { if (operate.type === SectionType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SectionOperation.active.event, operation: SectionOperation.active.event,
val: operates[operates.length - 1].val val: operates[operates.length - 1].val
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -234,20 +234,20 @@ function handleMenuActive(operates) {
*/ */
function handleMenuSetSpeed(operates) { function handleMenuSetSpeed(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SectionType && operate.code) { if (operate.type === SectionType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SectionOperation.setSpeed.event, operation: SectionOperation.setSpeed.event,
val: operates[operates.length - 1].val val: operates[operates.length - 1].val
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -256,30 +256,30 @@ function handleMenuSetSpeed(operates) {
*/ */
function handleMenuCancelSpeed(operates) { function handleMenuCancelSpeed(operates) {
if (operates.length == 1) { if (operates.length == 1) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SectionType && operate.code) { if (operate.type === SectionType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
operation: SectionOperation.cancelSpeed.event.query operation: SectionOperation.cancelSpeed.event.query
}; };
} }
return { error: true }; return { error: true };
} else if (operates.length >= 3) { } else if (operates.length >= 3) {
const operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === SectionType && operates[0].code) { if (operate.type === SectionType && operates[0].code) {
return { return {
over: true, over: true,
type: operate.type, type: operate.type,
code: operates[0].code, code: operates[0].code,
operation: SectionOperation.cancelSpeed.event.confirm operation: SectionOperation.cancelSpeed.event.confirm
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -288,20 +288,20 @@ function handleMenuCancelSpeed(operates) {
*/ */
function handleMenuAxlePreReset(operates) { function handleMenuAxlePreReset(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SectionType && operate.code) { if (operate.type === SectionType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SectionOperation.axlePreReset.event, operation: SectionOperation.axlePreReset.event,
val: operates[operates.length - 1].val val: operates[operates.length - 1].val
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -310,20 +310,20 @@ function handleMenuAxlePreReset(operates) {
*/ */
function handleMenuDetail(operates) { function handleMenuDetail(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SectionType && operate.code) { if (operate.type === SectionType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SectionOperation.detail.event, operation: SectionOperation.detail.event,
val: operates[operates.length - 1].val val: operates[operates.length - 1].val
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -331,20 +331,20 @@ function handleMenuDetail(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuNewTrain(operates) { function handleMenuNewTrain(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SectionType && operate.code) { if (operate.type === SectionType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SectionOperation.newtrain.event, operation: SectionOperation.newtrain.event,
val: operates[operates.length - 1].val val: operates[operates.length - 1].val
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -352,20 +352,20 @@ function handleMenuNewTrain(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuAlxeEffective(operates) { function handleMenuAlxeEffective(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SectionType && operate.code) { if (operate.type === SectionType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SectionOperation.alxeEffective.event, operation: SectionOperation.alxeEffective.event,
val: operates[operates.length - 1].val val: operates[operates.length - 1].val
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -373,27 +373,27 @@ function handleMenuAlxeEffective(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuSetLimitSpeed(operates) { function handleMenuSetLimitSpeed(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SectionType && operate.code) { if (operate.type === SectionType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SectionOperation.setLimitSpeed.event, operation: SectionOperation.setLimitSpeed.event,
val: operates[operates.length - 1].val val: operates[operates.length - 1].val
}; };
} else if (operate.type === MapDeviceType.Switch.type && operate.code) { } else if (operate.type === MapDeviceType.Switch.type && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SectionOperation.setLimitSpeed.event, operation: SectionOperation.setLimitSpeed.event,
val: operates[operates.length - 1].val val: operates[operates.length - 1].val
}; };
} }
return { error: true }; return { error: true };
} }
} }
/** /**
@ -401,19 +401,19 @@ function handleMenuSetLimitSpeed(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleButtonFault(operates) { function handleButtonFault(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === SectionType && operate.code) { if (operate.type === SectionType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
// over: true, // over: true,
operation: SectionOperation.fault.event operation: SectionOperation.fault.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -421,17 +421,17 @@ function handleButtonFault(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleButtonAxlePreReset(operates) { function handleButtonAxlePreReset(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === SectionType && operate.code) { if (operate.type === SectionType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SectionOperation.axlePreReset.event operation: SectionOperation.axlePreReset.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }

View File

@ -5,38 +5,38 @@ const StationControlOperation = OperationEvent.StationControl;
const StationControlType = MapDeviceType.StationControl.type; const StationControlType = MapDeviceType.StationControl.type;
export default { export default {
test: function (operates) { test: function (operates) {
const operateType = getOperateTypeBy('StationControl', operates[0].operation); const operateType = getOperateTypeBy('StationControl', operates[0].operation);
if (operateType) { if (operateType) {
return true; return true;
} else { } else {
return false; return false;
} }
}, },
convert: function (operates) { convert: function (operates) {
if (operates && operates.length) { if (operates && operates.length) {
const operation = operates[0].operation; const operation = operates[0].operation;
switch (operation) { switch (operation) {
case StationControlOperation.cancelStoppage.menu.operation: return handleMenuCancelStopPage(operates); case StationControlOperation.cancelStoppage.menu.operation: return handleMenuCancelStopPage(operates);
case StationControlOperation.stoppage.menu.operation: return handleMenuStoppage(operates); case StationControlOperation.stoppage.menu.operation: return handleMenuStoppage(operates);
case StationControlOperation.emergencyStationControl.menu.operation: return handleMenuEmergencyStationControl(operates); case StationControlOperation.emergencyStationControl.menu.operation: return handleMenuEmergencyStationControl(operates);
case StationControlOperation.requestStationControl.menu.operation: return handleMenuRequestStationControl(operates); case StationControlOperation.requestStationControl.menu.operation: return handleMenuRequestStationControl(operates);
case StationControlOperation.requestStationControl.mbar.operation: return handleBarRequestStationControl(operates); case StationControlOperation.requestStationControl.mbar.operation: return handleBarRequestStationControl(operates);
case StationControlOperation.forcedStationControl.menu.operation: return handleMenuForcedStationControl(operates); case StationControlOperation.forcedStationControl.menu.operation: return handleMenuForcedStationControl(operates);
case StationControlOperation.forcedStationControl.passwordConfirm.operation: return handleBarForcedStationControl(operates); case StationControlOperation.forcedStationControl.passwordConfirm.operation: return handleBarForcedStationControl(operates);
case StationControlOperation.forcedStationControl.mbar.operation: return handleBarForcedStationControl(operates); case StationControlOperation.forcedStationControl.mbar.operation: return handleBarForcedStationControl(operates);
case StationControlOperation.requestCentralControl.menu.operation: return handleMenuRequestCentralControl(operates); case StationControlOperation.requestCentralControl.menu.operation: return handleMenuRequestCentralControl(operates);
case StationControlOperation.requestCentralControl.mbar.operation: return handleBarRequestCentralControl(operates); case StationControlOperation.requestCentralControl.mbar.operation: return handleBarRequestCentralControl(operates);
case StationControlOperation.controlResponse.menu.operation: return handleMenuControlResponse(operates); case StationControlOperation.controlResponse.menu.operation: return handleMenuControlResponse(operates);
} }
} }
} }
}; };
/** /**
@ -44,19 +44,19 @@ export default {
* @param {*} operates * @param {*} operates
*/ */
export function handleMenuCancelStopPage(operates) { export function handleMenuCancelStopPage(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === StationControlType && operate.code) { if (operate.type === StationControlType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: StationControlOperation.cancelStoppage.event operation: StationControlOperation.cancelStoppage.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -64,19 +64,19 @@ export function handleMenuCancelStopPage(operates) {
* @param {*} operates * @param {*} operates
*/ */
export function handleMenuStoppage(operates) { export function handleMenuStoppage(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === StationControlType && operate.code) { if (operate.type === StationControlType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: StationControlOperation.stoppage.event operation: StationControlOperation.stoppage.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -84,20 +84,20 @@ export function handleMenuStoppage(operates) {
* @param {*} operates * @param {*} operates
*/ */
export function handleMenuEmergencyStationControl(operates) { export function handleMenuEmergencyStationControl(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
const operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === StationControlType && operate.val) { if (operate.type === StationControlType && operate.val) {
return { return {
type: operate.type, type: operate.type,
val: operate.val, val: operate.val,
code: operate.code, code: operate.code,
over: true, over: true,
operation: StationControlOperation.emergencyStationControl.event operation: StationControlOperation.emergencyStationControl.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -105,20 +105,20 @@ export function handleMenuEmergencyStationControl(operates) {
* @param {*} operates * @param {*} operates
*/ */
export function handleMenuRequestStationControl(operates) { export function handleMenuRequestStationControl(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
const operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === StationControlType && operate.val) { if (operate.type === StationControlType && operate.val) {
return { return {
type: operate.type, type: operate.type,
val: operate.val, val: operate.val,
code: operate.code, code: operate.code,
over: true, over: true,
operation: StationControlOperation.requestStationControl.event operation: StationControlOperation.requestStationControl.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -126,20 +126,20 @@ export function handleMenuRequestStationControl(operates) {
* @param {*} operates * @param {*} operates
*/ */
export function handleMenuForcedStationControl(operates) { export function handleMenuForcedStationControl(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
const operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === StationControlType && operate.val) { if (operate.type === StationControlType && operate.val) {
return { return {
type: operate.type, type: operate.type,
val: operate.val, val: operate.val,
code: operate.code, code: operate.code,
over: true, over: true,
operation: StationControlOperation.forcedStationControl.event operation: StationControlOperation.forcedStationControl.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -147,20 +147,20 @@ export function handleMenuForcedStationControl(operates) {
* @param {*} operates * @param {*} operates
*/ */
export function handleMenuRequestCentralControl(operates) { export function handleMenuRequestCentralControl(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
const operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === StationControlType && operate.val) { if (operate.type === StationControlType && operate.val) {
return { return {
type: operate.type, type: operate.type,
val: operate.val, val: operate.val,
code: operate.code, code: operate.code,
over: true, over: true,
operation: StationControlOperation.requestCentralControl.event operation: StationControlOperation.requestCentralControl.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -168,35 +168,35 @@ export function handleMenuRequestCentralControl(operates) {
* @param {*} operates * @param {*} operates
*/ */
export function handleMenuControlResponse(operates) { export function handleMenuControlResponse(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
const operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === StationControlType && operate.val) { if (operate.type === StationControlType && operate.val) {
let operation = ''; let operation = '';
if (operate.operation == StationControlOperation.controlResponse.agree.operation) { if (operate.operation == StationControlOperation.controlResponse.agree.operation) {
if (operate.prdType == '01') { if (operate.prdType == '01') {
operation = StationControlOperation.controlResponse.event.stationAgree; operation = StationControlOperation.controlResponse.event.stationAgree;
} else { } else {
operation = StationControlOperation.controlResponse.event.centralAgree; operation = StationControlOperation.controlResponse.event.centralAgree;
} }
} else { } else {
if (operate.prdType == '01') { if (operate.prdType == '01') {
operation = StationControlOperation.controlResponse.event.stationRefuse; operation = StationControlOperation.controlResponse.event.stationRefuse;
} else { } else {
operation = StationControlOperation.controlResponse.event.centralRefuse; operation = StationControlOperation.controlResponse.event.centralRefuse;
} }
} }
return { return {
type: operate.type, type: operate.type,
val: operate.val, val: operate.val,
code: operate.code, code: operate.code,
over: true, over: true,
operation: operation operation: operation
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -204,18 +204,18 @@ export function handleMenuControlResponse(operates) {
* @param {*} operates * @param {*} operates
*/ */
export function handleBarRequestStationControl(operates) { export function handleBarRequestStationControl(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
const operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === StationControlType && operate.val) { if (operate.type === StationControlType && operate.val) {
return { return {
type: operate.type, type: operate.type,
operation: StationControlOperation.requestStationControl.event, operation: StationControlOperation.requestStationControl.event,
code: operate.val code: operate.val
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -223,18 +223,18 @@ export function handleBarRequestStationControl(operates) {
* @param {*} operates * @param {*} operates
*/ */
export function handleBarForcedStationControl(operates) { export function handleBarForcedStationControl(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
const operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === StationControlType && operate.val) { if (operate.type === StationControlType && operate.val) {
return { return {
type: operate.type, type: operate.type,
code: operate.val, code: operate.val,
operation: StationControlOperation.forcedStationControl.event operation: StationControlOperation.forcedStationControl.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -242,16 +242,16 @@ export function handleBarForcedStationControl(operates) {
* @param {*} operates * @param {*} operates
*/ */
export function handleBarRequestCentralControl(operates) { export function handleBarRequestCentralControl(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
const operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === StationControlType && operate.val) { if (operate.type === StationControlType && operate.val) {
return { return {
type: operate.type, type: operate.type,
code: operate.val, code: operate.val,
operation: StationControlOperation.requestCentralControl.event operation: StationControlOperation.requestCentralControl.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }

View File

@ -6,7 +6,7 @@ const StationType = MapDeviceType.Station.type;
export default { export default {
test: function (operates) { test: function (operates) {
let operateType = getOperateTypeBy('Station', operates[0].operation); const operateType = getOperateTypeBy('Station', operates[0].operation);
if (operateType) { if (operateType) {
return true; return true;
} else { } else {
@ -15,23 +15,23 @@ export default {
}, },
convert: function (operates) { convert: function (operates) {
if (operates && operates.length) { if (operates && operates.length) {
let operation = operates[0].operation; const operation = operates[0].operation;
switch (operation) { switch (operation) {
case StationOperation.cancelStoppage.menu.operation: return handleMenuCancelStopPage(operates); case StationOperation.cancelStoppage.menu.operation: return handleMenuCancelStopPage(operates);
case StationOperation.stoppage.menu.operation: return handleMenuStoppage(operates); case StationOperation.stoppage.menu.operation: return handleMenuStoppage(operates);
case StationOperation.setAutoTrigger.menu.operation: return handleMenuSetAutoTrigger(operates); case StationOperation.setAutoTrigger.menu.operation: return handleMenuSetAutoTrigger(operates);
case StationOperation.cancelAutoTrigger.menu.operation: return handleMenuCancelAutoTrigger(operates); case StationOperation.cancelAutoTrigger.menu.operation: return handleMenuCancelAutoTrigger(operates);
case StationOperation.powerUnLock.menu.operation: return handleMenuPowerUnLock(operates); case StationOperation.powerUnLock.menu.operation: return handleMenuPowerUnLock(operates);
case StationOperation.execKeyOperationTest.menu.operation: return handleMenuExecKeyOperationTest(operates); case StationOperation.execKeyOperationTest.menu.operation: return handleMenuExecKeyOperationTest(operates);
case StationOperation.humanControlALL.menu.operation: return handleMenuHumanControlAll(operates); case StationOperation.humanControlALL.menu.operation: return handleMenuHumanControlAll(operates);
case StationOperation.atsAutoControlALL.menu.operation: return handleMenuAtsAutoControlAll(operates); case StationOperation.atsAutoControlALL.menu.operation: return handleMenuAtsAutoControlAll(operates);
} }
} }
} }
@ -39,17 +39,17 @@ export default {
/** /**
* 处理右键菜单 取消故障 操作 * 处理右键菜单 取消故障 操作
* @param {*} operates * @param {*} operates
*/ */
function handleMenuCancelStopPage(operates) { function handleMenuCancelStopPage(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
let operate = operates[0]; const operate = operates[0];
if (operate.type === StationType && operate.code) { if (operate.type === StationType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: StationOperation.cancelStoppage.event, operation: StationOperation.cancelStoppage.event
}; };
} }
return { error: true }; return { error: true };
@ -57,14 +57,13 @@ function handleMenuCancelStopPage(operates) {
return null; return null;
} }
/** /**
* 处理右键菜单 设置故障 操作 * 处理右键菜单 设置故障 操作
* @param {*} operates * @param {*} operates
*/ */
function handleMenuStoppage(operates) { function handleMenuStoppage(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
let operate = operates[0]; const operate = operates[0];
if (operate.type === StationType && operate.code) { if (operate.type === StationType && operate.code) {
return { return {
type: operate.type, type: operate.type,
@ -80,11 +79,11 @@ function handleMenuStoppage(operates) {
/** /**
* 处理右键菜单 全站设置联锁自动触发 操作 * 处理右键菜单 全站设置联锁自动触发 操作
* @param {*} operates * @param {*} operates
*/ */
function handleMenuSetAutoTrigger(operates) { function handleMenuSetAutoTrigger(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
let operate = operates[0]; const operate = operates[0];
if (operate.type === StationType && operate.code) { if (operate.type === StationType && operate.code) {
return { return {
type: operate.type, type: operate.type,
@ -100,11 +99,11 @@ function handleMenuSetAutoTrigger(operates) {
/** /**
* 处理右键菜单 全站取消联锁自动触发 操作 * 处理右键菜单 全站取消联锁自动触发 操作
* @param {*} operates * @param {*} operates
*/ */
function handleMenuCancelAutoTrigger(operates) { function handleMenuCancelAutoTrigger(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
let operate = operates[0]; const operate = operates[0];
if (operate.type === StationType && operate.code) { if (operate.type === StationType && operate.code) {
return { return {
type: operate.type, type: operate.type,
@ -120,11 +119,11 @@ function handleMenuCancelAutoTrigger(operates) {
/** /**
* 处理右键菜单 上电解锁 操作 * 处理右键菜单 上电解锁 操作
* @param {*} operates * @param {*} operates
*/ */
function handleMenuPowerUnLock(operates) { function handleMenuPowerUnLock(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
let operate = operates[0]; const operate = operates[0];
if (operate.type === StationType && operate.code) { if (operate.type === StationType && operate.code) {
return { return {
type: operate.type, type: operate.type,
@ -140,11 +139,11 @@ function handleMenuPowerUnLock(operates) {
/** /**
* 处理右键菜单 执行关键操作测试 操作 * 处理右键菜单 执行关键操作测试 操作
* @param {*} operates * @param {*} operates
*/ */
function handleMenuExecKeyOperationTest(operates) { function handleMenuExecKeyOperationTest(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
let operate = operates[0]; const operate = operates[0];
if (operate.type === StationType && operate.code) { if (operate.type === StationType && operate.code) {
return { return {
type: operate.type, type: operate.type,
@ -158,14 +157,13 @@ function handleMenuExecKeyOperationTest(operates) {
return null; return null;
} }
/** /**
* 处理右键菜单 所有进路自排关 操作 * 处理右键菜单 所有进路自排关 操作
* @param {*} operates * @param {*} operates
*/ */
function handleMenuHumanControlAll(operates) { function handleMenuHumanControlAll(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
let operate = operates[0]; const operate = operates[0];
if (operate.type === StationType && operate.code) { if (operate.type === StationType && operate.code) {
return { return {
type: operate.type, type: operate.type,
@ -181,11 +179,11 @@ function handleMenuHumanControlAll(operates) {
/** /**
* 处理右键菜单 所有进路自排开 操作 * 处理右键菜单 所有进路自排开 操作
* @param {*} operates * @param {*} operates
*/ */
function handleMenuAtsAutoControlAll(operates) { function handleMenuAtsAutoControlAll(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
let operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === StationType && operates[0].code) { if (operate.type === StationType && operates[0].code) {
return { return {
type: operate.type, type: operate.type,
@ -198,4 +196,4 @@ function handleMenuAtsAutoControlAll(operates) {
return { error: true }; return { error: true };
} }
return null; return null;
} }

View File

@ -5,434 +5,432 @@ const StationStandOperation = OperationEvent.StationStand;
const StationStandType = MapDeviceType.StationStand.type; const StationStandType = MapDeviceType.StationStand.type;
export default { export default {
test: function (operates) { test: function (operates) {
let operateType = getOperateTypeBy('StationStand', operates[0].operation); const operateType = getOperateTypeBy('StationStand', operates[0].operation);
if (operateType) { if (operateType) {
return true; return true;
} else { } else {
return false; return false;
} }
}, },
convert: function (operates) { convert: function (operates) {
if (operates && operates.length) { if (operates && operates.length) {
let operation = operates[0].operation; const operation = operates[0].operation;
switch (operation) { switch (operation) {
case StationStandOperation.cancelStoppage.menu.operation: return handleMenuCancelStopPage(operates); case StationStandOperation.cancelStoppage.menu.operation: return handleMenuCancelStopPage(operates);
case StationStandOperation.stoppage.menu.operation: return handleMenuStoppage(operates); case StationStandOperation.stoppage.menu.operation: return handleMenuStoppage(operates);
case StationStandOperation.earlyDeparture.menu.operation: return handleMenuEarlyDeparture(operates); case StationStandOperation.earlyDeparture.menu.operation: return handleMenuEarlyDeparture(operates);
case StationStandOperation.setJumpStop.menu.operation: return handleMenuSetJumpStop(operates); case StationStandOperation.setJumpStop.menu.operation: return handleMenuSetJumpStop(operates);
case StationStandOperation.cancelJumpStop.menu.operation: return handleMenuCancelJumpStop(operates); case StationStandOperation.cancelJumpStop.menu.operation: return handleMenuCancelJumpStop(operates);
case StationStandOperation.setDetainTrain.menu.operation: return handleMenuSetDetainTrain(operates); case StationStandOperation.setDetainTrain.menu.operation: return handleMenuSetDetainTrain(operates);
case StationStandOperation.cancelDetainTrain.menu.operation: return handleMenuCancelDetainTrain(operates); case StationStandOperation.cancelDetainTrain.menu.operation: return handleMenuCancelDetainTrain(operates);
case StationStandOperation.cancelDetainTrainForce.menu.operation: return handleMenuCancelDetainTrainForce(operates); case StationStandOperation.cancelDetainTrainForce.menu.operation: return handleMenuCancelDetainTrainForce(operates);
case StationStandOperation.detail.menu.operation: return handleMenuDetail(operates); case StationStandOperation.detail.menu.operation: return handleMenuDetail(operates);
case StationStandOperation.cancelDetainTrainAll.menu.operation: return handleMenuCancelDetainTrainAll(operates); case StationStandOperation.cancelDetainTrainAll.menu.operation: return handleMenuCancelDetainTrainAll(operates);
case StationStandOperation.setStopTime.menu.operation: return handleMenuSetStopTime(operates); case StationStandOperation.setStopTime.menu.operation: return handleMenuSetStopTime(operates);
case StationStandOperation.setRunLevel.menu.operation: return handleMenuSetRunLevel(operates); case StationStandOperation.setRunLevel.menu.operation: return handleMenuSetRunLevel(operates);
case StationStandOperation.setBackStrategy.menu.operation: return handleMenuSetBackStrategy(operates); case StationStandOperation.setBackStrategy.menu.operation: return handleMenuSetBackStrategy(operates);
case StationStandOperation.setDetainTrainAll.mbar.operation: return handleMbarSetDetainTrainAll(operates); case StationStandOperation.setDetainTrainAll.mbar.operation: return handleMbarSetDetainTrainAll(operates);
case StationStandOperation.cancelDetainTrainAll.mbar.operation: return handleMbarCancelDetainTrainAll(operates); case StationStandOperation.cancelDetainTrainAll.mbar.operation: return handleMbarCancelDetainTrainAll(operates);
case StationStandOperation.cancelUpDetainTrainAll.mbar.operation: return handleMbarCancelUpDetainTrainAll(operates); case StationStandOperation.cancelUpDetainTrainAll.mbar.operation: return handleMbarCancelUpDetainTrainAll(operates);
case StationStandOperation.cancelDownDetainTrainAll.mbar.operation: return handleMbarCancelDownDetainTrainAll(operates); case StationStandOperation.cancelDownDetainTrainAll.mbar.operation: return handleMbarCancelDownDetainTrainAll(operates);
} }
} }
} }
}; };
/** /**
* 处理右键菜单 取消故障 操作 * 处理右键菜单 取消故障 操作
* @param {*} operates * @param {*} operates
*/ */
function handleMenuCancelStopPage(operates) { function handleMenuCancelStopPage(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
let operate = operates[0]; const operate = operates[0];
if (operate.type === StationStandType && operate.code) { if (operate.type === StationStandType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: StationStandOperation.cancelStoppage.event, operation: StationStandOperation.cancelStoppage.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
* 处理右键菜单 设置故障 操作 * 处理右键菜单 设置故障 操作
* @param {*} operates * @param {*} operates
*/ */
function handleMenuStoppage(operates) { function handleMenuStoppage(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
let operate = operates[0]; const operate = operates[0];
if (operate.type === StationStandType) { if (operate.type === StationStandType) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: StationStandOperation.stoppage.event operation: StationStandOperation.stoppage.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
* 处理右键菜单 提前发车 操作 * 处理右键菜单 提前发车 操作
* @param {*} operates * @param {*} operates
*/ */
function handleMenuEarlyDeparture(operates) { function handleMenuEarlyDeparture(operates) {
if (operates.length > 0) { if (operates.length > 0) {
let operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === StationStandType) { if (operate.type === StationStandType) {
return { return {
type: operate.type, type: operate.type,
code: operates[0].code, code: operates[0].code,
over: true, over: true,
operation: StationStandOperation.earlyDeparture.event, operation: StationStandOperation.earlyDeparture.event,
val: operate.val val: operate.val
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
* 处理右键菜单 设置跳停 操作 * 处理右键菜单 设置跳停 操作
* @param {*} operates * @param {*} operates
*/ */
function handleMenuSetJumpStop(operates) { function handleMenuSetJumpStop(operates) {
if (operates.length > 1) { if (operates.length > 1) {
let operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === StationStandType) { if (operate.type === StationStandType) {
return { return {
type: operate.type, type: operate.type,
code: operates[0].code, code: operates[0].code,
over: true, over: true,
operation: StationStandOperation.setJumpStop.event, operation: StationStandOperation.setJumpStop.event,
val: operate.val val: operate.val
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
* 处理右键菜单 取消跳停 操作 * 处理右键菜单 取消跳停 操作
* @param {*} operates * @param {*} operates
*/ */
function handleMenuCancelJumpStop(operates) { function handleMenuCancelJumpStop(operates) {
if (operates.length > 1) { if (operates.length > 1) {
let operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === StationStandType) { if (operate.type === StationStandType) {
return { return {
type: operate.type, type: operate.type,
code: operates[0].code, code: operates[0].code,
over: true, over: true,
operation: StationStandOperation.cancelJumpStop.event, operation: StationStandOperation.cancelJumpStop.event,
val: operate.val val: operate.val
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
* 处理右键菜单 设置扣车 操作 * 处理右键菜单 设置扣车 操作
* @param {*} operates * @param {*} operates
*/ */
function handleMenuSetDetainTrain(operates) { function handleMenuSetDetainTrain(operates) {
if (operates.length > 1) { if (operates.length > 1) {
let operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === StationStandType) { if (operate.type === StationStandType) {
return { return {
type: operate.type, type: operate.type,
code: operates[0].code, code: operates[0].code,
over: true, over: true,
operation: StationStandOperation.setDetainTrain.event operation: StationStandOperation.setDetainTrain.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
* 处理右键菜单 取消扣车 操作 * 处理右键菜单 取消扣车 操作
* @param {*} operates * @param {*} operates
*/ */
function handleMenuCancelDetainTrain(operates) { function handleMenuCancelDetainTrain(operates) {
if (operates.length > 1) { if (operates.length > 1) {
let operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === StationStandType) { if (operate.type === StationStandType) {
return { return {
type: operate.type, type: operate.type,
code: operates[0].code, code: operates[0].code,
over: true, over: true,
// operation: operate.operation, // operation: operate.operation,
operation: StationStandOperation.cancelDetainTrain.event, operation: StationStandOperation.cancelDetainTrain.event,
val: operate.val val: operate.val
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
* 处理右键菜单 强制取消扣车 操作 * 处理右键菜单 强制取消扣车 操作
* @param {*} operates * @param {*} operates
*/ */
function handleMenuCancelDetainTrainForce(operates) { function handleMenuCancelDetainTrainForce(operates) {
if (operates.length > 1) { if (operates.length > 1) {
let operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === StationStandType) { if (operate.type === StationStandType) {
return { return {
type: operate.type, type: operate.type,
code: operates[0].code, code: operates[0].code,
over: true, over: true,
operation: StationStandOperation.cancelDetainTrainForce.event operation: StationStandOperation.cancelDetainTrainForce.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
* 处理右键菜单 站台详细信息 操作 * 处理右键菜单 站台详细信息 操作
* @param {*} operates * @param {*} operates
*/ */
function handleMenuDetail(operates) { function handleMenuDetail(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
let operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === StationStandType) { if (operate.type === StationStandType) {
return { return {
type: operate.type, type: operate.type,
code: operates[0].code, code: operates[0].code,
over: true, over: true,
operation: StationStandOperation.detail.event operation: StationStandOperation.detail.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
* 处理右键菜单 取消全站扣车 操作 * 处理右键菜单 取消全站扣车 操作
* @param {*} operates * @param {*} operates
*/ */
function handleMenuCancelDetainTrainAll(operates) { function handleMenuCancelDetainTrainAll(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
let operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === StationStandType) { if (operate.type === StationStandType) {
return { return {
type: operate.type, type: operate.type,
code: operates[0].code, code: operates[0].code,
over: true, over: true,
operation: StationStandOperation.cancelDetainTrainAll.event, operation: StationStandOperation.cancelDetainTrainAll.event,
val: operate.val, val: operate.val
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
* 处理右键菜单 设置停站时间 操作 * 处理右键菜单 设置停站时间 操作
* @param {*} operates * @param {*} operates
*/ */
function handleMenuSetStopTime(operates) { function handleMenuSetStopTime(operates) {
if (operates.length == 1) { if (operates.length == 1) {
let operate = operates[0]; const operate = operates[0];
if (operate.type === StationStandType && operate.code) { if (operate.type === StationStandType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
operation: StationStandOperation.setStopTime.event.query, operation: StationStandOperation.setStopTime.event.query
}; };
} }
return { error: true }; return { error: true };
} else if (operates.length >= 2) { } else if (operates.length >= 2) {
let operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === StationStandType && operate.val) { if (operate.type === StationStandType && operate.val) {
return { return {
over: true, over: true,
type: operate.type, type: operate.type,
code: operates[0].code, code: operates[0].code,
operation: StationStandOperation.setStopTime.event.confirm, operation: StationStandOperation.setStopTime.event.confirm,
val: operate.val val: operate.val
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
* 处理右键菜单 设置运行等级 操作 * 处理右键菜单 设置运行等级 操作
* @param {*} operates * @param {*} operates
*/ */
function handleMenuSetRunLevel(operates) { function handleMenuSetRunLevel(operates) {
if (operates.length == 1) { if (operates.length == 1) {
let operate = operates[0]; const operate = operates[0];
if (operate.type === StationStandType && operate.code) { if (operate.type === StationStandType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
operation: StationStandOperation.setRunLevel.event.query, operation: StationStandOperation.setRunLevel.event.query
}; };
} }
return { error: true }; return { error: true };
} else if (operates.length >= 2) { } else if (operates.length >= 2) {
let operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === StationStandType && operate.val) { if (operate.type === StationStandType && operate.val) {
return { return {
over: true, over: true,
type: operate.type, type: operate.type,
code: operates[0].code, code: operates[0].code,
operation: StationStandOperation.setRunLevel.event.confirm, operation: StationStandOperation.setRunLevel.event.confirm,
val: operate.val val: operate.val
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
* 处理右键菜单 提前发车 操作 * 处理右键菜单 提前发车 操作
* @param {*} operates * @param {*} operates
*/ */
function handleMenuSetBackStrategy(operates) { function handleMenuSetBackStrategy(operates) {
if (operates.length == 1) { if (operates.length == 1) {
let operate = operates[0]; const operate = operates[0];
if (operate.type === StationStandType && operate.code) { if (operate.type === StationStandType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
operation: StationStandOperation.setBackStrategy.event.query, operation: StationStandOperation.setBackStrategy.event.query
}; };
} }
return { error: true }; return { error: true };
} else if (operates.length >= 2) { } else if (operates.length >= 2) {
let operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === StationStandType && operate.val) { if (operate.type === StationStandType && operate.val) {
return { return {
over: true, over: true,
type: operate.type, type: operate.type,
code: operates[0].code, code: operates[0].code,
operation: StationStandOperation.setBackStrategy.event.confirm, operation: StationStandOperation.setBackStrategy.event.confirm,
val: operate.val val: operate.val
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
* 处理菜单栏 设置全线扣车 操作 * 处理菜单栏 设置全线扣车 操作
* @param {*} operates * @param {*} operates
*/ */
function handleMbarSetDetainTrainAll(operates) { function handleMbarSetDetainTrainAll(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
let operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === StationStandType) { if (operate.type === StationStandType) {
return { return {
type: operate.type, type: operate.type,
code: operate.val, code: operate.val,
operation: StationStandOperation.setDetainTrainAll.event, operation: StationStandOperation.setDetainTrainAll.event,
val: operate.val val: operate.val
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
* 处理菜单栏 取消全线扣车 操作 * 处理菜单栏 取消全线扣车 操作
* @param {*} operates * @param {*} operates
*/ */
function handleMbarCancelDetainTrainAll(operates) { function handleMbarCancelDetainTrainAll(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
let operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === StationStandType) { if (operate.type === StationStandType) {
return { return {
type: operate.type, type: operate.type,
code: operate.val, code: operate.val,
operation: StationStandOperation.cancelDetainTrainAll.event, operation: StationStandOperation.cancelDetainTrainAll.event,
val: operate.val val: operate.val
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
* 处理菜单栏 取消全线上行扣车 操作 * 处理菜单栏 取消全线上行扣车 操作
* @param {*} operates * @param {*} operates
*/ */
function handleMbarCancelUpDetainTrainAll(operates) { function handleMbarCancelUpDetainTrainAll(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
let operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === StationStandType) { if (operate.type === StationStandType) {
return { return {
type: operate.type, type: operate.type,
code: operate.val, code: operate.val,
operation: StationStandOperation.cancelUpDetainTrainAll.event, operation: StationStandOperation.cancelUpDetainTrainAll.event,
val: operate.val val: operate.val
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
* 处理菜单栏 取消全线上行扣车 操作 * 处理菜单栏 取消全线上行扣车 操作
* @param {*} operates * @param {*} operates
*/ */
function handleMbarCancelDownDetainTrainAll(operates) { function handleMbarCancelDownDetainTrainAll(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
let operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === StationStandType) { if (operate.type === StationStandType) {
return { return {
type: operate.type, type: operate.type,
code: operate.val, code: operate.val,
operation: StationStandOperation.cancelDownDetainTrainAll.event, operation: StationStandOperation.cancelDownDetainTrainAll.event,
val: operate.val val: operate.val
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }

View File

@ -5,58 +5,58 @@ const SwitchOperation = OperationEvent.Switch;
const SwitchType = MapDeviceType.Switch.type; const SwitchType = MapDeviceType.Switch.type;
export default { export default {
test: function (operates) { test: function (operates) {
const operateType = getOperateTypeBy('Switch', operates[0].operation); const operateType = getOperateTypeBy('Switch', operates[0].operation);
if (operateType) { if (operateType) {
return true; return true;
} else { } else {
return false; return false;
} }
}, },
convert: function (operates) { convert: function (operates) {
if (operates && operates.length) { if (operates && operates.length) {
const operation = operates[0].operation; const operation = operates[0].operation;
switch (operation) { switch (operation) {
case SwitchOperation.cancelStoppage.menu.operation: return handleMenuCancelStopPage(operates); case SwitchOperation.cancelStoppage.menu.operation: return handleMenuCancelStopPage(operates);
case SwitchOperation.stoppage.menu.operation: return handleMenuStoppage(operates); case SwitchOperation.stoppage.menu.operation: return handleMenuStoppage(operates);
case SwitchOperation.locate.button.operation: return handleButtonLocate(operates); case SwitchOperation.locate.button.operation: return handleButtonLocate(operates);
case SwitchOperation.locate.menu.operation: return handleMenuLocate(operates); case SwitchOperation.locate.menu.operation: return handleMenuLocate(operates);
case SwitchOperation.reverse.button.operation: return handleButtonReverse(operates); case SwitchOperation.reverse.button.operation: return handleButtonReverse(operates);
case SwitchOperation.reverse.menu.operation: return handleMenuReverse(operates); case SwitchOperation.reverse.menu.operation: return handleMenuReverse(operates);
case SwitchOperation.lock.button.operation: return handleButtonLock(operates); case SwitchOperation.lock.button.operation: return handleButtonLock(operates);
case SwitchOperation.lock.menu.operation: return handleMenuLock(operates); case SwitchOperation.lock.menu.operation: return handleMenuLock(operates);
case SwitchOperation.unlock.button.operation: return handleButtonUnlock(operates); case SwitchOperation.unlock.button.operation: return handleButtonUnlock(operates);
case SwitchOperation.unlock.menu.operation: return handleMenuUnlock(operates); case SwitchOperation.unlock.menu.operation: return handleMenuUnlock(operates);
case SwitchOperation.block.menu.operation: return handleMenuBlock(operates); case SwitchOperation.block.menu.operation: return handleMenuBlock(operates);
case SwitchOperation.unblock.menu.operation: return handleMenuUnblock(operates); case SwitchOperation.unblock.menu.operation: return handleMenuUnblock(operates);
case SwitchOperation.turnout.menu.operation: return handleMenuTurnout(operates); case SwitchOperation.turnout.menu.operation: return handleMenuTurnout(operates);
case SwitchOperation.turnoutForce.menu.operation: return handleMenuTurnoutForce(operates); case SwitchOperation.turnoutForce.menu.operation: return handleMenuTurnoutForce(operates);
case SwitchOperation.fault.menu.operation: return handleMenuFault(operates); case SwitchOperation.fault.menu.operation: return handleMenuFault(operates);
case SwitchOperation.axlePreReset.menu.operation: return handleMenuAxlePreReset(operates); case SwitchOperation.axlePreReset.menu.operation: return handleMenuAxlePreReset(operates);
case SwitchOperation.split.menu.operation: return handleMenuSplit(operates); case SwitchOperation.split.menu.operation: return handleMenuSplit(operates);
case SwitchOperation.active.menu.operation: return handleMenuActive(operates); case SwitchOperation.active.menu.operation: return handleMenuActive(operates);
case SwitchOperation.setSpeed.menu.operation: return handleMenuSetSpeed(operates); case SwitchOperation.setSpeed.menu.operation: return handleMenuSetSpeed(operates);
case SwitchOperation.cancelSpeed.menu.operation: return handleMenuCancelSpeed(operates); case SwitchOperation.cancelSpeed.menu.operation: return handleMenuCancelSpeed(operates);
case SwitchOperation.alxeEffective.menu.operation: return handleMenuAlxeEffective(operates); case SwitchOperation.alxeEffective.menu.operation: return handleMenuAlxeEffective(operates);
} }
} }
} }
}; };
/** /**
@ -64,19 +64,19 @@ export default {
* @param {*} operates * @param {*} operates
*/ */
function handleButtonLocate(operates) { function handleButtonLocate(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === SwitchType && operate.code) { if (operate.type === SwitchType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SwitchOperation.locate.event operation: SwitchOperation.locate.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -84,19 +84,19 @@ function handleButtonLocate(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleButtonReverse(operates) { function handleButtonReverse(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === SwitchType && operate.code) { if (operate.type === SwitchType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SwitchOperation.reverse.event operation: SwitchOperation.reverse.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -104,19 +104,19 @@ function handleButtonReverse(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleButtonLock(operates) { function handleButtonLock(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === SwitchType && operate.code) { if (operate.type === SwitchType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SwitchOperation.lock.event operation: SwitchOperation.lock.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -124,19 +124,19 @@ function handleButtonLock(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleButtonUnlock(operates) { function handleButtonUnlock(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === SwitchType && operate.code) { if (operate.type === SwitchType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SwitchOperation.unlock.event operation: SwitchOperation.unlock.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -144,19 +144,19 @@ function handleButtonUnlock(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuCancelStopPage(operates) { function handleMenuCancelStopPage(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SwitchType && operate.code) { if (operate.type === SwitchType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SwitchOperation.cancelStoppage.event operation: SwitchOperation.cancelStoppage.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -164,19 +164,19 @@ function handleMenuCancelStopPage(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuStoppage(operates) { function handleMenuStoppage(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SwitchType && operate.code) { if (operate.type === SwitchType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SwitchOperation.stoppage.event operation: SwitchOperation.stoppage.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -184,19 +184,19 @@ function handleMenuStoppage(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuLocate(operates) { function handleMenuLocate(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SwitchType && operate.code) { if (operate.type === SwitchType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SwitchOperation.locate.event operation: SwitchOperation.locate.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -204,19 +204,19 @@ function handleMenuLocate(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuReverse(operates) { function handleMenuReverse(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SwitchType && operate.code) { if (operate.type === SwitchType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SwitchOperation.reverse.event operation: SwitchOperation.reverse.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -224,19 +224,19 @@ function handleMenuReverse(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuLock(operates) { function handleMenuLock(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SwitchType && operate.code) { if (operate.type === SwitchType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SwitchOperation.lock.event operation: SwitchOperation.lock.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -244,19 +244,19 @@ function handleMenuLock(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuUnlock(operates) { function handleMenuUnlock(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SwitchType && operate.code) { if (operate.type === SwitchType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SwitchOperation.unlock.event operation: SwitchOperation.unlock.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -264,19 +264,19 @@ function handleMenuUnlock(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuBlock(operates) { function handleMenuBlock(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SwitchType && operate.code) { if (operate.type === SwitchType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SwitchOperation.block.event operation: SwitchOperation.block.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -284,19 +284,19 @@ function handleMenuBlock(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuUnblock(operates) { function handleMenuUnblock(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SwitchType && operate.code) { if (operate.type === SwitchType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SwitchOperation.unblock.event operation: SwitchOperation.unblock.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -304,19 +304,19 @@ function handleMenuUnblock(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuFault(operates) { function handleMenuFault(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SwitchType && operate.code) { if (operate.type === SwitchType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SwitchOperation.fault.event operation: SwitchOperation.fault.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -324,19 +324,19 @@ function handleMenuFault(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuTurnout(operates) { function handleMenuTurnout(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SwitchType && operate.code) { if (operate.type === SwitchType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SwitchOperation.turnout.event operation: SwitchOperation.turnout.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -344,19 +344,19 @@ function handleMenuTurnout(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuTurnoutForce(operates) { function handleMenuTurnoutForce(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SwitchType && operate.code) { if (operate.type === SwitchType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SwitchOperation.turnoutForce.event operation: SwitchOperation.turnoutForce.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -364,19 +364,19 @@ function handleMenuTurnoutForce(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuAxlePreReset(operates) { function handleMenuAxlePreReset(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SwitchType && operate.code) { if (operate.type === SwitchType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SwitchOperation.axlePreReset.event operation: SwitchOperation.axlePreReset.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -384,19 +384,19 @@ function handleMenuAxlePreReset(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuSplit(operates) { function handleMenuSplit(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SwitchType && operate.code) { if (operate.type === SwitchType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SwitchOperation.split.event operation: SwitchOperation.split.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -404,19 +404,19 @@ function handleMenuSplit(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuActive(operates) { function handleMenuActive(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SwitchType && operate.code) { if (operate.type === SwitchType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SwitchOperation.active.event operation: SwitchOperation.active.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -424,20 +424,20 @@ function handleMenuActive(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuSetSpeed(operates) { function handleMenuSetSpeed(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SwitchType && operate.code) { if (operate.type === SwitchType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SwitchOperation.setSpeed.event, operation: SwitchOperation.setSpeed.event,
val: operates[operates.length - 1].val val: operates[operates.length - 1].val
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -445,29 +445,29 @@ function handleMenuSetSpeed(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuCancelSpeed(operates) { function handleMenuCancelSpeed(operates) {
if (operates.length == 1) { if (operates.length == 1) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SwitchType && operate.code) { if (operate.type === SwitchType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
operation: SwitchOperation.cancelSpeed.event.query operation: SwitchOperation.cancelSpeed.event.query
}; };
} }
return { error: true }; return { error: true };
} else if (operates.length >= 3) { } else if (operates.length >= 3) {
const operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === SwitchType && operates[0].code) { if (operate.type === SwitchType && operates[0].code) {
return { return {
over: true, over: true,
type: operate.type, type: operate.type,
code: operates[0].code, code: operates[0].code,
operation: SwitchOperation.cancelSpeed.event.confirm operation: SwitchOperation.cancelSpeed.event.confirm
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -475,18 +475,18 @@ function handleMenuCancelSpeed(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuAlxeEffective(operates) { function handleMenuAlxeEffective(operates) {
if (operates.length >= 2) { if (operates.length >= 2) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === SwitchType && operate.code) { if (operate.type === SwitchType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: SwitchOperation.alxeEffective.event, operation: SwitchOperation.alxeEffective.event,
val: operates[operates.length - 1].val val: operates[operates.length - 1].val
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }

View File

@ -5,47 +5,47 @@ const TrainOperation = OperationEvent.Train;
const TrainType = MapDeviceType.Train.type; const TrainType = MapDeviceType.Train.type;
export default { export default {
test: function (operates) { test: function (operates) {
const operateType = getOperateTypeBy('Train', operates[0].operation); const operateType = getOperateTypeBy('Train', operates[0].operation);
if (operateType) { if (operateType) {
return true; return true;
} else { } else {
return false; return false;
} }
}, },
convert: function (operates) { convert: function (operates) {
if (operates && operates.length) { if (operates && operates.length) {
const operation = operates[0].operation; const operation = operates[0].operation;
switch (operation) { switch (operation) {
case TrainOperation.cancelStoppage.menu.operation: return handleMenuCancelStopPage(operates); case TrainOperation.cancelStoppage.menu.operation: return handleMenuCancelStopPage(operates);
case TrainOperation.stoppage.menu.operation: return handleMenuStoppage(operates); case TrainOperation.stoppage.menu.operation: return handleMenuStoppage(operates);
case TrainOperation.addTrainId.menu.operation: return handleMenuAddTrainId(operates); case TrainOperation.addTrainId.menu.operation: return handleMenuAddTrainId(operates);
case TrainOperation.editTrainId.menu.operation: return handleMenuEditTrainId(operates); case TrainOperation.editTrainId.menu.operation: return handleMenuEditTrainId(operates);
case TrainOperation.delTrainId.menu.operation: return handleMenuDelTrainId(operates); case TrainOperation.delTrainId.menu.operation: return handleMenuDelTrainId(operates);
case TrainOperation.moveTrainId.menu.operation: return handleMenuMoveTrainId(operates); case TrainOperation.moveTrainId.menu.operation: return handleMenuMoveTrainId(operates);
case TrainOperation.switchTrainId.menu.operation: return handleMenuSwitchTrainId(operates); case TrainOperation.switchTrainId.menu.operation: return handleMenuSwitchTrainId(operates);
case TrainOperation.editTrainNo.menu.operation: return handleMenuEditTrainNo(operates); case TrainOperation.editTrainNo.menu.operation: return handleMenuEditTrainNo(operates);
case TrainOperation.limitSpeed.menu.operation: return handleMenuLimitSpeed(operates); case TrainOperation.limitSpeed.menu.operation: return handleMenuLimitSpeed(operates);
case TrainOperation.setPlanTrainId.menu.operation: return handleMenuSetPlanTrainId(operates); case TrainOperation.setPlanTrainId.menu.operation: return handleMenuSetPlanTrainId(operates);
case TrainOperation.addPlanTrainId.menu.operation: return handleMenuAddPlanTrainId(operates); case TrainOperation.addPlanTrainId.menu.operation: return handleMenuAddPlanTrainId(operates);
case TrainOperation.moveEventlyTrainId.menu.operation: return handleMenuMoveEventlyTrainId(operates); case TrainOperation.moveEventlyTrainId.menu.operation: return handleMenuMoveEventlyTrainId(operates);
case TrainOperation.deletePlanTrainId.menu.operation: return handleMenuDeletePlanTrainId(operates); case TrainOperation.deletePlanTrainId.menu.operation: return handleMenuDeletePlanTrainId(operates);
} }
} }
} }
}; };
/** /**
@ -53,19 +53,19 @@ export default {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuCancelStopPage(operates) { function handleMenuCancelStopPage(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === TrainType && operate.code) { if (operate.type === TrainType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: TrainOperation.cancelStoppage.event operation: TrainOperation.cancelStoppage.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -73,19 +73,19 @@ function handleMenuCancelStopPage(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuStoppage(operates) { function handleMenuStoppage(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === TrainType && operate.code) { if (operate.type === TrainType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: TrainOperation.stoppage.event operation: TrainOperation.stoppage.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -93,20 +93,20 @@ function handleMenuStoppage(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuAddTrainId(operates) { function handleMenuAddTrainId(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
const operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === TrainType && operate.val) { if (operate.type === TrainType && operate.val) {
return { return {
type: operate.type, type: operate.type,
code: operates[0].code, code: operates[0].code,
over: true, over: true,
operation: TrainOperation.addTrainId.event, operation: TrainOperation.addTrainId.event,
val: operate.val val: operate.val
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -114,31 +114,31 @@ function handleMenuAddTrainId(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuEditTrainId(operates) { function handleMenuEditTrainId(operates) {
if (operates.length == 2) { if (operates.length == 2) {
const operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === TrainType && operate.val) { if (operate.type === TrainType && operate.val) {
return { return {
type: operate.type, type: operate.type,
code: operates[0].code, code: operates[0].code,
operation: TrainOperation.editTrainId.event.query, operation: TrainOperation.editTrainId.event.query,
val: operate.val val: operate.val
}; };
} }
return { error: true }; return { error: true };
} else if (operates.length > 2) { } else if (operates.length > 2) {
const operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === TrainType && operate.val) { if (operate.type === TrainType && operate.val) {
return { return {
type: operate.type, type: operate.type,
code: operates[0].code, code: operates[0].code,
over: true, over: true,
operation: TrainOperation.editTrainId.event.confirm, operation: TrainOperation.editTrainId.event.confirm,
val: operate.val val: operate.val
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -146,20 +146,20 @@ function handleMenuEditTrainId(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuDelTrainId(operates) { function handleMenuDelTrainId(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
const operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === TrainType && operate.val) { if (operate.type === TrainType && operate.val) {
return { return {
type: operate.type, type: operate.type,
code: operates[0].code, code: operates[0].code,
over: true, over: true,
operation: TrainOperation.delTrainId.event, operation: TrainOperation.delTrainId.event,
val: operate.val val: operate.val
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -167,20 +167,20 @@ function handleMenuDelTrainId(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuMoveTrainId(operates) { function handleMenuMoveTrainId(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
const operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === TrainType && operate.val) { if (operate.type === TrainType && operate.val) {
return { return {
type: operate.type, type: operate.type,
code: operates[0].code, code: operates[0].code,
over: true, over: true,
operation: TrainOperation.moveTrainId.event, operation: TrainOperation.moveTrainId.event,
val: operate.val val: operate.val
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -188,20 +188,20 @@ function handleMenuMoveTrainId(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuSwitchTrainId(operates) { function handleMenuSwitchTrainId(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
const operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === TrainType && operate.val) { if (operate.type === TrainType && operate.val) {
return { return {
type: operate.type, type: operate.type,
code: operates[0].code, code: operates[0].code,
over: true, over: true,
operation: TrainOperation.switchTrainId.event, operation: TrainOperation.switchTrainId.event,
val: operate.val val: operate.val
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -209,20 +209,20 @@ function handleMenuSwitchTrainId(operates) {
* @param {*} operates * @param {*} operates
*/ */
function handleMenuEditTrainNo(operates) { function handleMenuEditTrainNo(operates) {
if (operates.length >= 1) { if (operates.length >= 1) {
const operate = operates[operates.length - 1]; const operate = operates[operates.length - 1];
if (operate.type === TrainType && operate.val) { if (operate.type === TrainType && operate.val) {
return { return {
type: operate.type, type: operate.type,
code: operate[0].code, code: operate[0].code,
over: true, over: true,
operation: TrainOperation.editTrainNo.event, operation: TrainOperation.editTrainNo.event,
val: operate.val val: operate.val
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -231,19 +231,19 @@ function handleMenuEditTrainNo(operates) {
*/ */
function handleMenuLimitSpeed(operates) { function handleMenuLimitSpeed(operates) {
if (operates.length > 0) { if (operates.length > 0) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === TrainType && operate.code) { if (operate.type === TrainType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: TrainOperation.limitSpeed.event operation: TrainOperation.limitSpeed.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
/** /**
@ -252,64 +252,64 @@ function handleMenuLimitSpeed(operates) {
*/ */
function handleMenuSetPlanTrainId(operates) { function handleMenuSetPlanTrainId(operates) {
if (operates.length > 0) { if (operates.length > 0) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === TrainType && operate.code) { if (operate.type === TrainType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: TrainOperation.setPlanTrainId.event operation: TrainOperation.setPlanTrainId.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
function handleMenuAddPlanTrainId(operates) { function handleMenuAddPlanTrainId(operates) {
if (operates.length > 0) { if (operates.length > 0) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === TrainType && operate.code) { if (operate.type === TrainType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: TrainOperation.addPlanTrainId.event operation: TrainOperation.addPlanTrainId.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
function handleMenuMoveEventlyTrainId(operates) { function handleMenuMoveEventlyTrainId(operates) {
if (operates.length > 0) { if (operates.length > 0) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === TrainType && operate.code) { if (operate.type === TrainType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: TrainOperation.moveEventlyTrainId.event operation: TrainOperation.moveEventlyTrainId.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }
function handleMenuDeletePlanTrainId(operates) { function handleMenuDeletePlanTrainId(operates) {
if (operates.length > 0) { if (operates.length > 0) {
const operate = operates[0]; const operate = operates[0];
if (operate.type === TrainType && operate.code) { if (operate.type === TrainType && operate.code) {
return { return {
type: operate.type, type: operate.type,
code: operate.code, code: operate.code,
over: true, over: true,
operation: TrainOperation.deletePlanTrainId.event operation: TrainOperation.deletePlanTrainId.event
}; };
} }
return { error: true }; return { error: true };
} }
return null; return null;
} }

View File

@ -9,32 +9,32 @@ import CancelLimitOperationConverter from './CancelLimitOperationConverter';
import MixinOperationConverter from './MixinOperationConverter'; import MixinOperationConverter from './MixinOperationConverter';
export function getConverter(operates) { export function getConverter(operates) {
if (SwitchOperationConverter.test(operates)) { if (SwitchOperationConverter.test(operates)) {
return SwitchOperationConverter; return SwitchOperationConverter;
} else if (SignalOperationConverter.test(operates)) { } else if (SignalOperationConverter.test(operates)) {
return SignalOperationConverter; return SignalOperationConverter;
} else if (StationControlOperationConverter.test(operates)) { } else if (StationControlOperationConverter.test(operates)) {
return StationControlOperationConverter; return StationControlOperationConverter;
} else if (StationOperationConverter.test(operates)) { } else if (StationOperationConverter.test(operates)) {
return StationOperationConverter; return StationOperationConverter;
} else if (SectionOperationConverter.test(operates)) { } else if (SectionOperationConverter.test(operates)) {
return SectionOperationConverter; return SectionOperationConverter;
} else if (StationStandOperationConverter.test(operates)) { } else if (StationStandOperationConverter.test(operates)) {
return StationStandOperationConverter; return StationStandOperationConverter;
} else if (TrainOperationConverter.test(operates)) { } else if (TrainOperationConverter.test(operates)) {
return TrainOperationConverter; return TrainOperationConverter;
} else if (CancelLimitOperationConverter.test(operates)) { } else if (CancelLimitOperationConverter.test(operates)) {
return CancelLimitOperationConverter; return CancelLimitOperationConverter;
} else if (MixinOperationConverter.test(operates)) { } else if (MixinOperationConverter.test(operates)) {
return MixinOperationConverter; return MixinOperationConverter;
} }
} }

View File

@ -1,9 +1,9 @@
import store from '@/store'; import store from '@/store';
import router from '@/router'; import router from '@/router';
import OperateHandler from '@/scripts/plugin/OperateHandler';
import { sendCommand } from '@/api/jmap/training'; import { sendCommand } from '@/api/jmap/training';
import { OperationEvent } from '@/scripts/ConstDic'; import { OperationEvent } from '@/scripts/ConstDic';
import OperateHandler from '@/scripts/plugin/trainingOperateHandler'; import { getConverter } from '@/scripts/plugin/Converter/manager';
import { getConverter } from '@/scripts/plugin/converter/manager';
var OperateConverter = function () { }; var OperateConverter = function () { };
OperateConverter.prototype = { OperateConverter.prototype = {

View File

@ -1,147 +0,0 @@
import store from '@/store';
import router from '@/router';
import OperateConverter from '@/scripts/plugin/operateConvert2Command';
import { TrainingMode } from '@/scripts/ConstDic';
import { getConverter } from '@/scripts/plugin/converter/manager';
import { sendTrainingNextStep } from '@/api/jmap/training';
import { Message } from 'element-ui';
import LangStorage from '@/utils/lang';
var OperateHandler = function () {
};
OperateHandler.prototype = {
/** 操作组 */
operates: [],
backStep: function(num) {
this.operates = this.operates.slice(0, num);
},
/** 清空操作组 */
cleanOperates: function () {
this.operates.splice(0, this.operates.length);
},
/**
* 判断操作步骤是否正确
*/
judge: function (operate) {
let valid = false;
const steps = this.getSteps();
const order = this.getOrder();
if (order >= steps) {
return valid;
}
// debugger;
const standard = steps[order];
if (operate && standard && operate.code == standard.code && operate.type == standard.type &&
operate.operation == standard.operation &&
operate.val == standard.val) {
valid = true;
}
return valid;
},
/**
* 根据模式验证操作步骤
*/
validate: function (operate) {
// 按钮操作之后,第二步错误操作菜单的情况,需要直接返回
if ((this.operates.length && operate.start === true) && (this.operates[0].type === 'mbm')) {
return false;
}
// 如果是正常的第一步操作需要清空operates数组
if (operate.type === 'mbm' || operate.type === 'bar' || operate.start === true) {
this.cleanOperates();
}
this.operates.push(operate);
// 预处理
const converter = getConverter(this.operates);
if (converter && converter.preHandle instanceof Function) {
operate = converter.preHandle(this.operates);
}
let valid = true;
const mode = this.getTrainingMode();
if (TrainingMode.EDIT === mode) {
// 编辑制作模式
if (this.getOperateBreakStatus()) {
valid = false;
const tip = LangStorage.getLang() == 'en' ? 'Please enter a hint and click next' : '请输入提示并点击下一步';
Message.error(tip);
this.operates.pop();
return valid;
}
if (this.getTrainingStart()) {
store.dispatch('training/setTempStep', operate);
}
} else if (TrainingMode.TEACH === mode || TrainingMode.PRACTICE === mode) {
// 教学模式/练习模式
if (this.getTrainingStart()) {
valid = this.judge(operate);
} else {
this.cleanOperates();
valid = false;
}
}
// 发送每一步的步骤数据;
const basicInfo = store.getters['training/basicInfo'];
if (basicInfo.id && valid) {
const group = router.currentRoute.query.group;
sendTrainingNextStep({ trainingId: basicInfo.id, operate: operate }, group);
}
if (!valid) {
// 如果操作校验不正确,回退
this.operates.pop();
} else {
if (operate.cancel === true) {
this.cleanOperates();
}
}
return valid;
},
handle: function (operate) {
return new Promise((resolve, reject) => {
const rtn = { valid: false, response: null };
const valid = this.validate(operate);
rtn.valid = valid;
if (valid) {
// 改变状态开始请求
OperateConverter.convertAndSend(operate).then(response => {
rtn.response = response;
resolve(rtn);
}).catch(error => {
reject(error);
});
} else {
resolve(rtn);
}
});
},
getTrainingMode: function () {
return store.state.training.mode;
},
getSteps: function () {
return store.state.training.steps;
},
getOrder: function () {
return store.state.training.order;
},
getTrainingStart: function () {
return store.state.training.started;
},
getOperateBreakStatus: function () {
return store.state.menuOperation.break;
}
};
export default new OperateHandler();

View File

@ -1,6 +1,6 @@
import Vue from 'vue'; import Vue from 'vue';
import { TrainingMode } from '@/scripts/ConstDic'; import { TrainingMode } from '@/scripts/ConstDic';
import OperateHandler from '@/scripts/plugin/trainingOperateHandler'; import OperateHandler from '@/scripts/plugin/OperateHandler';
import deviceType from '../../jmap/constant/deviceType'; import deviceType from '../../jmap/constant/deviceType';
import LangStorage from '@/utils/lang'; import LangStorage from '@/utils/lang';
// const lang = LangStorage.getLang(); // const lang = LangStorage.getLang();

View File

@ -3,11 +3,11 @@ export function getBaseUrl() {
let BASE_API; let BASE_API;
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud'; // BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud'; BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪 // BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强 // BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 杜闪 // BASE_API = 'http://192.168.3.41:9000'; // 杜闪
BASE_API = 'http://192.168.3.82:9000'; // 杜康 // BASE_API = 'http://192.168.3.82:9000'; // 杜康
} else { } else {
BASE_API = process.env.VUE_APP_BASE_API; BASE_API = process.env.VUE_APP_BASE_API;
} }

View File

@ -13,11 +13,7 @@ export function creatSubscribe(topic, header) {
Vue.prototype.$stomp = new StompClient(); Vue.prototype.$stomp = new StompClient();
} }
Vue.prototype.$stomp.subscribe( Vue.prototype.$stomp.subscribe(topic, callback, header);
[displayTopic].includes(topic) ? `${topic}/${header.group}` : topic,
callback,
header
);
} catch (error) { } catch (error) {
console.error('websocket订阅失败'); console.error('websocket订阅失败');
} }

View File

@ -34,7 +34,6 @@ import { PermissionType } from '@/scripts/ConstDic';
import { getCountTime } from '@/utils/index'; import { getCountTime } from '@/utils/index';
import { runDiagramIsStart, quitScript } from '@/api/simulation'; import { runDiagramIsStart, quitScript } from '@/api/simulation';
import { timeFormat } from '@/utils/date'; import { timeFormat } from '@/utils/date';
import { EventBus } from '@/scripts/event-bus';
export default { export default {
name: 'MenuDemon', name: 'MenuDemon',
@ -186,8 +185,6 @@ export default {
}, },
back() { back() {
this.$store.dispatch('training/over').then(() => { this.$store.dispatch('training/over').then(() => {
EventBus.$emit('runPlanStop');
EventBus.$emit('chatSubscribeStop');
history.go(-1); history.go(-1);
Notification.closeAll(); Notification.closeAll();
}); });

View File

@ -178,7 +178,6 @@ export default {
back() { back() {
this.$emit('quit'); this.$emit('quit');
Notification.closeAll(); Notification.closeAll();
// exitFullscreen();
if (this.$route.params.mode == 'record') { if (this.$route.params.mode == 'record') {
/** 如果是演示返回时,需要重新创建仿真*/ /** 如果是演示返回时,需要重新创建仿真*/

View File

@ -22,12 +22,10 @@ export default {
stomp: null, stomp: null,
currentMap: null, currentMap: null,
mode: '', mode: '',
isDesignPlatform: false isDesignPlatform: false,
group: ''
}; };
}, },
computed: {
group() { return this.$route.query.group; }
},
watch: { watch: {
'$store.state.map.mapViewLoadedCount': function (val) { '$store.state.map.mapViewLoadedCount': function (val) {
this.subscribe(); this.subscribe();
@ -56,6 +54,7 @@ export default {
mounted() { mounted() {
window.onbeforeunload = this.clearSubscribe; window.onbeforeunload = this.clearSubscribe;
this.mode = this.$route.params.mode || ''; this.mode = this.$route.params.mode || '';
this.group = this.$route.query.group || '';
this.currentMap = this.$refs.mapCommon; this.currentMap = this.$refs.mapCommon;
this.$nextTick(() => { this.$nextTick(() => {
setTimeout(() => { setTimeout(() => {
@ -105,12 +104,12 @@ export default {
async subscribe() { async subscribe() {
this.clearSubscribe(); this.clearSubscribe();
const header = { group: this.group || '', 'X-Token': getToken() }; const header = { group: this.group || '', 'X-Token': getToken() };
creatSubscribe(displayTopic, header); creatSubscribe(`${displayTopic}\/${this.group}`, header);
await this.$store.dispatch('training/setHasSubscribed'); await this.$store.dispatch('training/setHasSubscribed');
}, },
clearSubscribe() { clearSubscribe() {
clearSubscribe(displayTopic); clearSubscribe(`${displayTopic}\/${this.group}`);
}, },
sendDeviceChangeEvent(data, header) { sendDeviceChangeEvent(data, header) {
// //