Merge remote-tracking branch 'remotes/origin/dev' into test

# Conflicts:
#	src/i18n/langs/en/map.js
#	src/utils/baseUrl.js
This commit is contained in:
joylink_cuiweidong 2019-11-08 09:41:33 +08:00
commit 2f1cc475a1
155 changed files with 9238 additions and 9442 deletions

View File

@ -10,6 +10,7 @@ import { handleToken } from '@/utils/auth';
import { creatSubscribe, perpetualTopic, commonTopic } from '@/utils/stomp';
import DeomonTopic from '@/views/demonstration/deomonTopic';
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
import { ProjectIcon } from '@/scripts/ConstDic';
export default {
name: 'App',
@ -29,6 +30,8 @@ export default {
mounted() {
this.prohibitSystemContextMenu();
this.subscribe();
const project = window.sessionStorage.getItem('project');
document.querySelector("link[rel*='icon']").href = ProjectIcon[project];
},
methods: {
resizeHandler() {

View File

@ -59,9 +59,9 @@ export function putLessonOffLine(id) {
/**
* 获取地图产品下的课程列表
*/
export function getCommodityProductLesson(prdCode) {
export function getCommodityProductLesson(prdId) {
return request({
url: `/api/lesson/${prdCode}/list`,
url: `/api/lesson/${prdId}/list`,
method: 'get'
});
}

View File

@ -2,194 +2,194 @@ import request from '@/utils/request';
/** 清除实训数据*/
export function clearTraining(args) {
return request({
url: `/api/training/${args.id}`,
method: 'delete'
});
return request({
url: `/api/training/${args.id}`,
method: 'delete'
});
}
/** 开始实训*/
export function startTraining(args, group) {
return request({
url: `/api/training/${args.id}/start`,
method: 'get',
params: {
group
}
});
return request({
url: `/api/training/${args.id}/start`,
method: 'get',
params: {
group
}
});
}
/** 实训结束*/
export function endTraining(args, group) {
return request({
url: `/api/training/${args.lessonId}/${args.id}/end`,
method: 'get',
params: {
mode: args.mode,
usedTime: args.usedTime,
group
}
});
return request({
url: `/api/training/${args.lessonId}/${args.id}/end`,
method: 'get',
params: {
mode: args.mode,
usedTime: args.usedTime,
group
}
});
}
/** 发送步骤数据*/
export function sendTrainingNextStep(data, group) {
return request({
url: `/api/training/${data.trainingId}/nextStep`,
method: 'post',
data: data.operate,
params: {
group
}
});
return request({
url: `/api/training/${data.trainingId}/nextStep`,
method: 'post',
data: data.operate,
params: {
group
}
});
}
/** 获取实训树*/
export function getTrainingTree() {
return request({
url: `/api/training/tree`,
method: 'get'
});
return request({
url: `/api/training/tree`,
method: 'get'
});
}
/** 获取章节基本信息*/
export function getTrainingDetail(trainingId) {
return request({
url: `/api/training/${trainingId}`,
method: 'get'
});
return request({
url: `/api/training/${trainingId}`,
method: 'get'
});
}
/** 添加实训*/
export function addTraining(data) {
return request({
url: '/api/training',
method: 'post',
data: data
});
return request({
url: '/api/training',
method: 'post',
data: data
});
}
/** 更新实训*/
export function updateTraining(data) {
return request({
url: `/api/training/${data.id}`,
method: 'put',
data: data
});
return request({
url: `/api/training/${data.id}`,
method: 'put',
data: data
});
}
/** 保存实训初始状态*/
export function saveTrainingInitStatus(data, group) {
return request({
url: `/api/training/${data.id}/detailSave?group=${group}`,
method: 'post',
data: data
});
return request({
url: `/api/training/${data.id}/detailSave?group=${group}`,
method: 'post',
data: data
});
}
/** 保存实训步骤数据*/
export function saveTrainingStepsData(data) {
return request({
url: `/api/training/${data.id}/stepsSave`,
method: 'post',
data: data
});
return request({
url: `/api/training/${data.id}/stepsSave`,
method: 'post',
data: data
});
}
/** 获取实训步骤数据*/
export function getTrainingStepsDetail(trainingId, params) {
return request({
url: `/api/training/${trainingId}/detail`,
method: 'get',
params: params
});
return request({
url: `/api/training/${trainingId}/detail`,
method: 'get',
params: params
});
}
/** 查询实训列表*/
export function pageQueryTraining(params) {
return request({
url: `/api/training/pagedQuery`,
method: 'get',
params: params
});
return request({
url: `/api/training/pagedQuery`,
method: 'get',
params: params
});
}
/** 自动生成实训操作*/
export function addAutoTraining(data) {
return request({
url: `/api/training/generate`,
method: 'post',
data: data
});
return request({
url: `/api/training/generate`,
method: 'post',
data: data
});
}
/** 修改自动删除实训操作*/
export function updateAutoTraining(data) {
return request({
url: `/api/training/batchUpdateGenerate`,
method: 'put',
data: data
});
return request({
url: `/api/training/batchUpdateGenerate`,
method: 'put',
data: data
});
}
/** 删除自动生成实训*/
export function deleteAutoTraining(params) {
return request({
url: `/api/training/generate`,
method: 'delete',
params: params
});
return request({
url: `/api/training/generate`,
method: 'delete',
params: params
});
}
/** 获取用户实训列表*/
export function getTrainingList(data) {
return request({
url: `/api/training/list`,
method: 'get',
params: data
});
return request({
url: `/api/training/list`,
method: 'get',
params: data
});
}
export function sendCommand(group, command) {
return request({
url: `/api/training/deviceChange?group=${group}`,
method: 'put',
data: {
param: command.val,
type: command.type,
code: command.code,
operation: command.operation
}
});
return request({
url: `/api/training/deviceChange?group=${group}`,
method: 'put',
data: {
param: command.val,
type: command.type,
code: command.code,
operation: command.operation
}
});
}
export function updateLesson(data) {
return request({
url: `/api/training/userTraining/${data.id}`,
method: 'put',
data: data
});
return request({
url: `/api/training/userTraining/${data.id}`,
method: 'put',
data: data
});
}
// 添加用户实训数据
export function addUserTraining(data) {
return request({
url: `/api/training/userTraining`,
method: 'post',
data: data
});
return request({
url: `/api/training/userTraining`,
method: 'post',
data: data
});
}
// 更新用户实训数据
export function putUserTraining(data) {
return request({
url: `/api/training/userTraining/${data.id}`,
method: 'put',
data: data
});
return request({
url: `/api/training/userTraining/${data.id}`,
method: 'put',
data: data
});
}
// 清除实训数据
export function deleteUserTraining(statsId) {
return request({
url: `/api/training/userTraining/${statsId}`,
method: 'delete'
});
return request({
url: `/api/training/userTraining/${statsId}`,
method: 'delete'
});
}

View File

@ -3,125 +3,115 @@ import request from '@/utils/request';
/** 分页获取课程权限数据*/
export function getLessonPermissonPageList(params) {
return request({
url: '/api/permission',
method: 'get',
params: params
});
return request({
url: '/api/permission',
method: 'get',
params: params
});
}
/** 创建课程权限*/
export function createLessonPermisson(data) {
return request({
url: '/api/permission',
method: 'post',
data: data
});
return request({
url: '/api/permission',
method: 'post',
data: data
});
}
/** 获取权限详情*/
export function getPermissonDetail(id) {
return request({
url: `/api/permission/${id}/package`,
method: 'get'
});
return request({
url: `/api/permission/${id}/package`,
method: 'get'
});
}
/** 修改权限*/
export function putPermissonDetail(data) {
return request({
url: `/api/permission/${data.id}`,
method: 'put',
data: data
});
return request({
url: `/api/permission/${data.id}`,
method: 'put',
data: data
});
}
/** 一键生成所有权限*/
export function postPermissonList(mapId) {
return request({
url: `/api/permission/${mapId}/generate`,
method: 'post'
});
return request({
url: `/api/permission/${mapId}/generate`,
method: 'post'
});
}
/** 获取用户某课程某段时间内可用的权限数量*/
export function getTotalRemains(params) {
return request({
url: '/api/userPermission/totalRemains',
method: 'get',
params: params
});
return request({
url: '/api/userPermission/totalRemains',
method: 'get',
params: params
});
}
/** 设置权限失效或有效*/
export function setLessonPermisson(data) {
return request({
url: `/api/userPermission/${data.id}/status`,
method: 'put',
data: data
});
return request({
url: `/api/userPermission/${data.id}/status`,
method: 'put',
data: data
});
}
/** 设置权限失效或有效*/
export function getPermissionList(id) {
return request({
url: `/api/permission/${id}`,
method: 'get'
});
}
/**
* 查询仿真权限列表
*/
export function queryPermissionSimulation(data) {
return request({
url: `/api/userPermission/${data.mapId}/${data.prdCode}/simulation`,
method: 'get'
});
return request({
url: `/api/permission/${id}`,
method: 'get'
});
}
/** 获取大屏权限列表*/
export function queryPermissionScreen() {
return request({
url: `/api/userPermission/bigScreen`,
method: 'get'
});
return request({
url: `/api/userPermission/bigScreen`,
method: 'get'
});
}
/**
* 用户权限列表
*/
export function listPermision(params) {
return request({
url: `/api/userPermission`,
method: 'get',
params: params
});
return request({
url: `/api/userPermission`,
method: 'get',
params: params
});
}
/**
* 个人权限列表
*/
export function listUserPermision(params) {
return request({
url: `/api/userPermission/my`,
method: 'get',
params: params
});
return request({
url: `/api/userPermission/my`,
method: 'get',
params: params
});
}
/** 用户权限列表 */
export function getDistribute(id) {
return request({
url: `/api/distribute/${id}`,
method: 'get'
});
return request({
url: `/api/distribute/${id}`,
method: 'get'
});
}
/** 设置权限所有者 */
export function putPermissionOwner(data) {
return request({
url: `/api/userPermission/${data.id}/owner`,
method: 'put',
data: data.owner
});
return request({
url: `/api/userPermission/${data.id}/owner`,
method: 'put',
data: data.owner
});
}

View File

@ -1,6 +1,6 @@
import request from '@/utils/request';
/** 分页查询皮肤*/
/** 分页查询真实线路*/
export function getSkinCodePageList(params) {
return request({
url: `/api/realLine`,
@ -9,7 +9,7 @@ export function getSkinCodePageList(params) {
});
}
/** 添加皮肤*/
/** 添加真实线路*/
export function addSkinCode(data) {
return request({
url: `/api/realLine`,
@ -18,7 +18,7 @@ export function addSkinCode(data) {
});
}
/** 删除皮肤*/
/** 删除真实线路*/
export function delSkinCode(id) {
return request({
url: `/api/realLine/${id}`,
@ -26,7 +26,7 @@ export function delSkinCode(id) {
});
}
/** 查询地图皮肤 */
/** 根据id查询真实线路 */
export function querySkinCode(id) {
return request({
url: `/api/realLine/${id}`,
@ -34,7 +34,7 @@ export function querySkinCode(id) {
});
}
/** 修改地图皮肤*/
/** 修改真实线路*/
export function updateSkinCode(data) {
return request({
url: `/api/realLine/${data.id}`,
@ -52,7 +52,7 @@ export function updateSkinCodeByCode(data) {
});
}
/** 查询皮肤是否存在*/
/** 检查code是否存在*/
export function querySkinCodeExistByCode(code) {
return request({
url: `/api/realLine/${code}/exist`,
@ -60,8 +60,8 @@ export function querySkinCodeExistByCode(code) {
});
}
/** 获取皮肤列表*/
export function getSkinCodeList() {
/** 获取真实线路列表*/
export function getLineCodeList() {
return request({
url: `/api/realLine/list`,
method: 'get'

View File

@ -9,9 +9,9 @@ export function getPublishMapTree(cityCode) {
}
/** 获取产品详细内容*/
export function getProductDetail(prdCode) {
export function getProductDetail(prdId) {
return request({
url: `/api/mapPrd/${prdCode}`,
url: `/api/mapPrd/${prdId}`,
method: 'get'
});
}
@ -72,9 +72,9 @@ export function getCommodityMapProduct(mapId) {
/**
* 获取地图下的产品详情
*/
export function getMapProductDetail(prdCode) {
export function getMapProductDetail(prdId) {
return request({
url: `/api/mapPrd/${prdCode}`,
url: `/api/mapPrd/${prdId}`,
method: 'get'
});
}

View File

@ -2,78 +2,78 @@ import request from '@/utils/request';
/** 获取故障规则列表*/
export function getFailureGenerateRules(params) {
return request({
url: `/api/simulation/failureGenerateRules`,
method: 'get',
params: params
});
return request({
url: `/api/simulation/failureGenerateRules`,
method: 'get',
params: params
});
}
/** 设置自动故障*/
export function setFailureMode(data, group) {
return request({
url: `/api/simulation/${group}/failureMode`,
method: 'post',
data: data
});
return request({
url: `/api/simulation/${group}/failureMode`,
method: 'post',
data: data
});
}
/**
* 仿真系统按计划行车
*/
export function runDiagramStart(params, group) {
return request({
url: `/api/simulation/${group}/start`,
method: 'put',
params: params
});
return request({
url: `/api/simulation/${group}/start`,
method: 'put',
params: params
});
}
/**
* 仿真系统结束计划行车
*/
export function runDiagramOver(group) {
return request({
url: `/api/simulation/${group}/over`,
method: 'put'
});
return request({
url: `/api/simulation/${group}/over`,
method: 'put'
});
}
/**
* 退出仿真系统
*/
export function runDiagramQuit(group) {
return request({
url: `/api/simulation/${group}/quit`,
method: 'put'
});
return request({
url: `/api/simulation/${group}/quit`,
method: 'put'
});
}
/** 获取仿真系统时间*/
export function runDiagramGetTime(group) {
return request({
url: `/api/simulation/${group}/systemTime`,
method: 'get'
});
return request({
url: `/api/simulation/${group}/systemTime`,
method: 'get'
});
}
// 查看是否开始按计划行车
export function runDiagramIsStart(group) {
return request({
url: `/api/simulation/${group}/isRunPlanStart`,
method: 'get'
});
return request({
url: `/api/simulation/${group}/isRunPlanStart`,
method: 'get'
});
}
/**
* 仿真系统CBTC
* @param {*} mapId
*/
export function simulationNotify({ mapId, code }) {
return request({
url: `/api/simulation/${mapId}/${code}`,
method: 'get'
});
export function simulationNotify({ mapId, mapPrdId }) {
return request({
url: `/api/simulation/${mapId}/${mapPrdId}`,
method: 'get'
});
}
/**
@ -81,10 +81,10 @@ export function simulationNotify({ mapId, code }) {
* @param {*} mapId
*/
export function bitScreenNotify({ mapId }) {
return request({
url: `/api/simulation/bigScreen/${mapId}`,
method: 'get'
});
return request({
url: `/api/simulation/bigScreen/${mapId}`,
method: 'get'
});
}
/**
@ -92,10 +92,10 @@ export function bitScreenNotify({ mapId }) {
* @param {*} data
*/
export function trainingNotify({ trainingId }) {
return request({
url: `/api/simulation/training/${trainingId}`,
method: 'get'
});
return request({
url: `/api/simulation/training/${trainingId}`,
method: 'get'
});
}
/**
@ -103,334 +103,334 @@ export function trainingNotify({ trainingId }) {
* @param {*} data
*/
export function examNotify({ examId }) {
return request({
url: `/api/simulation/exam/${examId}`,
method: 'get'
});
return request({
url: `/api/simulation/exam/${examId}`,
method: 'get'
});
}
/** 获取用户实训列表*/
export function getSimulationList(data) {
return request({
url: `/api/simulation/stats`,
method: 'get',
params: data
});
return request({
url: `/api/simulation/stats`,
method: 'get',
params: data
});
}
/** 添加用户仿真数据*/
export function postSimulationStats(data) {
return request({
url: `/api/simulation/stats`,
method: 'post',
data: data
});
return request({
url: `/api/simulation/stats`,
method: 'post',
data: data
});
}
/** 更新用户仿真数据*/
export function putSimulationStats(data) {
return request({
url: `/api/simulation/${data.id}/stats`,
method: 'put',
data: data
});
return request({
url: `/api/simulation/${data.id}/stats`,
method: 'put',
data: data
});
}
/** 删除用户仿真数据*/
export function deleteSimulationStats(statsId) {
return request({
url: `/api/simulation/${statsId}`,
method: 'delete'
});
return request({
url: `/api/simulation/${statsId}`,
method: 'delete'
});
}
/** 获取用户鼠标左键选中的设备信息*/
export function letfMouseSelectDevice(deviceCode, group) {
return request({
url: `/api/simulation/${group}/device/${deviceCode}`,
method: 'get'
});
return request({
url: `/api/simulation/${group}/device/${deviceCode}`,
method: 'get'
});
}
/** 获取每日运行图*/
export function getEveryDayRunPlanData(group) {
return request({
url: `/api/simulation/${group}/runPlan`,
method: 'get'
});
return request({
url: `/api/simulation/${group}/runPlan`,
method: 'get'
});
}
/** 录制脚本仿真*/
export function scriptRecordNotify(scriptId) {
return request({
url: `/api/simulation/scriptWrite/${scriptId}`,
method: 'get'
});
return request({
url: `/api/simulation/scriptWrite/${scriptId}`,
method: 'get'
});
}
/** 保存剧本背景*/
export function saveScriptScenes(group) {
return request({
url: `/api/simulation/${group}/scriptWrite/scenes`,
method: 'put'
});
return request({
url: `/api/simulation/${group}/scriptWrite/scenes`,
method: 'put'
});
}
/** 保存录制任务数据*/
export function saveScriptData(group) {
return request({
url: `/api/simulation/${group}/scriptWrite/saveData`,
method: 'put'
});
return request({
url: `/api/simulation/${group}/scriptWrite/saveData`,
method: 'put'
});
}
/** 更新任务地图定位信息*/
export function updateMapLocation(group, data) {
return request({
url: `/api/simulation/${group}/scriptWrite/mapLocation`,
method: 'put',
data
});
return request({
url: `/api/simulation/${group}/scriptWrite/mapLocation`,
method: 'put',
data
});
}
/** 获取剧本编制的所有成员角色*/
export function getScriptMemberData(group) {
return request({
url: `/api/simulation/${group}/scriptWrite/members`,
method: 'get'
});
return request({
url: `/api/simulation/${group}/scriptWrite/members`,
method: 'get'
});
}
/** 获取剧本出演成员角色 */
export function getScriptPlayMember(group) {
return request({
url: `/api/simulation/${group}/scriptWrite/players`,
method: 'get'
});
return request({
url: `/api/simulation/${group}/scriptWrite/players`,
method: 'get'
});
}
/** 取消剧本演出成员角色 */
export function cancleScriptMembers(group, data) {
return request({
url: `/api/simulation/${group}/scriptWrite/removePlayers`,
method: 'put',
data
});
return request({
url: `/api/simulation/${group}/scriptWrite/removePlayers`,
method: 'put',
data
});
}
/** 选择剧本演出成员角色 */
export function selectScriptMembers(group, data) {
return request({
url: `/api/simulation/${group}/scriptWrite/choosePlayers`,
method: 'put',
data
});
return request({
url: `/api/simulation/${group}/scriptWrite/choosePlayers`,
method: 'put',
data
});
}
/** 修改剧本演出成员性别 */
export function modifyScriptMemberSex(group, playerId, data) {
return request({
url: `/api/simulation/${group}/scriptWrite/player/${playerId}?gender=${data.gender}`,
method: 'put'
});
return request({
url: `/api/simulation/${group}/scriptWrite/player/${playerId}?gender=${data.gender}`,
method: 'put'
});
}
/** 清除仿真剧本数据*/
export function dumpScriptData(group) {
return request({
url: `/api/simulation/${group}/scriptWrite/saveData`,
method: 'delete'
});
return request({
url: `/api/simulation/${group}/scriptWrite/saveData`,
method: 'delete'
});
}
/** 查询录制剧本步骤*/
export function queryScriptStep(group) {
return request({
url: `/api/simulation/${group}/scriptRecordStage`,
method: 'get'
});
return request({
url: `/api/simulation/${group}/scriptRecordStage`,
method: 'get'
});
}
/** 获取指定时间里可加载列车的个数*/
export function getDesignatedTimeTrainNum(params, group) {
return request({
url: `/api/simulation/${group}/plan/trainNum`,
method: 'get',
params
});
return request({
url: `/api/simulation/${group}/plan/trainNum`,
method: 'get',
params
});
}
/** 添加剧本动作 */
export function addScriptAction(group, data) {
return request({
url: `/api/simulation/${group}/scriptWrite/action`,
method: 'post',
data
});
return request({
url: `/api/simulation/${group}/scriptWrite/action`,
method: 'post',
data
});
}
/** 删除剧本动作 */
export function deleteScriptAction(group, actionId) {
return request({
url: `/api/simulation/${group}/scriptWrite/action/${actionId}`,
method: 'delete'
});
return request({
url: `/api/simulation/${group}/scriptWrite/action/${actionId}`,
method: 'delete'
});
}
/** 修改剧本动作 */
export function modifyScriptAction(group, actionId, data) {
return request({
url: `/api/simulation/${group}/scriptWrite/action/${actionId}`,
method: 'put',
data
});
return request({
url: `/api/simulation/${group}/scriptWrite/action/${actionId}`,
method: 'put',
data
});
}
/** 分页查询存在的仿真 */
export function getExistingSimulation(params) {
return request({
url: `/api/simulation/manage/page`,
method: 'get',
params
});
return request({
url: `/api/simulation/manage/page`,
method: 'get',
params
});
}
/** 删除存在的仿真 */
export function deleteExistingSimulation(group) {
return request({
url: `/api/simulation/manage/${group}`,
method: 'delete'
});
return request({
url: `/api/simulation/manage/${group}`,
method: 'delete'
});
}
/** 根据设备类型获取设备列表 */
export function getDeviceCodeByDeviceType(group, params) {
return request({
url: `/api/simulation/${group}/deviceType/devices`,
method: 'get',
params
});
return request({
url: `/api/simulation/${group}/deviceType/devices`,
method: 'get',
params
});
}
/** 获取任务录制的数据 */
export function getScriptRecord(group) {
return request({
url: `/api/simulation/${group}/scriptWrite`,
method: 'get'
});
return request({
url: `/api/simulation/${group}/scriptWrite`,
method: 'get'
});
}
/** 加载任务*/
export function loadQuest(questId, memberId, group) {
return request({
url: `/api/simulation/${group}/quest/${questId}?memberId=${memberId}`,
method: 'post'
});
return request({
url: `/api/simulation/${group}/quest/${questId}?memberId=${memberId}`,
method: 'post'
});
}
/** 加载剧本 */
export function loadScript(scriptId, memberId, group) {
return request({
url: `api/simulation/${group}/script/${scriptId}?memberId=${memberId}`,
method: 'post'
});
return request({
url: `api/simulation/${group}/script/${scriptId}?memberId=${memberId}`,
method: 'post'
});
}
/** 退出剧本*/
export function quitScript(group) {
return request({
url: `/api/simulation/${group}/script`,
method: 'delete'
});
return request({
url: `/api/simulation/${group}/script`,
method: 'delete'
});
}
/** 退出任务*/
export function quitQuest(group) {
return request({
url: `/api/simulation/${group}/quest`,
method: 'put'
});
return request({
url: `/api/simulation/${group}/quest`,
method: 'put'
});
}
/** 根据group获取仿真对象*/
export function getSimulationInfo(group) {
return request({
url: `/api/simulation/${group}`,
method: 'get'
});
return request({
url: `/api/simulation/${group}`,
method: 'get'
});
}
/** 获取可用的设备指令*/
export function getAvailableDeviceCommand(params) {
return request({
url: `/api/simulation/deviceCommand/available`,
method: 'get',
params
});
return request({
url: `/api/simulation/deviceCommand/available`,
method: 'get',
params
});
}
/** 保存/修改任务剧本*/
export function saveTaskScript(group, data) {
return request({
url: `/api/simulation/${group}/questRecord/script`,
method: 'post',
data
});
return request({
url: `/api/simulation/${group}/questRecord/script`,
method: 'post',
data
});
}
/** 暂停剧本编制的仿真 */
export function scriptPause(group) {
return request({
url: `/api/simulation/${group}/scriptWrite/pause`,
method: 'post'
});
return request({
url: `/api/simulation/${group}/scriptWrite/pause`,
method: 'post'
});
}
/** 恢复仿真运行并执行刚编辑的剧本动作 */
export function executeScript(group) {
return request({
url: `/api/simulation/${group}/scriptWrite/execute`,
method: 'post'
});
return request({
url: `/api/simulation/${group}/scriptWrite/execute`,
method: 'post'
});
}
/** 生成用户自己的当日运行图*/
export function generateDayRunPlan(planId, group) {
return request({
url: `/api/simulation/${group}/loadRunPlan/${planId}`,
method: 'post'
});
return request({
url: `/api/simulation/${group}/loadRunPlan/${planId}`,
method: 'post'
});
}
/** 创建派班计划仿真*/
export function schedulingNotify(params) {
return request({
url: `/api/scheduling/simulation`,
method: 'post',
params
});
return request({
url: `/api/scheduling/simulation`,
method: 'post',
params
});
}
/** 获取PLC网关 */
export function getPlcGateway(group) {
return request({
url: `/api/simulation/${group}/plcGateway`,
method: 'get'
});
return request({
url: `/api/simulation/${group}/plcGateway`,
method: 'get'
});
}
/** 处理ibp盘事件 */
export function handlerIbpEvent(group, data) {
return request({
url: `/api/simulation/${group}/ibp/event`,
method: 'post',
data: data
});
return request({
url: `/api/simulation/${group}/ibp/event`,
method: 'post',
data: data
});
}
/** 预览脚本仿真*/
export function scriptDraftRecordNotify(scriptId) {
return request({
url: `/api/simulation/scriptDraft/${scriptId}`,
method: 'get'
});
return request({
url: `/api/simulation/scriptDraft/${scriptId}`,
method: 'get'
});
}

View File

@ -9,15 +9,6 @@ export function getTrainingSystemList(cityCode, params) {
});
}
export function querySystemByTypeAndPrdCode(params, prodCode) {
/** 根据系统类型和地图产品code查询系统的内容课程、章节、考试*/
return request({
url: `/api/mapSystem/queryByTypeAndPrdCode/${prodCode}`,
method: 'get',
params
});
}
export function getTrainingSystemListByMapId(mapId) {
/** 根据mapId去获取其子系统 */
return request({

BIN
src/assets/icon/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

View File

@ -103,5 +103,6 @@ export default {
connectToRealDeviceFailed: 'Connect to real device failed!',
getRealDeviceListFailed: 'Get real device list failed!',
deleteRealDeviceFailed: 'Delete real device failed!',
checkTheValidityFirst: 'Please check the validity first!'
checkTheValidityFirst: 'Please check the validity first!',
permissionAtLeast:'At least one of the number of permissions is more than 0'
};

View File

@ -88,6 +88,7 @@ export default {
button: 'button',
mapName: 'Name of the map:',
skinName: 'Skin style:',
selectCity: 'city:',
offsetXColon: 'X Offset:',
offsetYColon: 'Y Offset:',
@ -543,5 +544,6 @@ export default {
horizontal: 'Horizontal',
vertical: 'Vertical',
piece: 'piece'
piece: 'piece',
setStationCode: 'Batch set up centralized station'
};

View File

@ -1,35 +1,40 @@
export default {
permissionPack: 'Package',
setSuccess: 'Set successfully',
isSureSetBelonger: 'Are you sure to set {name} to be the owner of the permission?',
setBelonger: 'Set Owner',
lessonName: 'Lesson Name',
mapName: 'Map Name',
mapProductName: 'Product Name',
permissionType: 'Permission Type',
permissionStatus: 'Permission Status',
permissionUseType: 'Public/Private',
permissionTotal: 'Total',
permissionRemains: 'Remains',
isForever: 'Permanent',
startTime: 'Start Time',
endTime: 'End Time',
belonger: 'Owner',
userList: 'User List',
customPackageRules: 'Custom packaging rules',
addRules: 'Add rules',
package: 'Pack',
getQrcode: 'Get qr code',
hasExitRule: 'This type rule already exists',
pleaseAddRule: 'Please add rules',
selectDate: 'Select time',
addPermissionPackageRule: 'Add authority packaging rules',
editPermissionPackageRule: 'edit authority packaging rule',
restPermissionMaxNumber: '(maximum number of remaining permissions: {0})',
pleaseSelectTransferPermission: 'Select transfer permissions',
permissionName: 'Permission Name',
private: 'Private',
public: 'Public',
userName: 'User Name',
statusType: 'Status Type'
permissionPack: 'Package',
setSuccess: 'Set successfully',
isSureSetBelonger: 'Are you sure to set {name} to be the owner of the permission?',
setBelonger: 'Set Owner',
lessonName: 'Lesson Name',
mapName: 'Map Name',
mapProductName: 'Product Name',
permissionType: 'Permission Type',
permissionStatus: 'Permission Status',
permissionUseType: 'Public/Private',
permissionTotal: 'Total',
permissionRemains: 'Remains',
isForever: 'Permanent',
startTime: 'Start Time',
endTime: 'End Time',
belonger: 'Owner',
userList: 'User List',
customPackageRules: 'Custom packaging rules',
addRules: 'Add rules',
package: 'Pack',
getQrcode: 'Get qr code',
hasExitRule: 'This type rule already exists',
pleaseAddRule: 'Please add rules',
selectDate: 'Select time',
addPermissionPackageRule: 'Add authority packaging rules',
editPermissionPackageRule: 'edit authority packaging rule',
restPermissionMaxNumber: '(maximum number of remaining permissions: {0})',
pleaseSelectTransferPermission: 'Select transfer permissions',
permissionName: 'Permission Name',
private: 'Private',
public: 'Public',
userName: 'User Name',
statusType: 'Status Type',
isPackage:'Package',
numOfDistribute:'Num of distribute',
numOfTransfer:'Num of transfer',
transferTips:'You can receive multiple permissions at a time, and the permissions you receive can continue to be transferred.',
distributeTips:'Only one permission can be obtained at a time. The permission received is a dedicated permission and cannot be redistributed.'
};

View File

@ -120,5 +120,6 @@ export default {
pleaseSelectTheBelongsProject: 'Please select the belongs project',
copyMapAs: 'Copy map as',
whetherToCopyData: 'Whether to copy data',
copy:'Copy'
copy:'Copy',
lineType:'Line Type'
};

View File

@ -36,6 +36,8 @@ export default {
sectionRelSwitchCode: 'sectionRelSwitchCode',
pleaseSelectSectionName: 'Select the section name',
pleaseSelectSection: 'Select the section',
pleaseSelectStationCode: 'Select the section station code',
pleaseFillOffset: 'Please fill in the offset',
pleaseFillValue: 'Please fill in the value',
pleaseSelectLeftSectionName: 'Please select the left section name',

View File

@ -1,107 +1,113 @@
export default {
scriptTitle: 'Task Recording',
saveBackground: 'Save Background',
saveData: 'Save Data',
mapList: 'Map List',
createScript: 'Create Script',
modifyScript: 'Modify Script',
scriptName: 'Script Name',
addScript: 'Add Script',
map: 'Map',
scriptDescription: 'Script Description',
submit: 'submit',
scriptNameRule: 'Please input script name',
scriptDescriptionRule: 'Please input script description',
createScriptSuccess: 'Create script success',
createScriptFail: 'Create script failure',
scriptDetail: 'Script Detail',
scriptRecord: 'Edit',
scriptCreate: 'Create',
scriptModify: 'Modify',
scriptDelete: 'Delete',
getScriptFail: 'Get script information failure',
createSimulationFail: 'Create simulation failure',
modifyScriptSuccess: 'Modify script success',
modifyScriptFail: 'Modify script failure',
deleteScriptTip: 'This action will delete this script, whether to continue?',
deleteScriptSucess: 'delete script sucess',
deleteScriptFail: 'delete script failure',
scriptRecordTitle: 'Script Record',
drivingPause: 'Pause',
recoverAndExecute: 'Recover And Execute',
resetScript: 'Reset Script',
pauseFail: 'Pause failure',
recoverFail: 'Recover failure',
saveBackgroundSuceess: 'Save background suceess',
updateLocationFail: 'update location failure',
saveBackgroundFail: 'Save background failure',
saveDataSucess: 'Save data sucess',
saveDataFail: 'Save data failure',
clearDataTip: 'This action will clear the saved script data, whether to continue?',
resetDataSuccess: 'Reset script success',
resetDataFail: 'Reset script failure',
scriptTitle: 'Task Recording',
saveBackground: 'Save Background',
saveData: 'Save Data',
mapList: 'Map List',
createScript: 'Create Script',
modifyScript: 'Modify Script',
scriptName: 'Script Name',
addScript: 'Add Script',
map: 'Map',
scriptDescription: 'Script Description',
submit: 'submit',
scriptNameRule: 'Please input script name',
scriptDescriptionRule: 'Please input script description',
createScriptSuccess: 'Create script success',
createScriptFail: 'Create script failure',
scriptDetail: 'Script Detail',
scriptRecord: 'Edit',
scriptCreate: 'Create',
scriptModify: 'Modify',
scriptDelete: 'Delete',
getScriptFail: 'Get script information failure',
createSimulationFail: 'Create simulation failure',
modifyScriptSuccess: 'Modify script success',
modifyScriptFail: 'Modify script failure',
deleteScriptTip: 'This action will delete this script, whether to continue?',
deleteScriptSucess: 'delete script sucess',
deleteScriptFail: 'delete script failure',
scriptRecordTitle: 'Script Record',
drivingPause: 'Pause',
recoverAndExecute: 'Recover And Execute',
resetScript: 'Reset Script',
pauseFail: 'Pause failure',
recoverFail: 'Recover failure',
saveBackgroundSuceess: 'Save background suceess',
updateLocationFail: 'update location failure',
saveBackgroundFail: 'Save background failure',
saveDataSucess: 'Save data sucess',
saveDataFail: 'Save data failure',
clearDataTip: 'This action will clear the saved script data, whether to continue?',
resetDataSuccess: 'Reset script success',
resetDataFail: 'Reset script failure',
allRoles: 'All Roles',
actors: 'Actor Role',
roleSexMale: 'Male',
roleSexFemale: 'Female',
selectScriptActorSuccess: 'Select script actor success',
selectScriptActorFail: 'Select script actor failure',
cancleScriptActorSuccess: 'Cancle script actor success',
cancleScriptActorFail: 'Cancle script actor failure',
modifyScriptActorSexSuccess: 'Modify script actor sex success',
modifyScriptActorSexFail: 'Modify script actor sex failure',
allRoles: 'All Roles',
actors: 'Actor Role',
roleSexMale: 'Male',
roleSexFemale: 'Female',
selectScriptActorSuccess: 'Select script actor success',
selectScriptActorFail: 'Select script actor failure',
cancleScriptActorSuccess: 'Cancle script actor success',
cancleScriptActorFail: 'Cancle script actor failure',
modifyScriptActorSexSuccess: 'Modify script actor sex success',
modifyScriptActorSexFail: 'Modify script actor sex failure',
addConversition: 'Add Dialogue',
narrator: 'Sender',
narratorRules: 'Please select Sender',
receiver: 'Receiver',
receiverRules: 'Please select receiver',
conversitionContent: 'Content',
addCommand: 'Add Command',
executor: 'Executor',
executorRules: 'Please select executor',
executeCommand: 'Command',
executeCommandRules: 'Please select execute command',
startStation: 'Start Station',
startStationRules: 'Please select start station ',
endStation: 'End Station',
endStationRules: 'Please select end station',
addConversition: 'Add Dialogue',
narrator: 'Sender',
narratorRules: 'Please select Sender',
receiver: 'Receiver',
receiverRules: 'Please select receiver',
conversitionContent: 'Content',
addCommand: 'Add Command',
executor: 'Executor',
executorRules: 'Please select executor',
executeCommand: 'Command',
executeCommandRules: 'Please select execute command',
startStation: 'Start Station',
startStationRules: 'Please select start station ',
endStation: 'End Station',
endStationRules: 'Please select end station',
drivingMode:'Driving Mode',
drivingModeRules:'Please select driving mode',
speed:'Speed',
signal:'Signal',
speedRules:'Please input speed',
signalRules:'Please select signal',
addCommandButton: 'Add Command',
addConversitionButton: 'Add Dialogue',
conversitionContentRules: 'Please input content',
addCommandSucess: 'Add command sucess',
addCommandFail: 'Add command failure',
addConversitionSuccess: 'Add dialogue success',
addConversitionFail: 'Add dialogue failure',
modifyConversitionSuccess: 'Modify conversition success',
modifyConversitionFail: 'Modify conversition failure',
modifyConversition: 'Modify Conversition',
modifyConversitionButton: 'modify',
drivingByPlan: 'Driving By Plan',
scriptBack: 'Back',
speakTo: 'to',
executeCommandTips: 'execute command: ',
operate: 'Operate',
scriptList: 'Script List',
applyPublish: 'Apply for release',
preview: 'Preview',
status: 'Status',
applyRevoke: 'Revoke',
publish: 'Publish',
revokeReason: 'Revoke explanation',
language: 'language',
chinese: 'Chinese Simplified',
english: 'English',
publishScript: 'Publish Script',
releaseScriptSuccess: 'release script success',
releaseScriptFailed: 'release script failed',
publishScriptSuccess: 'Publish Script Success',
publishScriptFailed: 'Publish Script Failed',
releaseScriptTip: 'This action will apply to release script, whether to continue?',
revokeScriptTip: 'This action will undo release script, whether to continue?',
inputScriptName: 'Please input script name',
selectMap: 'Please select map',
inputScriptDescription: 'Please input script description'
addCommandButton: 'Add Command',
addConversitionButton: 'Add Dialogue',
conversitionContentRules: 'Please input content',
addCommandSucess: 'Add command sucess',
addCommandFail: 'Add command failure',
addConversitionSuccess: 'Add dialogue success',
addConversitionFail: 'Add dialogue failure',
modifyConversitionSuccess: 'Modify conversition success',
modifyConversitionFail: 'Modify conversition failure',
modifyConversition: 'Modify Conversition',
modifyConversitionButton: 'modify',
drivingByPlan: 'Driving By Plan',
scriptBack: 'Back',
speakTo: 'to',
executeCommandTips: 'execute command: ',
operate: 'Operate',
scriptList: 'Script List',
applyPublish: 'Apply for release',
preview: 'Preview',
status: 'Status',
applyRevoke: 'Revoke',
publish: 'Publish',
revokeReason: 'Revoke explanation',
language: 'language',
chinese: 'Chinese Simplified',
english: 'English',
publishScript: 'Publish Script',
releaseScriptSuccess: 'release script success',
releaseScriptFailed: 'release script failed',
publishScriptSuccess: 'Publish Script Success',
publishScriptFailed: 'Publish Script Failed',
releaseScriptTip: 'This action will apply to release script, whether to continue?',
revokeScriptTip: 'This action will undo release script, whether to continue?',
inputScriptName: 'Please input script name',
selectMap: 'Please select map',
inputScriptDescription: 'Please input script description'
};

View File

@ -219,5 +219,7 @@ export default {
setProjectSuccess: 'Set belongs project success!',
setProjectFail: 'Set belongs project fail!',
copyMapSuccess: 'Copy map success!',
copyMapFail: 'Copy map fail!'
copyMapFail: 'Copy map fail!',
pushNewsSuccess: 'Push news success!',
pushNewsFailed: 'Push news failed!'
};

View File

@ -1,36 +1,37 @@
export default {
comprehensiveTrainingManager: 'Comprehensive training manager:',
comprehensiveDrillRoom: 'Comprehensive drill room',
numberOfAssignableRoles: 'Number of assignable roles:',
dispatcher: 'Dispatcher',
increaseDispatchers: 'Increase dispatchers',
stationAttendant: 'Station attendant',
increaseStationAttendant: 'Increase station attendant',
teacher: 'Teacher',
increaseTeacher: 'Increase teacher',
universalAccount: 'Universal Account',
increaseUniversalAccount: 'Increase universal account',
driver: 'Driver',
increaseDriver: 'Increase driver',
bigScreen: 'Big screen',
increaseBigScreen: 'Increase big screen',
destroyRoom: 'Destroy room',
generatingQRCode: 'Generating QRCode',
startSimulation: 'Start simulation',
enterSimulation: 'Enter simulation',
endSimulation: 'End Simulation',
distributeTheRoomQRCode: 'Distribute the room QR code',
increaseIbp: 'increase IBP',
kickOutTheRoom: 'Kick out the room',
sending: 'sending...',
holdAndTalk: 'Hold and talk',
recording: 'recording...',
sendText: 'Send text',
left: 'left',
right: 'right',
realDevice: 'Real device',
plcGatewayOnline: '[PLC gateway online]',
plcGatewayOffline: '[PLC gateway offline]',
uplinkPlatform: 'Uplink platform',
downlinkPlatform: 'Downlink platform'
comprehensiveTrainingManager: 'Comprehensive training manager:',
comprehensiveDrillRoom: 'Comprehensive drill room',
numberOfAssignableRoles: 'Number of assignable roles:',
dispatcher: 'Dispatcher',
increaseDispatchers: 'Increase dispatchers',
stationAttendant: 'Station attendant',
increaseStationAttendant: 'Increase station attendant',
teacher: 'Teacher',
increaseTeacher: 'Increase teacher',
universalAccount: 'Universal Account',
increaseUniversalAccount: 'Increase universal account',
driver: 'Driver',
increaseDriver: 'Increase driver',
bigScreen: 'Big screen',
increaseBigScreen: 'Increase big screen',
destroyRoom: 'Destroy room',
generatingQRCode: 'Generating QRCode',
startSimulation: 'Start simulation',
enterSimulation: 'Enter simulation',
endSimulation: 'End Simulation',
distributeTheRoomQRCode: 'Distribute the room QR code',
increaseIbp: 'increase IBP',
kickOutTheRoom: 'Kick out the room',
sending: 'sending...',
holdAndTalk: 'Hold and talk',
recording: 'recording...',
sendText: 'Send text',
left: 'left',
right: 'right',
realDevice: 'Real device',
plcGatewayOnline: '[PLC gateway online]',
plcGatewayOffline: '[PLC gateway offline]',
uplinkPlatform: 'Uplink platform',
downlinkPlatform: 'Downlink platform',
ibp:'IBP'
};

View File

@ -103,5 +103,6 @@ export default {
connectToRealDeviceFailed: '关联真实设备失败!',
getRealDeviceListFailed: '获取真实设备列表失败!',
deleteRealDeviceFailed: '删除真实设备失败!',
checkTheValidityFirst: '请先进行有效性检查!'
checkTheValidityFirst: '请先进行有效性检查!',
permissionAtLeast:'至少有一种权限的数量大于0'
};

File diff suppressed because it is too large Load Diff

View File

@ -1,42 +1,48 @@
export default {
permissionPack: '权限打包',
setSuccess: '设置成功',
isSureSetBelonger: '是否确定设置{name}为权限所属人?',
setBelonger: '设置归属人',
lessonName: '课程名称',
mapName: '地图名称',
mapProductName: '产品名称',
permissionType: '权限类型',
permissionStatus: '权限状态',
permissionUseType: '公用/专用',
permissionTotal: '权限总数',
permissionRemains: '剩余权限',
isForever: '是否永久',
startTime: '开始时间',
endTime: '结束时间',
belonger: '归属人',
userList: '用户列表',
customPackageRules: '定制打包规则',
addRules: '添加规则',
package: '打包',
getQrcode: '获取二维码',
hasExitRule: '已存在此类型规则',
pleaseAddRule: '请添加规则',
selectDate: '选择时间',
addPermissionPackageRule: '增加权限打包规则',
editPermissionPackageRule: '编辑权限打包规则',
restPermissionMaxNumber: '(剩余最大权限个数:{0}',
pleaseSelectTransferPermission: '选择转赠权限',
permissionName: '权限名称',
private: '专用',
public: '公用',
selectPermission: '选择权限',
createOrder: '创建订单',
checkCode: '查看二维码',
goodsName: '商品名称',
price: '价格',
permissionList: '查看权限列表',
lastShep: '上一步',
userName: '用户名称',
statusType: '状态类型'
permissionPack: '权限打包',
setSuccess: '设置成功',
isSureSetBelonger: '是否确定设置{name}为权限所属人?',
setBelonger: '设置归属人',
lessonName: '课程名称',
mapName: '地图名称',
mapProductName: '产品名称',
permissionType: '权限类型',
permissionStatus: '权限状态',
permissionUseType: '公用/专用',
permissionTotal: '权限总数',
permissionRemains: '剩余权限',
isForever: '是否永久',
startTime: '开始时间',
endTime: '结束时间',
belonger: '归属人',
userList: '用户列表',
customPackageRules: '定制打包规则',
addRules: '添加规则',
package: '打包',
getQrcode: '获取二维码',
hasExitRule: '已存在此类型规则',
pleaseAddRule: '请添加规则',
selectDate: '选择时间',
addPermissionPackageRule: '增加权限打包规则',
editPermissionPackageRule: '编辑权限打包规则',
restPermissionMaxNumber: '(剩余最大权限个数:{0}',
pleaseSelectTransferPermission: '选择转赠权限',
permissionName: '权限名称',
private: '专用',
public: '公用',
selectPermission: '选择权限',
createOrder: '创建订单',
checkCode: '查看二维码',
goodsName: '商品名称',
price: '价格',
permissionList: '查看权限列表',
lastShep: '上一步',
userName: '用户名称',
statusType: '状态类型',
isPackage:'是否万能',
numOfDistribute:'分发权限数量',
numOfTransfer:'转赠权限数量',
transferTips:'一次可以领取多个权限,领到的权限可以继续转赠',
distributeTips:'一次只能领取一个权限,领到的权限是专用权限,不可再次分发'
};

View File

@ -124,5 +124,6 @@ export default {
pleaseSelectTheBelongsProject: '请选择归属项目',
copyMapAs: '复制地图为',
whetherToCopyData: '是否复制数据',
copy:'复制'
copy:'复制',
lineType:'线路类型'
};

View File

@ -34,6 +34,8 @@ export default {
basisLink: '基础Link:',
pleaseSelectSectionName: '请选择区段名称',
pleaseSelectSection: '请选择区段',
pleaseSelectStationCode: '请选择设备集中站',
pleaseFillOffset: '请填写偏移量',
pleaseFillValue: '请填写数值',
pleaseSelectLeftSectionName: '请选择左侧区段名称',

View File

@ -1,108 +1,114 @@
export default {
scriptTitle: '剧本录制',
saveBackground: '保存背景',
saveData: '保存数据',
mapList: '地图列表',
createScript: '创建剧本',
modifyScript: '修改剧本',
scriptName: '剧本名称',
addScript: '添加剧本',
map: '所属地图',
scriptDescription: '剧本描述',
submit: '确定',
scriptNameRule: '请输入剧本名称',
scriptDescriptionRule: '请输入剧本描述',
createScriptSuccess: '创建剧本成功',
createScriptFail: '创建剧本失败',
scriptDetail: '剧本详情',
scriptRecord: '编制',
scriptCreate: '创建',
scriptModify: '修改',
scriptDelete: '删除',
getScriptFail: '获取剧本信息失败',
createSimulationFail: '创建仿真失败',
modifyScriptSuccess: '修改剧本成功',
modifyScriptFail: '修改剧本失败',
deleteScriptTip: '此操作将删除此剧本, 是否继续?',
deleteScriptSucess: '删除成功',
deleteScriptFail: '删除失败',
scriptRecordTitle: '剧本编制',
drivingPause: '暂停',
recoverAndExecute: '恢复并执行',
resetScript: '重置剧本',
pauseFail: '暂停失败',
recoverFail: '恢复失败',
saveBackgroundSuceess: '保存背景成功',
updateLocationFail: '更新定位失败',
saveBackgroundFail: '保存背景失败',
saveDataSucess: '保存数据成功',
saveDataFail: '保存数据失败',
clearDataTip: '此操作将会清除已保存的编制数据, 是否继续?',
resetDataSuccess: '重置剧本成功',
resetDataFail: '重置剧本失败',
scriptTitle: '剧本录制',
saveBackground: '保存背景',
saveData: '保存数据',
mapList: '地图列表',
createScript: '创建剧本',
modifyScript: '修改剧本',
scriptName: '剧本名称',
addScript: '添加剧本',
map: '所属地图',
scriptDescription: '剧本描述',
submit: '确定',
scriptNameRule: '请输入剧本名称',
scriptDescriptionRule: '请输入剧本描述',
createScriptSuccess: '创建剧本成功',
createScriptFail: '创建剧本失败',
scriptDetail: '剧本详情',
scriptRecord: '编制',
scriptCreate: '创建',
scriptModify: '修改',
scriptDelete: '删除',
getScriptFail: '获取剧本信息失败',
createSimulationFail: '创建仿真失败',
modifyScriptSuccess: '修改剧本成功',
modifyScriptFail: '修改剧本失败',
deleteScriptTip: '此操作将删除此剧本, 是否继续?',
deleteScriptSucess: '删除成功',
deleteScriptFail: '删除失败',
scriptRecordTitle: '剧本编制',
drivingPause: '暂停',
recoverAndExecute: '恢复并执行',
resetScript: '重置剧本',
pauseFail: '暂停失败',
recoverFail: '恢复失败',
saveBackgroundSuceess: '保存背景成功',
updateLocationFail: '更新定位失败',
saveBackgroundFail: '保存背景失败',
saveDataSucess: '保存数据成功',
saveDataFail: '保存数据失败',
clearDataTip: '此操作将会清除已保存的编制数据, 是否继续?',
resetDataSuccess: '重置剧本成功',
resetDataFail: '重置剧本失败',
allRoles: '所有角色',
actors: '演员角色',
roleSexMale: '男',
roleSexFemale: '女',
selectScriptActorSuccess: '选择剧本角色成功',
selectScriptActorFail: '选择剧本角色失败',
cancleScriptActorSuccess: '取消剧本角色成功',
cancleScriptActorFail: '取消剧本角色失败',
modifyScriptActorSexSuccess: '修改剧本成员性别成功',
modifyScriptActorSexFail: '修改剧本成员性别失败',
allRoles: '所有角色',
actors: '演员角色',
roleSexMale: '男',
roleSexFemale: '女',
selectScriptActorSuccess: '选择剧本角色成功',
selectScriptActorFail: '选择剧本角色失败',
cancleScriptActorSuccess: '取消剧本角色成功',
cancleScriptActorFail: '取消剧本角色失败',
modifyScriptActorSexSuccess: '修改剧本成员性别成功',
modifyScriptActorSexFail: '修改剧本成员性别失败',
addConversition: '添加对话',
narrator: '讲述者',
narratorRules: '请选择讲述者',
receiver: '接收者',
receiverRules: '请选择接收者',
conversitionContent: '内容',
addCommand: '添加指令',
executor: '执行者',
executorRules: '请选择执行者',
executeCommand: '执行指令',
executeCommandRules: '请选择执行指令',
startStation: '起始站台',
startStationRules: '请选择起始站台',
endStation: '终点站台',
endStationRules: '请选择终点站台',
addConversition: '添加对话',
narrator: '讲述者',
narratorRules: '请选择讲述者',
receiver: '接收者',
receiverRules: '请选择接收者',
conversitionContent: '内容',
addCommand: '添加指令',
executor: '执行者',
executorRules: '请选择执行者',
executeCommand: '执行指令',
executeCommandRules: '请选择执行指令',
startStation: '起始站台',
startStationRules: '请选择起始站台',
endStation: '终点站台',
endStationRules: '请选择终点站台',
drivingMode:'列车驾驶模式',
drivingModeRules:'请选择列车驾驶模式',
speed:'速度',
signal:'信号机',
speedRules:'请输入速度',
signalRules:'请选择信号机',
addCommandButton: '添加指令',
addConversitionButton: '添加对话',
conversitionContentRules: '请输入内容',
addCommandSucess: '添加指令成功',
addCommandFail: '添加指令失败',
addConversitionSuccess: '添加对话成功',
addConversitionFail: '添加对话失败',
modifyConversitionSuccess: '修改对话成功',
modifyConversitionFail: '修改对话失败',
modifyConversition: '修改对话',
modifyConversitionButton: '修改',
addCommandButton: '添加指令',
addConversitionButton: '添加对话',
conversitionContentRules: '请输入内容',
addCommandSucess: '添加指令成功',
addCommandFail: '添加指令失败',
addConversitionSuccess: '添加对话成功',
addConversitionFail: '添加对话失败',
modifyConversitionSuccess: '修改对话成功',
modifyConversitionFail: '修改对话失败',
modifyConversition: '修改对话',
modifyConversitionButton: '修改',
drivingByPlan: '按计划行车',
scriptBack: '返回',
speakTo: '对',
executeCommandTips: '执行指令: ',
operate: '操作',
scriptList: '剧本列表',
applyPublish: '申请发布',
preview: '预览',
status: '状态',
applyRevoke: '撤回',
publish: '发布',
revokeReason: '驳回原因',
language: '语言',
chinese: '中文',
english: '英文',
publishScript: '发布剧本',
releaseScriptSuccess: '申请发布成功',
releaseScriptFailed: '申请发布失败',
publishScriptSuccess: '发布成功',
publishScriptFailed: '发布失败',
releaseScriptTip: '此操作将申请发布剧本, 是否继续?',
revokeScriptTip: '此操作将撤销发布剧本申请, 是否继续?',
inputScriptName: '请输入剧本',
selectMap: '请选择地图',
inputScriptDescription: '请输入剧本描述'
drivingByPlan: '按计划行车',
scriptBack: '返回',
speakTo: '对',
executeCommandTips: '执行指令: ',
operate: '操作',
scriptList: '剧本列表',
applyPublish: '申请发布',
preview: '预览',
status: '状态',
applyRevoke: '撤回',
publish: '发布',
revokeReason: '驳回原因',
language: '语言',
chinese: '中文',
english: '英文',
publishScript: '发布剧本',
releaseScriptSuccess: '申请发布成功',
releaseScriptFailed: '申请发布失败',
publishScriptSuccess: '发布成功',
publishScriptFailed: '发布失败',
releaseScriptTip: '此操作将申请发布剧本, 是否继续?',
revokeScriptTip: '此操作将撤销发布剧本申请, 是否继续?',
inputScriptName: '请输入剧本',
selectMap: '请选择地图',
inputScriptDescription: '请输入剧本描述'
};

View File

@ -219,5 +219,7 @@ export default {
setProjectSuccess: '设置归属项目成功!',
setProjectFail: '设置归属项目失败!',
copyMapSuccess: '复制地图成功!',
copyMapFail: '复制地图失败!'
copyMapFail: '复制地图失败!',
pushNewsSuccess: '推送消息成功!',
pushNewsFailed: '推送消息失败!'
};

View File

@ -1,36 +1,37 @@
export default {
comprehensiveTrainingManager: '综合实训管理者:',
comprehensiveDrillRoom: '综合演练室',
numberOfAssignableRoles: '可分配角色数量:',
dispatcher: '调度员',
increaseDispatchers: '增加调度人员',
stationAttendant: '车站值班员',
increaseStationAttendant: '增加车站值班员',
teacher: '教员',
increaseTeacher: '增加教员',
universalAccount: '通号',
increaseUniversalAccount: '增加通号',
driver: '司机',
increaseDriver: '增加司机',
bigScreen: '大屏',
increaseBigScreen: '增加大屏',
destroyRoom: '销毁房间',
generatingQRCode: '生成二维码',
startSimulation: '开始仿真',
enterSimulation: '进入仿真',
endSimulation: '结束仿真',
distributeTheRoomQRCode: '分发房间二维码',
increaseIbp: '增加IBP',
kickOutTheRoom: '踢出房间',
sending: '发送中...',
holdAndTalk: '按住说话',
recording: '录音中...',
sendText: '发送文字',
left: '左',
right: '右',
realDevice: '真实设备',
plcGatewayOnline: '[PLC网关在线]',
plcGatewayOffline: '[PLC网关离线]',
uplinkPlatform: '上行站台',
downlinkPlatform: '下行站台'
comprehensiveTrainingManager: '综合实训管理者:',
comprehensiveDrillRoom: '综合演练室',
numberOfAssignableRoles: '可分配角色数量:',
dispatcher: '调度员',
increaseDispatchers: '增加调度人员',
stationAttendant: '车站值班员',
increaseStationAttendant: '增加车站值班员',
teacher: '教员',
increaseTeacher: '增加教员',
universalAccount: '通号',
increaseUniversalAccount: '增加通号',
driver: '司机',
increaseDriver: '增加司机',
bigScreen: '大屏',
increaseBigScreen: '增加大屏',
destroyRoom: '销毁房间',
generatingQRCode: '生成二维码',
startSimulation: '开始仿真',
enterSimulation: '进入仿真',
endSimulation: '结束仿真',
distributeTheRoomQRCode: '分发房间二维码',
increaseIbp: '增加IBP',
kickOutTheRoom: '踢出房间',
sending: '发送中...',
holdAndTalk: '按住说话',
recording: '录音中...',
sendText: '发送文字',
left: '左',
right: '右',
realDevice: '真实设备',
plcGatewayOnline: '[PLC网关在线]',
plcGatewayOffline: '[PLC网关离线]',
uplinkPlatform: '上行站台',
downlinkPlatform: '下行站台',
ibp:'IBP'
};

View File

@ -4,107 +4,113 @@ const deviceRender = {};
/** IbpText渲染配置*/
deviceRender[deviceType.IbpText] = {
_type: deviceType.IbpText,
zlevel: 1,
z: 4
_type: deviceType.IbpText,
zlevel: 1,
z: 4
};
/** SquareButton渲染配置*/
deviceRender[deviceType.SquareButton] = {
_type: deviceType.SquareButton,
zlevel: 1,
z: 4
_type: deviceType.SquareButton,
zlevel: 1,
z: 4
};
/** WarnButton渲染配置*/
deviceRender[deviceType.WarnButton] = {
_type: deviceType.WarnButton,
zlevel: 1,
z: 4
_type: deviceType.WarnButton,
zlevel: 1,
z: 4
};
/** Arrow渲染配置*/
deviceRender[deviceType.Arrow] = {
_type: deviceType.Arrow,
zlevel: 1,
z: 2
_type: deviceType.Arrow,
zlevel: 1,
z: 2
};
/** TipBox渲染配置*/
deviceRender[deviceType.TipBox] = {
_type: deviceType.TipBox,
zlevel: 1,
z: 3
_type: deviceType.TipBox,
zlevel: 1,
z: 3
};
/** BackGround渲染配置*/
deviceRender[deviceType.Background] = {
_type: deviceType.Background,
zlevel: 1,
z: 0
_type: deviceType.Background,
zlevel: 1,
z: 0
};
/** CircularLamp渲染配置 */
deviceRender[deviceType.CircularLamp] = {
_type: deviceType.CircularLamp,
zlevel: 1,
z: 4
_type: deviceType.CircularLamp,
zlevel: 1,
z: 4
};
/** AppendageBox渲染配置 */
deviceRender[deviceType.AppendageBox] = {
_type: deviceType.AppendageBox,
zlevel: 1,
z: 1
_type: deviceType.AppendageBox,
zlevel: 1,
z: 1
};
/** IbpLine渲染配置 */
deviceRender[deviceType.IbpLine] = {
_type: deviceType.IbpLine,
zlevel: 1,
z: 1
_type: deviceType.IbpLine,
zlevel: 1,
z: 1
};
/** Elevator 渲染配置 */
deviceRender[deviceType.Elevator] = {
_type: deviceType.Elevator,
zlevel: 1,
z: 2
_type: deviceType.Elevator,
zlevel: 1,
z: 2
};
/** Key 渲染配置 */
deviceRender[deviceType.Key] = {
_type: deviceType.Key,
zlevel: 1,
z: 4
_type: deviceType.Key,
zlevel: 1,
z: 4
};
/** TeleTerminal 渲染配置 */
deviceRender[deviceType.TeleTerminal] = {
_type: deviceType.TeleTerminal,
zlevel: 1,
z: 4
_type: deviceType.TeleTerminal,
zlevel: 1,
z: 4
};
/** Clock 渲染配置*/
deviceRender[deviceType.Clock] = {
_type: deviceType.Clock,
zlevel: 1,
z: 4
_type: deviceType.Clock,
zlevel: 1,
z: 4
};
/** RotateTip 渲染配置 */
deviceRender[deviceType.RotateTip] = {
_type: deviceType.RotateTip,
zlevel: 1,
z: 4
_type: deviceType.RotateTip,
zlevel: 1,
z: 4
};
/** Alarm */
deviceRender[deviceType.Alarm] = {
_type: deviceType.Alarm,
zlevel: 1,
z: 4
_type: deviceType.Alarm,
zlevel: 1,
z: 4
};
deviceRender[deviceType.CheckBox] = {
_type: deviceType.CheckBox,
zlevel: 10,
z: 0
};
export default deviceRender;

View File

@ -1,18 +1,19 @@
const deviceType = {
IbpText: 'IbpText',
SquareButton: 'SquareButton',
Arrow: 'Arrow',
TipBox: 'TipBox',
Background: 'Background',
CircularLamp: 'CircularLamp',
IbpLine: 'IbpLine',
AppendageBox: 'AppendageBox',
Alarm: 'Alarm',
Elevator: 'Elevator',
Key: 'Key',
TeleTerminal: 'TeleTerminal',
Clock: 'Clock',
RotateTip: 'RotateTip'
IbpText: 'IbpText',
SquareButton: 'SquareButton',
Arrow: 'Arrow',
TipBox: 'TipBox',
Background: 'Background',
CircularLamp: 'CircularLamp',
IbpLine: 'IbpLine',
AppendageBox: 'AppendageBox',
Alarm: 'Alarm',
Elevator: 'Elevator',
Key: 'Key',
TeleTerminal: 'TeleTerminal',
Clock: 'Clock',
RotateTip: 'RotateTip',
CheckBox: 'CheckBox'
};
export default deviceType;

View File

@ -303,5 +303,25 @@ class IbpPan {
}
}
}
renderCheckBox(model) {
const type = model._type;
const code = model.code;
const oDevice = this.ibpDevice[code] || deviceFactory(type, model);
const nDevice = deviceFactory(type, Object.assign(oDevice.model || {}, model));
delete this.ibpDevice[code];
this.$painter.delete(oDevice);
if (!model._dispose) {
this.ibpDevice[code] = nDevice;
this.$painter.add(nDevice);
}
}
deleteCheckBox(code) {
const oDevice = this.ibpDevice[code];
if (oDevice) {
delete this.ibpDevice[code];
this.$painter.delete(oDevice);
}
}
}
export default IbpPan;

View File

@ -4,193 +4,282 @@ import * as eventTool from 'zrender/src/core/event';
import store from '@/store';
class EventModel {
constructor(e) {
this.clientX = e.event.clientX;
this.clientY = e.event.clientY;
constructor(e) {
this.clientX = e.event.clientX;
this.clientY = e.event.clientY;
let view = e.target;
while (view) {
if (Object.values(deviceType).includes(view._type)) {
this.deviceCode = view._code;
this.deviceType = view._type;
this.deviceModel = view.model;
this.eventTarget = view;
break;
}
view = view.parent;
}
}
let view = e.target;
while (view) {
if (Object.values(deviceType).includes(view._type)) {
this.deviceCode = view._code;
this.deviceType = view._type;
this.deviceModel = view.model;
this.eventTarget = view;
break;
}
view = view.parent;
}
}
}
class MouseController extends Eventful {
constructor(ibp) {
super();
this.$ibp = ibp;
this.$zr = ibp.getZr();
this.isAllowDragging=ibp.isAllowDragging||false;
this.events = ibp.getEvents();
this._dragging = false;
this.initHandler(this.$zr);
}
constructor(ibp) {
super();
this.$ibp = ibp;
this.$zr = ibp.getZr();
this.isAllowDragging = ibp.isAllowDragging || false; // 是否在绘图中,仅绘图状态下可拖拽
this.events = ibp.getEvents();
this._dragging = false; // 是否在拖拽状态
this.deviceList = [];
this.rightClickPoint = {
x: 0,
y: 0
}; // 右键点击坐标
this.initHandler(this.$zr);
}
initHandler(zr) {
if (zr) {
zr.on('contextmenu', this.contextmenu, this);
zr.on('mousemove', this.moveEvent, this);
zr.on('click', this.click, this);
initHandler(zr) {
if (zr) {
zr.on('contextmenu', this.contextmenu, this);
zr.on('mousemove', this.moveEvent, this);
zr.on('click', this.click, this);
this.enable = function (opts) {
opts = opts || {};
this._moveOnMouseMove = opts.moveOnMouseMove || true;
this._preventDefaultMouseMove = opts.preventDefaultMouseMove || true;
this.enable = function (opts) {
opts = opts || {};
this._moveOnMouseMove = opts.moveOnMouseMove || true;
this._preventDefaultMouseMove = opts.preventDefaultMouseMove || true;
this.disable();
this.disable();
zr.on('mousedown', this.mousedown, this);
zr.on('mousemove', this.mousemove, this);
zr.on('mouseup', this.mouseup, this);
zr.on('touchstart', this.mousedown, this);
zr.on('touchmove', this.mousemove, this);
zr.on('touchend', this.mouseup, this);
};
zr.on('mousedown', this.mousedown, this);
zr.on('mousemove', this.mousemove, this);
zr.on('mouseup', this.mouseup, this);
zr.on('touchstart', this.mousedown, this);
zr.on('touchmove', this.mousemove, this);
zr.on('touchend', this.mouseup, this);
};
this.disable = function () {
zr.off('mousedown', this.mousedown);
zr.off('mousemove', this.mousemove);
zr.off('mouseup', this.mouseup);
zr.off('touchstart', this.mousedown);
zr.off('touchmove', this.mousemove);
zr.off('touchend', this.mouseup);
};
this.disable = function () {
zr.off('mousedown', this.mousedown);
zr.off('mousemove', this.mousemove);
zr.off('mouseup', this.mouseup);
zr.off('touchstart', this.mousedown);
zr.off('touchmove', this.mousemove);
zr.off('touchend', this.mouseup);
};
this.dispose = function () {
zr.off('click', this.click);
zr.off('contextmenu', this.contextmenu);
zr.off('mousemove', this.moveEvent);
this.disable();
};
this.dispose = function () {
zr.off('click', this.click);
zr.off('contextmenu', this.contextmenu);
zr.off('mousemove', this.moveEvent);
this.disable();
};
this.isDragging = function () { return this._dragging; };
}
}
this.isDragging = function () { return this._dragging; };
}
}
setAllowDragging(data) {
this.isAllowDragging=data;
}
setAllowDragging(data) {
this.isAllowDragging = data;
}
mousedown(e) {
if (eventTool.notLeftMouse(e)) {
return;
}
e.event.preventDefault();
e.event.stopPropagation();
const em = new EventModel(e);
this.eventTarget = em.eventTarget;
if (this.eventTarget && this.eventTarget._type === deviceType.Background) {
this.eventTarget.setCursor('pointer');
}
this._offsetX=e.offsetX;
this._offsetY=e.offsetY;
this._x = e.offsetX;
this._y = e.offsetY;
this._dragging = true;
}
mousedown(e) {
e.event.preventDefault();
e.event.stopPropagation();
const em = new EventModel(e);
this.eventTarget = em.eventTarget;
this._offsetX = e.offsetX;
this._offsetY = e.offsetY;
this._x = e.offsetX;
this._y = e.offsetY;
this._dragging = true;
if (e.which === 3) {
this.handleMouseDownRight(e);
} else if (e.which === 1) {
this.handleMouseDownLeft(e);
} else if (e.which === 2) {
this.handleMouseDownWheel(e);
}
}
mousemove(e) {
if (eventTool.notLeftMouse(e) ||
!this._moveOnMouseMove ||
!this._dragging || !this.isAllowDragging
) {
return;
}
mousemove(e) {
const oldX = this._x;
const oldY = this._y;
const oldX = this._x;
const oldY = this._y;
const dx = e.offsetX - oldX;
const dy = e.offsetY - oldY;
const dx = e.offsetX - oldX;
const dy = e.offsetY - oldY;
this._x = e.offsetX;
this._y = e.offsetY;
if (e.which === 3) {
this.handleMouseMoveRight({x: e.offsetX, y: e.offsetY});
} else if (e.which === 1) {
this.handleMouseMoveLeft(e, dx, dy, oldX, oldY);
}
}
this._x = e.offsetX;
this._y = e.offsetY;
if (this._dragging) {
if ((this.eventTarget && this.eventTarget._type === deviceType.Background) || !this.isAllowDragging) {
this._preventDefaultMouseMove && eventTool.stop(e.event);
this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y });
return true;
} else if (this.isAllowDragging && this.eventTarget) {
this.eventTarget.grouper.drift(dx, dy, e);
}
} else {
return true;
}
mouseup(e) {
if (eventTool.notLeftMouse(e) || !this.eventTarget ) {
return;
}
if (this.deviceList.length) {
this.deviceList.forEach(item => {
item.setModel(e.offsetX - this._offsetX, e.offsetY - this._offsetY);
});
this.deviceList = [];
this.$ibp.deleteCheckBox('check_box');
this.eventTarget = '';
this._dragging = false;
this.deviceList = [];
return;
}
if (this.isAllowDragging) {
this.eventTarget.setModel(e.offsetX - this._offsetX, e.offsetY - this._offsetY);
this.eventTarget.dirty();
}
if (this.eventTarget._type === deviceType.Background) {
this.eventTarget.setCursor('default');
}
this.eventTarget = '';
this._dragging = false;
this.deviceList = [];
}
}
contextmenu(e) {
var em = this.checkEvent(e);
this.trigger(this.events.Contextmenu, em);
}
click(e) {
var em = this.checkEvent(e);
this.trigger(this.events.Selected, em);
}
moveEvent(e) {
const newEm = new EventModel(e);
const trainDetails = store.state.map.trainDetails;
if (trainDetails) {
if (newEm.deviceType != deviceType.Train || trainDetails.code != newEm.deviceCode) {
var instance = (this.$ibp.getDeviceByCode(trainDetails.code) || {} ).instance;
instance && instance.removeTrainDetail && instance.removeTrainDetail();
}
}
}
mouseup(e) {
if (!eventTool.notLeftMouse(e)&&this.isAllowDragging && this.eventTarget) {
this.eventTarget.setModel(e.offsetX - this._offsetX, e.offsetY - this._offsetY);
this.eventTarget.dirty();
}
// debugger;
if (this.eventTarget && this.eventTarget._type === deviceType.Background) {
// console.log('111-------');
this.eventTarget.setCursor('default');
}
this.eventTarget = '';
this._dragging = false;
}
checkEvent(e) {
var oldEm = new EventModel(this.$zr.curEvent || { event: {} });
var newEm = new EventModel(e);
if ([1, 3].includes(e.which)) {
// 查找之前和当前鼠标选中的实例
var oldDevice = this.$ibp.getDeviceByCode(oldEm.deviceCode) || {};
var newDevice = this.$ibp.getDeviceByCode(newEm.deviceCode) || {};
var oldInstance = (this.$ibp.getDeviceByCode(oldEm.deviceCode) || {}).instance || {};
var newInstance = (this.$ibp.getDeviceByCode(newEm.deviceCode) || {}).instance || {};
contextmenu(e) {
var em = this.checkEvent(e);
this.trigger(this.events.Contextmenu, em);
}
click(e) {
var em = this.checkEvent(e);
this.trigger(this.events.Selected, em);
}
moveEvent(e) {
const newEm = new EventModel(e);
const trainDetails = store.state.map.trainDetails;
if (trainDetails) {
if (newEm.deviceType != deviceType.Train || trainDetails.code != newEm.deviceCode) {
var instance = (this.$ibp.getDeviceByCode(trainDetails.code) || {} ).instance;
instance && instance.removeTrainDetail && instance.removeTrainDetail();
}
}
}
// 如果之前和当前选中的实例不一致
if (oldInstance != newInstance) {
// 如果实例有取消选择函数并且被点击,则执行取消选中函数
if (oldInstance.mouseEvent && oldInstance.mouseEvent.mouseout) {
// 视图数据设置点击标志,同步执行
oldDevice['down'] = false;
oldInstance.mouseEvent['mouseout'](e);
}
checkEvent(e) {
var oldEm = new EventModel(this.$zr.curEvent || { event: {} });
var newEm = new EventModel(e);
if ([1, 3].includes(e.which)) {
// 查找之前和当前鼠标选中的实例
var oldDevice = this.$ibp.getDeviceByCode(oldEm.deviceCode) || {};
var newDevice = this.$ibp.getDeviceByCode(newEm.deviceCode) || {};
var oldInstance = (this.$ibp.getDeviceByCode(oldEm.deviceCode) || {}).instance || {};
var newInstance = (this.$ibp.getDeviceByCode(newEm.deviceCode) || {}).instance || {};
// 如果实例有选中函数并且被点击,则执行选中函数
if (e.which == 3 && newInstance.mouseEvent && newInstance.mouseEvent.mouseover) {
newDevice['down'] = true;
newInstance.mouseEvent['mouseover'](e);
}
}
// 如果之前和当前选中的实例不一致
if (oldInstance != newInstance) {
// 如果实例有取消选择函数并且被点击,则执行取消选中函数
if (oldInstance.mouseEvent && oldInstance.mouseEvent.mouseout) {
// 视图数据设置点击标志,同步执行
oldDevice['down'] = false;
oldInstance.mouseEvent['mouseout'](e);
}
// 保存当前实例到全局
this.$zr.curEvent = e;
}
// 如果实例有选中函数并且被点击,则执行选中函数
if (e.which == 3 && newInstance.mouseEvent && newInstance.mouseEvent.mouseover) {
newDevice['down'] = true;
newInstance.mouseEvent['mouseover'](e);
}
}
// 保存当前实例到全局
this.$zr.curEvent = e;
}
return newEm;
}
return newEm;
}
/** 处理鼠标右键按下事件 */
handleMouseDownRight(e) {
this.rightClickPoint.x = e.offsetX;
this.rightClickPoint.y = e.offsetY;
}
/** 处理鼠标左键按下事件 */
handleMouseDownLeft(e) {
if (this.eventTarget && this.eventTarget._type === deviceType.Background) {
this.eventTarget.setCursor('pointer');
this.$ibp.deleteCheckBox('check_box');
} else if (this.eventTarget && this.eventTarget._type === deviceType.CheckBox) {
this.handleBoundingRect(this.eventTarget);
} else {
this.$ibp.deleteCheckBox('check_box');
}
}
/** 处理滚轮按下事件 */
handleMouseDownWheel(e) {
this.deviceList = [];
Object.values(this.$ibp.ibpDevice).forEach(item => {
if (item.instance._type !== deviceType.Background) {
this.deviceList.push(item.instance);
}
});
}
/** 处理右键拖动事件--- 改变选中区域大小 */
handleMouseMoveRight(point2) {
const point1 = this.rightClickPoint;
const x = Math.min(point1.x, point2.x) + this.$ibp.$options.offsetX;
const y = Math.min(point1.y, point2.y) + this.$ibp.$options.offsetY;
const width = Math.abs(point1.x - point2.x);
const height = Math.abs(point1.y - point2.y);
this.$ibp.renderCheckBox({code: 'check_box', _type: 'CheckBox', point: {x: x, y: y}, width: width, height: height });
}
/** 处理左键拖动事件--- 图形移动 */
handleMouseMoveLeft(e, dx, dy, oldX, oldY) {
if (!this._moveOnMouseMove || !this._dragging || !this.isAllowDragging) {
return;
}
// 选中区域图形移动
if (this.deviceList.length) {
this.deviceList.forEach(item => {
item.grouper.drift(dx, dy, e);
});
} else if (this._dragging && this.eventTarget) { // 选中元素图形移动
if (( this.eventTarget._type === deviceType.Background) || !this.isAllowDragging) {
this._preventDefaultMouseMove && eventTool.stop(e.event);
this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y });
} else if (this.isAllowDragging) {
this.eventTarget.grouper.drift(dx, dy, e);
}
}
}
/** 通过包围盒筛选选中区域的元素 */
handleBoundingRect(eventTarget) {
this.deviceList = [];
let boundingRect = eventTarget.grouper.getBoundingRect();
boundingRect = this.createFakeBoundingRect(eventTarget, boundingRect);
const deviceList = Object.values(this.$ibp.ibpDevice);
const includeDeviceList = [];
deviceList.forEach( item =>{
if (item.instance._type !== deviceType.Background) {
let deviceBoundingRect = item.instance.grouper.getBoundingRect();
deviceBoundingRect = this.createFakeBoundingRect(item.instance, deviceBoundingRect);
if (this.whetherInclude(boundingRect, deviceBoundingRect )) {
includeDeviceList.push(item.instance);
}
}
});
this.deviceList = includeDeviceList;
}
/** 创建假包围盒对象 */
createFakeBoundingRect(instance, boundingRect) {
return {
x1: instance.model.point.x + boundingRect.x,
y1: instance.model.point.y + boundingRect.y,
x2: instance.model.point.x + boundingRect.width,
y2: instance.model.point.y + boundingRect.height
};
}
/** 判断元素包围盒是否在选中区域 */
whetherInclude(boundingRect1, boundingRect2) {
return boundingRect1.x1 <= boundingRect2.x1 && boundingRect1.y1 <= boundingRect2.y1 && boundingRect1.x2 >= boundingRect2.x2 && boundingRect1.y2 >= boundingRect2.y2;
}
}
export default MouseController;

View File

@ -1,100 +1,100 @@
class Options {
constructor(opts, trigger) {
this.scaleIndex = 0;
this.scaleList = [
0.5, 0.6, 0.7, 0.8, 0.9,
1, 1.2, 1.4, 1.6, 1.8,
2, 2.2, 2.4, 2.6, 2.8,
3, 3.2, 3.4, 3.6, 3.8,
4, 4.2, 4.4, 4.6, 4.8,
5, 5.2, 5.4, 5.6, 5.8,
6, 6.2, 6.4, 6.6, 6.8,
7, 7.2, 7.4, 7.6, 7.8,
8, 8.2, 8.4, 8.6, 8.8
];
constructor(opts, trigger) {
this.scaleIndex = 0;
this.scaleList = [
0.5, 0.6, 0.7, 0.8, 0.9,
1, 1.2, 1.4, 1.6, 1.8,
2, 2.2, 2.4, 2.6, 2.8,
3, 3.2, 3.4, 3.6, 3.8,
4, 4.2, 4.4, 4.6, 4.8,
5, 5.2, 5.4, 5.6, 5.8,
6, 6.2, 6.4, 6.6, 6.8,
7, 7.2, 7.4, 7.6, 7.8,
8, 8.2, 8.4, 8.6, 8.8
];
if (Number.isFinite(opts.scaleRate)) {
const idx = this.scaleList.indexOf(opts.scaleRate);
if (idx >= 0) {
this.scaleIndex = idx;
}
}
if (Number.isFinite(opts.scaleRate)) {
const idx = this.scaleList.indexOf(opts.scaleRate);
if (idx >= 0) {
this.scaleIndex = idx;
}
}
this.scaleRate = opts.scaleRate || this.scaleList[this.scaleIndex]; // 缩放比例
this.scaleRate = opts.scaleRate || this.scaleList[this.scaleIndex]; // 缩放比例
this.offsetX = opts.offsetX || 0; // x偏移
this.offsetX = opts.offsetX || 0; // x偏移
this.offsetY = opts.offsetY || 0; // y偏移
this.offsetY = opts.offsetY || 0; // y偏移
this.throttle = opts.throttle || 100; // 刷新频率
this.throttle = opts.throttle || 100; // 刷新频率
this.disabled = false;
this.disabled = false;
this.moveOnMouseMove = true;
this.moveOnMouseMove = true;
this.zoomOnMouseWheel = false;
this.zoomOnMouseWheel = false;
this.preventDefaultMouseMove = true;
this.preventDefaultMouseMove = true;
this.trigger = trigger;
}
this.trigger = trigger;
}
update(payload) {
if (Number.isFinite(payload.dx)) {
this.offsetX -= payload.dx;
}
if (Number.isFinite(payload.dy)) {
this.offsetY -= payload.dy;
}
update(payload) {
if (Number.isFinite(payload.dx)) {
this.offsetX -= payload.dx;
}
if (Number.isFinite(payload.dy)) {
this.offsetY -= payload.dy;
}
if (Number.isFinite(payload.offsetX)) {
this.offsetX = payload.offsetX;
}
if (Number.isFinite(payload.offsetY)) {
this.offsetY = payload.offsetY;
}
if (Number.isFinite(payload.offsetX)) {
this.offsetX = payload.offsetX;
}
if (Number.isFinite(payload.offsetY)) {
this.offsetY = payload.offsetY;
}
if (Number.isFinite(payload.scale)) {
if (Number.isFinite(payload.scale)) {
if ((this.scaleIndex + payload.scale) >= 0 && (this.scaleIndex + payload.scale) < this.scaleList.length) {
this.scaleIndex = this.scaleIndex + payload.scale;
}
}
this.scaleRate = this.scaleList[this.scaleIndex];
}
if (Number.isFinite(payload.scale)) {
if (Number.isFinite(payload.scale)) {
if ((this.scaleIndex + payload.scale) >= 0 && (this.scaleIndex + payload.scale) < this.scaleList.length) {
this.scaleIndex = this.scaleIndex + payload.scale;
}
}
this.scaleRate = this.scaleList[this.scaleIndex];
}
if (Number.isFinite(payload.scaleRate)) {
const idx = this.scaleList.indexOf(payload.scaleRate);
if (idx < 0) {
return;
}
this.scaleIndex = idx;
this.scaleRate = payload.scaleRate;
}
if (Number.isFinite(payload.scaleRate)) {
const idx = this.scaleList.indexOf(payload.scaleRate);
if (idx < 0) {
return;
}
this.scaleIndex = idx;
this.scaleRate = payload.scaleRate;
}
if (payload.disabled === true || payload.disabled === false) {
this.disabled = payload.disabled;
}
if (payload.disabled === true || payload.disabled === false) {
this.disabled = payload.disabled;
}
if (payload.moveOnMouseMove === true || payload.moveOnMouseMove === false) {
this.moveOnMouseMove = payload.moveOnMouseMove;
}
if (payload.moveOnMouseMove === true || payload.moveOnMouseMove === false) {
this.moveOnMouseMove = payload.moveOnMouseMove;
}
if (payload.zoomOnMouseWheel === true || payload.zoomOnMouseWheel === false) {
this.zoomOnMouseWheel = payload.zoomOnMouseWheel;
}
if (payload.zoomOnMouseWheel === true || payload.zoomOnMouseWheel === false) {
this.zoomOnMouseWheel = payload.zoomOnMouseWheel;
}
if (this.trigger instanceof Function) { this.trigger(this); }
}
if (this.trigger instanceof Function) { this.trigger(this); }
}
getScaleRate(scale) {
if (Number.isFinite(scale)) {
if ((this.scaleIndex + scale) >= 0 && (this.scaleIndex + scale) < this.scaleList.length) {
return this.scaleList[this.scaleIndex + scale];
}
}
return this.scaleList[this.scaleIndex];
}
getScaleRate(scale) {
if (Number.isFinite(scale)) {
if ((this.scaleIndex + scale) >= 0 && (this.scaleIndex + scale) < this.scaleList.length) {
return this.scaleList[this.scaleIndex + scale];
}
}
return this.scaleList[this.scaleIndex];
}
}
export default Options;

View File

@ -6,185 +6,185 @@ import shapefactory from './shape/factory';
import TransformHandle from './transformHandle';
class Painter {
constructor(ibp) {
// 父级实例
this.$ibp = ibp;
this.$ibpZr = ibp.getZr();
constructor(ibp) {
// 父级实例
this.$ibp = ibp;
this.$ibpZr = ibp.getZr();
// 图层数据
this.ibpInstanceLevel = {};
// 图层数据
this.ibpInstanceLevel = {};
// 初始图层
this.initLevels();
// 初始图层
this.initLevels();
// 视图控制器
this.$transformHandle = new TransformHandle(this);
}
// 视图控制器
this.$transformHandle = new TransformHandle(this);
}
/**
/**
* 初始绘图实例
* @param {*} dom
* @param {*} config
*/
initLevels() {
initLevels() {
// 添加父级图层
this.parentLevel = new Group({ name: '__parent__' });
this.$ibpZr.add(this.parentLevel);
// 添加父级图层
this.parentLevel = new Group({ name: '__parent__' });
this.$ibpZr.add(this.parentLevel);
// 添加子级图层
zrUtil.each(Object.values(deviceType), (type) => {
const level = new Group({ name: `__${type}__` });
this.ibpInstanceLevel[type] = level;
this.parentLevel.add(level);
});
}
// 添加子级图层
zrUtil.each(Object.values(deviceType), (type) => {
const level = new Group({ name: `__${type}__` });
this.ibpInstanceLevel[type] = level;
this.parentLevel.add(level);
});
}
/**
/**
* 重绘视图
* @param {*} ibpDevice
*/
repaint(ibpDevice) {
// 清空视图
this.clear();
repaint(ibpDevice) {
// 清空视图
this.clear();
// 创建视图
Object.values(ibpDevice).forEach(device => {
this.add(device);
});
}
// 创建视图
Object.values(ibpDevice).forEach(device => {
this.add(device);
});
}
/**
/**
* 添加视图
* @param {*} device
*/
add(device) {
try {
device = Object.assign(device, { event: this.$ibp.$mouseController });
const instance = shapefactory(device, this.$ibp);
if (instance) {
device.instance = instance;
this.$transformHandle.transformView(instance);
this.ibpInstanceLevel[device.model._type].add(instance);
}
} catch (error) {
console.error(error);
}
}
add(device) {
try {
device = Object.assign(device, { event: this.$ibp.$mouseController });
const instance = shapefactory(device, this.$ibp);
if (instance) {
device.instance = instance;
this.$transformHandle.transformView(instance);
this.ibpInstanceLevel[device.model._type].add(instance);
}
} catch (error) {
console.error(error);
}
}
/**
/**
* 删除视图
* @param {*} device
*/
delete(device) {
const instance = device.instance;
if (instance) {
this.ibpInstanceLevel[device.model._type].remove(instance);
}
}
delete(device) {
const instance = device.instance;
if (instance) {
this.ibpInstanceLevel[device.model._type].remove(instance);
}
}
/**
/**
* 更新视图
* @param {*} device
*/
update(device) {
if (device) {
if (device.model._dispose) {
this.delete(device);
} else {
const instance = device.instance;
if (instance) {
instance.setState(device);
}
}
}
}
update(device) {
if (device) {
if (device.model._dispose) {
this.delete(device);
} else {
const instance = device.instance;
if (instance) {
instance.setState(device);
}
}
}
}
/**
/**
* 更新transform变化
* @param {*} opt
*/
updateTransform(opt, canvasSize) {
this.$transformHandle.updateTransform(opt, canvasSize);
}
updateTransform(opt, canvasSize) {
this.$transformHandle.updateTransform(opt, canvasSize);
}
/**
/**
* 更新zrender尺寸
* @param {*} opt
*/
updateZrSize(opt) {
this.$transformHandle.updateZrSize(opt);
}
updateZrSize(opt) {
this.$transformHandle.updateZrSize(opt);
}
/**
/**
* 初始化电子时钟时间
*/
initClockTime(device, initTime) {
device.instance.setClockTime(initTime);
}
/**
initClockTime(device, initTime) {
device.instance.setClockTime(initTime);
}
/**
* 电子时钟开始跑秒或暂停
*/
setClockStart(device, started) {
device.instance.setClockStart(started);
}
/**
setClockStart(device, started) {
device.instance.setClockStart(started);
}
/**
* 设置图层可见
* @param {*} code
*/
setLevelVisible(list) {
zrUtil.each(Object.values(deviceType), type => {
const level = this.ibpInstanceLevel[type];
if (list.includes(type)) {
level.show();
} else {
level.hide();
}
}, this);
}
setLevelVisible(list) {
zrUtil.each(Object.values(deviceType), type => {
const level = this.ibpInstanceLevel[type];
if (list.includes(type)) {
level.show();
} else {
level.hide();
}
}, this);
}
/**
/**
* 刷新图层
*/
refresh() {
this.$ibpZr.refresh();
}
refresh() {
this.$ibpZr.refresh();
}
/**
/**
* 清除图层
*/
clearLevel(type) {
const level = this.ibpInstanceLevel[type];
if (level) {
level.removeAll();
}
}
clearLevel(type) {
const level = this.ibpInstanceLevel[type];
if (level) {
level.removeAll();
}
}
/**
/**
* 清除canvas
*/
clear() {
zrUtil.each(Object.values(this.ibpInstanceLevel), (level) => {
level && level.removeAll();
}, this);
clear() {
zrUtil.each(Object.values(this.ibpInstanceLevel), (level) => {
level && level.removeAll();
}, this);
this.refresh();
}
this.refresh();
}
/**
/**
* 销毁图层
*/
dispose() {
this.ibpInstanceLevel = {};
this.parentLevel = null;
}
dispose() {
this.ibpInstanceLevel = {};
this.parentLevel = null;
}
/**
/**
* 父级图层
*/
getParentLevel() {
return this.parentLevel;
}
getParentLevel() {
return this.parentLevel;
}
}

46
src/ibp/shape/checkBox.js Normal file
View File

@ -0,0 +1,46 @@
import Group from 'zrender/src/container/Group';
import Rect from 'zrender/src/graphic/shape/Rect';
export default class checkBox extends Group {
constructor(device) {
super();
this.model = device.model;
this._type = device.model._type;
this._code = device.model.code;
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this.create();
}
create() {
const model = this.model;
this.grouper = new Group({
id: model.code,
position: [model.point.x, model.point.y]
});
this.box = new Rect({
zlevel: model.zlevel,
z: model.z,
draggable: false,
shape: {
x: 0,
y: 0,
width: this.model.width,
height: this.model.height
},
style: {
fill: 'rgb(135,206,250,0.2)'
}
});
this.grouper.add(this.box);
this.add(this.grouper);
}
setModel(dx, dy) {
this.model.point.x += dx;
this.model.point.y += dy;
}
setSize(width, height) {
this.model.width = width;
this.model.height = height;
}
}

View File

@ -13,6 +13,7 @@ import Key from './key';
import TeleTerminal from './teleTerminal';
import Clock from './clock';
import RotateTip from './rotateTip';
import CheckBox from './checkBox';
const ibpShape = {};
ibpShape[deviceType.Arrow] = Arrow;
@ -29,14 +30,15 @@ ibpShape[deviceType.Key] = Key;
ibpShape[deviceType.TeleTerminal] = TeleTerminal;
ibpShape[deviceType.Clock] = Clock;
ibpShape[deviceType.RotateTip] = RotateTip;
ibpShape[deviceType.CheckBox] = CheckBox;
function shapefactory(device, ibp) {
const type = device.model._type;
const shape = ibpShape[type];
if (shape instanceof Function) {
// eslint-disable-next-line
const type = device.model._type;
const shape = ibpShape[type];
if (shape instanceof Function) {
// eslint-disable-next-line
return new shape(device, ibp.style);
}
}
}
export default shapefactory;

View File

@ -2,43 +2,44 @@ import Group from 'zrender/src/container/Group';
import Line from 'zrender/src/graphic/shape/Line';
export default class ibpLine extends Group {
constructor(device) {
super();
this.model = device.model;
this._type = device.model._type;
this._code = device.model.code;
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this.create();
}
create() {
const model = this.model;
this.grouper=new Group({
id: model.code,
position: [model.point1.x, model.point1.y]
});
this.ibpLine = new Line({
zlevel: model.zlevel,
z: model.z,
draggable: false,
shape: {
x1: 0,
y1: 0,
x2: model.point2.x-model.point1.x,
y2: model.point2.y-model.point1.y
},
style: {
lineWidth: this.model.lineWidth,
stroke: this.model.fillColor
}
});
this.grouper.add(this.ibpLine);
this.add(this.grouper);
}
setModel(dx, dy) {
this.model.point1.x += dx;
this.model.point1.y += dy;
this.model.point2.x += dx;
this.model.point2.y += dy;
}
constructor(device) {
super();
this.model = device.model;
this._type = device.model._type;
this._code = device.model.code;
this.zlevel = device.model.zlevel;
this.model.point = this.model.point1;
this.z = device.model.z;
this.create();
}
create() {
const model = this.model;
this.grouper = new Group({
id: model.code,
position: [model.point1.x, model.point1.y]
});
this.ibpLine = new Line({
zlevel: model.zlevel,
z: model.z,
draggable: false,
shape: {
x1: 0,
y1: 0,
x2: model.point2.x - model.point1.x,
y2: model.point2.y - model.point1.y
},
style: {
lineWidth: this.model.lineWidth,
stroke: this.model.fillColor
}
});
this.grouper.add(this.ibpLine);
this.add(this.grouper);
}
setModel(dx, dy) {
this.model.point1.x += dx;
this.model.point1.y += dy;
this.model.point2.x += dx;
this.model.point2.y += dy;
}
}

View File

@ -2,89 +2,89 @@ import deviceType from './constant/deviceType';
import {createTransform, createBoundingRect} from './utils/parser';
class TransformHandle {
constructor(painter) {
this.$painter = painter;
constructor(painter) {
this.$painter = painter;
this.parentLevel = painter.getParentLevel();
this.parentLevel = painter.getParentLevel();
this.rect = { x: 0, y: 0, width: 0, height: 0 };
this.rect = { x: 0, y: 0, width: 0, height: 0 };
this.transform = createTransform({ scaleRate: 1, offsetX: 0, offsetY: 0 });
}
this.transform = createTransform({ scaleRate: 1, offsetX: 0, offsetY: 0 });
}
checkVisible(view) {
return createBoundingRect(view).intersect(this.rect);
}
checkVisible(view) {
return createBoundingRect(view).intersect(this.rect);
}
revisibleView(view) {
if (this.checkVisible(view)||view._type === deviceType.Background) {
view.show();
} else {
view.hide();
}
revisibleView(view) {
if (this.checkVisible(view) || view._type === deviceType.Background) {
view.show();
} else {
view.hide();
}
view.dirty();
}
view.dirty();
}
// 视图进行缩放/平移
transformView(view) {
if (view) {
view.transform = this.transform;
view.decomposeTransform();
this.revisibleView(view);
view.transform = '';
}
}
// 视图进行缩放/平移
transformView(view) {
if (view) {
view.transform = this.transform;
view.decomposeTransform();
this.revisibleView(view);
view.transform = '';
}
}
// 处理所有视图缩放/平移
transformAll() {
this.traverse(this.transformView, this);
}
// 处理所有视图缩放/平移
transformAll() {
this.traverse(this.transformView, this);
}
// 重新计算显示图形
revisibleAll() {
this.traverse(this.revisibleView, this);
}
// 重新计算显示图形
revisibleAll() {
this.traverse(this.revisibleView, this);
}
// 更新偏移量
updateTransform(opts, canvasSize) {
if (canvasSize) {
const elRect = this.parentLevel.getBoundingRect();
const zrRect = this.rect;
if (canvasSize.x - opts.offsetX > 0) {
opts.offsetX = -elRect.x;
}
// 更新偏移量
updateTransform(opts, canvasSize) {
if (canvasSize) {
const elRect = this.parentLevel.getBoundingRect();
const zrRect = this.rect;
if (canvasSize.x - opts.offsetX > 0) {
opts.offsetX = -elRect.x;
}
if (canvasSize.y - opts.offsetY > 0) {
opts.offsetY = -elRect.y;
}
if (canvasSize.y - opts.offsetY > 0) {
opts.offsetY = -elRect.y;
}
if (elRect.x + canvasSize.width < zrRect.width) {
opts.offsetX -= zrRect.width - (elRect.x + canvasSize.width);
}
if (elRect.x + canvasSize.width < zrRect.width) {
opts.offsetX -= zrRect.width - (elRect.x + canvasSize.width);
}
if (elRect.y + canvasSize.height < zrRect.height) {
opts.offsetY -= zrRect.height - (elRect.y + canvasSize.height);
}
}
this.transform = createTransform(opts);
this.transformAll();
}
if (elRect.y + canvasSize.height < zrRect.height) {
opts.offsetY -= zrRect.height - (elRect.y + canvasSize.height);
}
}
this.transform = createTransform(opts);
this.transformAll();
}
// 更新画布尺寸
updateZrSize(opts) {
this.rect = { x: 0, y: 0, width: opts.width, height: opts.height };
this.revisibleAll();
}
// 更新画布尺寸
updateZrSize(opts) {
this.rect = { x: 0, y: 0, width: opts.width, height: opts.height };
this.revisibleAll();
}
// 遍历group执行回调
traverse(cb, context) {
this.parentLevel.eachChild(level => {
level.eachChild((view) => {
cb.call(context, view);
}, context);
}, context);
}
// 遍历group执行回调
traverse(cb, context) {
this.parentLevel.eachChild(level => {
level.eachChild((view) => {
cb.call(context, view);
}, context);
}, context);
}
}
export default TransformHandle;

File diff suppressed because it is too large Load Diff

View File

@ -260,6 +260,14 @@ class SkinCode extends defaultStyle {
},
arrow: {
show: true // 控制模式箭头显隐
},
mouseOverStyle: { // 鼠标悬浮样式
fontSize: 10,
fontFormat: 'consolas',
fontColor: '#FFF000',
fontWeight: 'normal',
textAlign: 'middle',
textVerticalAlign: 'top'
}
};
@ -309,8 +317,8 @@ class SkinCode extends defaultStyle {
contentRectShow: false // 道岔封锁显示
},
monolock: { // 道岔单锁配置
locationColor: '#870E10', // 道岔单锁定位颜色 (红色)
inversionColor: '#870E10', // 道岔单锁反位颜色 (红色)
locationColor: '#ea282c', // 道岔单锁定位颜色 (红色)
inversionColor: '#ea282c', // 道岔单锁反位颜色 (红色)
rectShow: false // 道岔单锁 矩形框是否显示
}
};
@ -319,11 +327,71 @@ class SkinCode extends defaultStyle {
lineColor: '#FFFFFF' // 线条颜色
};
this[deviceType.LcControl] = {};
this[deviceType.LcControl] = {
text: {
fontSize: 10, // 灯字体大小
fontWeight: 'normal', // 字体粗细
distance: 5 // 灯跟文字距离
},
lamp: {
radiusR: 6, // 灯大小
controlColor: '#FFFF00' // 灯颜色
},
mouseOverStyle: {
fontSize: 10,
fontFormat: 'consolas',
fontColor: '#FFF000',
fontWeight: 'normal',
textAlign: 'middle',
textVerticalAlign: 'top',
arcColor: '#00FFFF',
textColor: '#000000'
}
};
this[deviceType.ZcControl] = {};
this[deviceType.ZcControl] = {
text: {
fontSize: 10, // 字体大小
fontWeight: 'normal', // 字体粗细
distance: 5 // 灯跟文字距离
},
lamp: {
radiusR: 6, // 灯大小
controlColor: '#00FF00' // 灯颜色
},
mouseOverStyle: {
fontSize: 10,
fontFormat: 'consolas',
fontColor: '#FFF000',
fontWeight: 'normal',
textAlign: 'middle',
textVerticalAlign: 'top',
arcColor: '#00FFFF',
textColor: '#000000'
}
};
this[deviceType.LimitControl] = {};
this[deviceType.LimitControl] = {
text: {
fontSize: 10, // 字体大小
fontWeight: 'normal', // 字体粗细
distance: 5 // 灯跟文字距离
},
lamp: {
radiusR: 6, // 灯大小
controlColor: '#ECE9D8' // 灯颜色
},
mouseOverStyle: {
fontSize: 10,
fontFormat: 'consolas',
fontColor: '#FFF000',
fontWeight: 'normal',
textAlign: 'middle',
textVerticalAlign: 'top',
textColor: '#000000',
arcColor: '#00FFFF'
}
};
this[deviceType.TrainWindow] = {
lineColor: '#4DD43F', // 车次窗颜色

View File

@ -4,127 +4,127 @@ const deviceRender = {};
/** link渲染配置*/
deviceRender[deviceType.Link] = {
_type: deviceType.Link,
zlevel: 1
// progressive: 1
_type: deviceType.Link,
zlevel: 1
// progressive: 1
};
/** Section渲染配置*/
deviceRender[deviceType.Section] = {
_type: deviceType.Section,
zlevel: 1
// progressive: 2
_type: deviceType.Section,
zlevel: 1
// progressive: 2
};
/** Signal渲染配置*/
deviceRender[deviceType.Signal] = {
_type: deviceType.Signal,
zlevel: 1
// progressive: 3
_type: deviceType.Signal,
zlevel: 1
// progressive: 3
};
/** Switch渲染配置*/
deviceRender[deviceType.Switch] = {
_type: deviceType.Switch,
zlevel: 1
// progressive: 5
_type: deviceType.Switch,
zlevel: 1
// progressive: 5
};
/** Station渲染配置*/
deviceRender[deviceType.Station] = {
_type: deviceType.Station,
zlevel: 1
// progressive: 4
_type: deviceType.Station,
zlevel: 1
// progressive: 4
};
/** StationStand渲染配置*/
deviceRender[deviceType.StationStand] = {
_type: deviceType.StationStand,
zlevel: 1
// progressive: 5
_type: deviceType.StationStand,
zlevel: 1
// progressive: 5
};
/** StationControl渲染配置*/
deviceRender[deviceType.StationControl] = {
_type: deviceType.StationControl,
zlevel: 1
// progressive: 4
_type: deviceType.StationControl,
zlevel: 1
// progressive: 4
};
/** ImageControl渲染配置*/
deviceRender[deviceType.ImageControl] = {
_type: deviceType.ImageControl,
zlevel: 1
// progressive: 5
_type: deviceType.ImageControl,
zlevel: 1
// progressive: 5
};
/** ZcControl渲染配置*/
deviceRender[deviceType.ZcControl] = {
_type: deviceType.ZcControl,
zlevel: 1
// progressive: 6
_type: deviceType.ZcControl,
zlevel: 1
// progressive: 6
};
/** LcControl渲染配置*/
deviceRender[deviceType.LcControl] = {
_type: deviceType.LcControl,
zlevel: 1
// progressive: 6
_type: deviceType.LcControl,
zlevel: 1
// progressive: 6
};
/** LimitControl渲染配置*/
deviceRender[deviceType.LimitControl] = {
_type: deviceType.LimitControl,
zlevel: 1
// progressive: 5
_type: deviceType.LimitControl,
zlevel: 1
// progressive: 5
};
/** StationDelayUnlock渲染配置*/
deviceRender[deviceType.StationDelayUnlock] = {
_type: deviceType.StationDelayUnlock,
zlevel: 1
// progressive: 6
_type: deviceType.StationDelayUnlock,
zlevel: 1
// progressive: 6
};
/** Train渲染配置*/
deviceRender[deviceType.Train] = {
_type: deviceType.Train,
zlevel: 1
// progressive: 9
_type: deviceType.Train,
zlevel: 1
// progressive: 9
};
/** TrainWindow渲染配置*/
deviceRender[deviceType.TrainWindow] = {
_type: deviceType.TrainWindow,
zlevel: 1
// progressive: 8
_type: deviceType.TrainWindow,
zlevel: 1
// progressive: 8
};
/** Line渲染配置*/
deviceRender[deviceType.Line] = {
_type: deviceType.Line,
zlevel: 1
// progressive: 7
_type: deviceType.Line,
zlevel: 1
// progressive: 7
};
/** Text渲染配置*/
deviceRender[deviceType.Text] = {
_type: deviceType.Text,
zlevel: 1
// progressive: 7
_type: deviceType.Text,
zlevel: 1
// progressive: 7
};
/** TrainWindow渲染配置*/
deviceRender[deviceType.TrainWindow] = {
_type: deviceType.TrainWindow,
zlevel: 1
// progressive: 4
_type: deviceType.TrainWindow,
zlevel: 1
// progressive: 4
};
/** Train渲染配置*/
deviceRender[deviceType.TRain] = {
_type: deviceType.TRain,
zlevel: 1
// progressive: 4
_type: deviceType.TRain,
zlevel: 1
// progressive: 4
};
export default deviceRender;

View File

@ -1,22 +1,22 @@
const deviceType = {
Link: 'Link',
Section: 'Section',
Switch: 'Switch',
Signal: 'Signal',
ZcControl: 'ZcControl',
LcControl: 'LcControl',
LimitControl: 'LimitControl',
ImageControl: 'ImageControl',
Station: 'Station',
StationStand: 'StationStand',
StationControl: 'StationControl',
StationCounter: 'StationCounter',
ButtonControl: 'ButtonControl',
StationDelayUnlock: 'StationDelayUnlock',
Train: 'Train',
TrainWindow: 'TrainWindow',
Line: 'Line',
Text: 'Text'
Link: 'Link',
Section: 'Section',
Switch: 'Switch',
Signal: 'Signal',
ZcControl: 'ZcControl',
LcControl: 'LcControl',
LimitControl: 'LimitControl',
ImageControl: 'ImageControl',
Station: 'Station',
StationStand: 'StationStand',
StationControl: 'StationControl',
StationCounter: 'StationCounter',
ButtonControl: 'ButtonControl',
StationDelayUnlock: 'StationDelayUnlock',
Train: 'Train',
TrainWindow: 'TrainWindow',
Line: 'Line',
Text: 'Text'
};
export default deviceType;

View File

@ -27,6 +27,10 @@ class KeyboardController extends Eventful {
window.removeEventListener('keydown', keydownHandle, false);
window.removeEventListener('keyup', keyupHandle, false);
};
this.dispose = function() {
this.disable();
};
}
}

View File

@ -20,7 +20,7 @@ class Jlmap {
this.methods = opts.methods;
// 鼠标事件
this.events = { __Pan: 'pan', __Zoom: 'zoom', Selected: 'selected', Contextmenu: 'contextmenu', DataZoom: 'dataZoom', Keyboard: 'Keyboard'};
this.events = { __Pan: 'pan', __Zoom: 'zoom', Selected: 'selected', Contextmenu: 'contextmenu', DataZoom: 'dataZoom', Keyboard: 'keyboard'};
// 皮肤参数
this.skinCode = '';
@ -328,6 +328,7 @@ class Jlmap {
this.clear();
this.$mouseController.dispose();
this.$keyboardController.dispose();
this.$zr && zrender.dispose(this.$zr);
this.$painter.dispose();
}

View File

@ -1,100 +1,100 @@
class Options {
constructor(opts, trigger) {
this.scaleIndex = 0;
this.scaleList = [
0.5, 0.6, 0.7, 0.8, 0.9,
1, 1.2, 1.4, 1.6, 1.8,
2, 2.2, 2.4, 2.6, 2.8,
3, 3.2, 3.4, 3.6, 3.8,
4, 4.2, 4.4, 4.6, 4.8,
5, 5.2, 5.4, 5.6, 5.8,
6, 6.2, 6.4, 6.6, 6.8,
7, 7.2, 7.4, 7.6, 7.8,
8, 8.2, 8.4, 8.6, 8.8
];
constructor(opts, trigger) {
this.scaleIndex = 0;
this.scaleList = [
0.8, 0.9,
1, 1.2, 1.4, 1.6, 1.8,
2, 2.2, 2.4, 2.6, 2.8,
3, 3.2, 3.4, 3.6, 3.8,
4, 4.2, 4.4, 4.6, 4.8,
5, 5.2, 5.4, 5.6, 5.8,
6, 6.2, 6.4, 6.6, 6.8,
7, 7.2, 7.4, 7.6, 7.8,
8
];
if (Number.isFinite(opts.scaleRate)) {
const idx = this.scaleList.indexOf(opts.scaleRate);
if (idx >= 0) {
this.scaleIndex = idx;
}
}
if (Number.isFinite(opts.scaleRate)) {
const idx = this.scaleList.indexOf(opts.scaleRate);
if (idx >= 0) {
this.scaleIndex = idx;
}
}
this.scaleRate = opts.scaleRate || this.scaleList[this.scaleIndex]; // 缩放比例
this.scaleRate = opts.scaleRate || this.scaleList[this.scaleIndex]; // 缩放比例
this.offsetX = opts.offsetX || 0; // x偏移
this.offsetX = opts.offsetX || 0; // x偏移
this.offsetY = opts.offsetY || 0; // y偏移
this.offsetY = opts.offsetY || 0; // y偏移
this.throttle = opts.throttle || 100; // 刷新频率
this.throttle = opts.throttle || 100; // 刷新频率
this.disabled = false;
this.disabled = false;
this.moveOnMouseMove = true;
this.moveOnMouseMove = true;
this.zoomOnMouseWheel = false;
this.zoomOnMouseWheel = false;
this.preventDefaultMouseMove = true;
this.preventDefaultMouseMove = true;
this.trigger = trigger;
}
this.trigger = trigger;
}
update(payload) {
if (Number.isFinite(payload.dx)) {
this.offsetX -= payload.dx;
}
if (Number.isFinite(payload.dy)) {
this.offsetY -= payload.dy;
}
update(payload) {
if (Number.isFinite(payload.dx)) {
this.offsetX -= payload.dx;
}
if (Number.isFinite(payload.dy)) {
this.offsetY -= payload.dy;
}
if (Number.isFinite(payload.offsetX)) {
this.offsetX = payload.offsetX;
}
if (Number.isFinite(payload.offsetY)) {
this.offsetY = payload.offsetY;
}
if (Number.isFinite(payload.offsetX)) {
this.offsetX = payload.offsetX;
}
if (Number.isFinite(payload.offsetY)) {
this.offsetY = payload.offsetY;
}
if (Number.isFinite(payload.scale)) {
if (Number.isFinite(payload.scale)) {
if ((this.scaleIndex + payload.scale) >= 0 && (this.scaleIndex + payload.scale) < this.scaleList.length) {
this.scaleIndex = this.scaleIndex + payload.scale;
}
}
this.scaleRate = this.scaleList[this.scaleIndex];
}
if (Number.isFinite(payload.scale)) {
if (Number.isFinite(payload.scale)) {
if ((this.scaleIndex + payload.scale) >= 0 && (this.scaleIndex + payload.scale) < this.scaleList.length) {
this.scaleIndex = this.scaleIndex + payload.scale;
}
}
this.scaleRate = this.scaleList[this.scaleIndex];
}
if (Number.isFinite(payload.scaleRate)) {
const idx = this.scaleList.indexOf(payload.scaleRate);
if (idx < 0) {
return;
}
this.scaleIndex = idx;
this.scaleRate = payload.scaleRate;
}
if (Number.isFinite(payload.scaleRate)) {
const idx = this.scaleList.indexOf(payload.scaleRate);
if (idx < 0) {
return;
}
this.scaleIndex = idx;
this.scaleRate = payload.scaleRate;
}
if (payload.disabled === true || payload.disabled === false) {
this.disabled = payload.disabled;
}
if (payload.disabled === true || payload.disabled === false) {
this.disabled = payload.disabled;
}
if (payload.moveOnMouseMove === true || payload.moveOnMouseMove === false) {
this.moveOnMouseMove = payload.moveOnMouseMove;
}
if (payload.moveOnMouseMove === true || payload.moveOnMouseMove === false) {
this.moveOnMouseMove = payload.moveOnMouseMove;
}
if (payload.zoomOnMouseWheel === true || payload.zoomOnMouseWheel === false) {
this.zoomOnMouseWheel = payload.zoomOnMouseWheel;
}
if (payload.zoomOnMouseWheel === true || payload.zoomOnMouseWheel === false) {
this.zoomOnMouseWheel = payload.zoomOnMouseWheel;
}
if (this.trigger instanceof Function) { this.trigger(this); }
}
if (this.trigger instanceof Function) { this.trigger(this); }
}
getScaleRate(scale) {
if (Number.isFinite(scale)) {
if ((this.scaleIndex + scale) >= 0 && (this.scaleIndex + scale) < this.scaleList.length) {
return this.scaleList[this.scaleIndex + scale];
}
}
return this.scaleList[this.scaleIndex];
}
getScaleRate(scale) {
if (Number.isFinite(scale)) {
if ((this.scaleIndex + scale) >= 0 && (this.scaleIndex + scale) < this.scaleList.length) {
return this.scaleList[this.scaleIndex + scale];
}
}
return this.scaleList[this.scaleIndex];
}
}
export default Options;

View File

@ -6,265 +6,265 @@ import shapefactory from './shape/factory';
import TransformHandle from './transformHandle';
class Painter {
constructor(jmap) {
// 父级实例
this.$jmap = jmap;
this.$zr = jmap.getZr();
constructor(jmap) {
// 父级实例
this.$jmap = jmap;
this.$zr = jmap.getZr();
// 图层数据
this.mapInstanceLevel = {};
// 图层数据
this.mapInstanceLevel = {};
// 初始图层
this.initLevels();
// 初始图层
this.initLevels();
// 视图控制器
this.$transformHandle = new TransformHandle(this);
}
// 视图控制器
this.$transformHandle = new TransformHandle(this);
}
/**
/**
* 初始绘图实例
* @param {*} dom
* @param {*} config
*/
initLevels() {
// 图层分级策略
this.layerBranch = {};
this.layerBranch['01'] = (type) => { return type == deviceType.Link; }; // 逻辑图层级
this.layerBranch['02'] = (type) => { return type != deviceType.Link; }; // 物理图层级
this.layerBranch['03'] = (type) => { return true; }; // 混合图层级
initLevels() {
// 图层分级策略
this.layerBranch = {};
this.layerBranch['01'] = (type) => { return type == deviceType.Link; }; // 逻辑图层级
this.layerBranch['02'] = (type) => { return type != deviceType.Link; }; // 物理图层级
this.layerBranch['03'] = (type) => { return true; }; // 混合图层级
// 添加父级图层
this.parentLevel = new Group({ name: '__parent__' });
this.$zr.add(this.parentLevel);
// 添加父级图层
this.parentLevel = new Group({ name: '__parent__' });
this.$zr.add(this.parentLevel);
// 添加子级图层
zrUtil.each(Object.values(deviceType), (type) => {
const level = new Group({ name: `__${type}__` });
this.mapInstanceLevel[type] = level;
this.parentLevel.add(level);
});
// 添加子级图层
zrUtil.each(Object.values(deviceType), (type) => {
const level = new Group({ name: `__${type}__` });
this.mapInstanceLevel[type] = level;
this.parentLevel.add(level);
});
// 设置默认显示图级
this.setLayerVisible('02');
}
// 设置默认显示图级
this.setLayerVisible('02');
}
/**
/**
* 重绘视图
* @param {*} mapDevice
*/
repaint(mapDevice) {
// 清空视图
this.clear();
repaint(mapDevice) {
// 清空视图
this.clear();
// 创建视图
Object.values(mapDevice).forEach(device => {
this.add(device);
});
}
// 创建视图
Object.values(mapDevice).forEach(device => {
this.add(device);
});
}
/**
/**
* 添加视图
* @param {*} device
*/
add(device) {
try {
const instance = shapefactory(device, this.$jmap);
if (instance) {
device.instance = instance;
this.$transformHandle.transformView(instance);
this.mapInstanceLevel[device._type].add(instance);
}
} catch (err) {
console.error(err);
}
}
add(device) {
try {
const instance = shapefactory(device, this.$jmap);
if (instance) {
device.instance = instance;
this.$transformHandle.transformView(instance);
this.mapInstanceLevel[device._type].add(instance);
}
} catch (err) {
console.error(err);
}
}
/**
/**
* 删除视图
* @param {*} device
*/
delete(device) {
const instance = device.instance;
if (instance) {
this.mapInstanceLevel[device._type].remove(instance);
}
}
delete(device) {
const instance = device.instance;
if (instance) {
this.mapInstanceLevel[device._type].remove(instance);
}
}
checkIntersect(device) {
var intersect = false;
var befor = device.instance;
var train = shapefactory(device, this.$jmap);
checkIntersect(device) {
var intersect = false;
var befor = device.instance;
var train = shapefactory(device, this.$jmap);
this.mapInstanceLevel[deviceType.Train].eachChild(elem => {
if (elem !== befor && elem.getBoundingRect().intersect(train.getBoundingRect())) {
intersect = true;
return;
}
});
this.mapInstanceLevel[deviceType.Train].eachChild(elem => {
if (elem !== befor && elem.getBoundingRect().intersect(train.getBoundingRect())) {
intersect = true;
return;
}
});
return intersect;
}
return intersect;
}
/**
/**
* 更新列车
* @param {*} device
*/
updateTrain(device) {
var oldTrainWindowModel = null;
var instance = device.instance;
var curModel = device;
updateTrain(device) {
var oldTrainWindowModel = null;
var instance = device.instance;
var curModel = device;
if (instance) {
oldTrainWindowModel = device.trainWindowModel;
}
if (instance) {
oldTrainWindowModel = device.trainWindowModel;
}
if (curModel.sectionCode) {
curModel.sectionModel = this.$jmap.getDeviceByCode(curModel.sectionCode);
}
if (curModel.sectionCode) {
curModel.sectionModel = this.$jmap.getDeviceByCode(curModel.sectionCode);
}
if (curModel.trainWindowCode) {
curModel.trainWindowModel = this.$jmap.getDeviceByCode(curModel.trainWindowCode);
}
if (curModel.trainWindowCode) {
curModel.trainWindowModel = this.$jmap.getDeviceByCode(curModel.trainWindowCode);
}
if (instance && oldTrainWindowModel && this.checkIntersect(device)) {
device.trainWindowModel = oldTrainWindowModel;
}
if (instance && oldTrainWindowModel && this.checkIntersect(device)) {
device.trainWindowModel = oldTrainWindowModel;
}
instance && this.mapInstanceLevel[deviceType.Train].remove(instance);
this.add(device);
}
instance && this.mapInstanceLevel[deviceType.Train].remove(instance);
this.add(device);
}
/**
/**
* 更新视图
* @param {*} device
*/
update(device) {
if (device) {
try {
if (device._dispose) {
this.delete(device);
} else if (deviceType.Train == device._type) {
this.updateTrain(device);
} else {
const instance = device.instance;
if (instance) {
instance.setState(device);
}
}
} catch (err) {
console.error(err);
}
}
}
update(device) {
if (device) {
try {
if (device._dispose) {
this.delete(device);
} else if (deviceType.Train == device._type) {
this.updateTrain(device);
} else {
const instance = device.instance;
if (instance) {
instance.setState(device);
}
}
} catch (err) {
console.error(err);
}
}
}
/**
/**
* 更新transform变化
* @param {*} opt
*/
updateTransform(opt) {
this.$transformHandle.updateTransform(opt);
}
updateTransform(opt) {
this.$transformHandle.updateTransform(opt);
}
/**
/**
* 更新zrender尺寸
* @param {*} opt
*/
updateZrSize(opt) {
this.$transformHandle.updateZrSize(opt);
}
updateZrSize(opt) {
this.$transformHandle.updateZrSize(opt);
}
/**
/**
* 过去坐标提示位置
* @param {*} opts
*/
getShapeTipPoint(instance, opts) {
if (instance) {
var point = instance.getShapeTipPoint(opts);
if (point) {
// 矩阵变换
var transform = this.$transformHandle.transform;
var transPoint = vector.applyTransform([], [point.x, point.y], transform);
return {
x: transPoint[0],
y: transPoint[1]
};
}
getShapeTipPoint(instance, opts) {
if (instance) {
var point = instance.getShapeTipPoint(opts);
if (point) {
// 矩阵变换
var transform = this.$transformHandle.transform;
var transPoint = vector.applyTransform([], [point.x, point.y], transform);
return {
x: transPoint[0],
y: transPoint[1]
};
}
}
}
}
}
/**
/**
* 设置逻辑和物理图层
* @param {*} layer
*/
setLayerVisible(layer) {
zrUtil.each(Object.values(deviceType), type => {
const level = this.mapInstanceLevel[type];
if (this.layerBranch[layer](type)) {
level.show();
} else {
level.hide();
}
}, this);
}
setLayerVisible(layer) {
zrUtil.each(Object.values(deviceType), type => {
const level = this.mapInstanceLevel[type];
if (this.layerBranch[layer](type)) {
level.show();
} else {
level.hide();
}
}, this);
}
/**
/**
* 设置图层可见
* @param {*} code
*/
setLevelVisible(list) {
zrUtil.each(Object.values(deviceType), type => {
const level = this.mapInstanceLevel[type];
if (list.includes(type)) {
level.show();
} else {
level.hide();
}
}, this);
}
setLevelVisible(list) {
zrUtil.each(Object.values(deviceType), type => {
const level = this.mapInstanceLevel[type];
if (list.includes(type)) {
level.show();
} else {
level.hide();
}
}, this);
}
/**
/**
* 刷新图层
*/
refresh() {
this.$zr.refresh();
}
refresh() {
this.$zr.refresh();
}
/**
/**
* 清除图层
*/
clearLevel(type) {
const level = this.mapInstanceLevel[type];
if (level) {
level.removeAll();
}
}
clearLevel(type) {
const level = this.mapInstanceLevel[type];
if (level) {
level.removeAll();
}
}
/**
/**
* 清除canvas
*/
clear() {
zrUtil.each(Object.values(this.mapInstanceLevel), (level) => {
level && level.removeAll();
}, this);
clear() {
zrUtil.each(Object.values(this.mapInstanceLevel), (level) => {
level && level.removeAll();
}, this);
this.refresh();
}
this.refresh();
}
/**
/**
* 销毁图层
*/
dispose() {
this.mapInstanceLevel = {};
this.parentLevel = null;
}
dispose() {
this.mapInstanceLevel = {};
this.parentLevel = null;
}
/**
/**
* 父级图层
*/
getParentLevel() {
return this.parentLevel;
}
getParentLevel() {
return this.parentLevel;
}
}

View File

@ -5,65 +5,65 @@ import Group from 'zrender/src/container/Group';
import Image from 'zrender/src/graphic/Image';
export default class ImageControl extends Group {
constructor(model, style) {
super();
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
this.model = model;
this.style = style;
this.z = model.zIndex || 1;
this.create();
}
constructor(model, style) {
super();
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
this.model = model;
this.style = style;
this.z = model.zIndex || 1;
this.create();
}
create() {
const model = this.model;
this.image = new Image({
zlevel: this.zlevel,
z: this.z,
origin: {
x: model.position.x,
y: model.position.y
},
rotation: -Math.PI / 180 * model.rotate,
style: {
image: model.url,
x: model.position.x,
y: model.position.y,
width: model.width,
height: model.height
}
});
this.add(this.image);
// 旋转
if (model.rotate) {
this.transformRotation(this.image);
}
}
create() {
const model = this.model;
this.image = new Image({
zlevel: this.zlevel,
z: this.z,
origin: {
x: model.position.x,
y: model.position.y
},
rotation: -Math.PI / 180 * model.rotate,
style: {
image: model.url,
x: model.position.x,
y: model.position.y,
width: model.width,
height: model.height
}
});
this.add(this.image);
// 旋转
if (model.rotate) {
this.transformRotation(this.image);
}
}
setState(model) {
}
setState(model) {
}
// 整体图片
transformRotation(item) {
if (this.model.rotate) {
const origin = [this.model.position.x, this.model.position.y];
const rotation = -Math.PI / 180 * Number(this.model.rotate);
item.origin = origin;
item.rotation = rotation;
item.dirty();
}
}
// 整体图片
transformRotation(item) {
if (this.model.rotate) {
const origin = [this.model.position.x, this.model.position.y];
const rotation = -Math.PI / 180 * Number(this.model.rotate);
item.origin = origin;
item.rotation = rotation;
item.dirty();
}
}
getShapeTipPoint() {
if (this.image) {
var distance = 2;
var rect = this.image.getBoundingRect();
return {
x: rect.x + rect.width / 2,
y: rect.y - distance
};
}
return null;
}
getShapeTipPoint() {
if (this.image) {
var distance = 2;
var rect = this.image.getBoundingRect();
return {
x: rect.x + rect.width / 2,
y: rect.y - distance
};
}
return null;
}
}

View File

@ -4,36 +4,36 @@ import Rect from 'zrender/src/graphic/shape/Rect';
// import store from '@/store';
class EMouse extends Group {
constructor(device) {
super();
this.device = device;
this.create();
}
create() {
if (this.device.link) {
const rect = this.device.link.getBoundingRect();
this.lineBorder = new Rect({
zlevel: this.device.zlevel,
z: this.device.z - 1,
shape: rect,
style: {
lineDash: [3, 3],
stroke: '#fff',
fill: this.device.style.transparentColor
}
});
constructor(device) {
super();
this.device = device;
this.create();
}
create() {
if (this.device.link) {
const rect = this.device.link.getBoundingRect();
this.lineBorder = new Rect({
zlevel: this.device.zlevel,
z: this.device.z - 1,
shape: rect,
style: {
lineDash: [3, 3],
stroke: '#fff',
fill: this.device.style.transparentColor
}
});
this.add(this.lineBorder);
this.lineBorder.hide();
}
}
this.add(this.lineBorder);
this.lineBorder.hide();
}
}
mouseover(e) {
this.lineBorder && this.lineBorder.show();
}
mouseover(e) {
this.lineBorder && this.lineBorder.show();
}
mouseout(e) {
this.lineBorder && this.lineBorder.hide();
}
mouseout(e) {
this.lineBorder && this.lineBorder.hide();
}
}
export default EMouse;

View File

@ -3,62 +3,62 @@ import Group from 'zrender/src/container/Group';
import EMouse from './EMouse';
class Link extends Group {
constructor(model, style) {
super();
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
this.model = model;
this.style = style;
this.create();
}
constructor(model, style) {
super();
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
this.model = model;
this.style = style;
this.create();
}
create() {
const model = this.model;
const style = this.style;
create() {
const model = this.model;
const style = this.style;
let textPosition = 'insideBottom';
if (model.lp.x !== model.rp.x && model.lp.y !== model.rp.y) {
textPosition = model.lp.y > model.rp.y ? 'insideLeft' : 'insideRight';
}
// 标准link
this.link = new Line({
zlevel: this.zlevel,
z: 0,
shape: {
x1: model.lp.x,
y1: model.lp.y,
x2: model.rp.x,
y2: model.rp.y
},
style: {
lineWidth: style.Link.linkWidth,
stroke: style.Link.linkColor,
text: model.name,
textDistance: style.Link.linkWidth * 2,
textPosition: textPosition, // 'inside',
textAlign: 'middle',
fontSize: style.Link.textFontSize,
textFill: style.Link.linkTextColor,
textStroke: style.Link.backgroundColor
}
});
this.add(this.link);
const path = window.location.href;
if (path.includes('/map/draw')) {
// 鼠标事件
this.mouseEvent = new EMouse(this);
this.add(this.mouseEvent);
this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); });
this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); });
}
}
let textPosition = 'insideBottom';
if (model.lp.x !== model.rp.x && model.lp.y !== model.rp.y) {
textPosition = model.lp.y > model.rp.y ? 'insideLeft' : 'insideRight';
}
// 标准link
this.link = new Line({
zlevel: this.zlevel,
z: 0,
shape: {
x1: model.lp.x,
y1: model.lp.y,
x2: model.rp.x,
y2: model.rp.y
},
style: {
lineWidth: style.Link.linkWidth,
stroke: style.Link.linkColor,
text: model.name,
textDistance: style.Link.linkWidth * 2,
textPosition: textPosition, // 'inside',
textAlign: 'middle',
fontSize: style.Link.textFontSize,
textFill: style.Link.linkTextColor,
textStroke: style.Link.backgroundColor
}
});
this.add(this.link);
const path = window.location.href;
if (path.includes('/map/draw')) {
// 鼠标事件
this.mouseEvent = new EMouse(this);
this.add(this.mouseEvent);
this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); });
this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); });
}
}
setState(model) {
}
setState(model) {
}
tipBasePoint() {
}
tipBasePoint() {
}
}
export default Link;

View File

@ -4,95 +4,95 @@ import Text from 'zrender/src/graphic/Text';
import Rect from 'zrender/src/graphic/shape/Rect';
class ESwName extends Group {
constructor(model) {
super();
this.model = model;
this.create();
}
constructor(model) {
super();
this.model = model;
this.create();
}
create() {
const model = this.model;
const style = this.model.style;
create() {
const model = this.model;
const style = this.model.style;
this.nameText = new Text({
zlevel: model.zlevel,
z: model.z + 6,
style: {
x: model.nameTextX,
y: model.nameTextY,
fontWeight: style.Switch.text.fontWeight,
fontSize: style.Switch.text.fontSize,
fontFamily: style.fontFamily,
text: model.name,
textAlign: model.triangle.drictx === 1 ? 'left' : 'right',
textVerticalAlign: 'middle',
textFill: style.Switch.text.fontColor
}
});
this.nameText = new Text({
zlevel: model.zlevel,
z: model.z + 6,
style: {
x: model.nameTextX,
y: model.nameTextY,
fontWeight: style.Switch.text.fontWeight,
fontSize: style.Switch.text.fontSize,
fontFamily: style.fontFamily,
text: model.name,
textAlign: model.triangle.drictx === 1 ? 'left' : 'right',
textVerticalAlign: 'middle',
textFill: style.Switch.text.fontColor
}
});
const rect = this.nameText.getBoundingRect();
let textWidth = rect.width * 0.8;
if (model.triangle.drictx !== 1) {
rect.x += rect.width;
textWidth = -textWidth;
}
const rect = this.nameText.getBoundingRect();
let textWidth = rect.width * 0.8;
if (model.triangle.drictx !== 1) {
rect.x += rect.width;
textWidth = -textWidth;
}
this.textRect = new Rect({
zlevel: model.zlevel,
z: model.z + 10,
silent: true,
shape: {
x: rect.x,
y: rect.y,
width: textWidth,
height: rect.height
},
style: {
lineWidth: 0,
// lineDash: [3, 3],
stroke: style.Switch.text.borderColor,
fill: style.transparentColor
}
});
this.textRect = new Rect({
zlevel: model.zlevel,
z: model.z + 10,
silent: true,
shape: {
x: rect.x,
y: rect.y,
width: textWidth,
height: rect.height
},
style: {
lineWidth: 0,
// lineDash: [3, 3],
stroke: style.Switch.text.borderColor,
fill: style.transparentColor
}
});
const data=LangStorage.getLang() == 'en'?'Turnout section':'道岔区段名称';
const data = LangStorage.getLang() == 'en' ? 'Turnout section' : '道岔区段名称';
this.arrowText = new Text({
zlevel: model.zlevel,
z: model.z + 20,
style: {
x: model.arrowTextX,
y: model.arrowTextY,
fontSize: style.arrowFontSize,
fontWeight: style.Switch.text.fontWeight,
fontFamily: style.fontFamily,
text: `${data}: ${model.sectionName}`,
textFill: '#000',
textAlign: 'left',
textPadding: 3,
textBackgroundColor: style.tipBackgroundColor
}
});
this.arrowText = new Text({
zlevel: model.zlevel,
z: model.z + 20,
style: {
x: model.arrowTextX,
y: model.arrowTextY,
fontSize: style.arrowFontSize,
fontWeight: style.Switch.text.fontWeight,
fontFamily: style.fontFamily,
text: `${data}: ${model.sectionName}`,
textFill: '#000',
textAlign: 'left',
textPadding: 3,
textBackgroundColor: style.tipBackgroundColor
}
});
this.add(this.textRect);
this.add(this.nameText);
this.add(this.arrowText);
this.add(this.textRect);
this.add(this.nameText);
this.add(this.arrowText);
this.arrowText.hide();
model.nameShow ? this.nameText.show() : this.nameText.hide();
}
this.arrowText.hide();
model.nameShow ? this.nameText.show() : this.nameText.hide();
}
getArrowText() {
return this.arrowText;
}
getArrowText() {
return this.arrowText;
}
getNameText() {
return this.nameText;
}
getNameText() {
return this.nameText;
}
getTextRect() {
return this.textRect;
}
getTextRect() {
return this.textRect;
}
}
export default ESwName;

View File

@ -12,414 +12,414 @@ import ELockRect from './ELockRect';
import EMouse from './EMouse';
export default class Switch extends Group {
constructor(model, style) {
super();
this._code = model.code;
this._type = model._type;
this.model = model;
this.style = style;
this.zlevel = model.zlevel;
this.z = 6;
this.triangle = new JTriangle(model.intersection, model.skew);
this.create();
this.createLockRect(); // 创建单锁矩形框显示
this.createMouseEvent();
this.setState(model);
}
constructor(model, style) {
super();
this._code = model.code;
this._type = model._type;
this.model = model;
this.style = style;
this.zlevel = model.zlevel;
this.z = 6;
this.triangle = new JTriangle(model.intersection, model.skew);
this.create();
this.createLockRect(); // 创建单锁矩形框显示
this.createMouseEvent();
this.setState(model);
}
createMouseEvent() {
// 鼠标事件
if (this.style.Switch.mouseOverStyle) {
this.mouseEvent = new EMouse(this);
this.add(this.mouseEvent);
this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); });
this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); });
}
}
createMouseEvent() {
// 鼠标事件
if (this.style.Switch.mouseOverStyle) {
this.mouseEvent = new EMouse(this);
this.add(this.mouseEvent);
this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); });
this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); });
}
}
create() {
const model = this.model;
const style = this.style;
create() {
const model = this.model;
const style = this.style;
let halfWidth = style.Section.line.width / 2;
const switchWidth = style.Section.line.width + style.Section.line.beyondWidth*2 + 0.8;
const swPadding = style.Switch.core.length;
const directx = this.triangle.drictx;
const directy = this.triangle.dricty;
const direct = -this.triangle.drictx * this.triangle.dricty;
const coverLength = switchWidth * 1.5;
let halfWidth = style.Section.line.width / 2;
const switchWidth = style.Section.line.width + style.Section.line.beyondWidth * 2 + 0.8;
const swPadding = style.Switch.core.length;
const directx = this.triangle.drictx;
const directy = this.triangle.dricty;
const direct = -this.triangle.drictx * this.triangle.dricty;
const coverLength = switchWidth * 1.5;
this.swCore = new ESwCore({
zlevel: this.zlevel,
z: this.z,
style: style,
intersectionX: model.intersection.x,
intersectionY: model.intersection.y,
coverLength: coverLength,
lineWidth: switchWidth,
triangle: this.triangle
});
this.swCore = new ESwCore({
zlevel: this.zlevel,
z: this.z,
style: style,
intersectionX: model.intersection.x,
intersectionY: model.intersection.y,
coverLength: coverLength,
lineWidth: switchWidth,
triangle: this.triangle
});
halfWidth += 0.3;
const point1 = [model.intersection.x - directx * halfWidth, model.intersection.y + directy * halfWidth];
const point2 = [point1[0] + directx * switchWidth / this.triangle.getSinRate(), point1[1]];
const point3 = [point2[0] + directx * this.triangle.getCotRate() * swPadding, point2[1] + directy * swPadding];
const point4 = [point3[0] + direct * this.triangle.getSin(switchWidth), point3[1] - direct * this.triangle.getCos(switchWidth)];
this.locShelter = new ESwLocal({ // 定位
zlevel: this.zlevel,
z: this.z,
style: style,
shelterPoints: [point1, point2, point3, point4],
cursor: 'pointer',
triangle: this.triangle,
onmouseover: () => { this.name.getArrowText().show(); },
onmouseout: () => { this.name.getArrowText().hide(); }
});
halfWidth += 0.3;
const point1 = [model.intersection.x - directx * halfWidth, model.intersection.y + directy * halfWidth];
const point2 = [point1[0] + directx * switchWidth / this.triangle.getSinRate(), point1[1]];
const point3 = [point2[0] + directx * this.triangle.getCotRate() * swPadding, point2[1] + directy * swPadding];
const point4 = [point3[0] + direct * this.triangle.getSin(switchWidth), point3[1] - direct * this.triangle.getCos(switchWidth)];
this.locShelter = new ESwLocal({ // 定位
zlevel: this.zlevel,
z: this.z,
style: style,
shelterPoints: [point1, point2, point3, point4],
cursor: 'pointer',
triangle: this.triangle,
onmouseover: () => { this.name.getArrowText().show(); },
onmouseout: () => { this.name.getArrowText().hide(); }
});
const slen = switchWidth / this.triangle.getSinRate();
const rpoint1 = [model.intersection.x + directx * halfWidth, model.intersection.y - directy * halfWidth];
const rpoint2 = [rpoint1[0] + directx * (swPadding + switchWidth * this.triangle.getCotRate()), rpoint1[1]];
const rpoint3 = [rpoint2[0], rpoint2[1] + directy * switchWidth];
const rpoint4 = [rpoint1[0] + this.triangle.getCos(slen), rpoint1[1] + this.triangle.getSin(slen)];
const slen = switchWidth / this.triangle.getSinRate();
const rpoint1 = [model.intersection.x + directx * halfWidth, model.intersection.y - directy * halfWidth];
const rpoint2 = [rpoint1[0] + directx * (swPadding + switchWidth * this.triangle.getCotRate()), rpoint1[1]];
const rpoint3 = [rpoint2[0], rpoint2[1] + directy * switchWidth];
const rpoint4 = [rpoint1[0] + this.triangle.getCos(slen), rpoint1[1] + this.triangle.getSin(slen)];
const switchWidth1 = style.Section.line.width / 2 + 0.1;
const width1 = switchWidth1 * this.triangle.getSinRate();
const height1 = switchWidth1 * this.triangle.getCosRate();
const width2 = (height1 + switchWidth1) / this.triangle.getTanRate();
const width3 = (style.Section.line.width / this.triangle.getSinRate()) - width2 - width1;
const spoint1 = [model.intersection.x + directx * width3, model.intersection.y - directy * switchWidth1];
const spoint2 = [spoint1[0] - directx * (width2 + width1) - directx * width3, spoint1[1]];
const spoint3 = [model.intersection.x - directx * width3, model.intersection.y + directy * switchWidth1];
const spoint4 = [spoint1[0] + directx * (width2 + width1) - directx * width3, spoint3[1]];
const switchWidth1 = style.Section.line.width / 2 + 0.1;
const width1 = switchWidth1 * this.triangle.getSinRate();
const height1 = switchWidth1 * this.triangle.getCosRate();
const width2 = (height1 + switchWidth1) / this.triangle.getTanRate();
const width3 = (style.Section.line.width / this.triangle.getSinRate()) - width2 - width1;
const spoint1 = [model.intersection.x + directx * width3, model.intersection.y - directy * switchWidth1];
const spoint2 = [spoint1[0] - directx * (width2 + width1) - directx * width3, spoint1[1]];
const spoint3 = [model.intersection.x - directx * width3, model.intersection.y + directy * switchWidth1];
const spoint4 = [spoint1[0] + directx * (width2 + width1) - directx * width3, spoint3[1]];
this.relocShelter = new ESwLnversion({ // 反位
zlevel: this.zlevel,
z: this.z,
style: style,
shelterPoints: [rpoint1, rpoint2, rpoint3, rpoint4],
sectionPoints: [spoint1, spoint2, spoint3, spoint4],
cursor: 'pointer',
halfWidth: halfWidth,
triangle: this.triangle,
onmouseover: () => { this.name.getArrowText().show(); },
onmouseout: () => { this.name.getArrowText().hide(); }
});
this.relocShelter = new ESwLnversion({ // 反位
zlevel: this.zlevel,
z: this.z,
style: style,
shelterPoints: [rpoint1, rpoint2, rpoint3, rpoint4],
sectionPoints: [spoint1, spoint2, spoint3, spoint4],
cursor: 'pointer',
halfWidth: halfWidth,
triangle: this.triangle,
onmouseover: () => { this.name.getArrowText().show(); },
onmouseout: () => { this.name.getArrowText().hide(); }
});
this.releaseBackground = new Line({ // 区段上遮盖段
zlevel: this.zlevel,
z: this.z,
shape: {
x1: model.intersection.x - (coverLength * this.triangle.getCotRate()),
y1: model.intersection.y,
x2: model.intersection.x + (coverLength * this.triangle.getCotRate()),
y2: model.intersection.y
},
style: {
lineWidth: style.Section.line.width + style.Section.line.beyondWidth + 1,
stroke: style.backgroundColor
}
});
this.releaseBackground = new Line({ // 区段上遮盖段
zlevel: this.zlevel,
z: this.z,
shape: {
x1: model.intersection.x - (coverLength * this.triangle.getCotRate()),
y1: model.intersection.y,
x2: model.intersection.x + (coverLength * this.triangle.getCotRate()),
y2: model.intersection.y
},
style: {
lineWidth: style.Section.line.width + style.Section.line.beyondWidth + 1,
stroke: style.backgroundColor
}
});
const arrowTextX = model.intersection.x + 10;
const arrowTextY = model.intersection.y + 15;
const nameTextX = model.namePosition.x + model.intersection.x + directx * (style.Section.line.width * 3 + style.Switch.text.offset.x) * this.triangle.getCotRate();
const nameTextY = model.namePosition.y + model.intersection.y + style.Switch.text.offset.y * (style.Switch.text.position || directy);
const arrowTextX = model.intersection.x + 10;
const arrowTextY = model.intersection.y + 15;
const nameTextX = model.namePosition.x + model.intersection.x + directx * (style.Section.line.width * 3 + style.Switch.text.offset.x) * this.triangle.getCotRate();
const nameTextY = model.namePosition.y + model.intersection.y + style.Switch.text.offset.y * (style.Switch.text.position || directy);
this.name = new ESwName({
zlevel: this.zlevel,
z: this.z,
style: style,
arrowTextX: arrowTextX,
arrowTextY: arrowTextY,
nameTextX: nameTextX,
nameTextY: nameTextY,
sectionName: model.sectionName,
name: model.name,
nameShow: style.Switch.text.show,
triangle: this.triangle
});
this.name = new ESwName({
zlevel: this.zlevel,
z: this.z,
style: style,
arrowTextX: arrowTextX,
arrowTextY: arrowTextY,
nameTextX: nameTextX,
nameTextY: nameTextY,
sectionName: model.sectionName,
name: model.name,
nameShow: style.Switch.text.show,
triangle: this.triangle
});
this.add(this.swCore); // 岔芯link
this.add(this.locShelter);
this.add(this.relocShelter);
this.add(this.releaseBackground);
this.add(this.name);
}
this.add(this.swCore); // 岔芯link
this.add(this.locShelter);
this.add(this.relocShelter);
this.add(this.releaseBackground);
this.add(this.name);
}
createLockRect() {
const offsetX = this.model.locateType == '01' ? 3 : 0;
this.lockRect = new ELockRect({ // 锁定矩形
zlevel: this.zlevel,
z: this.z + 6,
x: this.model.intersection.x - this.style.Switch.monolock.rectWidth / 2 + offsetX,
y: this.model.intersection.y - this.style.Switch.monolock.rectWidth / 2,
width: this.style.Switch.monolock.rectWidth,
lineWidth: 1.8,
stroke: this.style.Switch.monolock.rectBorderColor,
fill: this.style.transparentColor
});
this.add(this.lockRect);
this.lockRect.hide();
}
createLockRect() {
const offsetX = this.model.locateType == '01' ? 3 : 0;
this.lockRect = new ELockRect({ // 锁定矩形
zlevel: this.zlevel,
z: this.z + 6,
x: this.model.intersection.x - this.style.Switch.monolock.rectWidth / 2 + offsetX,
y: this.model.intersection.y - this.style.Switch.monolock.rectWidth / 2,
width: this.style.Switch.monolock.rectWidth,
lineWidth: 1.8,
stroke: this.style.Switch.monolock.rectBorderColor,
fill: this.style.transparentColor
});
this.add(this.lockRect);
this.lockRect.hide();
}
/** 名称动画*/
nameTextAnimation() {
this.name.getNameText().animateStyle(true)
.when(0, { textFill: this.style.backgroundColor })
.when(1000, { textFill: this.style.Switch.text.lossColor })
.when(2000, { textFill: this.style.backgroundColor })
.start();
/** 名称动画*/
nameTextAnimation() {
this.name.getNameText().animateStyle(true)
.when(0, { textFill: this.style.backgroundColor })
.when(1000, { textFill: this.style.Switch.text.lossColor })
.when(2000, { textFill: this.style.backgroundColor })
.start();
this.name.getTextRect().animateStyle(true)
.when(0, { textFill: this.style.backgroundColor })
.when(1000, { textFill: this.style.Switch.text.borderColor })
.when(2000, { textFill: this.style.backgroundColor })
.start();
}
this.name.getTextRect().animateStyle(true)
.when(0, { textFill: this.style.backgroundColor })
.when(1000, { textFill: this.style.Switch.text.borderColor })
.when(2000, { textFill: this.style.backgroundColor })
.start();
}
/** 设置岔芯是否隐藏*/
setSwitchCoreInvisible(invisible) {
if (invisible) {
this.swCore.hide();
} else {
this.swCore.show();
}
}
/** 设置岔芯是否隐藏*/
setSwitchCoreInvisible(invisible) {
if (invisible) {
this.swCore.hide();
} else {
this.swCore.show();
}
}
/** 设置岔芯颜色*/
setSwitchCoreColor(color) {
this.swCore && this.swCore.setColor(color);
}
/** 设置岔芯颜色*/
setSwitchCoreColor(color) {
this.swCore && this.swCore.setColor(color);
}
/** 设置道岔文字颜色*/
setTextColor(color) {
this.name.getNameText().setStyle({textFill: color});
}
/** 设置道岔文字颜色*/
setTextColor(color) {
this.name.getNameText().setStyle({textFill: color});
}
/** 设置道岔背景颜色*/
setTextStyle(style) {
this.name.getNameText().setStyle(style);
}
/** 设置道岔背景颜色*/
setTextStyle(style) {
this.name.getNameText().setStyle(style);
}
/** 设置道岔文字边框颜色 (道岔封锁) */
setHasTextBorder(width) {
this.name.getTextRect().setStyle({lineWidth: width});
}
/** 设置道岔文字边框颜色 (道岔封锁) */
setHasTextBorder(width) {
this.name.getTextRect().setStyle({lineWidth: width});
}
/** 恢复状态*/
recover() {
this.lockRect.hide();
this.setSwitchCoreColor(this.style.backgroundColor);
this.name.getNameText().stopAnimation(false);
this.swCore.stopAnimation(false);
this.relocShelter.stopAnimation(false);
this.relocShelter.hide();
this.releaseBackground.hide();
this.setHasTextBorder(0);
}
/** 恢复状态*/
recover() {
this.lockRect.hide();
this.setSwitchCoreColor(this.style.backgroundColor);
this.name.getNameText().stopAnimation(false);
this.swCore.stopAnimation(false);
this.relocShelter.stopAnimation(false);
this.relocShelter.hide();
this.releaseBackground.hide();
this.setHasTextBorder(0);
}
/** 定位*/
setLocationAction() {
this.recover();
this.setSwitchCoreInvisible(true);
this.locShelter.show();
this.relocShelter.hide();
this.setTextColor(this.style.Switch.text.locateColor);
}
/** 定位*/
setLocationAction() {
this.recover();
this.setSwitchCoreInvisible(true);
this.locShelter.show();
this.relocShelter.hide();
this.setTextColor(this.style.Switch.text.locateColor);
}
/** 反位*/
setInversionAction() {
this.recover();
this.setSwitchCoreInvisible(true);
this.setTextColor(this.style.Switch.text.inversionColor);
this.locShelter.hide();
this.relocShelter.show();
this.setSectionState(this.relocShelter.getSection(), 'fill', this.model);
}
/** 反位*/
setInversionAction() {
this.recover();
this.setSwitchCoreInvisible(true);
this.setTextColor(this.style.Switch.text.inversionColor);
this.locShelter.hide();
this.relocShelter.show();
this.setSectionState(this.relocShelter.getSection(), 'fill', this.model);
}
/** 失去*/
setLossAction(nameFlicker) {
this.recover();
this.locShelter.hide();
this.relocShelter.hide();
this.setSwitchCoreInvisible(false);
this.setTextColor(this.style.Switch.text.lossColor);
nameFlicker && this.nameTextAnimation();
}
/** 失去*/
setLossAction(nameFlicker) {
this.recover();
this.locShelter.hide();
this.relocShelter.hide();
this.setSwitchCoreInvisible(false);
this.setTextColor(this.style.Switch.text.lossColor);
nameFlicker && this.nameTextAnimation();
}
/** 挤叉*/
setForkAction() {
this.setLossAction(true);
this.swCore.animateStyle(item => {
item.animateStyle(true)
.when(0, { stroke: this.style.backgroundColor })
.when(1000, { stroke: 'red' })
.when(2000, { stroke: this.style.backgroundColor })
.start();
});
}
/** 挤叉*/
setForkAction() {
this.setLossAction(true);
this.swCore.animateStyle(item => {
item.animateStyle(true)
.when(0, { stroke: this.style.backgroundColor })
.when(1000, { stroke: 'red' })
.when(2000, { stroke: this.style.backgroundColor })
.start();
});
}
/** 空闲*/
spare() {
}
/** 空闲*/
spare() {
}
/** 单锁*/
setMonolock() {
if (this.style.Switch.monolock.rectShow) { // 判断单锁矩形是否显示
this.lockRect.show();
}
switch (this.model.locateType) {
case '01': // 定位
this.setTextColor(this.style.Switch.monolock.locationColor); // 设置道岔名称颜色
break;
case '02': // 反位
this.setTextColor(this.style.Switch.monolock.inversionColor); // 设置道岔名称颜色
break;
}
}
/** 单锁*/
setMonolock() {
if (this.style.Switch.monolock.rectShow) { // 判断单锁矩形是否显示
this.lockRect.show();
}
switch (this.model.locateType) {
case '01': // 定位
this.setTextColor(this.style.Switch.monolock.locationColor); // 设置道岔名称颜色
break;
case '02': // 反位
this.setTextColor(this.style.Switch.monolock.inversionColor); // 设置道岔名称颜色
break;
}
}
/** 封锁 */
block() {
if (this.style.Switch.block.nameBorderShow) {
this.setHasTextBorder(1);
} else if (this.style.Switch.block.contentRectShow) {
this.lockRect.show();
this.lockRect.setStyle({stroke: this.style.Switch.block.contentRectColor});
}
}
/** 封锁 */
block() {
if (this.style.Switch.block.nameBorderShow) {
this.setHasTextBorder(1);
} else if (this.style.Switch.block.contentRectShow) {
this.lockRect.show();
this.lockRect.setStyle({stroke: this.style.Switch.block.contentRectColor});
}
}
/** 延时释放*/
timeRelease() {
this.setSwitchCoreInvisible(true);
this.releaseBackground.show();
}
/** 延时释放*/
timeRelease() {
this.setSwitchCoreInvisible(true);
this.releaseBackground.show();
}
/** 设置道岔切除*/
setSwitchCutOff() {
this.setSwitchCoreInvisible(true);
switch (this.model.locateType) {
case '01':
this.releaseBackground.hide();
break;
case '02':
this.relocShelter.getSection().animateStyle(true)
.when(1000, { fill: this.style.backgroundColor })
.start();
break;
}
}
/** 设置道岔切除*/
setSwitchCutOff() {
this.setSwitchCoreInvisible(true);
switch (this.model.locateType) {
case '01':
this.releaseBackground.hide();
break;
case '02':
this.relocShelter.getSection().animateStyle(true)
.when(1000, { fill: this.style.backgroundColor })
.start();
break;
}
}
sectionCutOff(section) {
const lineWidth = this.style.Section.line.width + (this.model.sectionAstatus != '01' ? this.style.Section.line.beyondWidth : 0);
if (section) {
section.animateStyle(true, [
{ time: 0, styles: { lineWidth: lineWidth } },
{ time: 1000, styles: { stroke: this.style.backgroundColor } },
{ time: 2000, styles: { lineWidth: lineWidth } }
]);
}
}
sectionCutOff(section) {
const lineWidth = this.style.Section.line.width + (this.model.sectionAstatus != '01' ? this.style.Section.line.beyondWidth : 0);
if (section) {
section.animateStyle(true, [
{ time: 0, styles: { lineWidth: lineWidth } },
{ time: 1000, styles: { stroke: this.style.backgroundColor } },
{ time: 2000, styles: { lineWidth: lineWidth } }
]);
}
}
setSectionState(section, style, state) {
if (section && !section.animators.length) {
switch (state.sectionAstatus) {
case '00': break;
case '01': /** 空闲*/
section.setStyle(style, this.style.Section.line.spareColor);
break;
case '02': /** 通信车占用*/
section.setStyle(style, this.style.Section.line.communicationOccupiedColor);
break;
case '03': /** 非通信车占用*/
section.setStyle(style, this.style.Section.line.unCommunicationOccupiedColor);
break;
case '04': /** 进路锁闭*/
section.setStyle(style, this.style.Section.line.routeLockColor);
break;
case '05': /** 故障锁闭*/
section.setStyle(style, this.style.Section.line.faultLockColor);
break;
case '06': /** 封锁*/
section.setStyle(style, this.style.Section.line.blockColor);
break;
case '07': /** ATC切除*/
section.setStyle(style, this.style.Section.line.atcExcisionColor);
break;
case '08': /** ATS切除*/
section.setStyle(style, this.style.Section.line.atsExcisionColor);
section.animateStyle(true)
.when(1000, { fill: this.style.backgroundColor })
.when(2000, { fill: this.style.Section.line.atsExcisionColor })
.start();
break;
case '09': /** 进路延续保护 */
section.setStyle(style, this.style.Section.line.protectiveLockColor);
break;
}
setSectionState(section, style, state) {
if (section && !section.animators.length) {
switch (state.sectionAstatus) {
case '00': break;
case '01': /** 空闲*/
section.setStyle(style, this.style.Section.line.spareColor);
break;
case '02': /** 通信车占用*/
section.setStyle(style, this.style.Section.line.communicationOccupiedColor);
break;
case '03': /** 非通信车占用*/
section.setStyle(style, this.style.Section.line.unCommunicationOccupiedColor);
break;
case '04': /** 进路锁闭*/
section.setStyle(style, this.style.Section.line.routeLockColor);
break;
case '05': /** 故障锁闭*/
section.setStyle(style, this.style.Section.line.faultLockColor);
break;
case '06': /** 封锁*/
section.setStyle(style, this.style.Section.line.blockColor);
break;
case '07': /** ATC切除*/
section.setStyle(style, this.style.Section.line.atcExcisionColor);
break;
case '08': /** ATS切除*/
section.setStyle(style, this.style.Section.line.atsExcisionColor);
section.animateStyle(true)
.when(1000, { fill: this.style.backgroundColor })
.when(2000, { fill: this.style.Section.line.atsExcisionColor })
.start();
break;
case '09': /** 进路延续保护 */
section.setStyle(style, this.style.Section.line.protectiveLockColor);
break;
}
if (state.cutOff) {
this.sectionCutOff(section);
}
}
if (state.cutOff) {
this.sectionCutOff(section);
}
}
}
}
setLocateType(model) {
switch (model.locateType) {
case '01':
this.setLocationAction(); /** 定位*/
break;
case '02':
this.setInversionAction(); /** 反位*/
break;
case '03':
this.setLossAction(true); /** 失去*/
break;
case '04':
this.setForkAction(); /** 挤岔*/
break;
default:
this.setLocationAction();
}
}
setLocateType(model) {
switch (model.locateType) {
case '01':
this.setLocationAction(); /** 定位*/
break;
case '02':
this.setInversionAction(); /** 反位*/
break;
case '03':
this.setLossAction(true); /** 失去*/
break;
case '04':
this.setForkAction(); /** 挤岔*/
break;
default:
this.setLocationAction();
}
}
setState(model) {
this.setLocateType(model);
setState(model) {
this.setLocateType(model);
switch (model.status) {
case '01':
this.spare(); /** 空闲*/
break;
case '10':
this.setMonolock(); /** 单锁*/
break;
case '13':
this.timeRelease(); /** 延时释放*/
break;
case '14':
this.block(); /** 封锁*/
break;
}
switch (model.status) {
case '01':
this.spare(); /** 空闲*/
break;
case '10':
this.setMonolock(); /** 单锁*/
break;
case '13':
this.timeRelease(); /** 延时释放*/
break;
case '14':
this.block(); /** 封锁*/
break;
}
/** 区段切除*/
if (model.cutOff) {
this.setSwitchCutOff();
}
}
/** 区段切除*/
if (model.cutOff) {
this.setSwitchCutOff();
}
}
getBoundingRect() {
return this.name.getBoundingRect();
}
getBoundingRect() {
return this.name.getBoundingRect();
}
getShapeTipPoint() {
const text = this.name.getNameText();
if (text) {
const rect = text.getBoundingRect();
return {
x: rect.x + rect.width / 2,
y: rect.y
};
}
return null;
}
getShapeTipPoint() {
const text = this.name.getNameText();
if (text) {
const rect = text.getBoundingRect();
return {
x: rect.x + rect.width / 2,
y: rect.y
};
}
return null;
}
}

View File

@ -40,12 +40,12 @@ mapShape[deviceType.Line] = Line;
mapShape[deviceType.Text] = Text2;
function shapefactory(device, jmap) {
const type = device._type;
const shape = mapShape[type];
if (shape instanceof Function) {
// eslint-disable-next-line
const type = device._type;
const shape = mapShape[type];
if (shape instanceof Function) {
// eslint-disable-next-line
return new shape(device, jmap.style);
}
}
}
export default shapefactory;

View File

@ -19,94 +19,94 @@
<script>
import { runPlanTemplateList } from '@/api/runplan';
import { getSkinCodeList } from '@/api/management/mapskin';
import { getLineCodeList } from '@/api/management/mapline';
export default {
name: 'ChooseTemplatePlan',
data() {
return {
dialogShow: false,
loading: false,
skinCodeList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
reset: true,
labelWidth: '100px',
queryObject: {
name: {
type: 'text',
label: '运行图名称'
}
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
radioShow: true,
columns: [
{
title: '运行图名称',
prop: 'name'
},
{
title: '皮肤类型',
prop: 'skinCode',
type: 'tag',
columnValue: (row) => {
return this.$convertField(row.skinCode, this.skinCodeList, ['code', 'name']);
},
tagType: (row) => { return 'success'; }
}
]
},
name: 'ChooseTemplatePlan',
data() {
return {
dialogShow: false,
loading: false,
skinCodeList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
reset: true,
labelWidth: '100px',
queryObject: {
name: {
type: 'text',
label: '运行图名称'
}
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
radioShow: true,
columns: [
{
title: '运行图名称',
prop: 'name'
},
{
title: '皮肤类型',
prop: 'skinCode',
type: 'tag',
columnValue: (row) => {
return this.$convertField(row.skinCode, this.skinCodeList, ['code', 'name']);
},
tagType: (row) => { return 'success'; }
}
]
},
currentModel: {}
};
},
computed: {
title() {
return '选择模板运行图';
}
},
methods: {
loadInitData() {
this.skinCodeList = [];
getSkinCodeList().then(response => {
this.skinCodeList = response.data;
});
},
doShow() {
this.loading = false;
this.dialogShow = true;
this.loadInitData();
},
doClose() {
this.dialogShow = false;
},
queryFunction(params) {
if (this.$store.state.map && this.$store.state.map.map) {
params['skinCode'] = this.$store.getters['map/skinCode'];
}
return runPlanTemplateList(params);
},
handleConfirm() {
this.doClose();
if (this.$refs && this.$refs.pageRules) {
const choose = this.$refs.pageRules.currentChoose();
if (choose) {
this.$emit('chooseConfirm', choose);
} else {
this.$messageBox(`请选择模板运行图`);
}
}
},
reloadTable() {
this.queryList.reload();
}
}
currentModel: {}
};
},
computed: {
title() {
return '选择模板运行图';
}
},
methods: {
loadInitData() {
this.skinCodeList = [];
getLineCodeList().then(response => {
this.skinCodeList = response.data;
});
},
doShow() {
this.loading = false;
this.dialogShow = true;
this.loadInitData();
},
doClose() {
this.dialogShow = false;
},
queryFunction(params) {
if (this.$store.state.map && this.$store.state.map.map) {
params['skinCode'] = this.$store.getters['map/skinCode'];
}
return runPlanTemplateList(params);
},
handleConfirm() {
this.doClose();
if (this.$refs && this.$refs.pageRules) {
const choose = this.$refs.pageRules.currentChoose();
if (choose) {
this.$emit('chooseConfirm', choose);
} else {
this.$messageBox(`请选择模板运行图`);
}
}
},
reloadTable() {
this.queryList.reload();
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -21,7 +21,7 @@
import { runPlanTemplateList } from '@/api/runplan';
import { getStationList } from '@/api/runplan';
import { getEveryDayRunPlanData, generateDayRunPlan } from '@/api/simulation';
import { getSkinCodeList } from '@/api/management/mapskin';
import { getLineCodeList } from '@/api/management/mapline';
export default {
name: 'ReloadTodayPlan',
@ -76,7 +76,7 @@ export default {
methods: {
loadInitData() {
this.skinCodeList = [];
getSkinCodeList().then(response => {
getLineCodeList().then(response => {
this.skinCodeList = response.data;
});
},

View File

@ -19,94 +19,94 @@
<script>
import { runPlanTemplateList } from '@/api/runplan';
import { getSkinCodeList } from '@/api/management/mapskin';
import { getLineCodeList } from '@/api/management/mapline';
export default {
name: 'ChooseTemplatePlan',
data() {
return {
dialogShow: false,
loading: false,
skinCodeList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
reset: true,
labelWidth: '100px',
queryObject: {
name: {
type: 'text',
label: '运行图名称'
}
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
radioShow: true,
columns: [
{
title: '运行图名称',
prop: 'name'
},
{
title: '皮肤类型',
prop: 'skinCode',
type: 'tag',
columnValue: (row) => {
return this.$convertField(row.skinCode, this.skinCodeList, ['code', 'name']);
},
tagType: (row) => { return 'success'; }
}
]
},
name: 'ChooseTemplatePlan',
data() {
return {
dialogShow: false,
loading: false,
skinCodeList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
reset: true,
labelWidth: '100px',
queryObject: {
name: {
type: 'text',
label: '运行图名称'
}
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
radioShow: true,
columns: [
{
title: '运行图名称',
prop: 'name'
},
{
title: '皮肤类型',
prop: 'skinCode',
type: 'tag',
columnValue: (row) => {
return this.$convertField(row.skinCode, this.skinCodeList, ['code', 'name']);
},
tagType: (row) => { return 'success'; }
}
]
},
currentModel: {}
};
},
computed: {
title() {
return '选择模板运行图';
}
},
methods: {
loadInitData() {
this.skinCodeList = [];
getSkinCodeList().then(response => {
this.skinCodeList = response.data;
});
},
doShow() {
this.loading = false;
this.dialogShow = true;
this.loadInitData();
},
doClose() {
this.dialogShow = false;
},
queryFunction(params) {
if (this.$store.state.map && this.$store.state.map.map) {
params['skinCode'] = this.$store.getters['map/skinCode'];
}
return runPlanTemplateList(params);
},
handleConfirm() {
this.doClose();
if (this.$refs && this.$refs.pageRules) {
const choose = this.$refs.pageRules.currentChoose();
if (choose) {
this.$emit('chooseConfirm', choose);
} else {
this.$messageBox(`请选择模板运行图`);
}
}
},
reloadTable() {
this.queryList.reload();
}
}
currentModel: {}
};
},
computed: {
title() {
return '选择模板运行图';
}
},
methods: {
loadInitData() {
this.skinCodeList = [];
getLineCodeList().then(response => {
this.skinCodeList = response.data;
});
},
doShow() {
this.loading = false;
this.dialogShow = true;
this.loadInitData();
},
doClose() {
this.dialogShow = false;
},
queryFunction(params) {
if (this.$store.state.map && this.$store.state.map.map) {
params['skinCode'] = this.$store.getters['map/skinCode'];
}
return runPlanTemplateList(params);
},
handleConfirm() {
this.doClose();
if (this.$refs && this.$refs.pageRules) {
const choose = this.$refs.pageRules.currentChoose();
if (choose) {
this.$emit('chooseConfirm', choose);
} else {
this.$messageBox(`请选择模板运行图`);
}
}
},
reloadTable() {
this.queryList.reload();
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -21,7 +21,7 @@
import { runPlanTemplateList } from '@/api/runplan';
import { getStationList } from '@/api/runplan';
import { getEveryDayRunPlanData, generateDayRunPlan } from '@/api/simulation';
import { getSkinCodeList } from '@/api/management/mapskin';
import { getLineCodeList } from '@/api/management/mapline';
export default {
name: 'ReloadTodayPlan',
@ -76,7 +76,7 @@ export default {
methods: {
loadInitData() {
this.skinCodeList = [];
getSkinCodeList().then(response => {
getLineCodeList().then(response => {
this.skinCodeList = response.data;
});
},

View File

@ -19,94 +19,94 @@
<script>
import { runPlanTemplateList } from '@/api/runplan';
import { getSkinCodeList } from '@/api/management/mapskin';
import { getLineCodeList } from '@/api/management/mapline';
export default {
name: 'ChooseTemplatePlan',
data() {
return {
dialogShow: false,
loading: false,
skinCodeList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
reset: true,
labelWidth: '100px',
queryObject: {
name: {
type: 'text',
label: '运行图名称'
}
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
radioShow: true,
columns: [
{
title: '运行图名称',
prop: 'name'
},
{
title: '皮肤类型',
prop: 'skinCode',
type: 'tag',
columnValue: (row) => {
return this.$convertField(row.skinCode, this.skinCodeList, ['code', 'name']);
},
tagType: (row) => { return 'success'; }
}
]
},
name: 'ChooseTemplatePlan',
data() {
return {
dialogShow: false,
loading: false,
skinCodeList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
reset: true,
labelWidth: '100px',
queryObject: {
name: {
type: 'text',
label: '运行图名称'
}
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
radioShow: true,
columns: [
{
title: '运行图名称',
prop: 'name'
},
{
title: '皮肤类型',
prop: 'skinCode',
type: 'tag',
columnValue: (row) => {
return this.$convertField(row.skinCode, this.skinCodeList, ['code', 'name']);
},
tagType: (row) => { return 'success'; }
}
]
},
currentModel: {}
};
},
computed: {
title() {
return '选择模板运行图';
}
},
methods: {
loadInitData() {
this.skinCodeList = [];
getSkinCodeList().then(response => {
this.skinCodeList = response.data;
});
},
doShow() {
this.loading = false;
this.dialogShow = true;
this.loadInitData();
},
doClose() {
this.dialogShow = false;
},
queryFunction(params) {
if (this.$store.state.map && this.$store.state.map.map) {
params['skinCode'] = this.$store.getters['map/skinCode'];
}
return runPlanTemplateList(params);
},
handleConfirm() {
this.doClose();
if (this.$refs && this.$refs.pageRules) {
const choose = this.$refs.pageRules.currentChoose();
if (choose) {
this.$emit('chooseConfirm', choose);
} else {
this.$messageBox(`请选择模板运行图`);
}
}
},
reloadTable() {
this.queryList.reload();
}
}
currentModel: {}
};
},
computed: {
title() {
return '选择模板运行图';
}
},
methods: {
loadInitData() {
this.skinCodeList = [];
getLineCodeList().then(response => {
this.skinCodeList = response.data;
});
},
doShow() {
this.loading = false;
this.dialogShow = true;
this.loadInitData();
},
doClose() {
this.dialogShow = false;
},
queryFunction(params) {
if (this.$store.state.map && this.$store.state.map.map) {
params['skinCode'] = this.$store.getters['map/skinCode'];
}
return runPlanTemplateList(params);
},
handleConfirm() {
this.doClose();
if (this.$refs && this.$refs.pageRules) {
const choose = this.$refs.pageRules.currentChoose();
if (choose) {
this.$emit('chooseConfirm', choose);
} else {
this.$messageBox(`请选择模板运行图`);
}
}
},
reloadTable() {
this.queryList.reload();
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -21,7 +21,7 @@
import { runPlanTemplateList } from '@/api/runplan';
import { getStationList } from '@/api/runplan';
import { getEveryDayRunPlanData, generateDayRunPlan } from '@/api/simulation';
import { getSkinCodeList } from '@/api/management/mapskin';
import { getLineCodeList } from '@/api/management/mapline';
export default {
name: 'ReloadTodayPlan',
@ -76,7 +76,7 @@ export default {
methods: {
loadInitData() {
this.skinCodeList = [];
getSkinCodeList().then(response => {
getLineCodeList().then(response => {
this.skinCodeList = response.data;
});
},

View File

@ -22,386 +22,386 @@ import { MapDeviceType, OperationEvent, DeviceMenu } from '@/scripts/ConstDic';
import { MenuDisabledState, menuConvert, menuFiltration } from './utils/menuItemStatus';
export default {
name: 'SectionMenu',
components: {
PopMenu,
SectionControl,
SectionCmdControl,
SpeedCmdControl,
TrainCreate,
NoticeInfo
},
props: {
selected: {
type: Object,
default() {
return null;
}
}
},
data() {
return {
menu: [],
menuNormal: {
local: [
{
label: this.$t('menu.menuSection.sectionFaultUnlock'),
handler: this.fault,
disabledCallback: MenuDisabledState.Section.fault,
auth: { station: true, center: false }
},
{
label: this.$t('menu.menuSection.sectionResection'),
handler: this.split,
disabledCallback: MenuDisabledState.Section.split,
auth: { station: true, center: false }
},
{
label: this.$t('menu.menuSection.sectionActive'),
handler: this.active,
disabledCallback: MenuDisabledState.Section.active,
auth: { station: true, center: false }
},
{
label: this.$t('menu.menuSection.sectionAxisPreReset'),
handler: this.axlePreReset,
disabledCallback: MenuDisabledState.Section.axlePreReset,
auth: { station: true, center: false }
},
{
label: this.$t('menu.menuSection.sectionBlockade'),
handler: this.lock,
disabledCallback: MenuDisabledState.Section.lock,
auth: { station: true, center: false }
},
{
label: this.$t('menu.menuSection.sectionUnblock'),
handler: this.unlock,
disabledCallback: MenuDisabledState.Section.unlock,
auth: { station: true, center: false }
},
{
label: this.$t('menu.menuSection.sectionSetSpeedLimit'),
handler: this.setSpeed,
disabledCallback: MenuDisabledState.Section.setSpeed,
auth: { station: true, center: false }
},
{
label: this.$t('menu.menuSection.sectionCancelSpeedLimit'),
handler: this.cancelSpeed,
disabledCallback: MenuDisabledState.Section.cancelSpeed,
auth: { station: true, center: false }
}
],
central: [
{
label: this.$t('menu.menuSection.sectionFaultUnlock'),
handler: this.fault,
disabledCallback: MenuDisabledState.Section.fault,
auth: { station: false, center: true }
},
{
label: this.$t('menu.menuSection.sectionResection'),
handler: this.split,
disabledCallback: MenuDisabledState.Section.split,
auth: { station: false, center: true }
},
{
label: this.$t('menu.menuSection.sectionActive'),
handler: this.active,
disabledCallback: MenuDisabledState.Section.active,
auth: { station: false, center: true }
},
{
label: this.$t('menu.menuSection.axisPreReset'),
handler: this.axlePreReset,
disabledCallback: MenuDisabledState.Section.axlePreReset,
auth: { station: false, center: false }
},
{
label: this.$t('menu.menuSection.sectionBlockade'),
handler: this.lock,
disabledCallback: MenuDisabledState.Section.lock,
auth: { station: false, center: true }
},
{
label: this.$t('menu.menuSection.sectionUnblock'),
handler: this.unlock,
disabledCallback: MenuDisabledState.Section.unlock,
auth: { station: false, center: true }
},
{
label: this.$t('menu.menuSection.sectionSetSpeedLimit'),
handler: this.setSpeed,
disabledCallback: MenuDisabledState.Section.setSpeed,
auth: { station: false, center: true }
},
{
label: this.$t('menu.menuSection.sectionCancelSpeedLimit'),
handler: this.cancelSpeed,
disabledCallback: MenuDisabledState.Section.cancelSpeed,
auth: { station: false, center: true }
}
]
},
menuTrain: [
{
label: this.$t('menu.menuSection.createTrain'),
handler: this.newTrain,
disabledCallback: MenuDisabledState.Section.newTrain
}
],
menuForce: [
{
label: this.$t('menu.menuSection.setFault'),
handler: this.setStoppage,
disabledCallback: MenuDisabledState.Section.setStoppage
},
{
label: this.$t('menu.menuSection.cancelFault'),
handler: this.cancelStoppage,
disabledCallback: MenuDisabledState.Section.cancelStoppage
}
]
};
},
computed: {
...mapGetters('training', [
'mode',
'operatemode'
]),
...mapGetters('menuOperation', [
'buttonOperation'
])
},
watch: {
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Section) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
methods: {
clickEvent() {
const self = this;
window.onclick = function (e) {
self.doClose();
};
},
initMenu() {
//
this.menu = menuFiltration(this.menuNormal);
if (this.operatemode === OperateMode.ADMIN) {
this.menu = [...this.menu, ...this.menuForce, ...this.menuTrain];
}
name: 'SectionMenu',
components: {
PopMenu,
SectionControl,
SectionCmdControl,
SpeedCmdControl,
TrainCreate,
NoticeInfo
},
props: {
selected: {
type: Object,
default() {
return null;
}
}
},
data() {
return {
menu: [],
menuNormal: {
local: [
{
label: this.$t('menu.menuSection.sectionFaultUnlock'),
handler: this.fault,
disabledCallback: MenuDisabledState.Section.fault,
auth: { station: true, center: false }
},
{
label: this.$t('menu.menuSection.sectionResection'),
handler: this.split,
disabledCallback: MenuDisabledState.Section.split,
auth: { station: true, center: false }
},
{
label: this.$t('menu.menuSection.sectionActive'),
handler: this.active,
disabledCallback: MenuDisabledState.Section.active,
auth: { station: true, center: false }
},
{
label: this.$t('menu.menuSection.sectionAxisPreReset'),
handler: this.axlePreReset,
disabledCallback: MenuDisabledState.Section.axlePreReset,
auth: { station: true, center: false }
},
{
label: this.$t('menu.menuSection.sectionBlockade'),
handler: this.lock,
disabledCallback: MenuDisabledState.Section.lock,
auth: { station: true, center: false }
},
{
label: this.$t('menu.menuSection.sectionUnblock'),
handler: this.unlock,
disabledCallback: MenuDisabledState.Section.unlock,
auth: { station: true, center: false }
},
{
label: this.$t('menu.menuSection.sectionSetSpeedLimit'),
handler: this.setSpeed,
disabledCallback: MenuDisabledState.Section.setSpeed,
auth: { station: true, center: false }
},
{
label: this.$t('menu.menuSection.sectionCancelSpeedLimit'),
handler: this.cancelSpeed,
disabledCallback: MenuDisabledState.Section.cancelSpeed,
auth: { station: true, center: false }
}
],
central: [
{
label: this.$t('menu.menuSection.sectionFaultUnlock'),
handler: this.fault,
disabledCallback: MenuDisabledState.Section.fault,
auth: { station: false, center: true }
},
{
label: this.$t('menu.menuSection.sectionResection'),
handler: this.split,
disabledCallback: MenuDisabledState.Section.split,
auth: { station: false, center: true }
},
{
label: this.$t('menu.menuSection.sectionActive'),
handler: this.active,
disabledCallback: MenuDisabledState.Section.active,
auth: { station: false, center: true }
},
{
label: this.$t('menu.menuSection.axisPreReset'),
handler: this.axlePreReset,
disabledCallback: MenuDisabledState.Section.axlePreReset,
auth: { station: false, center: false }
},
{
label: this.$t('menu.menuSection.sectionBlockade'),
handler: this.lock,
disabledCallback: MenuDisabledState.Section.lock,
auth: { station: false, center: true }
},
{
label: this.$t('menu.menuSection.sectionUnblock'),
handler: this.unlock,
disabledCallback: MenuDisabledState.Section.unlock,
auth: { station: false, center: true }
},
{
label: this.$t('menu.menuSection.sectionSetSpeedLimit'),
handler: this.setSpeed,
disabledCallback: MenuDisabledState.Section.setSpeed,
auth: { station: false, center: true }
},
{
label: this.$t('menu.menuSection.sectionCancelSpeedLimit'),
handler: this.cancelSpeed,
disabledCallback: MenuDisabledState.Section.cancelSpeed,
auth: { station: false, center: true }
}
]
},
menuTrain: [
{
label: this.$t('menu.menuSection.createTrain'),
handler: this.newTrain,
disabledCallback: MenuDisabledState.Section.newTrain
}
],
menuForce: [
{
label: this.$t('menu.menuSection.setFault'),
handler: this.setStoppage,
disabledCallback: MenuDisabledState.Section.setStoppage
},
{
label: this.$t('menu.menuSection.cancelFault'),
handler: this.cancelStoppage,
disabledCallback: MenuDisabledState.Section.cancelStoppage
}
]
};
},
computed: {
...mapGetters('training', [
'mode',
'operatemode'
]),
...mapGetters('menuOperation', [
'buttonOperation'
])
},
watch: {
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Section) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
methods: {
clickEvent() {
const self = this;
window.onclick = function (e) {
self.doClose();
};
},
initMenu() {
//
this.menu = menuFiltration(this.menuNormal);
if (this.operatemode === OperateMode.ADMIN) {
this.menu = [...this.menu, ...this.menuForce, ...this.menuTrain];
}
//
if (this.operatemode === OperateMode.FAULT) {
this.menu = this.menuForce;
}
//
if (this.operatemode === OperateMode.FAULT) {
this.menu = this.menuForce;
}
this.menu = menuConvert(this.menu);
},
doShow(point) {
this.clickEvent();
this.initMenu();
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
this.$refs.popMenu.resetShowPosition(point);
}
},
doClose() {
if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.close();
}
},
//
setStoppage() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.stoppage.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
//
cancelStoppage() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.cancelStoppage.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
//
fault() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.fault.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.sectionCmdControl.doShow(operate, this.selected);
}
});
},
//
split() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.split.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.sectionControl.doShow(operate, this.selected);
}
});
},
//
active() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.active.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.sectionControl.doShow(operate, this.selected);
}
});
},
//
axlePreReset() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.axlePreReset.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.sectionCmdControl.doShow(operate, this.selected);
}
});
},
//
lock() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.lock.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.sectionControl.doShow(operate, this.selected);
}
});
},
//
unlock() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.unlock.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.sectionCmdControl.doShow(operate, this.selected);
}
});
},
//
setSpeed() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.setSpeed.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.speedCmdControl.doShow(operate, this.selected);
}
});
},
//
cancelSpeed() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.cancelSpeed.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {
const tempData = response.data;
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.speedCmdControl.doShow(operate, this.selected, tempData);
}
});
},
//
newTrain() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.newtrain.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainCreate.doShow(operate, this.selected);
}
});
}
}
this.menu = menuConvert(this.menu);
},
doShow(point) {
this.clickEvent();
this.initMenu();
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
this.$refs.popMenu.resetShowPosition(point);
}
},
doClose() {
if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.close();
}
},
//
setStoppage() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.stoppage.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
//
cancelStoppage() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.cancelStoppage.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
//
fault() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.fault.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.sectionCmdControl.doShow(operate, this.selected);
}
});
},
//
split() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.split.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.sectionControl.doShow(operate, this.selected);
}
});
},
//
active() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.active.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.sectionControl.doShow(operate, this.selected);
}
});
},
//
axlePreReset() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.axlePreReset.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.sectionCmdControl.doShow(operate, this.selected);
}
});
},
//
lock() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.lock.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.sectionControl.doShow(operate, this.selected);
}
});
},
//
unlock() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.unlock.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.sectionCmdControl.doShow(operate, this.selected);
}
});
},
//
setSpeed() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.setSpeed.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.speedCmdControl.doShow(operate, this.selected);
}
});
},
//
cancelSpeed() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.cancelSpeed.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {
const tempData = response.data;
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.speedCmdControl.doShow(operate, this.selected, tempData);
}
});
},
//
newTrain() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.newtrain.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainCreate.doShow(operate, this.selected);
}
});
}
}
};
</script>

View File

@ -26,463 +26,463 @@ import { MapDeviceType, OperationEvent, DeviceMenu } from '@/scripts/ConstDic';
import { MenuDisabledState, menuConvert, menuFiltration } from './utils/menuItemStatus';
export default {
name: 'StationStandMenu',
components: {
PopMenu,
StandControl,
StandDetail,
StandRunLevel,
NoticeInfo,
StandBackStrategy,
StandStopTime,
StandDetainTrainAll
},
props: {
selected: {
type: Object,
default() {
return null;
}
}
},
data() {
return {
menu: [],
menuNormal: {
local: [
{
label: this.$t('menu.menuStationStand.detainTrain'),
handler: this.setDetainTrain,
disabledCallback: MenuDisabledState.StationStand.setDetainTrain,
auth: { station: true, center: false }
},
{
label: this.$t('menu.menuStationStand.cancelDetainTrain'),
handler: this.cancelDetainTrain,
disabledCallback: MenuDisabledState.StationStand.cancelDetainTrain,
auth: { station: true, center: false }
},
{
label: this.$t('menu.menuStationStand.cancelDetainTrainForce'),
handler: this.cancelDetainTrainForce,
disabledCallback: MenuDisabledState.StationStand.cancelDetainTrainForce,
auth: { station: true, center: false }
},
{
label: this.$t('menu.menuStationStand.jumpStop'),
handler: this.setJumpStop,
disabledCallback: MenuDisabledState.StationStand.setJumpStop,
auth: { station: true, center: false }
},
{
label: this.$t('menu.menuStationStand.cancelJumpStop'),
handler: this.cancelJumpStop,
disabledCallback: MenuDisabledState.StationStand.cancelJumpStop,
auth: { station: true, center: false }
},
{
label: this.$t('menu.menuStationStand.setRunLevel'),
handler: this.setRunLevel,
disabledCallback: MenuDisabledState.StationStand.setRunLevel,
auth: { station: false, center: false }
},
{
label: this.$t('menu.menuStationStand.setEarlyDeparture'),
handler: this.earlyDeparture,
disabledCallback: MenuDisabledState.StationStand.earlyDeparture,
auth: { station: false, center: false }
},
{
label: this.$t('menu.menuStationStand.setBackStrategy'),
handler: this.setBackStrategy,
disabledCallback: MenuDisabledState.StationStand.setBackStrategy,
auth: { station: false, center: false }
},
{
label: this.$t('menu.menuStationStand.getStationStandStatus'),
handler: this.detail,
disabledCallback: MenuDisabledState.StationStand.detail,
auth: { station: true, center: false }
}
],
central: [
{
label: this.$t('menu.menuStationStand.detainTrain'),
handler: this.setDetainTrain,
disabledCallback: MenuDisabledState.StationStand.setDetainTrain,
auth: { station: false, center: true }
},
{
label: this.$t('menu.menuStationStand.cancelDetainTrain'),
handler: this.cancelDetainTrain,
disabledCallback: MenuDisabledState.StationStand.cancelDetainTrain,
auth: { station: false, center: true }
},
{
label: this.$t('menu.menuStationStand.cancelDetainTrainForce'),
handler: this.cancelDetainTrainForce,
disabledCallback: MenuDisabledState.StationStand.cancelDetainTrainForce,
auth: { station: false, center: false }
},
{
label: this.$t('menu.menuStationStand.cancelDetainTrainAll'),
handler: this.cancelDetainTrainAll,
disabledCallback: MenuDisabledState.StationStand.cancelDetainTrainAll,
auth: { station: false, center: true }
},
{
label: this.$t('menu.menuStationStand.jumpStop'),
handler: this.setJumpStop,
disabledCallback: MenuDisabledState.StationStand.setJumpStop,
auth: { station: false, center: true }
},
{
label: this.$t('menu.menuStationStand.cancelJumpStop'),
handler: this.cancelJumpStop,
disabledCallback: MenuDisabledState.StationStand.cancelJumpStop,
auth: { station: true, center: true }
},
{
label: this.$t('menu.menuStationStand.setStopTime'),
handler: this.setStopTime,
disabledCallback: MenuDisabledState.StationStand.setStopTime,
auth: { station: false, center: true }
},
{
label: this.$t('menu.menuStationStand.setRunLevel'),
handler: this.setRunLevel,
disabledCallback: MenuDisabledState.StationStand.setRunLevel,
auth: { station: false, center: true }
},
{
label: this.$t('menu.menuStationStand.setEarlyDeparture'),
handler: this.earlyDeparture,
disabledCallback: MenuDisabledState.StationStand.earlyDeparture,
auth: { station: false, center: true }
},
{
label: this.$t('menu.menuStationStand.setBackStrategy'),
handler: this.setBackStrategy,
disabledCallback: MenuDisabledState.StationStand.setBackStrategy,
auth: { station: false, center: true }
},
{
label: this.$t('menu.menuStationStand.getStationStandStatus'),
handler: this.detail,
disabledCallback: MenuDisabledState.StationStand.detail,
auth: { station: true, center: true }
}
]
},
menuForce: [
{
label: this.$t('menu.menuStationStand.setFault'),
handler: this.setStoppage,
disabledCallback: MenuDisabledState.StationStand.setStoppage
},
{
label: this.$t('menu.menuStationStand.cancelFault'),
handler: this.cancelStoppage,
disabledCallback: MenuDisabledState.StationStand.cancelStoppage
}
]
};
},
computed: {
...mapGetters('training', [
'mode',
'operatemode'
]),
...mapGetters('menuOperation', [
'buttonOperation'
])
},
watch: {
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.StationStand) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
methods: {
clickEvent() {
const self = this;
window.onclick = function (e) {
self.doClose();
};
},
initMenu() {
//
this.menu = menuFiltration(this.menuNormal);
if (this.operatemode === OperateMode.ADMIN) {
this.menu = [...this.menu, ...this.menuForce];
}
name: 'StationStandMenu',
components: {
PopMenu,
StandControl,
StandDetail,
StandRunLevel,
NoticeInfo,
StandBackStrategy,
StandStopTime,
StandDetainTrainAll
},
props: {
selected: {
type: Object,
default() {
return null;
}
}
},
data() {
return {
menu: [],
menuNormal: {
local: [
{
label: this.$t('menu.menuStationStand.detainTrain'),
handler: this.setDetainTrain,
disabledCallback: MenuDisabledState.StationStand.setDetainTrain,
auth: { station: true, center: false }
},
{
label: this.$t('menu.menuStationStand.cancelDetainTrain'),
handler: this.cancelDetainTrain,
disabledCallback: MenuDisabledState.StationStand.cancelDetainTrain,
auth: { station: true, center: false }
},
{
label: this.$t('menu.menuStationStand.cancelDetainTrainForce'),
handler: this.cancelDetainTrainForce,
disabledCallback: MenuDisabledState.StationStand.cancelDetainTrainForce,
auth: { station: true, center: false }
},
{
label: this.$t('menu.menuStationStand.jumpStop'),
handler: this.setJumpStop,
disabledCallback: MenuDisabledState.StationStand.setJumpStop,
auth: { station: true, center: false }
},
{
label: this.$t('menu.menuStationStand.cancelJumpStop'),
handler: this.cancelJumpStop,
disabledCallback: MenuDisabledState.StationStand.cancelJumpStop,
auth: { station: true, center: false }
},
{
label: this.$t('menu.menuStationStand.setRunLevel'),
handler: this.setRunLevel,
disabledCallback: MenuDisabledState.StationStand.setRunLevel,
auth: { station: false, center: false }
},
{
label: this.$t('menu.menuStationStand.setEarlyDeparture'),
handler: this.earlyDeparture,
disabledCallback: MenuDisabledState.StationStand.earlyDeparture,
auth: { station: false, center: false }
},
{
label: this.$t('menu.menuStationStand.setBackStrategy'),
handler: this.setBackStrategy,
disabledCallback: MenuDisabledState.StationStand.setBackStrategy,
auth: { station: false, center: false }
},
{
label: this.$t('menu.menuStationStand.getStationStandStatus'),
handler: this.detail,
disabledCallback: MenuDisabledState.StationStand.detail,
auth: { station: true, center: false }
}
],
central: [
{
label: this.$t('menu.menuStationStand.detainTrain'),
handler: this.setDetainTrain,
disabledCallback: MenuDisabledState.StationStand.setDetainTrain,
auth: { station: false, center: true }
},
{
label: this.$t('menu.menuStationStand.cancelDetainTrain'),
handler: this.cancelDetainTrain,
disabledCallback: MenuDisabledState.StationStand.cancelDetainTrain,
auth: { station: false, center: true }
},
{
label: this.$t('menu.menuStationStand.cancelDetainTrainForce'),
handler: this.cancelDetainTrainForce,
disabledCallback: MenuDisabledState.StationStand.cancelDetainTrainForce,
auth: { station: false, center: false }
},
{
label: this.$t('menu.menuStationStand.cancelDetainTrainAll'),
handler: this.cancelDetainTrainAll,
disabledCallback: MenuDisabledState.StationStand.cancelDetainTrainAll,
auth: { station: false, center: true }
},
{
label: this.$t('menu.menuStationStand.jumpStop'),
handler: this.setJumpStop,
disabledCallback: MenuDisabledState.StationStand.setJumpStop,
auth: { station: false, center: true }
},
{
label: this.$t('menu.menuStationStand.cancelJumpStop'),
handler: this.cancelJumpStop,
disabledCallback: MenuDisabledState.StationStand.cancelJumpStop,
auth: { station: true, center: true }
},
{
label: this.$t('menu.menuStationStand.setStopTime'),
handler: this.setStopTime,
disabledCallback: MenuDisabledState.StationStand.setStopTime,
auth: { station: false, center: true }
},
{
label: this.$t('menu.menuStationStand.setRunLevel'),
handler: this.setRunLevel,
disabledCallback: MenuDisabledState.StationStand.setRunLevel,
auth: { station: false, center: true }
},
{
label: this.$t('menu.menuStationStand.setEarlyDeparture'),
handler: this.earlyDeparture,
disabledCallback: MenuDisabledState.StationStand.earlyDeparture,
auth: { station: false, center: true }
},
{
label: this.$t('menu.menuStationStand.setBackStrategy'),
handler: this.setBackStrategy,
disabledCallback: MenuDisabledState.StationStand.setBackStrategy,
auth: { station: false, center: true }
},
{
label: this.$t('menu.menuStationStand.getStationStandStatus'),
handler: this.detail,
disabledCallback: MenuDisabledState.StationStand.detail,
auth: { station: true, center: true }
}
]
},
menuForce: [
{
label: this.$t('menu.menuStationStand.setFault'),
handler: this.setStoppage,
disabledCallback: MenuDisabledState.StationStand.setStoppage
},
{
label: this.$t('menu.menuStationStand.cancelFault'),
handler: this.cancelStoppage,
disabledCallback: MenuDisabledState.StationStand.cancelStoppage
}
]
};
},
computed: {
...mapGetters('training', [
'mode',
'operatemode'
]),
...mapGetters('menuOperation', [
'buttonOperation'
])
},
watch: {
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.StationStand) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
methods: {
clickEvent() {
const self = this;
window.onclick = function (e) {
self.doClose();
};
},
initMenu() {
//
this.menu = menuFiltration(this.menuNormal);
if (this.operatemode === OperateMode.ADMIN) {
this.menu = [...this.menu, ...this.menuForce];
}
//
if (this.operatemode === OperateMode.FAULT) {
this.menu = this.menuForce;
}
//
if (this.operatemode === OperateMode.FAULT) {
this.menu = this.menuForce;
}
this.menu = menuConvert(this.menu);
},
doShow(point) {
this.clickEvent();
this.initMenu();
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
this.$refs.popMenu.resetShowPosition(point);
}
},
doClose() {
if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.close();
}
},
//
setStoppage() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.StationStand.type,
label: MapDeviceType.StationStand.label,
operation: OperationEvent.StationStand.stoppage.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
//
cancelStoppage() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.StationStand.type,
label: MapDeviceType.StationStand.label,
operation: OperationEvent.StationStand.cancelStoppage.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
//
setDetainTrain() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.StationStand.type,
label: MapDeviceType.StationStand.label,
operation: OperationEvent.StationStand.setDetainTrain.menu.operation
};
this.menu = menuConvert(this.menu);
},
doShow(point) {
this.clickEvent();
this.initMenu();
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
this.$refs.popMenu.resetShowPosition(point);
}
},
doClose() {
if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.close();
}
},
//
setStoppage() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.StationStand.type,
label: MapDeviceType.StationStand.label,
operation: OperationEvent.StationStand.stoppage.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
//
cancelStoppage() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.StationStand.type,
label: MapDeviceType.StationStand.label,
operation: OperationEvent.StationStand.cancelStoppage.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
//
setDetainTrain() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.StationStand.type,
label: MapDeviceType.StationStand.label,
operation: OperationEvent.StationStand.setDetainTrain.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.standControl.doShow(operate, this.selected);
}
});
},
//
cancelDetainTrain() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.StationStand.type,
label: MapDeviceType.StationStand.label,
operation: OperationEvent.StationStand.cancelDetainTrain.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.standControl.doShow(operate, this.selected);
}
});
},
//
cancelDetainTrainForce() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.StationStand.type,
label: MapDeviceType.StationStand.label,
operation: OperationEvent.StationStand.cancelDetainTrainForce.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.standControl.doShow(operate, this.selected);
}
});
},
// 线
cancelDetainTrainAll() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.StationStand.type,
label: MapDeviceType.StationStand.label,
operation: OperationEvent.StationStand.cancelDetainTrainAll.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.standDetainTrainAll.doShow(operate, this.selected);
}
});
},
//
setJumpStop() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.StationStand.type,
label: MapDeviceType.StationStand.label,
operation: OperationEvent.StationStand.setJumpStop.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.standControl.doShow(operate, this.selected);
}
});
},
//
cancelJumpStop() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.StationStand.type,
label: MapDeviceType.StationStand.label,
operation: OperationEvent.StationStand.cancelJumpStop.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.standControl.doShow(operate, this.selected);
}
});
},
//
setStopTime() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.StationStand.type,
label: MapDeviceType.StationStand.label,
operation: OperationEvent.StationStand.setStopTime.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {
let tempDate = null;
if (response) {
tempDate = response.data;
}
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.standStopTime.doShow(operate, this.selected, tempDate);
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
//
setRunLevel() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.StationStand.type,
label: MapDeviceType.StationStand.label,
operation: OperationEvent.StationStand.setRunLevel.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {
let tempDate = null;
if (response) {
tempDate = response.data;
}
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.standRunLevel.doShow(operate, this.selected, tempDate);
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
//
earlyDeparture() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.StationStand.type,
operation: OperationEvent.StationStand.earlyDeparture.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.standControl.doShow(operate, this.selected);
}
});
},
//
setBackStrategy() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.StationStand.type,
operation: OperationEvent.StationStand.setBackStrategy.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.standControl.doShow(operate, this.selected);
}
});
},
//
cancelDetainTrain() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.StationStand.type,
label: MapDeviceType.StationStand.label,
operation: OperationEvent.StationStand.cancelDetainTrain.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.standControl.doShow(operate, this.selected);
}
});
},
//
cancelDetainTrainForce() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.StationStand.type,
label: MapDeviceType.StationStand.label,
operation: OperationEvent.StationStand.cancelDetainTrainForce.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.standControl.doShow(operate, this.selected);
}
});
},
// 线
cancelDetainTrainAll() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.StationStand.type,
label: MapDeviceType.StationStand.label,
operation: OperationEvent.StationStand.cancelDetainTrainAll.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.standDetainTrainAll.doShow(operate, this.selected);
}
});
},
//
setJumpStop() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.StationStand.type,
label: MapDeviceType.StationStand.label,
operation: OperationEvent.StationStand.setJumpStop.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.standControl.doShow(operate, this.selected);
}
});
},
//
cancelJumpStop() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.StationStand.type,
label: MapDeviceType.StationStand.label,
operation: OperationEvent.StationStand.cancelJumpStop.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.standControl.doShow(operate, this.selected);
}
});
},
//
setStopTime() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.StationStand.type,
label: MapDeviceType.StationStand.label,
operation: OperationEvent.StationStand.setStopTime.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {
let tempDate = null;
if (response) {
tempDate = response.data;
}
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.standStopTime.doShow(operate, this.selected, tempDate);
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
//
setRunLevel() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.StationStand.type,
label: MapDeviceType.StationStand.label,
operation: OperationEvent.StationStand.setRunLevel.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {
let tempDate = null;
if (response) {
tempDate = response.data;
}
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.standRunLevel.doShow(operate, this.selected, tempDate);
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
//
earlyDeparture() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.StationStand.type,
operation: OperationEvent.StationStand.earlyDeparture.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.standControl.doShow(operate, this.selected);
}
});
},
//
setBackStrategy() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.StationStand.type,
operation: OperationEvent.StationStand.setBackStrategy.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {
let tempDate = null;
if (response) {
tempDate = response.data;
}
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.standBackStrategy.doShow(operate, this.selected, tempDate);
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
//
detail() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.StationStand.type,
label: MapDeviceType.StationStand.label,
operation: OperationEvent.StationStand.detail.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {
let tempDate = null;
if (response) {
tempDate = response.data;
}
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.standDetail.doShow(operate, this.selected, tempDate);
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
}
}
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {
let tempDate = null;
if (response) {
tempDate = response.data;
}
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.standBackStrategy.doShow(operate, this.selected, tempDate);
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
//
detail() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.StationStand.type,
label: MapDeviceType.StationStand.label,
operation: OperationEvent.StationStand.detail.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {
let tempDate = null;
if (response) {
tempDate = response.data;
}
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.standDetail.doShow(operate, this.selected, tempDate);
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
}
}
};
</script>

View File

@ -19,94 +19,94 @@
<script>
import { runPlanTemplateList } from '@/api/runplan';
import { getSkinCodeList } from '@/api/management/mapskin';
import { getLineCodeList } from '@/api/management/mapline';
export default {
name: 'ChooseTemplatePlan',
data() {
return {
dialogShow: false,
loading: false,
skinCodeList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
reset: true,
labelWidth: '120px',
queryObject: {
name: {
type: 'text',
label: this.$t('menu.runGraphName')
}
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
radioShow: true,
columns: [
{
title: this.$t('menu.runGraphName'),
prop: 'name'
},
{
title: this.$t('menu.skinType'),
prop: 'skinCode',
type: 'tag',
columnValue: (row) => {
return this.$convertField(row.skinCode, this.skinCodeList, ['code', 'name']);
},
tagType: (row) => { return 'success'; }
}
]
},
name: 'ChooseTemplatePlan',
data() {
return {
dialogShow: false,
loading: false,
skinCodeList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
reset: true,
labelWidth: '120px',
queryObject: {
name: {
type: 'text',
label: this.$t('menu.runGraphName')
}
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
radioShow: true,
columns: [
{
title: this.$t('menu.runGraphName'),
prop: 'name'
},
{
title: this.$t('menu.skinType'),
prop: 'skinCode',
type: 'tag',
columnValue: (row) => {
return this.$convertField(row.skinCode, this.skinCodeList, ['code', 'name']);
},
tagType: (row) => { return 'success'; }
}
]
},
currentModel: {}
};
},
computed: {
title() {
return this.$t('menu.selectTemplateRunGraph');
}
},
methods: {
loadInitData() {
this.skinCodeList = [];
getSkinCodeList().then(response => {
this.skinCodeList = response.data;
});
},
doShow() {
this.loading = false;
this.dialogShow = true;
this.loadInitData();
},
doClose() {
this.dialogShow = false;
},
queryFunction(params) {
if (this.$store.state.map && this.$store.state.map.map) {
params['skinCode'] = this.$store.getters['map/skinCode'];
}
return runPlanTemplateList(params);
},
handleConfirm() {
if (this.$refs && this.$refs.pageRules) {
const choose = this.$refs.pageRules.currentChoose();
if (choose) {
this.$emit('chooseConfirm', choose);
this.doClose();
} else {
this.$messageBox(this.$t('menu.pleaseSelectTemplateRunGraph'));
}
}
},
reloadTable() {
this.queryList.reload();
}
}
currentModel: {}
};
},
computed: {
title() {
return this.$t('menu.selectTemplateRunGraph');
}
},
methods: {
loadInitData() {
this.skinCodeList = [];
getLineCodeList().then(response => {
this.skinCodeList = response.data;
});
},
doShow() {
this.loading = false;
this.dialogShow = true;
this.loadInitData();
},
doClose() {
this.dialogShow = false;
},
queryFunction(params) {
if (this.$store.state.map && this.$store.state.map.map) {
params['skinCode'] = this.$store.getters['map/skinCode'];
}
return runPlanTemplateList(params);
},
handleConfirm() {
if (this.$refs && this.$refs.pageRules) {
const choose = this.$refs.pageRules.currentChoose();
if (choose) {
this.$emit('chooseConfirm', choose);
this.doClose();
} else {
this.$messageBox(this.$t('menu.pleaseSelectTemplateRunGraph'));
}
}
},
reloadTable() {
this.queryList.reload();
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -21,7 +21,7 @@
import { runPlanTemplateList } from '@/api/runplan';
import { getStationList } from '@/api/runplan';
import { getEveryDayRunPlanData, generateDayRunPlan } from '@/api/simulation';
import { getSkinCodeList } from '@/api/management/mapskin';
import { getLineCodeList } from '@/api/management/mapline';
export default {
name: 'ReloadTodayPlan',
@ -76,7 +76,7 @@ export default {
methods: {
loadInitData() {
this.skinCodeList = [];
getSkinCodeList().then(response => {
getLineCodeList().then(response => {
this.skinCodeList = response.data;
});
},

View File

@ -2,69 +2,69 @@
import {createTransform, createBoundingRect} from './utils/parser';
class TransformHandle {
constructor(painter) {
this.$painter = painter;
constructor(painter) {
this.$painter = painter;
this.parentLevel = painter.getParentLevel();
this.parentLevel = painter.getParentLevel();
this.rect = { x: 0, y: 0, width: 0, height: 0 };
this.rect = { x: 0, y: 0, width: 0, height: 0 };
this.transform = createTransform({ scaleRate: 1, offsetX: 0, offsetY: 0 });
}
this.transform = createTransform({ scaleRate: 1, offsetX: 0, offsetY: 0 });
}
checkVisible(view) {
return createBoundingRect(view).intersect(this.rect);
}
checkVisible(view) {
return createBoundingRect(view).intersect(this.rect);
}
revisibleView(view) {
if (this.checkVisible(view)) {
view.show();
} else {
view.hide();
}
revisibleView(view) {
if (this.checkVisible(view)) {
view.show();
} else {
view.hide();
}
view.dirty();
}
view.dirty();
}
// 视图进行缩放/平移
transformView(view) {
if (view) {
view.transform = this.transform;
view.decomposeTransform();
this.revisibleView(view);
}
}
// 视图进行缩放/平移
transformView(view) {
if (view) {
view.transform = this.transform;
view.decomposeTransform();
this.revisibleView(view);
}
}
// 处理所有视图缩放/平移
transformAll() {
this.traverse(this.transformView, this);
}
// 处理所有视图缩放/平移
transformAll() {
this.traverse(this.transformView, this);
}
// 重新计算显示图形
revisibleAll() {
this.traverse(this.revisibleView, this);
}
// 重新计算显示图形
revisibleAll() {
this.traverse(this.revisibleView, this);
}
// 更新偏移量
updateTransform(opts) {
this.transform = createTransform(opts);
this.transformAll();
}
// 更新偏移量
updateTransform(opts) {
this.transform = createTransform(opts);
this.transformAll();
}
// 更新画布尺寸
updateZrSize(opts) {
this.rect = { x: 0, y: 0, width: opts.width, height: opts.height };
this.revisibleAll();
}
// 更新画布尺寸
updateZrSize(opts) {
this.rect = { x: 0, y: 0, width: opts.width, height: opts.height };
this.revisibleAll();
}
// 遍历group执行回调
traverse(cb, context) {
this.parentLevel.eachChild(level => {
level.eachChild((view) => {
cb.call(context, view);
}, context);
}, context);
}
// 遍历group执行回调
traverse(cb, context) {
this.parentLevel.eachChild(level => {
level.eachChild((view) => {
cb.call(context, view);
}, context);
}, context);
}
}
export default TransformHandle;

View File

@ -6,213 +6,210 @@ import Vue from 'vue';
import { deepClone } from '@/utils/index';
export function createTransform(opts) {
let transform = matrix.create();
transform = matrix.scale(matrix.create(), transform, [opts.scaleRate, opts.scaleRate]);
transform = matrix.translate(matrix.create(), transform, [-opts.offsetX, -opts.offsetY]);
return transform;
let transform = matrix.create();
transform = matrix.scale(matrix.create(), transform, [opts.scaleRate, opts.scaleRate]);
transform = matrix.translate(matrix.create(), transform, [-opts.offsetX, -opts.offsetY]);
return transform;
}
export function createBoundingRect(view) {
const rect = view.getBoundingRect();
const scale = view.scale[0];
const offsetX = view.position[0];
const offsetY = view.position[1];
rect.x = rect.x * scale + offsetX;
rect.y = rect.y * scale + offsetY;
rect.width = rect.width * scale;
rect.height = rect.height * scale;
return rect;
const rect = view.getBoundingRect();
const scale = view.scale[0];
const offsetX = view.position[0];
const offsetY = view.position[1];
rect.x = rect.x * scale + offsetX;
rect.y = rect.y * scale + offsetY;
rect.width = rect.width * scale;
rect.height = rect.height * scale;
return rect;
}
export function calculateDCenter(viewRect, zrbound) {
var dx = (zrbound.width - viewRect.width) / 2 - viewRect.x;
var dy = 0;
return { dx: dx, dy: dy };
var dx = (zrbound.width - viewRect.width) / 2 - viewRect.x;
var dy = 0;
return { dx: dx, dy: dy };
}
export function deviceFactory(type, elem) {
return {...deviceRender[type], ...elem};
return {...deviceRender[type], ...elem};
}
export function createDevice(type, model, propConvert) {
const device = deviceFactory(type, model);
return propConvert ? propConvert.initPrivateProps(device) : device;
export function createDevice(type, elem, propConvert) {
const device = deviceFactory(type, Object.assign(elem, { _type: type } ));
return propConvert ? propConvert.initPrivateProps(device) : device;
}
export function parser(data, skinCode) {
var mapDevice = {};
var propConvert = skinCode ? Vue.prototype.$theme.loadPropConvert(skinCode): null;
if (data) {
zrUtil.each(data.linkList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Link, elem, propConvert);
}, this);
var mapDevice = {};
var propConvert = skinCode ? Vue.prototype.$theme.loadPropConvert(skinCode) : null;
if (data) {
zrUtil.each(data.linkList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Link, elem, propConvert);
}, this);
zrUtil.each(data.sectionList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Section, elem, propConvert);
}, this);
zrUtil.each(data.sectionList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Section, elem, propConvert);
}, this);
zrUtil.each(data.signalList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Signal, elem, propConvert);
}, this);
zrUtil.each(data.signalList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Signal, elem, propConvert);
}, this);
zrUtil.each(data.stationList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Station, elem, propConvert);
}, this);
zrUtil.each(data.stationList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Station, elem, propConvert);
}, this);
zrUtil.each(data.stationStandList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.StationStand, elem, propConvert);
}, this);
zrUtil.each(data.stationStandList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.StationStand, elem, propConvert);
}, this);
zrUtil.each(data.stationControlList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.StationControl, elem, propConvert);
}, this);
zrUtil.each(data.stationControlList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.StationControl, elem, propConvert);
}, this);
zrUtil.each(data.counterList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.StationCounter, elem, propConvert);
}, this);
zrUtil.each(data.counterList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.StationCounter, elem, propConvert);
}, this);
zrUtil.each(data.delayShowList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.StationDelayUnlock, elem, propConvert);
}, this);
zrUtil.each(data.delayShowList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.StationDelayUnlock, elem, propConvert);
}, this);
zrUtil.each(data.lineList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Line, elem, propConvert);
}, this);
zrUtil.each(data.lineList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Line, elem, propConvert);
}, this);
zrUtil.each(data.textList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Text, elem, propConvert);
}, this);
zrUtil.each(data.textList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Text, elem, propConvert);
}, this);
zrUtil.each(data.zcList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.ZcControl, elem, propConvert);
}, this);
zrUtil.each(data.zcList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.ZcControl, elem, propConvert);
}, this);
zrUtil.each(data.buttonList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.ButtonControl, elem, propConvert);
}, this);
zrUtil.each(data.buttonList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.ButtonControl, elem, propConvert);
}, this);
zrUtil.each(data.lcList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.LcControl, elem, propConvert);
}, this);
zrUtil.each(data.lcList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.LcControl, elem, propConvert);
}, this);
zrUtil.each(data.tempSpeedLimitList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.LimitControl, elem, propConvert);
}, this);
zrUtil.each(data.tempSpeedLimitList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.LimitControl, elem, propConvert);
}, this);
zrUtil.each(data.resourceList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.ImageControl, elem, propConvert);
}, this);
zrUtil.each(data.resourceList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.ImageControl, elem, propConvert);
}, this);
zrUtil.each(data.trainList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Train, elem, propConvert);
}, this);
zrUtil.each(data.trainList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Train, elem, propConvert);
}, this);
zrUtil.each(data.Line || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Line, elem, propConvert);
}, this);
zrUtil.each(data.Line || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Line, elem, propConvert);
}, this);
zrUtil.each(data.Text || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Text, elem, propConvert);
}, this);
zrUtil.each(data.Text || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Text, elem, propConvert);
}, this);
zrUtil.each(data.trainWindowList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.TrainWindow, elem, propConvert);
if (elem.sectionCode) {
const section = mapDevice[elem.sectionCode];
if (section) {
section['trainWindowCode'] = elem.code;
}
}
}, this);
zrUtil.each(data.trainWindowList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.TrainWindow, elem, propConvert);
if (elem.sectionCode) {
const section = mapDevice[elem.sectionCode];
if (section) {
section['trainWindowCode'] = elem.code;
}
}
}, this);
zrUtil.each(data.switchList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Switch, elem, propConvert);
const cnodeSection = mapDevice[mapDevice[elem.code].sectionACode];
const lnodeSection = mapDevice[mapDevice[elem.code].sectionBCode];
const rnodeSection = mapDevice[mapDevice[elem.code].sectionCCode];
zrUtil.each(data.switchList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Switch, elem, propConvert);
const cnodeSection = mapDevice[mapDevice[elem.code].sectionACode];
const lnodeSection = mapDevice[mapDevice[elem.code].sectionBCode];
const rnodeSection = mapDevice[mapDevice[elem.code].sectionCCode];
if (cnodeSection && lnodeSection && rnodeSection) {
cnodeSection['switch'] = lnodeSection['switch'] = rnodeSection['switch'] = mapDevice[elem.code];
const cnode = mapDevice[cnodeSection.linkCode];
if (cnode && cnode.leftFdCode === lnodeSection.linkCode && cnode.leftSdCode === rnodeSection.linkCode) {
mapDevice[elem.code].intersection = {
x: cnodeSection.points[0].x,
y: cnodeSection.points[0].y
};
mapDevice[elem.code].skew = {
x: rnodeSection.points[rnodeSection.points.length - 2].x,
y: rnodeSection.points[rnodeSection.points.length - 2].y
};
} else if (cnode && cnode.rightFdCode === lnodeSection.linkCode && cnode.rightSdCode === rnodeSection.linkCode) {
mapDevice[elem.code].intersection = {
x: cnodeSection.points[cnodeSection.points.length - 1].x,
y: cnodeSection.points[cnodeSection.points.length - 1].y
};
mapDevice[elem.code].skew = {
x: rnodeSection.points[1].x,
y: rnodeSection.points[1].y
};
}
if (cnodeSection && lnodeSection && rnodeSection) {
cnodeSection['switch'] = lnodeSection['switch'] = rnodeSection['switch'] = mapDevice[elem.code];
const cnode = mapDevice[cnodeSection.linkCode];
if (cnode && cnode.leftFdCode === lnodeSection.linkCode && cnode.leftSdCode === rnodeSection.linkCode) {
mapDevice[elem.code].intersection = {
x: cnodeSection.points[0].x,
y: cnodeSection.points[0].y
};
mapDevice[elem.code].skew = {
x: rnodeSection.points[rnodeSection.points.length - 2].x,
y: rnodeSection.points[rnodeSection.points.length - 2].y
};
} else if (cnode && cnode.rightFdCode === lnodeSection.linkCode && cnode.rightSdCode === rnodeSection.linkCode) {
mapDevice[elem.code].intersection = {
x: cnodeSection.points[cnodeSection.points.length - 1].x,
y: cnodeSection.points[cnodeSection.points.length - 1].y
};
mapDevice[elem.code].skew = {
x: rnodeSection.points[1].x,
y: rnodeSection.points[1].y
};
}
const section = mapDevice[cnodeSection.parentCode];
if (section) {
mapDevice[elem.code].sectionName = section.name;
section['relSwitchCode'] = elem.code;
}
const section = mapDevice[cnodeSection.parentCode];
if (section) {
mapDevice[elem.code].sectionName = section.name;
section['relSwitchCode'] = elem.code;
}
rnodeSection['layer'] = -1;
}
}, this);
}
rnodeSection['layer'] = -1;
}
}, this);
}
return mapDevice;
return mapDevice;
}
// 同步绘制数据到原始数据
export function updateForList(model, map, liststr) {
const list = map[liststr];
if (list && list instanceof Array) {
const i = list.findIndex(elem => { return elem.code == model.code; });
if (model._dispose) {
i >= 0 && list.splice(i, 1);
} else if (!list[i]) {
list.push(deepClone(model));
} else if (i >= 0) {
// const item = list[i];
list[i] = deepClone(model); // item map 数据 model 页面表单数据
// Object.keys(model).forEach(key => {
// if (key != 'instance') {
// item[key] = model[key];
// }
// });
}
} else {
map[liststr] = [model];
}
export function updateForList(model, state, liststr) {
const list = state.map[liststr];
if (list && list instanceof Array) {
const i = list.findIndex(elem => { return elem.code == model.code; });
if (model._dispose) {
i >= 0 && list.splice(i, 1); // 删除
} else if (!list[i]) {
list.push(deepClone(model)); // 新增
} else if (i >= 0) {
list[i] = deepClone(model); // item map 数据 model 页面表单数据
// state.mapDevice[model.code] = deepClone(model);
// console.log(list[i], '更新');
}
} else {
state.map[liststr] = [model];
}
}
export function updateMapData(state, model) {
const map = state.map;
if (map && model) {
switch (model._type) {
case deviceType.Link: updateForList(model, map, 'linkList'); break;
case deviceType.Section: updateForList(model, map, 'sectionList'); break;
case deviceType.Switch: updateForList(model, map, 'switchList'); break;
case deviceType.Signal: updateForList(model, map, 'signalList'); break;
case deviceType.Station: updateForList(model, map, 'stationList'); break;
case deviceType.StationStand: updateForList(model, map, 'stationStandList'); break;
case deviceType.StationControl: updateForList(model, map, 'stationControlList'); break;
case deviceType.StationCounter: updateForList(model, map, 'stationCounterList'); break;
case deviceType.ZcControl: updateForList(model, map, 'zcControlList'); break;
case deviceType.StationDelayUnlock:updateForList(model, map, 'stationDelayUnlockList'); break;
case deviceType.LcControl: updateForList(model, map, 'lcControlList'); break;
case deviceType.ButtonControl: updateForList(model, map, 'buttonList'); break;
case deviceType.LimitControl: updateForList(model, map, 'tempSpeedLimitList'); break;
case deviceType.ImageControl: updateForList(model, map, 'imageControl'); break;
case deviceType.Train: updateForList(model, map, 'trainList'); break;
case deviceType.TrainWindow: updateForList(model, map, 'trainWindowList'); break;
case deviceType.Line: updateForList(model, map, 'lineList'); break;
case deviceType.Text: updateForList(model, map, 'textList'); break;
}
}
// const map = state.map;
// const mapDevice = state.mapDevice;
if (state.map && model) {
switch (model._type) {
case deviceType.Link: updateForList(model, state, 'linkList'); break;
case deviceType.Section: updateForList(model, state, 'sectionList'); break;
case deviceType.Switch: updateForList(model, state, 'switchList'); break;
case deviceType.Signal: updateForList(model, state, 'signalList'); break;
case deviceType.Station: updateForList(model, state, 'stationList'); break;
case deviceType.StationStand: updateForList(model, state, 'stationStandList'); break;
case deviceType.StationControl: updateForList(model, state, 'stationControlList'); break;
case deviceType.StationCounter: updateForList(model, state, 'stationCounterList'); break;
case deviceType.ZcControl: updateForList(model, state, 'zcControlList'); break;
case deviceType.StationDelayUnlock:updateForList(model, state, 'stationDelayUnlockList'); break;
case deviceType.LcControl: updateForList(model, state, 'lcControlList'); break;
case deviceType.ButtonControl: updateForList(model, state, 'buttonList'); break;
case deviceType.LimitControl: updateForList(model, state, 'tempSpeedLimitList'); break;
case deviceType.ImageControl: updateForList(model, state, 'imageControl'); break;
case deviceType.Train: updateForList(model, state, 'trainList'); break;
case deviceType.TrainWindow: updateForList(model, state, 'trainWindowList'); break;
case deviceType.Line: updateForList(model, state, 'lineList'); break;
case deviceType.Text: updateForList(model, state, 'textList'); break;
}
}
}

View File

@ -124,270 +124,271 @@ import { getUserinfoName, getUserinfoNickname, getUserinfoMobile, getUserinfoMob
import { setInterval, clearInterval } from 'timers';
export default {
data() {
return {
visible: false,
userInfo: {
name: '',
nickname: '',
mobile: '',
email: '',
passWord: ''
},
editInfo: {
name: '',
nickname: '',
mobile: '',
email: '',
passWord: ''
},
nationCode: '86',
nameShow: true,
nickNameShow: true,
mobileShow: true,
emailShow: true,
passwordShow: true,
mobileCode: null,
emailCode: null,
passWordCode: null,
data() {
return {
visible: false,
userInfo: {
name: '',
nickname: '',
mobile: '',
email: '',
passWord: ''
},
editInfo: {
name: '',
nickname: '',
mobile: '',
email: '',
passWord: ''
},
nationCode: '86',
nameShow: true,
nickNameShow: true,
mobileShow: true,
emailShow: true,
passwordShow: true,
mobileCode: null,
emailCode: null,
passWordCode: null,
oldPassWord: null,
newPassWord1: null,
oldPassWord: null,
newPassWord1: null,
mobileCodeTime: 0,
emailCodeTime: 0,
passWordCodeTime: 0,
mobileCodeTime: 0,
emailCodeTime: 0,
passWordCodeTime: 0,
emailTime: null,
mobileTime: null,
passWordTime: null,
countryList: [
{ name: this.$t('global.china'), value: '86' },
{ name: this.$t('global.australia'), value: '61' },
{ name: this.$t('global.england'), value: '44' },
{ name: this.$t('global.hongKong'), value: '852' },
{ name: this.$t('global.Japanese'), value: '81' },
{ name: this.$t('global.macao'), value: '853' },
{ name: this.$t('global.singapore'), value: '65' },
{ name: this.$t('global.taiwan'), value: '886' },
{ name: this.$t('global.america'), value: '1' }
],
nationCodeInit: '86' //
};
},
computed: {
info() {
return this.$store.state.user;
}
},
methods: {
geTel(tel) {
const reg = /^(\d{3})\d{4}(\d{4})$/;
return tel.replace(reg, '$1****$2');
},
doShow() {
this.visible = true;
const token = getToken() || getDesignToken();
getInfo(token).then(response => {
const user = response.data;
this.userInfo = {
name: user.name,
nickname: user.nickname,
mobile: user.mobile,
email: user.email,
passWord: ''
};
this.oldPassWord = user.password;
this.nationCode = user.nationCode ? user.nationCode : '86';
this.nationCodeInit = user.nationCode ? user.nationCode : '86';
}).catch(error => {
console.log(error, '请求个人信息失败');
});
},
doClose() {
this.visible = false;
},
switcherName() {
this.editInfo.name = this.userInfo.name;
this.nameShow = !this.nameShow;
},
async saveName() {
if (this.editInfo.name) {
try {
await getUserinfoName(this.info.id, this.editInfo.name);
this.userInfo.name = this.editInfo.name;
this.nameShow = !this.nameShow;
this.$store.commit('SET_NAME', this.editInfo.name);
} catch (error) {
console.log(error, '错误');
}
}
},
emailTime: null,
mobileTime: null,
passWordTime: null,
countryList: [
{ name: this.$t('global.china'), value: '86' },
{ name: this.$t('global.australia'), value: '61' },
{ name: this.$t('global.england'), value: '44' },
{ name: this.$t('global.hongKong'), value: '852' },
{ name: this.$t('global.Japanese'), value: '81' },
{ name: this.$t('global.macao'), value: '853' },
{ name: this.$t('global.singapore'), value: '65' },
{ name: this.$t('global.taiwan'), value: '886' },
{ name: this.$t('global.america'), value: '1' }
],
nationCodeInit: '86' //
};
},
computed: {
info() {
return this.$store.state.user;
}
},
methods: {
geTel(tel) {
const reg = /^(\d{3})\d{4}(\d{4})$/;
return tel.replace(reg, '$1****$2');
},
doShow() {
this.visible = true;
const token = getToken() || getDesignToken();
getInfo(token).then(response => {
debugger;
const user = response.data;
this.userInfo = {
name: user.name,
nickname: user.nickname,
mobile: user.mobile,
email: user.email,
passWord: ''
};
this.oldPassWord = user.password;
this.nationCode = user.nationCode ? user.nationCode : '86';
this.nationCodeInit = user.nationCode ? user.nationCode : '86';
}).catch(error => {
console.log(error, '请求个人信息失败');
});
},
doClose() {
this.visible = false;
},
switcherName() {
this.editInfo.name = this.userInfo.name;
this.nameShow = !this.nameShow;
},
async saveName() {
if (this.editInfo.name) {
try {
await getUserinfoName(this.info.id, this.editInfo.name);
this.userInfo.name = this.editInfo.name;
this.nameShow = !this.nameShow;
this.$store.commit('SET_NAME', this.editInfo.name);
} catch (error) {
console.log(error, '错误');
}
}
},
switcherNickname() {
this.editInfo.nickname = this.userInfo.nickname;
this.nickNameShow = !this.nickNameShow;
},
async saveNickName() {
if (this.editInfo.nickname) {
try {
await getUserinfoNickname(this.info.id, this.editInfo.nickname);
this.userInfo.nickname = this.editInfo.nickname;
this.nickNameShow = !this.nickNameShow;
this.$store.commit('SET_NICKNAME', this.editInfo.nickname);
} catch (error) {
console.log(error, '错误');
}
}
},
switcherNickname() {
this.editInfo.nickname = this.userInfo.nickname;
this.nickNameShow = !this.nickNameShow;
},
async saveNickName() {
if (this.editInfo.nickname) {
try {
await getUserinfoNickname(this.info.id, this.editInfo.nickname);
this.userInfo.nickname = this.editInfo.nickname;
this.nickNameShow = !this.nickNameShow;
this.$store.commit('SET_NICKNAME', this.editInfo.nickname);
} catch (error) {
console.log(error, '错误');
}
}
},
switcherMobile() {
// this.editInfo.mobile = this.userInfo.mobile;
this.mobileShow = !this.mobileShow;
},
async saveMobile() {
if (this.editInfo.mobile && this.mobileCode) {
try {
const params = {
mobile: this.editInfo.mobile,
nationCode: this.nationCode,
validCode: this.mobileCode
};
await getUserinfoMobile(this.info.id, params);
this.userInfo.mobile = this.editInfo.mobile;
this.nationCodeInit = this.nationCode;
this.mobileShow = !this.mobileShow;
this.mobileCode = null;
} catch (error) {
this.$message.info(this.$t('global.codeError'));
}
}
},
async sendMobileCode() {
const random = Math.floor((Math.random()*10000)+1);
const timeCount = Date.parse(new Date()) / 1000;
const pass = `${timeCount}${this.nationCode}${this.editInfo.mobile}${random}`;
const param = {
mobile: this.editInfo.mobile,
nationCode: this.nationCode,
rd: random,
time: timeCount,
token: md5(pass)
};
try {
this.mobileCodeTime = 30;
this.mobileTime = setInterval(() => {
this.mobileCodeTime--;
if (this.mobileCodeTime <= 0) {
this.mobileCodeTime = 0;
clearInterval(this.mobileTime);
this.mobileTime = null;
}
}, 1000);
await getUserinfoMobileCode(param);
} catch (error) {
this.$message.info(this.$t('global.codeFaile'));
}
},
switcherMobile() {
// this.editInfo.mobile = this.userInfo.mobile;
this.mobileShow = !this.mobileShow;
},
async saveMobile() {
if (this.editInfo.mobile && this.mobileCode) {
try {
const params = {
mobile: this.editInfo.mobile,
nationCode: this.nationCode,
validCode: this.mobileCode
};
await getUserinfoMobile(this.info.id, params);
this.userInfo.mobile = this.editInfo.mobile;
this.nationCodeInit = this.nationCode;
this.mobileShow = !this.mobileShow;
this.mobileCode = null;
} catch (error) {
this.$message.info(this.$t('global.codeError'));
}
}
},
async sendMobileCode() {
const random = Math.floor((Math.random() * 10000) + 1);
const timeCount = Date.parse(new Date()) / 1000;
const pass = `${timeCount}${this.nationCode}${this.editInfo.mobile}${random}`;
const param = {
mobile: this.editInfo.mobile,
nationCode: this.nationCode,
rd: random,
time: timeCount,
token: md5(pass)
};
try {
this.mobileCodeTime = 30;
this.mobileTime = setInterval(() => {
this.mobileCodeTime--;
if (this.mobileCodeTime <= 0) {
this.mobileCodeTime = 0;
clearInterval(this.mobileTime);
this.mobileTime = null;
}
}, 1000);
await getUserinfoMobileCode(param);
} catch (error) {
this.$message.info(this.$t('global.codeFaile'));
}
},
switcherEmail() {
// this.editInfo.email = this.userInfo.email;
this.emailShow = !this.emailShow;
},
async saveEmail() {
if (this.editInfo.email && this.emailCode) {
try {
const params = {
email: this.editInfo.email,
validCode: this.emailCode
};
await getUserinfoEmail(this.info.id, params);
this.userInfo.email = this.editInfo.email;
this.emailShow = !this.emailShow;
this.emailCode = null;
} catch (error) {
this.$message.info(this.$t('global.codeError'));
}
}
},
async sendEmailCode() {
try {
this.emailCodeTime = 30;
this.emailTime = setInterval(() => {
this.emailCodeTime--;
if (this.emailCodeTime <= 0) {
this.emailCodeTime = 0;
clearInterval(this.emailTime);
this.emailTime = null;
}
}, 1000);
await getUserinfoEmailCode(this.editInfo.email);
} catch (error) {
this.$message.info(this.$t('global.codeFaile'));
}
},
switcherEmail() {
// this.editInfo.email = this.userInfo.email;
this.emailShow = !this.emailShow;
},
async saveEmail() {
if (this.editInfo.email && this.emailCode) {
try {
const params = {
email: this.editInfo.email,
validCode: this.emailCode
};
await getUserinfoEmail(this.info.id, params);
this.userInfo.email = this.editInfo.email;
this.emailShow = !this.emailShow;
this.emailCode = null;
} catch (error) {
this.$message.info(this.$t('global.codeError'));
}
}
},
async sendEmailCode() {
try {
this.emailCodeTime = 30;
this.emailTime = setInterval(() => {
this.emailCodeTime--;
if (this.emailCodeTime <= 0) {
this.emailCodeTime = 0;
clearInterval(this.emailTime);
this.emailTime = null;
}
}, 1000);
await getUserinfoEmailCode(this.editInfo.email);
} catch (error) {
this.$message.info(this.$t('global.codeFaile'));
}
},
switcherPassWord() {
this.passwordShow = !this.passwordShow;
},
async savePassWord() {
if (this.newPassWord1.length <= 5) {
this.$message.info(this.$t('global.passWordLength'));
} else {
this.uploadPassword();
}
},
async uploadPassword() {
if (this.newPassWord1) {
//
const param = {
password: md5(this.newPassWord1),
vfCode: this.passWordCode
};
try {
await getUserinfoPassword(this.info.id, param);
this.passwordShow = !this.passwordShow;
this.newPassWord1 = '';
this.passWordCode = null;
} catch (error) {
console.log(error, 11);
}
} else {
this.$message.info(this.$t('global.passWordSome'));
}
},
async sendPassWordCode() {
if (this.userInfo.mobile) {
const random = Math.floor((Math.random()*10000)+1);
const timeCount = Date.parse(new Date()) / 1000;
const pass = `${timeCount}${this.nationCodeInit}${this.userInfo.mobile}${random}`;
const param = {
mobile: this.userInfo.mobile,
nationCode: this.nationCodeInit,
rd: random,
time: timeCount,
token: md5(pass)
};
try {
this.passWordCodeTime = 30;
this.passWordTime = setInterval(() => {
this.passWordCodeTime--;
if (this.passWordCodeTime <= 0) {
this.passWordCodeTime = 0;
clearInterval(this.mobileTime);
this.passWordTime = null;
}
}, 1000);
await getUserinfoMobileCode(param);
} catch (error) {
this.$message.info(this.$t('global.codeFaile'));
}
} else {
this.passwordShow = !this.passwordShow;
this.$message.info(this.$t('global.enterMobileNumber'));
}
}
}
switcherPassWord() {
this.passwordShow = !this.passwordShow;
},
async savePassWord() {
if (this.newPassWord1.length <= 5) {
this.$message.info(this.$t('global.passWordLength'));
} else {
this.uploadPassword();
}
},
async uploadPassword() {
if (this.newPassWord1) {
//
const param = {
password: md5(this.newPassWord1),
vfCode: this.passWordCode
};
try {
await getUserinfoPassword(this.info.id, param);
this.passwordShow = !this.passwordShow;
this.newPassWord1 = '';
this.passWordCode = null;
} catch (error) {
console.log(error, 11);
}
} else {
this.$message.info(this.$t('global.passWordSome'));
}
},
async sendPassWordCode() {
if (this.userInfo.mobile) {
const random = Math.floor((Math.random() * 10000) + 1);
const timeCount = Date.parse(new Date()) / 1000;
const pass = `${timeCount}${this.nationCodeInit}${this.userInfo.mobile}${random}`;
const param = {
mobile: this.userInfo.mobile,
nationCode: this.nationCodeInit,
rd: random,
time: timeCount,
token: md5(pass)
};
try {
this.passWordCodeTime = 30;
this.passWordTime = setInterval(() => {
this.passWordCodeTime--;
if (this.passWordCodeTime <= 0) {
this.passWordCodeTime = 0;
clearInterval(this.mobileTime);
this.passWordTime = null;
}
}, 1000);
await getUserinfoMobileCode(param);
} catch (error) {
this.$message.info(this.$t('global.codeFaile'));
}
} else {
this.passwordShow = !this.passwordShow;
this.$message.info(this.$t('global.enterMobileNumber'));
}
}
}
};
</script>

View File

@ -66,7 +66,6 @@ import MapPreview from '@/views/designPlatform/mapPreview';
import DesignPlatformUser from '@/views/designUser/index';
// import Replay from '@/views/replay/index';
import Package from '@/views/package/index';
import PackageDraft from '@/views/package/draft/ruleForm';
import PackageDetail from '@/views/package/detail';

View File

@ -2198,12 +2198,20 @@ export const IbpOperation = {
};
import LangStorage from '@/utils/lang';
import Favicon from '@/assets/icon/favicon.png';
import FaviconXty from '@/assets/icon/favicon_xty.png';
export const loginTitle = {
xty: '西安铁路职业技术学院城市轨道交通实训平台',
login: LangStorage.getLang() == 'en' ? ' Urban Rail Transit Practical Training Platform' : '城市轨道交通实训平台',
design: LangStorage.getLang() == 'en' ? ' Urban Rail Transit Design Platform' : '城市轨道交通设计平台',
designxty: '西安铁路职业技术学院城市轨道交通设计平台'
};
export const ProjectIcon = {
xty: FaviconXty,
login: Favicon,
design: Favicon,
designxty: FaviconXty
};
export const ProjectCode = {
xty: 'XTY',

View File

@ -8,60 +8,60 @@ import { getConverter } from '@/scripts/plugin/converter/manager';
var OperateConverter = function () { };
OperateConverter.prototype = {
/** 转换 操作 为 指令 */
convert: function (operate) {
if (operate.send) {
let command = null;
const converter = getConverter(OperateHandler.operates);
if (converter) {
command = converter.convert(OperateHandler.operates);
}
/** 转换 操作 为 指令 */
convert: function (operate) {
if (operate.send) {
let command = null;
const converter = getConverter(OperateHandler.operates);
if (converter) {
command = converter.convert(OperateHandler.operates);
}
if (command && command.error) {
// 命令错误,可以回退或清空(暂用回退)
OperateHandler.operates.pop();
store.dispatch('training/setTempStep', null);
command = null;
} else if (command && command.over) {
// 清空操作组
OperateHandler.cleanOperates();
store.dispatch('menuOperation/setButtonOperation', null);
}
if (command && command.error) {
// 命令错误,可以回退或清空(暂用回退)
OperateHandler.operates.pop();
store.dispatch('training/setTempStep', null);
command = null;
} else if (command && command.over) {
// 清空操作组
OperateHandler.cleanOperates();
store.dispatch('menuOperation/setButtonOperation', null);
}
return command;
} else if (operate.operation === OperationEvent.Command.cancel.menu.operation || operate.over) {
// 取消操作,清空操作组
OperateHandler.cleanOperates();
}
return null;
},
return command;
} else if (operate.operation === OperationEvent.Command.cancel.menu.operation || operate.over) {
// 取消操作,清空操作组
OperateHandler.cleanOperates();
}
return null;
},
sendToServer: function (command) {
const group = router.currentRoute.query.group;
return new Promise((resolve, reject) => {
sendCommand(group, command).then((response) => {
resolve(response);
}).catch(error => {
reject(error);
});
});
},
sendToServer: function (command) {
const group = router.currentRoute.query.group;
return new Promise((resolve, reject) => {
sendCommand(group, command).then((response) => {
resolve(response);
}).catch(error => {
reject(error);
});
});
},
/** 转换操作 为 指令并发送 */
convertAndSend: function (operate) {
return new Promise((resolve, reject) => {
const command = this.convert(operate);
if (command) {
this.sendToServer(command).then(response => {
resolve(response);
}).catch(error => {
reject(error);
});
} else {
resolve();
}
});
}
/** 转换操作 为 指令并发送 */
convertAndSend: function (operate) {
return new Promise((resolve, reject) => {
const command = this.convert(operate);
if (command) {
this.sendToServer(command).then(response => {
resolve(response);
}).catch(error => {
reject(error);
});
} else {
resolve();
}
});
}
};
export default new OperateConverter();

View File

@ -11,138 +11,137 @@ var OperateHandler = function () {
};
OperateHandler.prototype = {
/** 操作组 */
operates: [],
/** 操作组 */
operates: [],
backStep: function(num) {
this.operates = this.operates.slice(0, num);
},
backStep: function(num) {
this.operates = this.operates.slice(0, num);
},
/** 清空操作组 */
cleanOperates: function () {
this.operates.splice(0, this.operates.length);
},
/** 清空操作组 */
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 &&
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;
},
valid = true;
}
return valid;
},
/**
/**
* 根据模式验证操作步骤
*/
validate: function (operate) {
// 按钮操作之后,第二步错误操作菜单的情况,需要直接返回
if ((this.operates.length && operate.start === true) &&
(this.operates[0].type === 'mbm')) {
return false;
}
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();
}
// 如果是正常的第一步操作需要清空operates数组
if (operate.type === 'mbm' || operate.type === 'bar' || operate.start === true) {
this.cleanOperates();
}
this.operates.push(operate);
this.operates.push(operate);
// 预处理
const converter = getConverter(this.operates);
if (converter && converter.preHandle instanceof Function) {
operate = converter.preHandle(this.operates);
}
// 预处理
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;
}
}
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);
}
// 发送每一步的步骤数据;
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();
}
}
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);
return valid;
},
handle: function (operate) {
return new Promise((resolve, reject) => {
const rtn = { valid: false, response: null };
const valid = this.validate(operate);
rtn.valid = valid;
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;
}
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,76 +1,76 @@
import { getDomOffset } from '@/utils/index';
const config = {
namespaced: true,
namespaced: true,
state: {
width: document.documentElement.clientWidth, // 地图canvas 容器 宽度
height: document.documentElement.clientHeight, // 地图canvas 容器 高度
menuBarLoadedCount: 0, // menuBar加载完成
canvasSizeCount: 0, // 地图canvas 大小变更标识
canvasId: '', // 地图canvas容器dom id
canvasOffset: {}, // canvas dom 偏移
canvasOffsetCount: 0 // 地图canvas 偏移变更标识
},
state: {
width: document.documentElement.clientWidth, // 地图canvas 容器 宽度
height: document.documentElement.clientHeight, // 地图canvas 容器 高度
menuBarLoadedCount: 0, // menuBar加载完成
canvasSizeCount: 0, // 地图canvas 大小变更标识
canvasId: '', // 地图canvas容器dom id
canvasOffset: {}, // canvas dom 偏移
canvasOffsetCount: 0 // 地图canvas 偏移变更标识
},
getters: {
width: (state) => {
return state.width;
},
height: (state) => {
return state.height;
},
canvasId: (state) => {
return state.canvasId;
}
},
getters: {
width: (state) => {
return state.width;
},
height: (state) => {
return state.height;
},
canvasId: (state) => {
return state.canvasId;
}
},
mutations: {
SET_WIDTH: (state, width) => {
state.width = width;
},
SET_HEIGHT: (state, height) => {
state.height = height;
},
setCanvasId: (state, id) => {
state.canvasId = id;
},
updateMenuBar: (state) => {
state.menuBarLoadedCount += 1;
},
setCanvasOffset: (state, offset) => {
state.canvasOffset = offset;
}
},
actions: {
resize({ state, commit }, opt) {
if (opt.width) {
commit('SET_WIDTH', opt.width);
}
if (opt.height) {
commit('SET_HEIGHT', opt.height);
}
state.canvasSizeCount += 1;
},
mutations: {
SET_WIDTH: (state, width) => {
state.width = width;
},
SET_HEIGHT: (state, height) => {
state.height = height;
},
setCanvasId: (state, id) => {
state.canvasId = id;
},
updateMenuBar: (state) => {
state.menuBarLoadedCount += 1;
},
setCanvasOffset: (state, offset) => {
state.canvasOffset = offset;
}
},
actions: {
resize({ state, commit }, opt) {
if (opt.width) {
commit('SET_WIDTH', opt.width);
}
if (opt.height) {
commit('SET_HEIGHT', opt.height);
}
state.canvasSizeCount += 1;
},
updateMenuBar({ commit }) {
commit('updateMenuBar');
},
updateMenuBar({ commit }) {
commit('updateMenuBar');
},
setCurrentCancasId: ({state, dispatch, commit }, payLoad) => {
commit('setCanvasId', payLoad.id);
dispatch('resetCanvasOffset');
},
setCurrentCancasId: ({state, dispatch, commit }, payLoad) => {
commit('setCanvasId', payLoad.id);
dispatch('resetCanvasOffset');
},
resetCanvasOffset: ({ commit, state }) => {
const mapCanvas = document.getElementById(state.canvasId);
if (mapCanvas) {
const offset = getDomOffset(mapCanvas);
commit('setCanvasOffset', offset);
state.canvasOffsetCount += 1;
}
}
}
resetCanvasOffset: ({ commit, state }) => {
const mapCanvas = document.getElementById(state.canvasId);
if (mapCanvas) {
const offset = getDomOffset(mapCanvas);
commit('setCanvasOffset', offset);
state.canvasOffsetCount += 1;
}
}
}
};
export default config;

View File

@ -1,6 +1,8 @@
import deviceType from '@/jmap/constant/deviceType';
import { parser, updateMapData } from '@/jmap/utils/parser';
import Vue from 'vue';
import { deepAssign } from '@/utils/index';
/**
* 查询向上受影响的Devices
* @param {Object} map
@ -199,6 +201,84 @@ function saveMapDeviceDefaultRelations(state) {
}
}
function handleOperation(state, models) {
const list = [];
models.forEach(item => {
if (item._dispose) {
list.push({ operation: 'del', data: deepAssign({}, state.mapDevice[item.code]) });
} else if (state.mapDevice[item.code]) {
list.push({ operation: 'edit', data: deepAssign({}, state.mapDevice[item.code]) });
} else {
list.push({ operation: 'add', data: deepAssign({}, item) });
}
});
// console.log(list, '步骤数据');
if (list.length) {
if (state.stepData.length >= 15) { // 步骤数据最多储存15步
state.stepData.pop();
}
state.stepData.unshift(list);
state.recoverStepData = [];
}
}
// 撤销
function revocation(state, models) {
if (models && models.length) {
const list = [];
const stepList = [];
models.forEach(item => {
switch (item.operation) {
case 'add': {
list.push({ operation: 'del', data: deepAssign({}, state.mapDevice[item.data.code])});
stepList.push({...item.data, _dispose: true});
break;
}
case 'del': {
list.push({ operation: 'add', data: deepAssign({}, item.data)});
stepList.push({...item.data, _dispose: false});
break;
}
case 'edit': {
list.push({ operation: 'edit', data: deepAssign({}, state.mapDevice[item.data.code] || item.data)});
stepList.push({...item.data, _dispose: false});
break;
}
}
});
state.recoverStepData.unshift(list);
return stepList;
}
}
// 恢复
function recover(state, models) {
if (models && models.length) {
const list = [];
const stepList = [];
models.forEach(item => {
switch (item.operation) {
case 'add': {
list.push({ operation: 'del', data: deepAssign({}, state.mapDevice[item.data.code])});
stepList.push({...item.data, _dispose: true});
break;
}
case 'del': {
list.push({ operation: 'add', data: deepAssign({}, item.data)});
stepList.push({...item.data, _dispose: false});
break;
}
case 'edit': {
list.push({ operation: 'edit', data: deepAssign({}, state.mapDevice[item.data.code] || item.data)});
stepList.push({...item.data, _dispose: false});
break;
}
}
});
state.stepData.unshift(list);
return stepList;
}
}
/**
* 实训状态数据
*/
@ -206,6 +286,8 @@ const map = {
namespaced: true,
state: {
stepData: [], // 缓存数据
recoverStepData: [], // 缓存恢复数据
map: null, // 地图数据
dataZoom: {}, // 缩放位置
mapDevice: {}, // 解析后的地图数据
@ -220,6 +302,12 @@ const map = {
mapList: (state) => {
return state.mapList;
},
stepData: (state) => {
return state.stepData;
},
recoverStepData: (state) => {
return state.recoverStepData;
},
map: (state) => {
return state.map;
},
@ -378,6 +466,9 @@ const map = {
trainDetails: (state) => {
return state.trainDetails;
},
mapDevice: (state) => {
return state.mapDevice;
},
getDeviceByCode: (state) => (code) => {
return state.mapDevice[code];
},
@ -443,11 +534,13 @@ const map = {
state.dataZoom = dataZoom;
},
mapRender: (state, devices) => {
if (state.map) {
devices.forEach(elem => { updateMapData(state, elem); });
}
if (Vue.prototype.$jlmap) {
Vue.prototype.$jlmap.render(devices);
if (devices && devices.length) {
if (state.map) {
devices.forEach(elem => { updateMapData(state, elem); });
}
if (Vue.prototype.$jlmap) {
Vue.prototype.$jlmap.render(devices);
}
}
},
setTrainDetails: (state, details) => {
@ -530,19 +623,7 @@ const map = {
setMapDataIdList: ({ state }, data) => {
state.mapIdList[`mapDate_${data.mapId}`] = data.mapData;
},
updateMapDevices: ({ commit }, models) => {
return new Promise((resolve) => {
if (!(models instanceof Array)) {
models = [models];
}
commit('mapRender', models);
resolve(models);
});
},
deleteMapDevices: ({ commit, state }, models) => {
updateMapDevices: ({ commit, state }, models) => {
return new Promise((resolve) => {
if (!(models instanceof Array)) {
models = [models];
@ -550,16 +631,29 @@ const map = {
// 查找向上关联需要一起删除的设备
const effectedModelList = [];
models.forEach((device) => {
queryEffectedModels(state.map, device, effectedModelList);
models.forEach((model) => {
if (model['_dispose']) {
queryEffectedModels(state.map, model, effectedModelList);
} else {
effectedModelList.push(model);
}
});
effectedModelList.forEach(elem => { elem['_dispose'] = true; });
handleOperation(state, effectedModelList);
commit('mapRender', effectedModelList);
resolve(effectedModelList);
});
},
setRevocation({ state, commit }) {
commit('mapRender', revocation(state, state.stepData.shift() || [])); // 撤销
},
setRecover({ state, commit }) {
commit('mapRender', recover(state, state.recoverStepData.shift() || [])); // 恢复
},
saveMapDeviceDefaultRelations({ state }) {
saveMapDeviceDefaultRelations(state);
},

View File

@ -4,173 +4,173 @@ import { TrainingMode } from '@/scripts/ConstDic';
* 菜单操作状态数据
*/
const menuOperation = {
namespaced: true,
namespaced: true,
state: {
break: false, // 对话框菜单是否弹出(用于中断控制)
mbmpCount: 0, // 地图按钮菜单位置变更标识
buttonOperation: null, // 按钮菜单是否被按下
selected: {}, // 选中的地图对象
selectedCount: 0, // 选中对象变更标识
menu: null, // 弹出菜单设备
menuPosition: {}, // 弹出菜单位置
menuCount: 0, // 弹出菜单变更标识
menuParam: '', // 弹出菜单参数
magnifyCount: 0, // 地图放大比例标识
shrinkCount: 0, // 地图缩小比例标识
mapDrawSelectCount: 0 // 地图编辑点击标识
},
state: {
break: false, // 对话框菜单是否弹出(用于中断控制)
mbmpCount: 0, // 地图按钮菜单位置变更标识
buttonOperation: null, // 按钮菜单是否被按下
selected: {}, // 选中的地图对象
selectedCount: 0, // 选中对象变更标识
menu: null, // 弹出菜单设备
menuPosition: {}, // 弹出菜单位置
menuCount: 0, // 弹出菜单变更标识
menuParam: '', // 弹出菜单参数
magnifyCount: 0, // 地图放大比例标识
shrinkCount: 0, // 地图缩小比例标识
mapDrawSelectCount: 0 // 地图编辑点击标识
},
getters: {
selected: (state) => {
return state.selected;
},
mbmpCount: (state) => {
return state.mbmpCount;
},
menuParam: (state) => {
return state.menuParam;
},
buttonOperation: (state) => {
return state.buttonOperation;
},
checkDialogIsOpen: (state) => (menu) => {
return state.menu == menu;
}
},
getters: {
selected: (state) => {
return state.selected;
},
mbmpCount: (state) => {
return state.mbmpCount;
},
menuParam: (state) => {
return state.menuParam;
},
buttonOperation: (state) => {
return state.buttonOperation;
},
checkDialogIsOpen: (state) => (menu) => {
return state.menu == menu;
}
},
mutations: {
reset: (state) => {
state.menu = null;
state.selected = null;
state.menuPosition = {};
state.buttonOperation = null;
},
doBreak: (state, editStatus) => {
if (!state.break) {
state.break = true;
if (editStatus != TrainingMode.EDIT) {
state.menuCount += 1;
}
}
},
doRoute: (state) => {
if (state.break) {
state.break = false;
state.menuCount += 1;
}
},
setButtonOperation: (state, operation) => {
state.buttonOperation = operation;
},
setSelected: (state, selected) => {
state.selected = selected;
state.selectedCount += 1;
},
mbmpCountIncrement: (state) => {
state.mbmpCount += 1;
},
setMenu: (state, menu) => {
state.menu = menu;
state.menuCount += 1;
},
setMenuParam: (state, param) => {
state.menuParam = param;
},
setMenuPosition: (state, position) => {
state.menuPosition = position;
},
setMenuPositionOffset: (state, offset) => {
if (state.menuPosition) {
state.menuPosition = {
x: state.menuPosition.x + offset.x,
y: state.menuPosition.y + offset.y
};
}
},
setMagnifyCount: (state) => {
state.magnifyCount += 1;
},
setShrinkCount: (state) => {
state.shrinkCount += 1;
},
setMapDrawSelectCount: (state) => {
state.mapDrawSelectCount += 1;
}
},
mutations: {
reset: (state) => {
state.menu = null;
state.selected = null;
state.menuPosition = {};
state.buttonOperation = null;
},
doBreak: (state, editStatus) => {
if (!state.break) {
state.break = true;
if (editStatus != TrainingMode.EDIT) {
state.menuCount += 1;
}
}
},
doRoute: (state) => {
if (state.break) {
state.break = false;
state.menuCount += 1;
}
},
setButtonOperation: (state, operation) => {
state.buttonOperation = operation;
},
setSelected: (state, selected) => {
state.selected = selected;
state.selectedCount += 1;
},
mbmpCountIncrement: (state) => {
state.mbmpCount += 1;
},
setMenu: (state, menu) => {
state.menu = menu;
state.menuCount += 1;
},
setMenuParam: (state, param) => {
state.menuParam = param;
},
setMenuPosition: (state, position) => {
state.menuPosition = position;
},
setMenuPositionOffset: (state, offset) => {
if (state.menuPosition) {
state.menuPosition = {
x: state.menuPosition.x + offset.x,
y: state.menuPosition.y + offset.y
};
}
},
setMagnifyCount: (state) => {
state.magnifyCount += 1;
},
setShrinkCount: (state) => {
state.shrinkCount += 1;
},
setMapDrawSelectCount: (state) => {
state.mapDrawSelectCount += 1;
}
},
actions: {
/**
actions: {
/**
* 放大地图
*/
handleMagnifyCount: ({ commit }) => {
commit('setMagnifyCount');
},
handleMagnifyCount: ({ commit }) => {
commit('setMagnifyCount');
},
/**
/**
* 缩小地图
*/
handleShrinkCount: ({ commit }) => {
commit('setShrinkCount');
},
handleShrinkCount: ({ commit }) => {
commit('setShrinkCount');
},
/** 清除菜单操作*/
reset: ({ commit }) => {
commit('reset');
},
/** 清除菜单操作*/
reset: ({ commit }) => {
commit('reset');
},
/**
/**
* 处理操作是否中断
*/
handleBreakFlag: ({ commit, rootState }, payLoad) => {
if (rootState.training.mode === TrainingMode.EDIT && rootState.training.started && payLoad && payLoad.break) {
commit('doBreak', rootState.training.mode);
} else {
commit('doRoute');
}
},
handleBreakFlag: ({ commit, rootState }, payLoad) => {
if (rootState.training.mode === TrainingMode.EDIT && rootState.training.started && payLoad && payLoad.break) {
commit('doBreak', rootState.training.mode);
} else {
commit('doRoute');
}
},
/**
/**
* 地图按钮菜单位置改变事件
*/
mbmPositionChange: ({ commit }) => {
commit('mbmpCountIncrement');
},
mbmPositionChange: ({ commit }) => {
commit('mbmpCountIncrement');
},
/**
/**
* 设置按钮菜单按钮
*/
setButtonOperation: ({ commit }, operation) => {
commit('setButtonOperation', operation);
},
setButtonOperation: ({ commit }, operation) => {
commit('setButtonOperation', operation);
},
/**
/**
* 设置选中model
*/
setSelected: ({ commit }, selected) => {
commit('setSelected', selected);
},
setSelected: ({ commit }, selected) => {
commit('setSelected', selected);
},
/**
/**
* 设置菜单
*/
setPopMenu: ({ commit }, payLoad) => {
commit('setMenu', payLoad.menu);
commit('setMenuParam', payLoad.param);
commit('setMenuPosition', payLoad.position);
},
setPopMenu: ({ commit }, payLoad) => {
commit('setMenu', payLoad.menu);
commit('setMenuParam', payLoad.param);
commit('setMenuPosition', payLoad.position);
},
/**
/**
* 更新坐标
*/
setMenuPositionOffset: ({ commit }, offset) => {
commit('setMenuPositionOffset', offset);
},
setMenuPositionOffset: ({ commit }, offset) => {
commit('setMenuPositionOffset', offset);
},
setMapDrawSelectCount: ({ commit }) => {
commit('setMapDrawSelectCount');
}
}
setMapDrawSelectCount: ({ commit }) => {
commit('setMapDrawSelectCount');
}
}
};
export default menuOperation;

View File

@ -8,552 +8,552 @@ import LangStorage from '@/utils/lang';
* 实训状态数据
*/
const training = {
namespaced: true,
namespaced: true,
state: {
mode: null, // 模式
operatemode: null, // 操作模式 管理员/普通
started: false, // 是否开始
switchcount: 0, // 开关标识
basicInfo: {}, // 实训基本信息数据
offsetStationCode: '', // 偏移到车站
rezoomCount: 0, // 车站变更标识
steps: [], // 实训步骤数据
tempStep: {}, // 临时步骤数据(编辑模式)
order: -1, // 实训进行到第几步
orderCount: 0, // 步骤变更标识
operateErrMsg: '', // 操作错误提示信息
subscribeCount: 0, // 仿真订阅完成标识
score: 0, // 实训得分
usedTime: 0, // 实训所需时间
timeInterval: null, // 计时器
tipEvent: 0, // 提示刷新检测
operate: {}, // 操作model,
initTime: 0, // 当前系统时间
prdType: '', // 产品类型
roles: '', // 角色权限类型
group: '' // 设置全局 group
},
state: {
mode: null, // 模式
operatemode: null, // 操作模式 管理员/普通
started: false, // 是否开始
switchcount: 0, // 开关标识
basicInfo: {}, // 实训基本信息数据
offsetStationCode: '', // 偏移到车站
rezoomCount: 0, // 车站变更标识
steps: [], // 实训步骤数据
tempStep: {}, // 临时步骤数据(编辑模式)
order: -1, // 实训进行到第几步
orderCount: 0, // 步骤变更标识
operateErrMsg: '', // 操作错误提示信息
subscribeCount: 0, // 仿真订阅完成标识
score: 0, // 实训得分
usedTime: 0, // 实训所需时间
timeInterval: null, // 计时器
tipEvent: 0, // 提示刷新检测
operate: {}, // 操作model,
initTime: 0, // 当前系统时间
prdType: '', // 产品类型
roles: '', // 角色权限类型
group: '' // 设置全局 group
},
getters: {
tempStep: (state) => {
return state.tempStep;
},
steps: (state) => {
return state.steps;
},
order: (state) => {
return state.order;
},
offsetStationCode: (state) => {
return state.offsetStationCode;
},
basicInfo: (state) => {
return state.basicInfo;
},
mode: (state) => {
return state.mode;
},
operatemode: (state) => {
return state.operatemode;
},
started: (state) => {
return state.started;
},
score: (state) => {
return state.score;
},
usedTime: (state) => {
return state.usedTime;
},
tipEvent: (state) => {
return state.tipEvent;
},
initTime: (state) => {
return state.initTime;
},
prdType: (state) => {
return state.prdType;
},
roles: (state) => {
return state.roles;
},
// 视图中的列车列表
viewTrainList: (state) => () =>{
const trainList = [];
const mapDevice = Vue.prototype.$jlmap.mapDevice;
Object.values(mapDevice).forEach(device => {
if (device && device._type === deviceType.Train) {
trainList.push(device);
}
});
getters: {
tempStep: (state) => {
return state.tempStep;
},
steps: (state) => {
return state.steps;
},
order: (state) => {
return state.order;
},
offsetStationCode: (state) => {
return state.offsetStationCode;
},
basicInfo: (state) => {
return state.basicInfo;
},
mode: (state) => {
return state.mode;
},
operatemode: (state) => {
return state.operatemode;
},
started: (state) => {
return state.started;
},
score: (state) => {
return state.score;
},
usedTime: (state) => {
return state.usedTime;
},
tipEvent: (state) => {
return state.tipEvent;
},
initTime: (state) => {
return state.initTime;
},
prdType: (state) => {
return state.prdType;
},
roles: (state) => {
return state.roles;
},
// 视图中的列车列表
viewTrainList: (state) => () =>{
const trainList = [];
const mapDevice = Vue.prototype.$jlmap.mapDevice;
Object.values(mapDevice).forEach(device => {
if (device && device._type === deviceType.Train) {
trainList.push(device);
}
});
return trainList;
}
},
return trainList;
}
},
mutations: {
changeMode: (state, mode) => {
state.mode = mode;
},
changeOperateMode: (state, mode) => {
state.operatemode = mode;
},
start: (state) => {
state.started = true;
state.switchcount += 1;
},
over: (state) => {
state.started = false;
state.switchcount += 1;
},
updateMapState: (state, deviceStatus) => {
Vue.prototype.$jlmap && Vue.prototype.$jlmap.update(deviceStatus);
},
setMapDefaultState: (state) =>{
Vue.prototype.$jlmap && Vue.prototype.$jlmap.setDefaultState();
},
setBasicInfo: (state, basicInfo) => {
state.basicInfo = basicInfo;
},
setOffsetStationCode: (state, offsetStationCode) => {
state.offsetStationCode = offsetStationCode || null;
if (state % 100 === 0) {
state.rezoomCount = 0;
} else {
state.rezoomCount += 1;
}
},
setSteps: (state, steps) => {
state.steps = steps;
},
addStep: (state, step) => {
state.steps.push(step);
},
next: (state) => {
state.order += 1;
state.orderCount += 1;
},
orderCountIncrement: (state) => {
state.orderCount += 1;
},
resetOrder: (state) => {
state.order = -1;
},
backOrder: (state, stepNum) => {
if (state.order > stepNum) {
state.order -= stepNum;
state.orderCount += 1;
}
},
setTempStep: (state, step) => {
state.tempStep = step;
},
mutations: {
changeMode: (state, mode) => {
state.mode = mode;
},
changeOperateMode: (state, mode) => {
state.operatemode = mode;
},
start: (state) => {
state.started = true;
state.switchcount += 1;
},
over: (state) => {
state.started = false;
state.switchcount += 1;
},
updateMapState: (state, deviceStatus) => {
Vue.prototype.$jlmap && Vue.prototype.$jlmap.update(deviceStatus);
},
setMapDefaultState: (state) =>{
Vue.prototype.$jlmap && Vue.prototype.$jlmap.setDefaultState();
},
setBasicInfo: (state, basicInfo) => {
state.basicInfo = basicInfo;
},
setOffsetStationCode: (state, offsetStationCode) => {
state.offsetStationCode = offsetStationCode || null;
if (state % 100 === 0) {
state.rezoomCount = 0;
} else {
state.rezoomCount += 1;
}
},
setSteps: (state, steps) => {
state.steps = steps;
},
addStep: (state, step) => {
state.steps.push(step);
},
next: (state) => {
state.order += 1;
state.orderCount += 1;
},
orderCountIncrement: (state) => {
state.orderCount += 1;
},
resetOrder: (state) => {
state.order = -1;
},
backOrder: (state, stepNum) => {
if (state.order > stepNum) {
state.order -= stepNum;
state.orderCount += 1;
}
},
setTempStep: (state, step) => {
state.tempStep = step;
},
setOperateErrMsg: (state, errMsg) => {
state.operateErrMsg = errMsg;
},
setOperateErrMsg: (state, errMsg) => {
state.operateErrMsg = errMsg;
},
setHasSubscribed: (state) => {
state.subscribeCount++;
},
setHasSubscribed: (state) => {
state.subscribeCount++;
},
setScore: (state, score) => {
state.score = score;
},
resetScore: (state) => {
state.score = '';
},
tipEventIncrement: (state) => {
state.tipEvent++;
},
resetUsedTime: (state) => {
state.usedTime = 0;
},
countUsedTime: (state) => {
if (state.timeInterval) {
clearInterval(state.timeInterval);
state.timeInterval = null;
}
state.timeInterval = setInterval(() => {
state.usedTime++;
state.initTime += 1000;
}, 1000);
},
stopCountTime: (state) => {
if (state.timeInterval) {
clearInterval(state.timeInterval);
state.timeInterval = null;
}
},
setOperate: (state, operate) => {
state.operate = operate;
},
setInitTime: (state, operate) => {
state.initTime = operate;
},
setPrdType: (state, prdType) => {
state.prdType = prdType;
},
setRoles: (state, roles) => {
state.roles = roles;
},
setGroup: (state, group) => {
state.group = group;
}
},
setScore: (state, score) => {
state.score = score;
},
resetScore: (state) => {
state.score = '';
},
tipEventIncrement: (state) => {
state.tipEvent++;
},
resetUsedTime: (state) => {
state.usedTime = 0;
},
countUsedTime: (state) => {
if (state.timeInterval) {
clearInterval(state.timeInterval);
state.timeInterval = null;
}
state.timeInterval = setInterval(() => {
state.usedTime++;
state.initTime += 1000;
}, 1000);
},
stopCountTime: (state) => {
if (state.timeInterval) {
clearInterval(state.timeInterval);
state.timeInterval = null;
}
},
setOperate: (state, operate) => {
state.operate = operate;
},
setInitTime: (state, operate) => {
state.initTime = operate;
},
setPrdType: (state, prdType) => {
state.prdType = prdType;
},
setRoles: (state, roles) => {
state.roles = roles;
},
setGroup: (state, group) => {
state.group = group;
}
},
actions: {
/**
actions: {
/**
* 清除仿真所在组
*/
clearSimulationGroup: ({ commit }, type) => {
commit('clearSimulationGroup', type);
},
/**
clearSimulationGroup: ({ commit }, type) => {
commit('clearSimulationGroup', type);
},
/**
* 设置socke已经连接
*/
setHasSubscribed: ({ commit }) => {
commit('setHasSubscribed');
},
/**
setHasSubscribed: ({ commit }) => {
commit('setHasSubscribed');
},
/**
* 模式变更
*/
changeMode: ({ commit }, opts) => {
commit('changeMode', opts.mode);
},
changeMode: ({ commit }, opts) => {
commit('changeMode', opts.mode);
},
/**
/**
* 操作模式变更
*/
changeOperateMode: ({ commit }, opts) => {
commit('changeOperateMode', opts.mode);
},
changeOperateMode: ({ commit }, opts) => {
commit('changeOperateMode', opts.mode);
},
/**
/**
* 重置实训状态
*/
reset: ({ commit }) => {
commit('over');
commit('resetOrder');
commit('stopCountTime');
reset: ({ commit }) => {
commit('over');
commit('resetOrder');
commit('stopCountTime');
// 清空计时器以及得分
commit('resetUsedTime');
commit('resetScore');
// 设置其他属性状态
commit('setOffsetStationCode', null);
},
// 清空计时器以及得分
commit('resetUsedTime');
commit('resetScore');
// 设置其他属性状态
commit('setOffsetStationCode', null);
},
/**
/**
* 开始
*/
start: ({ commit }) => {
// 清空操作组
OperateHandler.cleanOperates();
// 清空计时器以及得分
commit('stopCountTime');
commit('resetUsedTime');
commit('resetScore');
commit('start');
},
start: ({ commit }) => {
// 清空操作组
OperateHandler.cleanOperates();
// 清空计时器以及得分
commit('stopCountTime');
commit('resetUsedTime');
commit('resetScore');
commit('start');
},
/**
/**
* 结束
*/
over: ({ commit }) => {
commit('over');
commit('resetOrder');
commit('stopCountTime');
},
over: ({ commit }) => {
commit('over');
commit('resetOrder');
commit('stopCountTime');
},
/**
/**
* step步骤是否结束
*/
isStepOver: ({ state }) => {
if (state.order >= state.steps.length) {
return true;
}
},
isStepOver: ({ state }) => {
if (state.order >= state.steps.length) {
return true;
}
},
/**
/**
* 停止计时
*/
setStopCountTime: ({ commit }) => {
commit('stopCountTime');
},
setStopCountTime: ({ commit }) => {
commit('stopCountTime');
},
/**
/**
* 主动判断是否结束
*/
judgeFinish: ({ dispatch, commit, state }, rtn) => {
if (state.started) {
if (state.order >= state.steps.length) {
if (rtn && rtn.valid) {
commit('next');
commit('setOperateErrMsg', { errMsg: LangStorage.getLang() == 'en' ? 'Correct operation! Training is over!' : '操作正确!实训结束!', color: 'green' });
} else {
commit('setOperateErrMsg', { errMsg: LangStorage.getLang() == 'en' ? 'Operation error! Training is over!' : '操作错误!实训结束!', color: 'red' });
}
dispatch('over');
dispatch('changeMode', { mode: null });
if (rtn.hasOwnProperty('score')) {
commit('setScore', rtn.score || 0);
}
} else {
rtn && rtn.valid && commit('next');
}
}
},
judgeFinish: ({ dispatch, commit, state }, rtn) => {
if (state.started) {
if (state.order >= state.steps.length) {
if (rtn && rtn.valid) {
commit('next');
commit('setOperateErrMsg', { errMsg: LangStorage.getLang() == 'en' ? 'Correct operation! Training is over!' : '操作正确!实训结束!', color: 'green' });
} else {
commit('setOperateErrMsg', { errMsg: LangStorage.getLang() == 'en' ? 'Operation error! Training is over!' : '操作错误!实训结束!', color: 'red' });
}
dispatch('over');
dispatch('changeMode', { mode: null });
if (rtn.hasOwnProperty('score')) {
commit('setScore', rtn.score || 0);
}
} else {
rtn && rtn.valid && commit('next');
}
}
},
/**
/**
* 开始实训模式变更和开始的混合操作
*/
startTraining: ({ commit }, opts) => {
commit('resetOrder');
commit('changeMode', opts.mode);
if (opts.start) {
// 清空计时器以及得分
commit('stopCountTime');
commit('resetUsedTime');
commit('resetScore');
// 开始实训
commit('start');
commit('next');
// 开始计时
commit('countUsedTime');
}
},
startTraining: ({ commit }, opts) => {
commit('resetOrder');
commit('changeMode', opts.mode);
if (opts.start) {
// 清空计时器以及得分
commit('stopCountTime');
commit('resetUsedTime');
commit('resetScore');
// 开始实训
commit('start');
commit('next');
// 开始计时
commit('countUsedTime');
}
},
/**
/**
* 开始实训模式变更和开始的混合操作
*/
backSteps: ({ commit }, stepNum) => {
if (Number.isInteger) {
commit('backOrder', stepNum);
}
},
backSteps: ({ commit }, stepNum) => {
if (Number.isInteger) {
commit('backOrder', stepNum);
}
},
/**
/**
* 下一步
*/
next: ({ commit, state }, operate) => {
commit('setOperate', operate);
return new Promise((resolve, reject) => {
if (!state.started && !state.mode) {
commit('setOperateErrMsg', { errMsg: LangStorage.getLang() == 'en' ? 'Please click start, start training!' : '请点击开始,开始实训!', color: 'red' });
return;
}
next: ({ commit, state }, operate) => {
commit('setOperate', operate);
return new Promise((resolve, reject) => {
if (!state.started && !state.mode) {
commit('setOperateErrMsg', { errMsg: LangStorage.getLang() == 'en' ? 'Please click start, start training!' : '请点击开始,开始实训!', color: 'red' });
return;
}
// 处理operation
OperateHandler.handle(operate).then(rtn => {
if (state.started) {
// 教学和联系模式需要给出过程步骤提示
if (TrainingMode.TEACH === state.mode || TrainingMode.PRACTICE === state.mode) {
if (rtn && rtn.valid) {
commit('next');
commit('setOperateErrMsg', { errMsg: LangStorage.getLang() == 'en' ? "Correct operation! That's great!" : '操作正确!真棒!', color: 'green' });
commit('tipEventIncrement');
} else {
if (!operate.repeat) {
commit('setOperateErrMsg', { errMsg: LangStorage.getLang() == 'en' ? 'operation mistake!' : '操作错误!', color: 'red' });
}
}
} else if (TrainingMode.EXAM === state.mode || TrainingMode.TEST === state.mode) {
// 测试和考试不给提示
rtn && rtn.valid && commit('next');
}
}
resolve(rtn);
}).catch(error => {
reject(error);
});
});
},
// 处理operation
OperateHandler.handle(operate).then(rtn => {
if (state.started) {
// 教学和联系模式需要给出过程步骤提示
if (TrainingMode.TEACH === state.mode || TrainingMode.PRACTICE === state.mode) {
if (rtn && rtn.valid) {
commit('next');
commit('setOperateErrMsg', { errMsg: LangStorage.getLang() == 'en' ? "Correct operation! That's great!" : '操作正确!真棒!', color: 'green' });
commit('tipEventIncrement');
} else {
if (!operate.repeat) {
commit('setOperateErrMsg', { errMsg: LangStorage.getLang() == 'en' ? 'operation mistake!' : '操作错误!', color: 'red' });
}
}
} else if (TrainingMode.EXAM === state.mode || TrainingMode.TEST === state.mode) {
// 测试和考试不给提示
rtn && rtn.valid && commit('next');
}
}
resolve(rtn);
}).catch(error => {
reject(error);
});
});
},
/**
/**
* 提示消息重新加载
*/
tipReload: ({ commit }) => {
commit('orderCountIncrement');
},
tipReload: ({ commit }) => {
commit('orderCountIncrement');
},
/**
/**
* 更新偏移位置车站
*/
updateOffsetStationCode: ({ commit }, payLoad) => {
commit('setOffsetStationCode', payLoad.offsetStationCode);
},
updateOffsetStationCode: ({ commit }, payLoad) => {
commit('setOffsetStationCode', payLoad.offsetStationCode);
},
/**
/**
* 设置实训数据
*/
setTrainingData: ({ commit }, trainingData) => {
const basicInfo = {
id: trainingData.id,
name: trainingData.name,
remarks: trainingData.remarks,
prdType: trainingData.prdType,
minDuration: trainingData.minDuration,
maxDuration: trainingData.maxDuration
};
commit('setBasicInfo', basicInfo);
const steps = trainingData.steps;
commit('setSteps', steps);
const offsetStationCode = trainingData.locateDeviceCode;
commit('setOffsetStationCode', offsetStationCode);
commit('setMapDefaultState');
},
setTrainingData: ({ commit }, trainingData) => {
const basicInfo = {
id: trainingData.id,
name: trainingData.name,
remarks: trainingData.remarks,
prdType: trainingData.prdType,
minDuration: trainingData.minDuration,
maxDuration: trainingData.maxDuration
};
commit('setBasicInfo', basicInfo);
const steps = trainingData.steps;
commit('setSteps', steps);
const offsetStationCode = trainingData.locateDeviceCode;
commit('setOffsetStationCode', offsetStationCode);
commit('setMapDefaultState');
},
/**
/**
* 设置步骤数据
*/
setSteps: ({ commit }, steps) => {
commit('setSteps', steps);
},
setSteps: ({ commit }, steps) => {
commit('setSteps', steps);
},
/**
/**
* 添加步骤数据
*/
addStep: ({ state, commit }, step) => {
return new Promise((resolve, reject) => {
try {
var valid = true;
const steps = state.steps;
if (steps && steps.length > 0) {
const last = steps.length - 1;
if (steps[last].type === step.type &&
addStep: ({ state, commit }, step) => {
return new Promise((resolve, reject) => {
try {
var valid = true;
const steps = state.steps;
if (steps && steps.length > 0) {
const last = steps.length - 1;
if (steps[last].type === step.type &&
steps[last].code === step.code &&
steps[last].operation === step.operation) {
steps.splice(last, 1);
step.order = step.order - 1;
valid = false;
}
}
commit('addStep', step);
resolve(valid);
} catch (error) {
reject(error);
}
});
},
/**
steps.splice(last, 1);
step.order = step.order - 1;
valid = false;
}
}
commit('addStep', step);
resolve(valid);
} catch (error) {
reject(error);
}
});
},
/**
* 设置地图默认状态
*/
setMapDefaultState: ({ commit }) => {
commit('setMapDefaultState');
},
setMapDefaultState: ({ commit }) => {
commit('setMapDefaultState');
},
/**
/**
* 更新地图设备状态数据
*/
updateMapState: ({ commit }, deviceStatus) => {
commit('updateMapState', deviceStatus);
},
updateMapState: ({ commit }, deviceStatus) => {
commit('updateMapState', deviceStatus);
},
/**
/**
* 设置临时步骤数据
*/
setTempStep: ({ commit }, step) => {
commit('setTempStep', step);
},
setTempStep: ({ commit }, step) => {
commit('setTempStep', step);
},
/**
/**
* 开始教学模式
*/
teachModeStart: ({ dispatch }, mode) => {
const payLoad = { start: true, mode: mode };
dispatch('startTraining', payLoad);
},
teachModeStart: ({ dispatch }, mode) => {
const payLoad = { start: true, mode: mode };
dispatch('startTraining', payLoad);
},
/**
/**
* 开始考试模式
*/
examModeStart: ({ dispatch }) => {
const payLoad = { start: true, mode: TrainingMode.EXAM };
dispatch('startTraining', payLoad);
},
examModeStart: ({ dispatch }) => {
const payLoad = { start: true, mode: TrainingMode.EXAM };
dispatch('startTraining', payLoad);
},
/**
/**
* 仿真和大屏和计划模式
*/
simulationStart: ({ dispatch }) => {
const payLoad = { start: true, mode: TrainingMode.NORMAL };
dispatch('startTraining', payLoad);
},
simulationStart: ({ dispatch }) => {
const payLoad = { start: true, mode: TrainingMode.NORMAL };
dispatch('startTraining', payLoad);
},
/**
/**
* 结束模式
*/
end: ({ commit }, mode) => {
commit('over');
commit('resetOrder');
commit('stopCountTime');
commit('changeMode', mode);
},
end: ({ commit }, mode) => {
commit('over');
commit('resetOrder');
commit('stopCountTime');
commit('changeMode', mode);
},
/**
/**
* 是否教学模式
*/
isTeachMode: ({ state }) => {
return new Promise((resolve, reject) => {
if (state.mode === TrainingMode.TEACH) {
resolve();
} else {
reject(new Error('not teach mode'));
}
});
},
isTeachMode: ({ state }) => {
return new Promise((resolve, reject) => {
if (state.mode === TrainingMode.TEACH) {
resolve();
} else {
reject(new Error('not teach mode'));
}
});
},
/**
/**
* 设置用户得分
*/
setScore: ({ commit }, score) => {
commit('setScore', score);
},
setScore: ({ commit }, score) => {
commit('setScore', score);
},
/**
/**
* 设置tip变化事件
*/
emitTipFresh: ({ commit }) => {
commit('tipEventIncrement');
},
emitTipFresh: ({ commit }) => {
commit('tipEventIncrement');
},
/**
/**
* 设置WebSocket链接状态
*/
setConnected: ({ commit }, isConnected) => {
commit('setConnected', isConnected);
},
setConnected: ({ commit }, isConnected) => {
commit('setConnected', isConnected);
},
/**
/**
* 设置系统时间
*/
setInitTime: ({ commit }, initTime) => {
commit('setInitTime', initTime);
},
setInitTime: ({ commit }, initTime) => {
commit('setInitTime', initTime);
},
/**
/**
* 设置产品类型
*/
setPrdType: ({ commit }, prdType) => {
commit('setPrdType', prdType);
},
setPrdType: ({ commit }, prdType) => {
commit('setPrdType', prdType);
},
/**
/**
* 设置角色列表
*/
setRoles: ({ commit }, roles) => {
commit('setRoles', roles);
},
setRoles: ({ commit }, roles) => {
commit('setRoles', roles);
},
/**
/**
* 设置仿真组
*/
setGroup: ({ commit }, group) => {
commit('setGroup', group);
}
}
setGroup: ({ commit }, group) => {
commit('setGroup', group);
}
}
};
export default training;

View File

@ -6,7 +6,7 @@ export function getBaseUrl() {
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5: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'; // 杜康
} else {
BASE_API = process.env.VUE_APP_BASE_API;

View File

@ -66,17 +66,6 @@ export default {
height() {
return this.$store.state.app.height - 260;
}
},
watch: {
},
created() {
},
mounted() {
// this.loadInitData();
},
beforeDestroy() {
},
methods: {
show(lessonId) {

View File

@ -18,189 +18,175 @@ import { listPublishMap } from '@/api/jmap/map';
import LessonDetail from './detail';
export default {
name: 'LessonApproval',
components: {
LessonDetail
},
data() {
return {
dialogFormVisible: false,
rejectId: '',
formModel: {
explanation: ''
},
mapList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '120px',
reset: true,
queryObject: {
mapId: {
type: 'select',
label: this.$t('approval.map')+this.$t('global.colon'),
config: {
data: []
}
},
lessonName: {
type: 'text',
label: this.$t('lesson.courseName')
},
userName: {
type: 'text',
label: this.$t('approval.applicant')+this.$t('global.colon')
}
}
},
queryList: {
query: reviewLessonList,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('lesson.courseName'),
prop: 'name'
},
{
title: this.$t('approval.map'),
prop: 'mapId ',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.mapId, this.mapList, ['value', 'label']); },
tagType: (row) => { return ''; }
},
{
title: this.$t('approval.courseDescription'),
prop: 'remarks'
},
{
title: this.$t('approval.applicant'),
prop: 'userName'
},
{
title: this.$t('approval.applyTime'),
prop: 'uploadTime',
type: 'tag',
columnValue: (row) => { return this.handleTime(row.uploadTime); },
tagType: (row) => { return ''; }
},
{
type: 'button',
title: this.$t('global.operate'),
width: '400',
buttons: [
{
name: this.$t('approval.lookOver'),
handleClick: this.goDetail,
type: ''
},
{
name: this.$t('approval.applyPassed'),
handleClick: this.pass,
type: ''
},
{
name: this.$t('approval.applyReject'),
handleClick: this.noPass,
type: ''
}
]
}
]
},
form: {
labelWidth: '150px',
items: [
{ prop: 'explanation', label: this.$t('approval.explanation'), type: 'textarea', required: true}
]
},
rules: {
explanation: [
{ required: true, message: this.$t('rules.enterRejectReason'), trigger: 'blur' }
]
}
};
},
watch: {
},
created() {
listPublishMap().then(response=>{
this.mapList = response.data.map(elem => { return { value: elem.id, label: elem.name } });
this.queryForm.queryObject.mapId.config.data = this.mapList;
});
},
mounted() {
},
beforeDestroy() {
},
methods: {
goDetail(index, row) {
this.$refs.lessonDetail.show(row.id);
},
pass(index, row) {
this.$confirm(this.$t('tip.publishTheCourseHint'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
const params = {
cityCode: row.cityCode,
mapId: row.mapId,
name: row.name,
prdCode: row.prdCode
};
adminPublishLesson(params, row.id).then(response => {
this.loading = false;
this.$message.success(this.$t('tip.coursePublishSuccessful'));
this.doClose();
}).catch(() => {
this.loading = false;
this.$messageBox(this.$t('tip.coursePublishFailed'));
});
});
},
noPass(index, row) {
this.dialogFormVisible = true;
this.rejectId = row.id;
},
handleTime(time) {
const timeList = time.split('T');
return timeList[0] + ' ' +timeList[1];
},
doClose() {
this.$refs.queryListPage.refresh(true);
},
rejectConfirm() {
this.$refs.dataform.validateForm(() => {
if (this.rejectId) {
rejectedLessonRelease(this.formModel, this.rejectId).then(resp =>{
this.loading = false;
this.$message.success(this.$t('tip.rejectedCourseReleaseApplicationSuccessful'));
this.dialogFormVisible = false;
this.rejectId = '';
this.doClose();
}).catch(() => {
this.loading = false;
this.$messageBox(this.$t('tip.rejectedCourseReleaseApplicationSuccessful'));
this.dialogFormVisible = false;
this.rejectId = '';
this.doClose();
});
}
});
},
rejectCancel() {
this.dialogFormVisible = false;
this.rejectId = '';
this.textarea = '';
}
}
name: 'LessonApproval',
components: {
LessonDetail
},
data() {
return {
dialogFormVisible: false,
rejectId: '',
formModel: {
explanation: ''
},
mapList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '120px',
reset: true,
queryObject: {
mapId: {
type: 'select',
label: this.$t('approval.map') + this.$t('global.colon'),
config: {
data: []
}
},
lessonName: {
type: 'text',
label: this.$t('lesson.courseName')
},
userName: {
type: 'text',
label: this.$t('approval.applicant') + this.$t('global.colon')
}
}
},
queryList: {
query: reviewLessonList,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('lesson.courseName'),
prop: 'name'
},
{
title: this.$t('approval.map'),
prop: 'mapId ',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.mapId, this.mapList, ['value', 'label']); },
tagType: (row) => { return ''; }
},
{
title: this.$t('approval.courseDescription'),
prop: 'remarks'
},
{
title: this.$t('approval.applicant'),
prop: 'userName'
},
{
title: this.$t('approval.applyTime'),
prop: 'uploadTime',
type: 'tag',
columnValue: (row) => { return row.uploadTime.replace('T', ' '); },
tagType: (row) => { return ''; }
},
{
type: 'button',
title: this.$t('global.operate'),
width: '400',
buttons: [
{
name: this.$t('approval.lookOver'),
handleClick: this.goDetail,
type: ''
},
{
name: this.$t('approval.applyPassed'),
handleClick: this.pass,
type: ''
},
{
name: this.$t('approval.applyReject'),
handleClick: this.noPass,
type: ''
}
]
}
]
},
form: {
labelWidth: '150px',
items: [
{ prop: 'explanation', label: this.$t('approval.explanation'), type: 'textarea', required: true}
]
},
rules: {
explanation: [
{ required: true, message: this.$t('rules.enterRejectReason'), trigger: 'blur' }
]
}
};
},
created() {
listPublishMap().then(response=>{
this.mapList = response.data.map(elem => { return { value: elem.id, label: elem.name }; });
this.queryForm.queryObject.mapId.config.data = this.mapList;
});
},
methods: {
goDetail(index, row) {
this.$refs.lessonDetail.show(row.id);
},
pass(index, row) {
this.$confirm(this.$t('tip.publishTheCourseHint'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
const params = {
cityCode: row.cityCode,
mapId: row.mapId,
name: row.name,
prdId: row.prdId
};
adminPublishLesson(params, row.id).then(response => {
this.loading = false;
this.$message.success(this.$t('tip.coursePublishSuccessful'));
this.doClose();
}).catch(() => {
this.loading = false;
this.$messageBox(this.$t('tip.coursePublishFailed'));
});
});
},
noPass(index, row) {
this.dialogFormVisible = true;
this.rejectId = row.id;
},
doClose() {
this.$refs.queryListPage.refresh(true);
},
rejectConfirm() {
this.$refs.dataform.validateForm(() => {
if (this.rejectId) {
rejectedLessonRelease(this.formModel, this.rejectId).then(resp =>{
this.loading = false;
this.$message.success(this.$t('tip.rejectedCourseReleaseApplicationSuccessful'));
this.dialogFormVisible = false;
this.rejectId = '';
this.doClose();
}).catch(() => {
this.loading = false;
this.$messageBox(this.$t('tip.rejectedCourseReleaseApplicationSuccessful'));
this.dialogFormVisible = false;
this.rejectId = '';
this.doClose();
});
}
});
},
rejectCancel() {
this.dialogFormVisible = false;
this.rejectId = '';
this.textarea = '';
}
}
};
</script>
<style lang="scss" scoped>

View File

@ -1,20 +1,19 @@
<template>
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<run-plan-operate ref="applyPassed" :title="$t('approval.passedRunPlan')" @reloadTable="reloadTable" type="applyPassed" @create="handleConfirmPass" />
<run-plan-operate ref="applyReject" :title="$t('approval.rejectRunPlan')" @reloadTable="reloadTable" type="applyReject" @create="handleConfirmReject" />
<run-plan-operate ref="applyPassed" :title="$t('approval.passedRunPlan')" type="applyPassed" @reloadTable="reloadTable" @create="handleConfirmPass" />
<run-plan-operate ref="applyReject" :title="$t('approval.rejectRunPlan')" type="applyReject" @reloadTable="reloadTable" @create="handleConfirmReject" />
</div>
</template>
<script>
import RunPlanOperate from './operate';
import { reviewRunPlanList, publishRunPlan, rejectRunPlan, previewRunPlan } from '@/api/designPlatform';
import { listPublishMap } from '@/api/jmap/map';
// import { getSkinCodeList } from '@/api/management/mapskin';
import { launchFullscreen } from '@/utils/screen';
import { UrlConfig } from '@/router/index';
export default {
name: 'ScriptApproval',
name: 'RunPlanApproval',
components: {
RunPlanOperate
},
@ -102,16 +101,8 @@ export default {
}
};
},
watch: {
},
created() {
},
mounted() {
this.loadInitData();
},
beforeDestroy() {
},
methods: {
reloadTable() {

View File

@ -1,95 +1,93 @@
<template>
<div>
<el-dialog :title="title" :visible.sync="dialogVisible" width="500px" :before-close="doClose" center>
<data-form ref="dataform" :form="form" :formModel="formModel" :rules="rules"></data-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doCreate">{{$t('global.confirm')}}</el-button>
<el-button @click="doClose">{{$t('global.cancel')}}</el-button>
</span>
</el-dialog>
</div>
<div>
<el-dialog :title="title" :visible.sync="dialogVisible" width="500px" :before-close="doClose" center>
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doCreate">{{ $t('global.confirm') }}</el-button>
<el-button @click="doClose">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
name: 'ScriptOperate',
data() {
return {
dialogVisible: false,
formModel:{
runPlanName:'',
id:'',
explanation:'',
},
isShow: false,
export default {
name: 'ScriptOperate',
props: {
title: {type:String, required:true},
type: {type:String, required:true}
},
data() {
return {
dialogVisible: false,
formModel:{
runPlanName:'',
id:'',
explanation:''
},
isShow: false
};
},
computed: {
form() {
let form = {};
if (this.type == 'applyPassed') {
form = {
labelWidth: '150px',
items: [
{ prop: 'runPlanName', label: this.$t('approval.runPlanName'), type: 'text', required: true}
]
};
} else {
form = {
labelWidth: '150px',
items: [
{ prop: 'explanation', label: this.$t('approval.explanation'), type: 'textarea', required: true}
]
};
}
return form;
},
props: {
title: String,
type:String,
},
computed: {
form() {
let form={};
if(this.type=="applyPassed"){
form = {
labelWidth: '150px',
items: [
{ prop: 'runPlanName', label: this.$t('approval.runPlanName'), type: 'text', required: true},
]
}
}
else{
form = {
labelWidth: '150px',
items: [
{ prop: 'explanation', label: this.$t('approval.explanation'), type: 'textarea', required: true},
]
}
}
return form
},
rules() {
let crules ={};
if(this.type=="applyPassed"){
crules={
runPlanName: [
{ required: true, message: this.$t('approval.inputRunPlanName'), trigger: 'blur' },
]
}
}
else{
crules={
explanation:[
{ required: true, message: this.$t('approval.inputRejectExplanation'), trigger: 'blur',max:200 },
]
}
}
return crules
},
},
methods: {
doShow(row) {
if(this.type=="applyPassed"){
this.formModel.runPlanName=row.name;
}
this.formModel.id=row.id;
this.dialogVisible = true
},
doCreate() {
let self = this
this.$refs.dataform.validateForm(() => {
self.$emit('create', Object.assign({}, this.formModel));
self.doClose()
})
},
doClose() {
this.$refs.dataform.resetForm();
this.isShow = false;
this.dialogVisible = false
rules() {
let crules = {};
if (this.type == 'applyPassed') {
crules = {
runPlanName: [
{ required: true, message: this.$t('approval.inputRunPlanName'), trigger: 'blur' }
]
};
} else {
crules = {
explanation:[
{ required: true, message: this.$t('approval.inputRejectExplanation'), trigger: 'blur', max:200 }
]
};
}
return crules;
}
};
},
methods: {
doShow(row) {
if (this.type == 'applyPassed') {
this.formModel.runPlanName = row.name;
}
this.formModel.id = row.id;
this.dialogVisible = true;
},
doCreate() {
const self = this;
this.$refs.dataform.validateForm(() => {
self.$emit('create', Object.assign({}, this.formModel));
self.doClose();
});
},
doClose() {
this.$refs.dataform.resetForm();
this.isShow = false;
this.dialogVisible = false;
}
}
};
</script>
<style lang="scss" scoped>
/deep/ .el-dialog--center .el-dialog__body{

View File

@ -1,179 +1,167 @@
<template>
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<script-operate ref='applyReject' @reloadTable="reloadTable" @create="handleConfirmReject" :title="$t('approval.rejectScript')">
</script-operate>
</div>
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<script-operate ref="applyReject" :title="$t('approval.rejectScript')" @reloadTable="reloadTable" @create="handleConfirmReject" />
</div>
</template>
<script>
import { launchFullscreen } from '@/utils/screen';
import { UrlConfig } from '@/router/index';
import { scriptDraftRecordNotify } from '@/api/simulation';
import ScriptOperate from './operate';
import { reviewScriptList,publishScript,rejectScript } from '@/api/designPlatform';
import { listPublishMap } from '@/api/jmap/map';
export default {
name: 'ScriptApproval',
components: {
ScriptOperate
},
data() {
return{
allMapList:[],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '100px',
reset: true,
queryObject: {
mapId: {
type: 'select',
label: this.$t('approval.map'),
config: {
data: []
}
},
'name':{
type: 'text',
label: this.$t('approval.scriptName')
},
'creatorName': {
type: 'text',
label: this.$t('approval.applicant')
import { launchFullscreen } from '@/utils/screen';
import { UrlConfig } from '@/router/index';
import { scriptDraftRecordNotify } from '@/api/simulation';
import ScriptOperate from './operate';
import { reviewScriptList, publishScript, rejectScript } from '@/api/designPlatform';
import { listPublishMap } from '@/api/jmap/map';
export default {
name: 'ScriptApproval',
components: {
ScriptOperate
},
data() {
return {
allMapList:[],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '100px',
reset: true,
queryObject: {
mapId: {
type: 'select',
label: this.$t('approval.map'),
config: {
data: []
}
},
'name':{
type: 'text',
label: this.$t('approval.scriptName')
},
'creatorName': {
type: 'text',
label: this.$t('approval.applicant')
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('approval.scriptName'),
width:250,
prop: 'name'
},
{
title: this.$t('approval.map'),
prop: 'mapId ',
width:250,
type: 'tag',
columnValue: (row) => { return this.$convertField(row.mapId , this.mapList, ['value', 'label']); },
tagType: (row) => { return ''; }
},
{
title: this.$t('approval.scriptDescription'),
prop: 'description'
},
{
title: this.$t('approval.applicant'),
prop: 'creatorName'
},
{
title: this.$t('approval.applyTime'),
prop: 'uploadTime',
type: 'tag',
columnValue: (row) => { return row.uploadTime.replace("T"," ")},
tagType: (row) => { return ''; }
},
{
type: 'button',
title: this.$t('global.operate'),
width: '450',
buttons: [
{
name: this.$t('approval.applyPassed'),
handleClick: this.applyPassed,
type: ''
},
{
name: this.$t('approval.applyReject'),
handleClick: this.applyReject,
type: ''
},
{
name: this.$t('approval.scriptPreview'),
handleClick: this.scriptPreview,
type: ''
}
]
}
]
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('approval.scriptName'),
width:250,
prop: 'name'
},
{
title: this.$t('approval.map'),
prop: 'mapId ',
width:250,
type: 'tag',
columnValue: (row) => { return this.$convertField(row.mapId, this.mapList, ['value', 'label']); },
tagType: (row) => { return ''; }
},
{
title: this.$t('approval.scriptDescription'),
prop: 'description'
},
{
title: this.$t('approval.applicant'),
prop: 'creatorName'
},
{
title: this.$t('approval.applyTime'),
prop: 'uploadTime',
type: 'tag',
columnValue: (row) => { return row.uploadTime.replace('T', ' '); },
tagType: (row) => { return ''; }
},
{
type: 'button',
title: this.$t('global.operate'),
width: '450',
buttons: [
{
name: this.$t('approval.applyPassed'),
handleClick: this.applyPassed,
type: ''
},
{
name: this.$t('approval.applyReject'),
handleClick: this.applyReject,
type: ''
},
{
name: this.$t('approval.scriptPreview'),
handleClick: this.scriptPreview,
type: ''
}
]
}
]
}
};
},
mounted() {
this.loadInitData();
},
methods: {
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
},
created(){
async loadInitData() {
try {
//
this.mapList = [];
const res = await listPublishMap();
this.allMapList = res.data;
this.mapList = res.data.map(elem => { return { value: elem.id, label: elem.name }; });
this.queryForm.queryObject.mapId.config.data = this.mapList;
} catch (error) {
console.error(error, '获取发布地图');
}
},
mounted(){
this.loadInitData();
queryFunction(params) {
return reviewScriptList(params);
},
beforeDestroy(){
applyPassed(index, row) {
this.handleConfirmPass(row);
},
watch: {
applyReject(index, row) {
this.$refs.applyReject.doShow(row);
},
methods: {
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
},
goDetail() {
this.$router.push({path:``});
},
async loadInitData() {
try {
//
this.mapList = [];
const res = await listPublishMap();
this.allMapList=res.data;
this.mapList = res.data.map(elem => { return { value: elem.id, label: elem.name } });
this.queryForm.queryObject.mapId.config.data=this.mapList;
} catch (error) {
console.error(error, '获取发布地图');
}
},
queryFunction(params) {
return reviewScriptList(params);
},
applyPassed(index,row){
this.handleConfirmPass(row);
},
applyReject(index,row){
this.$refs.applyReject.doShow(row);
},
scriptPreview(index,row){
let mapInfo=this.allMapList.find(elem=>{return elem.id==row.mapId});
scriptDraftRecordNotify(row.id).then(resp => {
const query = { mapId: row.mapId, group: resp.data, scriptId: row.id,skinCode:mapInfo.skinCode,try:0};
this.$router.push({ path: `${UrlConfig.design.display}/demon`, query });
launchFullscreen();
}).catch(error => {
this.$messageBox(`${this.$t('scriptRecord.createSimulationFail')}: ${error.message}`);
});
},
handleConfirmReject(data){
rejectScript(data.id,data).then(resp => {
this.reloadTable();
this.$message.success(this.$t('approval.rejectScriptSuccess'));
}).catch(error => {
this.$messageBox(`${this.$t('approval.rejectScriptFailed')}: ${error.message}`);
})
},
handleConfirmPass(data){
publishScript(data.id).then(resp => {
this.reloadTable();
this.$message.success(this.$t('approval.passedScriptSuccess'));
}).catch(error => {
this.$messageBox(`${this.$t('approval.passedScriptFailed')}: ${error.message}`);
})
},
scriptPreview(index, row) {
const mapInfo = this.allMapList.find(elem=>{ return elem.id == row.mapId; });
scriptDraftRecordNotify(row.id).then(resp => {
const query = { mapId: row.mapId, group: resp.data, scriptId: row.id, skinCode:mapInfo.skinCode, try:0};
this.$router.push({ path: `${UrlConfig.design.display}/demon`, query });
launchFullscreen();
}).catch(error => {
this.$messageBox(`${this.$t('scriptRecord.createSimulationFail')}: ${error.message}`);
});
},
handleConfirmReject(data) {
rejectScript(data.id, data).then(resp => {
this.reloadTable();
this.$message.success(this.$t('approval.rejectScriptSuccess'));
}).catch(error => {
this.$messageBox(`${this.$t('approval.rejectScriptFailed')}: ${error.message}`);
});
},
handleConfirmPass(data) {
publishScript(data.id).then(resp => {
this.reloadTable();
this.$message.success(this.$t('approval.passedScriptSuccess'));
}).catch(error => {
this.$messageBox(`${this.$t('approval.passedScriptFailed')}: ${error.message}`);
});
}
}
};
</script>
<style lang="scss" scoped>
/deep/

View File

@ -1,68 +1,67 @@
<template>
<div>
<el-dialog :title="title" :visible.sync="dialogVisible" width="500px" :before-close="doClose" center>
<data-form ref="dataform" :form="form" :formModel="formModel" :rules="rules"></data-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doCreate">{{$t('global.confirm')}}</el-button>
<el-button @click="doClose">{{$t('global.cancel')}}</el-button>
</span>
</el-dialog>
</div>
<div>
<el-dialog :title="title" :visible.sync="dialogVisible" width="500px" :before-close="doClose" center>
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doCreate">{{ $t('global.confirm') }}</el-button>
<el-button @click="doClose">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
name: 'ScriptOperate',
data() {
return {
dialogVisible: false,
formModel:{
id:'',
explanation:'',
}
export default {
name: 'ScriptOperate',
props: {
title:{type:String, required:true}
},
data() {
return {
dialogVisible: false,
formModel:{
id:'',
explanation:''
}
};
},
computed: {
form() {
const form = {
labelWidth: '150px',
items: [
{ prop: 'explanation', label: this.$t('approval.explanation'), type: 'textarea', required: true}
]
};
return form;
},
props: {
title: String,
type:String,
},
computed: {
form() {
let form={
labelWidth: '150px',
items: [
{ prop: 'explanation', label: this.$t('approval.explanation'), type: 'textarea', required: true},
]
}
return form
},
rules() {
let crules ={
explanation:[
{ required: true, message: this.$t('approval.inputRejectExplanation'), trigger: 'blur',max:200 },
]
}
return crules
},
},
methods: {
doShow(row) {
this.formModel.id=row.id;
this.dialogVisible = true
},
doCreate() {
let self = this
this.$refs.dataform.validateForm(() => {
self.$emit('create', Object.assign({}, this.formModel));
self.doClose()
})
},
doClose() {
this.$refs.dataform.resetForm();
this.dialogVisible = false
}
rules() {
const crules = {
explanation:[
{ required: true, message: this.$t('approval.inputRejectExplanation'), trigger: 'blur', max:200 }
]
};
return crules;
}
};
},
methods: {
doShow(row) {
this.formModel.id = row.id;
this.dialogVisible = true;
},
doCreate() {
const self = this;
this.$refs.dataform.validateForm(() => {
self.$emit('create', Object.assign({}, this.formModel));
self.doClose();
});
},
doClose() {
this.$refs.dataform.resetForm();
this.dialogVisible = false;
}
}
};
</script>
<style lang="scss" scoped>
/deep/ .el-dialog--center .el-dialog__body{

View File

@ -1,9 +1,9 @@
<template>
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="600px" :before-close="handleClose" center>
<div>
<el-alert title="一次只能领取一个权限,领到的权限是专用权限,不可再次分发" type="warning" show-icon :closable="closable" style="margin-bottom:10px" />
<el-alert :title="$t('permission.distributeTips')" type="warning" show-icon :closable="closable" style="margin-bottom:10px" />
<el-form ref="distributeForm" :rules="rules" :model="formModel">
<el-form-item key="date" prop="date" :label="this.$t('global.selectionTime')" :required="false" label-width="100px">
<el-form-item key="date" prop="date" :label="this.$t('global.selectionTime')" :required="false" label-width="140px">
<el-date-picker
v-model="formModel.date"
align="right"
@ -22,33 +22,33 @@
>
<el-table-column
prop="permissionName"
label="权限名称"
:label="$t('permission.permissionName')"
align="center"
/>
<el-table-column
prop="amount"
label="权限总数"
:label="$t('permission.permissionTotal')"
align="center"
width="80"
/>
<el-table-column
prop="remains"
label="剩余权限"
:label="$t('permission.permissionRemains')"
align="center"
width="80"
/>
<el-table-column
prop="isPackage"
label="是否万能"
:label="$t('permission.isPackage')"
align="center"
width="80"
>
<template slot-scope="scope">
{{ scope.row.isPackage?'是':'否' }}
{{ scope.row.isPackage? $t('global.yes'):$t('global.no') }}
</template>
</el-table-column>
<el-table-column
label="分发权限数量"
:label="$t('permission.numOfDistribute') "
align="center"
>
<template slot-scope="scope">
@ -87,7 +87,7 @@ export default {
endTime: '',
date: ''
},
prdCode: '',
prdId: '',
mapId: '',
numberMessage: '',
PermissionType: '',
@ -149,10 +149,9 @@ export default {
changeSelectDate() {
if (this.formModel.date) {
this.isLoading = true;
const data = {mapId:this.mapId, proCode:this.prdCode, startTime:this.formModel.date[0], endTime:this.formModel.date[1]};
const data = {mapId:this.mapId, prdId:this.prdId, startTime:this.formModel.date[0], endTime:this.formModel.date[1], type:this.PermissionType};
if (this.PermissionType == PermissionType.LESSON || this.PermissionType == PermissionType.EXAM) {
data.lessonId = this.formModel.lessonId;
data.type = this.PermissionType;
}
getAvailableUserPermission(data).then(res=>{
this.isLoading = false;
@ -176,7 +175,7 @@ export default {
if (data) {
this.formModel.lessonId = data.id;
this.formModel.lessonName = data.name;
this.prdCode = data.prdCode;
this.prdId = data.prdId;
this.mapId = data.mapId;
this.PermissionType = data.PermissionType;
this.setTotalMax();
@ -185,16 +184,24 @@ export default {
handleSure() {
this.$refs['distributeForm'].validate((info) => {
if (info) {
this.isLoading = true;
const model = {
startTime: this.formModel.date[0],
endTime: this.formModel.date[1],
userPermissionAndAmountVOList:[],
distribute: false
};
let count = 0;
this.formModel.permissionList.forEach(data=>{
if (data.chooseNumber > 0) {
count++;
}
model.userPermissionAndAmountVOList.push({'userPermissionId':data.id, 'amount':data.chooseNumber});
});
if (count <= 0) {
this.$messageBox( this.$t('error.permissionAtLeast'));
return false;
}
this.isLoading = true;
//
givePermission(model).then(response => {
this.isLoading = false;

View File

@ -1,9 +1,9 @@
<template>
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="600px" :before-close="handleClose" center>
<div>
<el-alert title="一次可以领取多个权限,领到的权限可以继续转赠" type="warning" show-icon :closable="closable" style="margin-bottom:10px" />
<el-alert :title="$t('permission.transferTips')" type="warning" show-icon :closable="closable" style="margin-bottom:10px" />
<el-form ref="transferForm" :rules="rules" :model="formModel">
<el-form-item key="date" prop="date" :label="this.$t('global.selectionTime')" :required="false" label-width="100px">
<el-form-item key="date" prop="date" :label="this.$t('global.selectionTime')" :required="false" label-width="140px">
<el-date-picker
v-model="formModel.date"
align="right"
@ -22,33 +22,33 @@
>
<el-table-column
prop="permissionName"
label="权限名称"
:label="$t('permission.permissionName')"
align="center"
/>
<el-table-column
prop="amount"
label="权限总数"
:label="$t('permission.permissionTotal')"
align="center"
width="80"
/>
<el-table-column
prop="remains"
label="剩余权限"
:label="$t('permission.permissionRemains')"
align="center"
width="80"
/>
<el-table-column
prop="isPackage"
label="是否万能"
:label="$t('permission.isPackage')"
align="center"
width="80"
>
<template slot-scope="scope">
{{ scope.row.isPackage?'是':'否' }}
{{ scope.row.isPackage? $t('global.yes'):$t('global.no') }}
</template>
</el-table-column>
<el-table-column
label="转赠权限数量"
:label="$t('permission.numOfTransfer')"
align="center"
>
<template slot-scope="scope">
@ -87,7 +87,7 @@ export default {
endTime: '',
date: ''
},
prdCode: '',
prdId: '',
mapId: '',
numberMessage: '',
PermissionType: '',
@ -149,10 +149,9 @@ export default {
changeSelectDate() {
if (this.formModel.date) {
this.isLoading = true;
const data = {mapId:this.mapId, proCode:this.prdCode, startTime:`${this.formModel.date[0]} 00:00:00`, endTime:`${this.formModel.date[1]} 23:59:59`};
const data = {mapId:this.mapId, prdId:this.prdId, startTime:`${this.formModel.date[0]} 00:00:00`, endTime:`${this.formModel.date[1]} 23:59:59`, type:this.PermissionType};
if (this.PermissionType == PermissionType.LESSON || this.PermissionType == PermissionType.EXAM) {
data.lessonId = this.formModel.lessonId;
data.type = this.PermissionType;
}
getAvailableUserPermission(data).then(res=>{
this.isLoading = false;
@ -176,7 +175,7 @@ export default {
if (data) {
this.formModel.lessonId = data.id;
this.formModel.lessonName = data.name;
this.prdCode = data.prdCode;
this.prdId = data.prdId;
this.mapId = data.mapId;
this.PermissionType = data.PermissionType;
this.setTotalMax();
@ -185,16 +184,24 @@ export default {
handleSure() {
this.$refs['transferForm'].validate((info) => {
if (info) {
this.isLoading = true;
const model = {
startTime:`${this.formModel.date[0]} 00:00:00`,
endTime:`${this.formModel.date[1]} 23:59:59`,
userPermissionAndAmountVOList:[],
distribute: true
};
let count = 0;
this.formModel.permissionList.forEach(data=>{
if (data.chooseNumber > 0) {
count++;
}
model.userPermissionAndAmountVOList.push({'userPermissionId':data.id, 'amount':data.chooseNumber});
});
if (count <= 0) {
this.$messageBox( this.$t('error.permissionAtLeast'));
return false;
}
this.isLoading = true;
//
givePermission(model).then(response => {
this.isLoading = false;
@ -212,35 +219,6 @@ export default {
});
}
});
// this.$refs.dataform.validateForm(() => {
// const model = {
// startTime: `${this.formModel.date[0]} 00:00:00`,
// endTime: `${this.formModel.date[1]} 23:59:59`,
// amount: this.formModel.total,
// permissionType: this.PermissionType
// };
// if (this.PermissionType == PermissionType.LESSON || this.PermissionType == PermissionType.EXAM) {
// model['lessonId'] = this.formModel.lessonId;
// model['mapId'] = this.mapId;
// model['prdCode'] = this.prdCode;
// } else if (this.PermissionType == PermissionType.SIMULATION) {
// model['mapId'] = this.mapId;
// model['prdCode'] = this.prdCode;
// }
// //
// permissionTurnAdd(model).then(response => {
// const url = response.data;
// this.$emit('QrCodeShow', {
// url: url,
// title: this.$t('global.transferQrcode')
// });
// this.dialogVisible = false;
// this.$emit('initLoadPage');
// this.handleClose();
// }).catch(() => {
// this.$messageBox(this.$t('error.getTransferQrcodeFailed'));
// });
// });
},
close() {
this.dialogVisible = false;

View File

@ -46,98 +46,98 @@ import ConfirmDraft from './confirm';
import FinishDraft from './finish';
export default {
name: 'LessonDetail',
components: {
CommitDraft,
ConfirmDraft,
FinishDraft
},
data() {
return {
active: -1,
order: {},
title: '',
finishStatus: '02',
orderData: {},
routeDict: {
0: 'commit',
1: 'confirm',
2: 'finish'
}
};
},
computed: {
systemName() {
switch (this.$route.query.permissionType) {
case PermissionType.LESSON: return this.$t('global.coursePrice');
case PermissionType.EXAM: return this.$t('global.testPrice');
case PermissionType.SIMULATION: return this.$t('global.simulationPrice');
case PermissionType.SCREEN: return this.$t('global.timeUnitPrice');
}
return '';
},
height() {
if (/\/dp\//.test(this.$route.path) ||
name: 'LessonDetail',
components: {
CommitDraft,
ConfirmDraft,
FinishDraft
},
data() {
return {
active: -1,
order: {},
title: '',
finishStatus: '02',
orderData: {},
routeDict: {
0: 'commit',
1: 'confirm',
2: 'finish'
}
};
},
computed: {
systemName() {
switch (this.$route.query.permissionType) {
case PermissionType.LESSON: return this.$t('global.coursePrice');
case PermissionType.EXAM: return this.$t('global.testPrice');
case PermissionType.SIMULATION: return this.$t('global.simulationPrice');
case PermissionType.SCREEN: return this.$t('global.timeUnitPrice');
}
return '';
},
height() {
if (/\/dp\//.test(this.$route.path) ||
/\/plan\//.test(this.$route.path)) {
return this.$store.state.app.height;
}
return this.$store.state.app.height;
}
return this.$store.state.app.height - 61;
}
},
watch: {
$route(newVal) {
this.initLoadPage();
}
},
mounted() {
this.initLoadPage();
},
methods: {
//
initLoadPage() {
const data = {
permissionType: this.$route.query.permissionType
};
if (this.$route.query.permissionType != '04') {
data['mapId'] = this.$route.query.mapId;
data['prdCode'] = this.$route.query.prdCode;
data['lessonId'] = this.$route.query.lessonId;
}
getCommodityDetailByParams(data).then(response => {
this.active = 0;
this.orderData = response.data;
}).catch(() => {
this.$messageBox(this.$t('tip.failedCourse'));
});
},
//
commit(data) {
this.active = 1;
this.order = data;
},
//
confirm(data) {
this.active = 2;
this.finishStatus = data;
this.$refs.finish.createCountTimer();
},
//
finish(data) {
this.active = 0;
const type = this.$route.query.permissionType;
if (type === PermissionType.LESSON) {
this.$router.replace({ path: `${UrlConfig.trainingPlatform.teachDetail}/${this.$route.query.subSystem}`, query: {lessonId: this.$route.query.lessonId, mapId: this.$route.query.mapId, prdCode: this.$route.query.prdCode}});
} else if (type === PermissionType.EXAM) {
this.$router.replace({ path: `${UrlConfig.trainingPlatform.course}/${this.$route.query.subSystem}`});
} else if (type === PermissionType.SCREEN) {
this.$router.replace({ path: `${UrlConfig.dp.detail}/${this.$route.params.lessonId}` });
} else if (type === PermissionType.SIMULATION) {
this.$router.replace({ path: `${UrlConfig.trainingPlatform.prodDetail}/${this.$route.query.subSystem}`, query: { mapId: this.$route.query.mapId} });
} else {
this.$router.replace({ path: `/` });
}
}
}
return this.$store.state.app.height - 61;
}
},
watch: {
$route(newVal) {
this.initLoadPage();
}
},
mounted() {
this.initLoadPage();
},
methods: {
//
initLoadPage() {
const data = {
permissionType: this.$route.query.permissionType
};
if (this.$route.query.permissionType != '04') {
data['mapId'] = this.$route.query.mapId;
data['prdId'] = this.$route.query.prdId;
data['lessonId'] = this.$route.query.lessonId;
}
getCommodityDetailByParams(data).then(response => {
this.active = 0;
this.orderData = response.data;
}).catch(() => {
this.$messageBox(this.$t('tip.failedCourse'));
});
},
//
commit(data) {
this.active = 1;
this.order = data;
},
//
confirm(data) {
this.active = 2;
this.finishStatus = data;
this.$refs.finish.createCountTimer();
},
//
finish(data) {
this.active = 0;
const type = this.$route.query.permissionType;
if (type === PermissionType.LESSON) {
this.$router.replace({ path: `${UrlConfig.trainingPlatform.teachDetail}/${this.$route.query.subSystem}`, query: {lessonId: this.$route.query.lessonId, mapId: this.$route.query.mapId, prdId: this.$route.query.prdId}});
} else if (type === PermissionType.EXAM) {
this.$router.replace({ path: `${UrlConfig.trainingPlatform.course}/${this.$route.query.subSystem}`});
} else if (type === PermissionType.SCREEN) {
this.$router.replace({ path: `${UrlConfig.dp.detail}/${this.$route.params.lessonId}` });
} else if (type === PermissionType.SIMULATION) {
this.$router.replace({ path: `${UrlConfig.trainingPlatform.prodDetail}/${this.$route.query.subSystem}`, query: { mapId: this.$route.query.mapId} });
} else {
this.$router.replace({ path: `/` });
}
}
}
};
</script>

View File

@ -48,7 +48,7 @@ export default {
loading: true,
buttonLoading: false,
currentLessonId: '',
currentPrdCode: '',
currentPrdId: '',
productList: [],
courseModel: {
id: '',
@ -57,7 +57,7 @@ export default {
skinCode: '',
remarks: '',
prdType: '',
prdCode: '',
prdId: '',
pmsList: []
},
jointShow: false,
@ -108,11 +108,11 @@ export default {
skinCode: resp.data.mapPrd.skinCode,
remarks: resp.data.mapPrd.remarks,
prdType: resp.data.mapPrd.prdType,
prdCode: resp.data.mapPrd.code,
prdId: resp.data.mapPrd.id,
pmsList: resp.data.permissionList || [],
PermissionType: PermissionType.SIMULATION
};
this.currentPrdCode = resp.data.mapPrd.code;
this.currentPrdId = resp.data.mapPrd.id;
if (resp.data.mapPrd.prdType === '03') {
this.getJointTrainingList();
}
@ -121,7 +121,7 @@ export default {
this.tryUser = 1;
const paras = {
mapId: this.mapId,
prdCode: this.courseModel.prdCode,
prdId: this.courseModel.prdId,
permissionType: PermissionType.SIMULATION
};
@ -166,7 +166,7 @@ export default {
this.buttonLoading = true;
const param = {
mapId: Number(this.mapId),
prdCode: this.courseModel.prdCode
prdId: this.courseModel.prdId
};
const res = await postCreateRoom(param);
if (res && res.code == 200) {
@ -212,9 +212,9 @@ export default {
},
jumpScheduling() {
this.buttonLoading = true;
const data = { mapId: this.courseModel.mapId, code: this.currentPrdCode };
const data = { mapId: this.courseModel.mapId, prdId: this.currentPrdId };
schedulingNotify(data).then(resp => {
const query = { skinCode: this.courseModel.skinCode, group: resp.data, prdType: this.courseModel.prdType, mapId: this.courseModel.mapId, code: this.currentPrdCode, goodsId: this.goodsId, try: this.tryUser };
const query = { skinCode: this.courseModel.skinCode, group: resp.data, prdType: this.courseModel.prdType, mapId: this.courseModel.mapId, code: this.currentPrdId, goodsId: this.goodsId, try: this.tryUser };
this.$router.push({ path: `${UrlConfig.display}/demon`, query: query });
launchFullscreen();
}).catch(error => {
@ -223,10 +223,10 @@ export default {
});
},
jump() {
const data = { mapId: this.courseModel.mapId, code: this.currentPrdCode };
const data = { mapId: this.courseModel.mapId, mapPrdId: this.currentPrdId };
this.buttonLoading = true;
simulationNotify(data).then(resp => {
const query = { skinCode: this.courseModel.skinCode, group: resp.data, prdType: this.courseModel.prdType, mapId: this.courseModel.mapId, code: this.currentPrdCode, goodsId: this.goodsId, try: this.tryUser };
const query = { skinCode: this.courseModel.skinCode, group: resp.data, prdType: this.courseModel.prdType, mapId: this.courseModel.mapId, code: this.currentPrdId, goodsId: this.goodsId, try: this.tryUser };
this.$router.push({ path: `${UrlConfig.display}/demon`, query: query });
launchFullscreen();
}).catch(error => {
@ -238,7 +238,7 @@ export default {
this.buttonLoading = true;
this.$router.push({
path: `${UrlConfig.trainingPlatform.pay}/${this.courseModel.id}`,
query: { permissionType: PermissionType.SIMULATION, prdCode: this.courseModel.prdCode, mapId: this.courseModel.mapId, subSystem: this.$route.params.subSystem }
query: { permissionType: PermissionType.SIMULATION, prdId: this.courseModel.prdId, mapId: this.courseModel.mapId, subSystem: this.$route.params.subSystem }
});
},
transfer() {

View File

@ -3,10 +3,10 @@
<div class="clearfix">
<span>{{ $t('map.publishedMapList') }}</span>
</div>
<div class="text_item" style="height: calc(100% - 47px);">
<div class="text_item">
<filter-city v-if="project==='design'" ref="filerCity" filter-empty :query-function="queryFunction" :local-param-name="localParamName" @filterSelectChange="refresh" />
<el-input v-if="project==='design'" v-model="filterText" :placeholder="this.$t('global.filteringKeywords')" clearable />
<div style="height: calc(100% - 76px);">
<div class="tree_mian_box">
<el-tree ref="tree" class="tree_box" :data="treeList" node-key="id" :props="defaultProps" highlight-current :span="22" :filter-node-method="filterNode" @node-click="clickEvent">
<span slot-scope="{ node:tnode, data }">
<span class="el-icon-tickets" :style="{color: data.valid ? 'green':''}" />
@ -52,11 +52,6 @@ export default {
},
node: {
},
point: {
x: 0,
y: 0
},
editModel: {},
localParamName: 'publish_cityCode'
};
},
@ -140,14 +135,13 @@ export default {
cityCode: elem.cityCode
}
];
this.isAdministrator() ? elem.children.push({id: '2', name: this.$t('designPlatform.lessonDesign'), type: 'lessonDesign', mapId: elem.id, skinCode: elem.skinCode, cityCode: elem.cityCode}) : '';
this.isAdministrator() ? elem.children.push({id: '2', name: this.$t('designPlatform.lessonDesign'), type: 'lessonDesign', mapId: elem.id, cityCode: elem.cityCode}) : '';
elem.children.push(
{
id: '3',
name: this.$t('designPlatform.scriptDesign'),
type: 'scriptDesign',
mapId: elem.id,
skinCode: elem.skinCode,
cityCode: elem.cityCode
// code:elem.children.find(n => { return n.name.includes("")})
});
@ -197,6 +191,12 @@ export default {
color: #3ea726;
}
}
.text_item{
height: calc(100% - 47px);
.tree_mian_box{
height: calc(100% - 76px);
}
}
.map-list-main{
text-align:left;

View File

@ -1,23 +1,19 @@
<template>
<el-card>
<div class="home-box" :style="{height: height+'px'}">
<el-scrollbar wrap-class="scrollbar-wrapper">
<div class="content_box">
<h1 class="title">
城市轨道交通设计平台
</h1>
<div class="card-box">
<el-carousel :interval="4000" type="card" height="380px">
<el-carousel-item v-for="(item, index) in listImg" :key="index">
<img :src="item.src" alt="" height="100%" width="100%">
</el-carousel-item>
</el-carousel>
</div>
<div class="brief-box">{{ $t('demonstration.simulationSystemDescription') }}</div>
<div class="joylink-card">
<el-scrollbar wrap-class="scrollbar-wrapper">
<div class="content_box">
<h1 class="title">城市轨道交通设计平台</h1>
<div class="card-box">
<el-carousel :interval="4000" type="card" height="380px">
<el-carousel-item v-for="(item, index) in listImg" :key="index">
<img :src="item.src" alt="" height="100%" width="100%">
</el-carousel-item>
</el-carousel>
</div>
</el-scrollbar>
</div>
</el-card>
<div class="brief-box">{{ $t('demonstration.simulationSystemDescription') }}</div>
</div>
</el-scrollbar>
</div>
</template>
<script>
@ -41,11 +37,6 @@ export default {
{ src: home6 }
]
};
},
computed: {
height() {
return this.$store.state.app.height - 93;
}
}
};
</script>
@ -55,12 +46,10 @@ export default {
/deep/ .el-carousel {
overflow: hidden;
}
.home-box {
float: left;
width: 100%;
.joylink-card{
height: 100%;
font-family: 'Microsoft YaHei';
overflow: hidden;
.content_box{
padding: 0 100px 15px;
}

View File

@ -72,13 +72,11 @@ export default {
resize() {
this.widthLeft = Number(localStore.get('LeftWidth')) || this.widthLeft;
const width = this.$store.state.app.width - 521 - this.widthLeft;
// const height = this.$store.state.app.height - 90;
this.$store.dispatch('config/resize', { width: width });
},
setMapResize(LeftWidth) {
this.currentWidth = this.$store.state.app.width - this.widthLeft;
const widths = this.$store.state.app.width - 521 - LeftWidth;
// const heights = this.$store.state.app.height - 90;
this.$store.dispatch('config/resize', { width: widths });
}

View File

@ -44,23 +44,12 @@ export default {
this.initLoadData();
});
},
// '$store.state.map.mapViewLoadedCount': function (val) {
// // this.subscribe();
// debugger;
// this.$store.dispatch('map/setTrainWindowShow', false);
// },
'$store.state.app.windowSizeCount': function() {
this.setWindowSize();
}
},
async beforeDestroy() {
// await this.clearAllTimer();
// if (!this.isReplay) {
// await this.quit();
// }
// await this.$store.dispatch('training/reset');
await this.$store.dispatch('map/mapClear');
// EventBus.$off('clearCheckLogin');
},
async mounted() {
await this.setWindowSize();
@ -103,7 +92,6 @@ export default {
const width = this.$store.state.app.width - (this.widthLeft || 450);
const height = this.height;
this.$store.dispatch('config/resize', { width, height });
// this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: this.offsetStationCode });
});
}
}

View File

@ -3,9 +3,9 @@
<div class="clearfix">
<span>{{ $t('map.myMapList') }}</span>
</div>
<div class="text_item" style="height: calc(100% - 47px);">
<div class="text_item">
<el-input v-model="filterText" :placeholder="this.$t('global.filteringKeywords')" clearable />
<div style="height: calc(100% - 89px); overflow-y: auto;">
<div class="tree_box">
<el-tree ref="tree" :data="treeList" node-key="id" :props="defaultProps" highlight-current :span="22" :filter-node-method="filterNode" @node-click="clickEvent" @node-contextmenu="showContextMenu">
<span slot-scope="{ node:tnode, data }">
<span class="el-icon-tickets" :style="{color: data.valid ? 'green':''}" />
@ -36,7 +36,6 @@ import { DeviceMenu } from '@/scripts/ConstDic';
import { postBuildMapImport, listMap } from '@/api/jmap/mapdraft';
import { UrlConfig } from '@/router/index';
import { removeSessionStorage } from '@/utils/auth';
import localStore from 'storejs';
import MapOperateMenu from './mapmanage/operateMenu';
export default {
@ -62,9 +61,6 @@ export default {
children: 'children',
label: 'name'
},
node: {
},
heightUp: 450,
point: {
x: 0,
y: 0
@ -74,11 +70,11 @@ export default {
};
},
computed: {
role() {
return this.$store.state.user.roles.includes('04') ||
this.$store.state.user.roles.includes('05') ||
this.$store.state.user.roles.includes('01');
}
// role() {
// return this.$store.state.user.roles.includes('04') ||
// this.$store.state.user.roles.includes('05') ||
// this.$store.state.user.roles.includes('01');
// }
},
watch: {
filterText(val) {
@ -89,7 +85,6 @@ export default {
removeSessionStorage('demonList');
},
mounted() {
this.heightUp = Number(localStore.get('upHeight') ? localStore.get('upHeight') : (this.height) / 2);
this.loadInitData();
},
methods: {
@ -106,8 +101,6 @@ export default {
try {
const res = await listMap();
res.data && res.data.forEach(elem=>{
// if(elem.children)
// {
elem.type = 'map';
elem.children = [
{
@ -127,7 +120,6 @@ export default {
skinCode: elem.skinCode
}
];
// }
});
this.treeData = res.data;
@ -165,8 +157,6 @@ export default {
this.editModel = obj;
this.editModel.skinCode = obj.skinCode;
this.$store.dispatch('menuOperation/setPopMenu', { position: this.point, menu: menu });
} else {
//
}
},
jlmap3d() {
@ -212,9 +202,13 @@ export default {
height: 47px;
line-height: 47px;
}
.tree_box{
height: 100%;
}
.text_item{
height: calc(100% - 47px);
.tree_box{
height: calc(100% - 89px);
overflow-y: auto;
}
}
.buttonList{
padding: 8px 0px 8px 0px;
border-top: 1px #ccc solid;

View File

@ -1,6 +1,6 @@
<template>
<div class="app-wrapper" style="height: 100%;">
<map-create ref="mapCreate" :skin-code="skinCode" @refresh="refresh1" @editmap="handleNodeClick" />
<div class="app-wrapper">
<map-create ref="mapCreate" :skin-code="skinCode" @refresh="refresh1" />
<div v-show="listShow" class="examList" :style="{width: widthLeft+'px'}">
<demon-list ref="demonList" :width="widthLeft" @createMap="createMap" />
</div>
@ -19,7 +19,6 @@ import { launchFullscreen } from '@/utils/screen';
import localStore from 'storejs';
import { getSessionStorage, setSessionStorage } from '@/utils/auth';
import MapCreate from './mapmanage/create';
import { UrlConfig } from '@/router/index';
export default {
name: 'DesignPlatform',
@ -71,38 +70,12 @@ export default {
drapWidth(width) {
this.widthLeft = Number(width);
},
createMap() {
this.$refs.mapCreate.show();
},
refresh1() {
this.$refs.demonList.loadInitData();
},
getSkinCode(node) {
let next = node;
while (next) {
if (next.data && next.data.type == 'skin') {
this.skinCode = next.data.id;
break;
}
next = next.parent;
}
},
handleNodeClick(obj, node) {
this.getSkinCode(node);
if (obj && obj.type == 'map') {
this.editModel = obj;
this.$store.dispatch('menuOperation/setPopMenu', { position: null, menu: null });
this.mapSelected({ view: 'draft' });
}
},
mapSelected(data) {
if (data && this.editModel) {
this.$router.push({ path: `${UrlConfig.map.draft}/${this.editModel.id}/${data.view}`, query: { name: this.editModel.name } });
}
},
resize() {
this.widthLeft = Number(localStore.get('LeftWidth')) || this.widthLeft;
const width = this.$store.state.app.width - 521 - this.widthLeft;
@ -114,7 +87,6 @@ export default {
const heights = this.$store.state.app.height - 90;
this.$store.dispatch('config/resize', { width: widths, height: heights });
}
}
};
</script>
@ -122,7 +94,7 @@ export default {
@import "src/styles/mixin.scss";
.app-wrapper {
@include clearfix;
@include clearfix;
position: relative;
height: 100%;
width: 100%;

View File

@ -43,16 +43,15 @@
<el-button type="primary" :loading="loading" @click="create">{{ $t('map.confirm') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { newMap, postBuildMapImport, newUsePublishMap } from '@/api/jmap/mapdraft';
import { newMap, newUsePublishMap } from '@/api/jmap/mapdraft';
import { listPublishMap } from '@/api/jmap/map';
import XLSX from 'xlsx';
import { translate, translateSheetTitle } from '@/scripts/translate';
import { sheet_to_json } from '@/utils/Export2Excel';
import { getSkinCodeList } from '@/api/management/mapskin';
// import XLSX from 'xlsx';
// import { translate, translateSheetTitle } from '@/scripts/translate';
// import { sheet_to_json } from '@/utils/Export2Excel';
import { getLineCodeList } from '@/api/management/mapline';
export default {
name: 'MapCreate',
@ -127,7 +126,7 @@ export default {
},
initLoadData() {
this.skinCodeList = [];
getSkinCodeList().then(response => {
getLineCodeList().then(response => {
this.skinCodeList = response.data;
});
this.$Dictionary.cityType().then(list => {
@ -173,109 +172,109 @@ export default {
}
});
}
},
importf() { //
const obj = this.$refs.files;
let wb;
if (!obj.files) return;
const f = obj.files[0];
this.loadingUpload = true;
const reader = new FileReader();
const that = this;
reader.onload = function (e) {
const data = e.target.result;
if (that.rABS) {
wb = XLSX.read(btoa(that.fixdata(data)), {//
type: 'base64'
});
} else {
wb = XLSX.read(data, {
type: 'binary'
});
}
const resultJSONData = {};
for (const index in wb.Sheets) {
const titleNum = that.formatSheetTitle(index);
const key = translateSheetTitle.sheetName[titleNum];
const filterVal = that.handelData(key);
const jsonData = sheet_to_json(wb.Sheets[index]);
const data = that.formatJson(filterVal, jsonData, key);
if (key === 'base') {
for (const i in data[0]) {
resultJSONData[i] = data[0][i];
}
} else {
resultJSONData[key] = data;
}
}
that.resultJSON = resultJSONData;
if (that.resultJSON) {
postBuildMapImport(that.resultJSON).then(res => {
that.loadingUpload = false;
that.$message.success(this.$t('map.importSuccessful'));
that.$emit('refresh');
that.close();
}).catch(error => {
that.loadingUpload = false;
that.$message.error(this.$t('map.importFailure') + error.message);
});
}
obj.value = ''; //
};
if (that.rABS) {
reader.readAsArrayBuffer(f);
} else {
reader.readAsBinaryString(f);
}
},
//
handelData(key) {
const tHeader = [];
const tHeaderF = [];
if (translate[key]) {
translate[key].columns.forEach(item => {
tHeader.push(item.tHeader);
tHeaderF.push(item.key);
});
}
const filterVal = {
tHeader: tHeader,
tHeaderF: tHeaderF
};
return filterVal;
},
// BinaryString
fixdata(data) {
var o = '';
var l = 0;
var w = 10240;
for (; l < data.byteLength / w; ++l) o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w, l * w + w)));
o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w)));
return o;
},
//
formatJson(filterVal, jsonData, key) {
jsonData.map((item, index) => {
const json = {};
filterVal.tHeader.map((j, o) => {
if (item[j] != undefined) {
json[filterVal.tHeaderF[o]] = translate[key].columns[o].formatter(item[j]);
}
});
jsonData.splice(index, 1, json);
});
return jsonData;
},
// sheet
formatSheetTitle(title) {
let index;
translateSheetTitle.sheetTitle.forEach((v, i) => {
if (title == v) index = i;
});
return index;
}
// importf() { //
// const obj = this.$refs.files;
// let wb;
// if (!obj.files) return;
// const f = obj.files[0];
// this.loadingUpload = true;
// const reader = new FileReader();
// const that = this;
// reader.onload = function (e) {
// const data = e.target.result;
// if (that.rABS) {
// wb = XLSX.read(btoa(that.fixdata(data)), {//
// type: 'base64'
// });
// } else {
// wb = XLSX.read(data, {
// type: 'binary'
// });
// }
// const resultJSONData = {};
// for (const index in wb.Sheets) {
// const titleNum = that.formatSheetTitle(index);
// const key = translateSheetTitle.sheetName[titleNum];
// const filterVal = that.handelData(key);
// const jsonData = sheet_to_json(wb.Sheets[index]);
// const data = that.formatJson(filterVal, jsonData, key);
// if (key === 'base') {
// for (const i in data[0]) {
// resultJSONData[i] = data[0][i];
// }
// } else {
// resultJSONData[key] = data;
// }
// }
// that.resultJSON = resultJSONData;
// if (that.resultJSON) {
// postBuildMapImport(that.resultJSON).then(res => {
// that.loadingUpload = false;
// that.$message.success(this.$t('map.importSuccessful'));
// that.$emit('refresh');
// that.close();
// }).catch(error => {
// that.loadingUpload = false;
// that.$message.error(this.$t('map.importFailure') + error.message);
// });
// }
// obj.value = ''; //
// };
// if (that.rABS) {
// reader.readAsArrayBuffer(f);
// } else {
// reader.readAsBinaryString(f);
// }
// },
// //
// handelData(key) {
// const tHeader = [];
// const tHeaderF = [];
// if (translate[key]) {
// translate[key].columns.forEach(item => {
// tHeader.push(item.tHeader);
// tHeaderF.push(item.key);
// });
// }
// const filterVal = {
// tHeader: tHeader,
// tHeaderF: tHeaderF
// };
// return filterVal;
// },
// // BinaryString
// fixdata(data) {
// var o = '';
// var l = 0;
// var w = 10240;
// for (; l < data.byteLength / w; ++l) o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w, l * w + w)));
// o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w)));
// return o;
// },
// //
// formatJson(filterVal, jsonData, key) {
// jsonData.map((item, index) => {
// const json = {};
// filterVal.tHeader.map((j, o) => {
// if (item[j] != undefined) {
// json[filterVal.tHeaderF[o]] = translate[key].columns[o].formatter(item[j]);
// }
// });
// jsonData.splice(index, 1, json);
// });
// return jsonData;
// },
// // sheet
// formatSheetTitle(title) {
// let index;
// translateSheetTitle.sheetTitle.forEach((v, i) => {
// if (title == v) index = i;
// });
// return index;
// }
}
};
</script>

View File

@ -42,7 +42,7 @@
<script>
import { updateMap, getMapDetail } from '@/api/jmap/mapdraft';
import { getSkinCodeList } from '@/api/management/mapskin';
import { getLineCodeList } from '@/api/management/mapline';
import { saveMap } from '@/api/jmap/mapdraft';
export default {
@ -158,7 +158,6 @@ export default {
save() {
this.loading = true;
if (this.basicInfo) {
// this.editModel.id = this.$route.params.mapId;
this.$refs['edit'].validate((valid) => {
if (valid) {
updateMap(this.editModel).then(response => {
@ -221,7 +220,7 @@ export default {
});
this.skinCodeList = [];
getSkinCodeList().then(response => {
getLineCodeList().then(response => {
this.skinCodeList = response.data;
});
}

View File

@ -17,6 +17,7 @@ import MapEdit from './edit';
import MapSaveAs from './saveAs';
import MapPublish from './publish';
import { mapGetters } from 'vuex';
import { saveMap } from '@/api/jmap/mapdraft';
export default {
name: 'MapOperateMenu',
@ -47,10 +48,10 @@ export default {
label: this.$t('map.updateObj'),
handler: this.updateObj
},
// {
// label: this.$t('map.updateObjAxis'),
// handler: this.updateObjAxis
// },
{
label: this.$t('map.updateObjAxis'),
handler: this.updateObjAxis
},
{
label: this.$t('map.saveAs'),
handler: this.saveAs
@ -69,7 +70,15 @@ export default {
handler: this.publish
},
menuNormal: [],
menu: []
menu: [],
updtModel: {
code: '',
scaling: '',
origin: {
x: '',
y: ''
}
}
};
},
computed: {
@ -124,12 +133,45 @@ export default {
this.$refs.edit.show('editCode');
}
},
// updateObjAxis() {
// this.doClose();
// if (this.$refs && this.$refs.axisEdit) {
// this.$refs.axisEdit.show('editPoint');
// }
// },
updateObjAxis() {
this.doClose();
this.getMapOrigin();
this.$confirm('您确认按当前绘图位置更新坐标及缩放比例?', this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
const map = this.$store.state.map.map;
this.$store.dispatch('map/saveMapDeviceDefaultRelations').then(() => {
const param = {
mapId: this.$route.params.mapId,
skinVO: {
code: this.$store.state.map.map.skinVO.code,
name: this.$store.state.map.map.skinVO.name,
origin: {
x: this.updtModel.origin.x,
y: this.updtModel.origin.y
},
scaling: this.updtModel.scaling
}
};
saveMap(Object.assign(map, param)).then(response => {
this.$message.success(this.$t('map.updateSuccessfully'));
}).catch(() => {
this.$messageBox(this.$t('map.updateFailed'));
});
});
}).catch(() => { });
},
getMapOrigin() {
const dataZoom = this.$store.state.map.dataZoom;
if (dataZoom && dataZoom.offsetX) {
this.updtModel.origin.x = Number.parseInt(dataZoom.offsetX);
this.updtModel.origin.y = Number.parseInt(dataZoom.offsetY);
this.updtModel.scaling = dataZoom.scaleRate;
}
},
saveAs() {
this.doClose();
if (this.$refs && this.$refs.saveAs) {

View File

@ -399,7 +399,7 @@ export default {
const resp = await getTrainingDetail(this.trainingId);
if (resp && resp.code == 200) {
const detail = resp.data;
const rest = await getProductDetail(detail.prdCode);
const rest = await getProductDetail(detail.prdId);
if (rest && rest.code == 200) {
const data = rest.data;
await this.$store.dispatch('training/setPrdType', data.prdType);

View File

@ -143,8 +143,7 @@ export default {
},
computed: {
...mapGetters([
'canvasWidth',
'canvasHeight'
'canvasWidth'
]),
...mapGetters('map', [
'map'
@ -188,10 +187,10 @@ export default {
isDemon() {
return this.mode === 'demon';
},
isScreen() {
isScreen() { //
return this.mode === 'dp';
},
isReplay() {
isReplay() { //
return this.mode === 'replay';
},
isScript() {
@ -392,7 +391,7 @@ export default {
const resp = await getTrainingDetail(this.trainingId);
if (resp && resp.code == 200) {
const detail = resp.data;
const rest = await getProductDetail(detail.prdCode);
const rest = await getProductDetail(detail.prdId);
if (rest && rest.code == 200) {
const data = rest.data;
await this.$store.dispatch('training/setPrdType', data.prdType);

View File

@ -130,7 +130,7 @@ export default {
loadInitData() {
const data = {
mapId: this.$route.query.mapId,
prdCode: this.$route.query.code,
prdId: this.$route.query.code,
permissionType: PermissionType.SIMULATION
};
getGoodsTryUse(data).then(res => {

View File

@ -3,7 +3,7 @@
<div slot="header" style="text-align: center;">
<b>{{ $t('exam.courseName') + ': '+ courseModel.name }}</b>
</div>
<div style=" margin:50px" :style="{ height: height - 190 +'px' }">
<div style="margin:50px" :style="{ height: height - 190 +'px' }">
<el-tabs v-model="activeName">
<el-tab-pane :label="this.$t('exam.itemList')" name="first">
<div v-if="courseModel.treeList.length != 0" :style="{ height: height - 230 +'px' }">
@ -122,7 +122,7 @@ export default {
id: resp.data.id,
name: resp.data.name,
pmsList: resp.data.permissionList || [],
prdCode: resp.data.prdCode,
prdId: resp.data.prdId,
mapId: resp.data.mapId,
PermissionType: PermissionType.EXAM,
treeList: resp.data.examDefinitionList
@ -140,7 +140,7 @@ export default {
this.loading = true;
this.$router.push({
path: `${UrlConfig.trainingPlatform.pay}/${this.courseModel.id}`,
query: { permissionType: PermissionType.EXAM, lessonId: this.courseModel.id, prdCode: this.courseModel.prdCode, mapId: this.courseModel.mapId, subSystem: this.$route.params.subSystem }
query: { permissionType: PermissionType.EXAM, lessonId: this.courseModel.id, prdId: this.courseModel.prdId, mapId: this.courseModel.mapId, subSystem: this.$route.params.subSystem }
});
},
checkCourse() {

View File

@ -3,7 +3,7 @@
<div class="card-title">
<b>{{ $t('exam.nameOfTestPaper') +': ' + examDetails.name }}</b>
</div>
<div style="padding:50px; padding-right: 0; height: 100%;">
<div class="card_content">
<el-scrollbar wrap-class="scrollbar-wrapper">
<p class="list-item">
<span class="list-label">{{ $t('exam.examStartTime') +':' }}</span>
@ -183,7 +183,7 @@ export default {
getPublishLessonDetail({ id: this.examDetails.lessonId }).then((res) => {
this.$router.push({
path: `${UrlConfig.trainingPlatform.pay}/${this.examDetails.lessonId}`,
query: { permissionType: PermissionType.EXAM, lessonId: this.examDetails.lessonId, prdCode: res.data.prdCode, mapId: res.data.mapId }
query: { permissionType: PermissionType.EXAM, lessonId: this.examDetails.lessonId, prdId: res.data.prdId, mapId: res.data.mapId }
});
}).catch(() => {
this.$messageBox(this.$t('error.obtainCourseDetailsFailed'));
@ -260,6 +260,11 @@ export default {
text-align: center;
border-bottom: 1px solid #e6e6e6;
}
.card_content{
padding:50px;
padding-right: 0;
height: 100%;
}
}
.menu li {

View File

@ -133,9 +133,9 @@ export default {
};
//
const path = window.location.href;
let flag = false;
let mouseWheelFlag = false;
if (path.includes('design/userlist/map/draw')) {
flag = true;
mouseWheelFlag = true;
}
Vue.prototype.$jlmap = new Jlmap({
@ -149,7 +149,7 @@ export default {
scaleRate: 1,
offsetX: 0,
offsetY: 0,
zoomOnMouseWheel: flag
zoomOnMouseWheel: mouseWheelFlag
},
methods: {
dataLoaded: this.handleDataLoaded,
@ -161,6 +161,7 @@ export default {
this.$jlmap.on('dataZoom', this.onDataZoom, this);
this.$jlmap.on('selected', this.onSelected, this);
this.$jlmap.on('contextmenu', this.onContextMenu, this);
this.$jlmap.on('keyboard', this.onKeyboard, this);
window.document.oncontextmenu = function () {
return false;
@ -215,6 +216,15 @@ export default {
//
handleOptionsUpdate(options) {
},
//
onKeyboard(hook) {
switch (hook) {
case 'Control_Z': this.$store.dispatch('map/setRevocation');
break;
case 'Control_Y': this.$store.dispatch('map/setRecover');
break;
}
},
//
onDataZoom(dataZoom) {
this.dataZoom.offsetX = dataZoom.offsetX.toFixed(1) + '';

View File

@ -98,7 +98,7 @@ export default {
},
detail: {
mapId: '',
prdCode: ''
prdId: ''
}
};
},
@ -175,7 +175,7 @@ export default {
loadTrainingList(data) {
getLessonDetail({ id: data.lessonId }).then(resp => {
this.detail.mapId = resp.data.mapId;
this.detail.prdCode = resp.data.prdCode;
this.detail.prdId = resp.data.prdId;
this.chapterModel.lessonId = resp.data.id;
this.chapterModel.lessonName = resp.data.name;
if (data.type === 'Chapter') {

View File

@ -92,9 +92,9 @@ export default {
},
{
title: this.$t('lesson.product'),
prop: 'prdCode',
prop: 'prdId',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.prdCode, this.prdTypeList, ['code', 'name']); },
columnValue: (row) => { return this.$convertField(row.prdId, this.prdTypeList, ['code', 'name']); },
tagType: (row) => { return 'success'; }
},
{
@ -147,7 +147,7 @@ export default {
},
async queryFunction(params) {
params['mapId'] = this.detail.mapId;
params['prdCode'] = this.detail.prdCode;
params['prdId'] = this.detail.prdId;
const res = await pageQueryTraining(params);
this.trainings.forEach(ele => {
res.data.list.forEach(item => {

View File

@ -20,13 +20,13 @@
/>
</el-select>
</el-form-item>
<el-form-item :label="this.$t('lesson.associatedProducts')" prop="prdCode">
<el-select v-model="courseModel.prdCode" :placeholder="$t('rules.pleaseSelect')" :disabled="isEdit">
<el-form-item :label="this.$t('lesson.associatedProducts')" prop="prdId">
<el-select v-model="courseModel.prdId" :placeholder="$t('rules.pleaseSelect')" :disabled="isEdit">
<el-option
v-for="(item,index) in productList"
:key="index"
:label="item.name"
:value="item.code"
:value="item.id"
/>
</el-select>
</el-form-item>
@ -74,7 +74,7 @@ export default {
mapIdList: [],
courseModel: {
id: '',
prdCode: '',
prdId: '',
product: [],
mapId: '',
name: '',
@ -94,7 +94,7 @@ export default {
mapId: [
{ required: true, message: this.$t('rules.selectMapName'), trigger: 'change' }
],
prdCode: [
prdId: [
{ required: true, message: this.$t('rules.selectAssociatedProduct'), trigger: 'change' }
],
remarks: [
@ -133,7 +133,7 @@ export default {
this.$refs.form.validate((valid) => {
if (valid) {
const model = {
prdCode: this.courseModel.prdCode,
prdId: this.courseModel.prdId,
name: this.courseModel.name,
mapId: this.courseModel.mapId,
remarks: this.courseModel.remarks
@ -153,7 +153,7 @@ export default {
if (valid) {
const model = {
id: this.courseModel.id,
prdCode: this.courseModel.prdCode,
prdId: this.courseModel.prdId,
name: this.courseModel.name,
mapId: this.courseModel.mapId,
remarks: this.courseModel.remarks
@ -174,7 +174,7 @@ export default {
this.courseModel = {
id: data.id,
mapId: this.$route.query.mapId,
prdCode: data.prdCode,
prdId: data.prdId,
name: data.name,
remarks: data.remarks
};

Some files were not shown because too many files have changed in this diff Show More