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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,35 +1,40 @@
export default { export default {
permissionPack: 'Package', permissionPack: 'Package',
setSuccess: 'Set successfully', setSuccess: 'Set successfully',
isSureSetBelonger: 'Are you sure to set {name} to be the owner of the permission?', isSureSetBelonger: 'Are you sure to set {name} to be the owner of the permission?',
setBelonger: 'Set Owner', setBelonger: 'Set Owner',
lessonName: 'Lesson Name', lessonName: 'Lesson Name',
mapName: 'Map Name', mapName: 'Map Name',
mapProductName: 'Product Name', mapProductName: 'Product Name',
permissionType: 'Permission Type', permissionType: 'Permission Type',
permissionStatus: 'Permission Status', permissionStatus: 'Permission Status',
permissionUseType: 'Public/Private', permissionUseType: 'Public/Private',
permissionTotal: 'Total', permissionTotal: 'Total',
permissionRemains: 'Remains', permissionRemains: 'Remains',
isForever: 'Permanent', isForever: 'Permanent',
startTime: 'Start Time', startTime: 'Start Time',
endTime: 'End Time', endTime: 'End Time',
belonger: 'Owner', belonger: 'Owner',
userList: 'User List', userList: 'User List',
customPackageRules: 'Custom packaging rules', customPackageRules: 'Custom packaging rules',
addRules: 'Add rules', addRules: 'Add rules',
package: 'Pack', package: 'Pack',
getQrcode: 'Get qr code', getQrcode: 'Get qr code',
hasExitRule: 'This type rule already exists', hasExitRule: 'This type rule already exists',
pleaseAddRule: 'Please add rules', pleaseAddRule: 'Please add rules',
selectDate: 'Select time', selectDate: 'Select time',
addPermissionPackageRule: 'Add authority packaging rules', addPermissionPackageRule: 'Add authority packaging rules',
editPermissionPackageRule: 'edit authority packaging rule', editPermissionPackageRule: 'edit authority packaging rule',
restPermissionMaxNumber: '(maximum number of remaining permissions: {0})', restPermissionMaxNumber: '(maximum number of remaining permissions: {0})',
pleaseSelectTransferPermission: 'Select transfer permissions', pleaseSelectTransferPermission: 'Select transfer permissions',
permissionName: 'Permission Name', permissionName: 'Permission Name',
private: 'Private', private: 'Private',
public: 'Public', public: 'Public',
userName: 'User Name', userName: 'User Name',
statusType: 'Status Type' 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', pleaseSelectTheBelongsProject: 'Please select the belongs project',
copyMapAs: 'Copy map as', copyMapAs: 'Copy map as',
whetherToCopyData: 'Whether to copy data', whetherToCopyData: 'Whether to copy data',
copy:'Copy' copy:'Copy',
lineType:'Line Type'
}; };

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -4,193 +4,282 @@ import * as eventTool from 'zrender/src/core/event';
import store from '@/store'; import store from '@/store';
class EventModel { class EventModel {
constructor(e) { constructor(e) {
this.clientX = e.event.clientX; this.clientX = e.event.clientX;
this.clientY = e.event.clientY; this.clientY = e.event.clientY;
let view = e.target; let view = e.target;
while (view) { while (view) {
if (Object.values(deviceType).includes(view._type)) { if (Object.values(deviceType).includes(view._type)) {
this.deviceCode = view._code; this.deviceCode = view._code;
this.deviceType = view._type; this.deviceType = view._type;
this.deviceModel = view.model; this.deviceModel = view.model;
this.eventTarget = view; this.eventTarget = view;
break; break;
} }
view = view.parent; view = view.parent;
} }
} }
} }
class MouseController extends Eventful { class MouseController extends Eventful {
constructor(ibp) { constructor(ibp) {
super(); super();
this.$ibp = ibp; this.$ibp = ibp;
this.$zr = ibp.getZr(); this.$zr = ibp.getZr();
this.isAllowDragging=ibp.isAllowDragging||false; this.isAllowDragging = ibp.isAllowDragging || false; // 是否在绘图中,仅绘图状态下可拖拽
this.events = ibp.getEvents(); this.events = ibp.getEvents();
this._dragging = false; this._dragging = false; // 是否在拖拽状态
this.initHandler(this.$zr); this.deviceList = [];
} this.rightClickPoint = {
x: 0,
y: 0
}; // 右键点击坐标
this.initHandler(this.$zr);
}
initHandler(zr) { initHandler(zr) {
if (zr) { if (zr) {
zr.on('contextmenu', this.contextmenu, this); zr.on('contextmenu', this.contextmenu, this);
zr.on('mousemove', this.moveEvent, this); zr.on('mousemove', this.moveEvent, this);
zr.on('click', this.click, this); zr.on('click', this.click, this);
this.enable = function (opts) { this.enable = function (opts) {
opts = opts || {}; opts = opts || {};
this._moveOnMouseMove = opts.moveOnMouseMove || true; this._moveOnMouseMove = opts.moveOnMouseMove || true;
this._preventDefaultMouseMove = opts.preventDefaultMouseMove || true; this._preventDefaultMouseMove = opts.preventDefaultMouseMove || true;
this.disable(); this.disable();
zr.on('mousedown', this.mousedown, this); zr.on('mousedown', this.mousedown, this);
zr.on('mousemove', this.mousemove, this); zr.on('mousemove', this.mousemove, this);
zr.on('mouseup', this.mouseup, this); zr.on('mouseup', this.mouseup, this);
zr.on('touchstart', this.mousedown, this); zr.on('touchstart', this.mousedown, this);
zr.on('touchmove', this.mousemove, this); zr.on('touchmove', this.mousemove, this);
zr.on('touchend', this.mouseup, this); zr.on('touchend', this.mouseup, this);
}; };
this.disable = function () { this.disable = function () {
zr.off('mousedown', this.mousedown); zr.off('mousedown', this.mousedown);
zr.off('mousemove', this.mousemove); zr.off('mousemove', this.mousemove);
zr.off('mouseup', this.mouseup); zr.off('mouseup', this.mouseup);
zr.off('touchstart', this.mousedown); zr.off('touchstart', this.mousedown);
zr.off('touchmove', this.mousemove); zr.off('touchmove', this.mousemove);
zr.off('touchend', this.mouseup); zr.off('touchend', this.mouseup);
}; };
this.dispose = function () { this.dispose = function () {
zr.off('click', this.click); zr.off('click', this.click);
zr.off('contextmenu', this.contextmenu); zr.off('contextmenu', this.contextmenu);
zr.off('mousemove', this.moveEvent); zr.off('mousemove', this.moveEvent);
this.disable(); this.disable();
}; };
this.isDragging = function () { return this._dragging; }; this.isDragging = function () { return this._dragging; };
} }
} }
setAllowDragging(data) { setAllowDragging(data) {
this.isAllowDragging=data; this.isAllowDragging = data;
} }
mousedown(e) { mousedown(e) {
if (eventTool.notLeftMouse(e)) { e.event.preventDefault();
return; e.event.stopPropagation();
} const em = new EventModel(e);
e.event.preventDefault(); this.eventTarget = em.eventTarget;
e.event.stopPropagation(); this._offsetX = e.offsetX;
const em = new EventModel(e); this._offsetY = e.offsetY;
this.eventTarget = em.eventTarget; this._x = e.offsetX;
if (this.eventTarget && this.eventTarget._type === deviceType.Background) { this._y = e.offsetY;
this.eventTarget.setCursor('pointer'); this._dragging = true;
} if (e.which === 3) {
this._offsetX=e.offsetX; this.handleMouseDownRight(e);
this._offsetY=e.offsetY; } else if (e.which === 1) {
this._x = e.offsetX; this.handleMouseDownLeft(e);
this._y = e.offsetY; } else if (e.which === 2) {
this._dragging = true; this.handleMouseDownWheel(e);
} }
}
mousemove(e) { mousemove(e) {
if (eventTool.notLeftMouse(e) || const oldX = this._x;
!this._moveOnMouseMove || const oldY = this._y;
!this._dragging || !this.isAllowDragging
) {
return;
}
const oldX = this._x; const dx = e.offsetX - oldX;
const oldY = this._y; const dy = e.offsetY - oldY;
const dx = e.offsetX - oldX; this._x = e.offsetX;
const dy = e.offsetY - oldY; 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; mouseup(e) {
this._y = e.offsetY; if (eventTool.notLeftMouse(e) || !this.eventTarget ) {
if (this._dragging) { return;
if ((this.eventTarget && this.eventTarget._type === deviceType.Background) || !this.isAllowDragging) { }
this._preventDefaultMouseMove && eventTool.stop(e.event); if (this.deviceList.length) {
this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y }); this.deviceList.forEach(item => {
return true; item.setModel(e.offsetX - this._offsetX, e.offsetY - this._offsetY);
} else if (this.isAllowDragging && this.eventTarget) { });
this.eventTarget.grouper.drift(dx, dy, e); this.deviceList = [];
} this.$ibp.deleteCheckBox('check_box');
} else { this.eventTarget = '';
return true; 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) { checkEvent(e) {
if (!eventTool.notLeftMouse(e)&&this.isAllowDragging && this.eventTarget) { var oldEm = new EventModel(this.$zr.curEvent || { event: {} });
this.eventTarget.setModel(e.offsetX - this._offsetX, e.offsetY - this._offsetY); var newEm = new EventModel(e);
this.eventTarget.dirty(); if ([1, 3].includes(e.which)) {
} // 查找之前和当前鼠标选中的实例
// debugger; var oldDevice = this.$ibp.getDeviceByCode(oldEm.deviceCode) || {};
if (this.eventTarget && this.eventTarget._type === deviceType.Background) { var newDevice = this.$ibp.getDeviceByCode(newEm.deviceCode) || {};
// console.log('111-------'); var oldInstance = (this.$ibp.getDeviceByCode(oldEm.deviceCode) || {}).instance || {};
this.eventTarget.setCursor('default'); var newInstance = (this.$ibp.getDeviceByCode(newEm.deviceCode) || {}).instance || {};
}
this.eventTarget = '';
this._dragging = false;
}
contextmenu(e) { // 如果之前和当前选中的实例不一致
var em = this.checkEvent(e); if (oldInstance != newInstance) {
this.trigger(this.events.Contextmenu, em); // 如果实例有取消选择函数并且被点击,则执行取消选中函数
} if (oldInstance.mouseEvent && oldInstance.mouseEvent.mouseout) {
click(e) { // 视图数据设置点击标志,同步执行
var em = this.checkEvent(e); oldDevice['down'] = false;
this.trigger(this.events.Selected, em); oldInstance.mouseEvent['mouseout'](e);
} }
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();
}
}
}
checkEvent(e) { // 如果实例有选中函数并且被点击,则执行选中函数
var oldEm = new EventModel(this.$zr.curEvent || { event: {} }); if (e.which == 3 && newInstance.mouseEvent && newInstance.mouseEvent.mouseover) {
var newEm = new EventModel(e); newDevice['down'] = true;
if ([1, 3].includes(e.which)) { newInstance.mouseEvent['mouseover'](e);
// 查找之前和当前鼠标选中的实例 }
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 (oldInstance != newInstance) { this.$zr.curEvent = e;
// 如果实例有取消选择函数并且被点击,则执行取消选中函数 }
if (oldInstance.mouseEvent && oldInstance.mouseEvent.mouseout) {
// 视图数据设置点击标志,同步执行
oldDevice['down'] = false;
oldInstance.mouseEvent['mouseout'](e);
}
// 如果实例有选中函数并且被点击,则执行选中函数 return newEm;
if (e.which == 3 && newInstance.mouseEvent && newInstance.mouseEvent.mouseover) { }
newDevice['down'] = true; /** 处理鼠标右键按下事件 */
newInstance.mouseEvent['mouseover'](e); handleMouseDownRight(e) {
} this.rightClickPoint.x = e.offsetX;
} this.rightClickPoint.y = e.offsetY;
}
// 保存当前实例到全局 /** 处理鼠标左键按下事件 */
this.$zr.curEvent = e; handleMouseDownLeft(e) {
} if (this.eventTarget && this.eventTarget._type === deviceType.Background) {
this.eventTarget.setCursor('pointer');
return newEm; 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; export default MouseController;

View File

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

View File

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

View File

@ -2,43 +2,44 @@ import Group from 'zrender/src/container/Group';
import Line from 'zrender/src/graphic/shape/Line'; import Line from 'zrender/src/graphic/shape/Line';
export default class ibpLine extends Group { export default class ibpLine extends Group {
constructor(device) { constructor(device) {
super(); super();
this.model = device.model; this.model = device.model;
this._type = device.model._type; this._type = device.model._type;
this._code = device.model.code; this._code = device.model.code;
this.zlevel = device.model.zlevel; this.zlevel = device.model.zlevel;
this.z = device.model.z; this.model.point = this.model.point1;
this.create(); this.z = device.model.z;
} this.create();
create() { }
const model = this.model; create() {
this.grouper=new Group({ const model = this.model;
id: model.code, this.grouper = new Group({
position: [model.point1.x, model.point1.y] id: model.code,
}); position: [model.point1.x, model.point1.y]
this.ibpLine = new Line({ });
zlevel: model.zlevel, this.ibpLine = new Line({
z: model.z, zlevel: model.zlevel,
draggable: false, z: model.z,
shape: { draggable: false,
x1: 0, shape: {
y1: 0, x1: 0,
x2: model.point2.x-model.point1.x, y1: 0,
y2: model.point2.y-model.point1.y x2: model.point2.x - model.point1.x,
}, y2: model.point2.y - model.point1.y
style: { },
lineWidth: this.model.lineWidth, style: {
stroke: this.model.fillColor lineWidth: this.model.lineWidth,
} stroke: this.model.fillColor
}); }
this.grouper.add(this.ibpLine); });
this.add(this.grouper); this.grouper.add(this.ibpLine);
} this.add(this.grouper);
setModel(dx, dy) { }
this.model.point1.x += dx; setModel(dx, dy) {
this.model.point1.y += dy; this.model.point1.x += dx;
this.model.point2.x += dx; this.model.point1.y += dy;
this.model.point2.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'; import {createTransform, createBoundingRect} from './utils/parser';
class TransformHandle { class TransformHandle {
constructor(painter) { constructor(painter) {
this.$painter = 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) { checkVisible(view) {
return createBoundingRect(view).intersect(this.rect); return createBoundingRect(view).intersect(this.rect);
} }
revisibleView(view) { revisibleView(view) {
if (this.checkVisible(view)||view._type === deviceType.Background) { if (this.checkVisible(view) || view._type === deviceType.Background) {
view.show(); view.show();
} else { } else {
view.hide(); view.hide();
} }
view.dirty(); view.dirty();
} }
// 视图进行缩放/平移 // 视图进行缩放/平移
transformView(view) { transformView(view) {
if (view) { if (view) {
view.transform = this.transform; view.transform = this.transform;
view.decomposeTransform(); view.decomposeTransform();
this.revisibleView(view); this.revisibleView(view);
view.transform = ''; view.transform = '';
} }
} }
// 处理所有视图缩放/平移 // 处理所有视图缩放/平移
transformAll() { transformAll() {
this.traverse(this.transformView, this); this.traverse(this.transformView, this);
} }
// 重新计算显示图形 // 重新计算显示图形
revisibleAll() { revisibleAll() {
this.traverse(this.revisibleView, this); this.traverse(this.revisibleView, this);
} }
// 更新偏移量 // 更新偏移量
updateTransform(opts, canvasSize) { updateTransform(opts, canvasSize) {
if (canvasSize) { if (canvasSize) {
const elRect = this.parentLevel.getBoundingRect(); const elRect = this.parentLevel.getBoundingRect();
const zrRect = this.rect; const zrRect = this.rect;
if (canvasSize.x - opts.offsetX > 0) { if (canvasSize.x - opts.offsetX > 0) {
opts.offsetX = -elRect.x; opts.offsetX = -elRect.x;
} }
if (canvasSize.y - opts.offsetY > 0) { if (canvasSize.y - opts.offsetY > 0) {
opts.offsetY = -elRect.y; opts.offsetY = -elRect.y;
} }
if (elRect.x + canvasSize.width < zrRect.width) { if (elRect.x + canvasSize.width < zrRect.width) {
opts.offsetX -= zrRect.width - (elRect.x + canvasSize.width); opts.offsetX -= zrRect.width - (elRect.x + canvasSize.width);
} }
if (elRect.y + canvasSize.height < zrRect.height) { if (elRect.y + canvasSize.height < zrRect.height) {
opts.offsetY -= zrRect.height - (elRect.y + canvasSize.height); opts.offsetY -= zrRect.height - (elRect.y + canvasSize.height);
} }
} }
this.transform = createTransform(opts); this.transform = createTransform(opts);
this.transformAll(); this.transformAll();
} }
// 更新画布尺寸 // 更新画布尺寸
updateZrSize(opts) { updateZrSize(opts) {
this.rect = { x: 0, y: 0, width: opts.width, height: opts.height }; this.rect = { x: 0, y: 0, width: opts.width, height: opts.height };
this.revisibleAll(); this.revisibleAll();
} }
// 遍历group执行回调 // 遍历group执行回调
traverse(cb, context) { traverse(cb, context) {
this.parentLevel.eachChild(level => { this.parentLevel.eachChild(level => {
level.eachChild((view) => { level.eachChild((view) => {
cb.call(context, view); cb.call(context, view);
}, context); }, context);
}, context); }, context);
} }
} }
export default TransformHandle; export default TransformHandle;

File diff suppressed because it is too large Load Diff

View File

@ -260,6 +260,14 @@ class SkinCode extends defaultStyle {
}, },
arrow: { arrow: {
show: true // 控制模式箭头显隐 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 // 道岔封锁显示 contentRectShow: false // 道岔封锁显示
}, },
monolock: { // 道岔单锁配置 monolock: { // 道岔单锁配置
locationColor: '#870E10', // 道岔单锁定位颜色 (红色) locationColor: '#ea282c', // 道岔单锁定位颜色 (红色)
inversionColor: '#870E10', // 道岔单锁反位颜色 (红色) inversionColor: '#ea282c', // 道岔单锁反位颜色 (红色)
rectShow: false // 道岔单锁 矩形框是否显示 rectShow: false // 道岔单锁 矩形框是否显示
} }
}; };
@ -319,11 +327,71 @@ class SkinCode extends defaultStyle {
lineColor: '#FFFFFF' // 线条颜色 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] = { this[deviceType.TrainWindow] = {
lineColor: '#4DD43F', // 车次窗颜色 lineColor: '#4DD43F', // 车次窗颜色

View File

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

View File

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

View File

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

View File

@ -20,7 +20,7 @@ class Jlmap {
this.methods = opts.methods; 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 = ''; this.skinCode = '';
@ -328,6 +328,7 @@ class Jlmap {
this.clear(); this.clear();
this.$mouseController.dispose(); this.$mouseController.dispose();
this.$keyboardController.dispose();
this.$zr && zrender.dispose(this.$zr); this.$zr && zrender.dispose(this.$zr);
this.$painter.dispose(); this.$painter.dispose();
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,213 +6,210 @@ import Vue from 'vue';
import { deepClone } from '@/utils/index'; import { deepClone } from '@/utils/index';
export function createTransform(opts) { export function createTransform(opts) {
let transform = matrix.create(); let transform = matrix.create();
transform = matrix.scale(matrix.create(), transform, [opts.scaleRate, opts.scaleRate]); transform = matrix.scale(matrix.create(), transform, [opts.scaleRate, opts.scaleRate]);
transform = matrix.translate(matrix.create(), transform, [-opts.offsetX, -opts.offsetY]); transform = matrix.translate(matrix.create(), transform, [-opts.offsetX, -opts.offsetY]);
return transform; return transform;
} }
export function createBoundingRect(view) { export function createBoundingRect(view) {
const rect = view.getBoundingRect(); const rect = view.getBoundingRect();
const scale = view.scale[0]; const scale = view.scale[0];
const offsetX = view.position[0]; const offsetX = view.position[0];
const offsetY = view.position[1]; const offsetY = view.position[1];
rect.x = rect.x * scale + offsetX; rect.x = rect.x * scale + offsetX;
rect.y = rect.y * scale + offsetY; rect.y = rect.y * scale + offsetY;
rect.width = rect.width * scale; rect.width = rect.width * scale;
rect.height = rect.height * scale; rect.height = rect.height * scale;
return rect; return rect;
} }
export function calculateDCenter(viewRect, zrbound) { export function calculateDCenter(viewRect, zrbound) {
var dx = (zrbound.width - viewRect.width) / 2 - viewRect.x; var dx = (zrbound.width - viewRect.width) / 2 - viewRect.x;
var dy = 0; var dy = 0;
return { dx: dx, dy: dy }; return { dx: dx, dy: dy };
} }
export function deviceFactory(type, elem) { export function deviceFactory(type, elem) {
return {...deviceRender[type], ...elem}; return {...deviceRender[type], ...elem};
} }
export function createDevice(type, model, propConvert) { export function createDevice(type, elem, propConvert) {
const device = deviceFactory(type, model); const device = deviceFactory(type, Object.assign(elem, { _type: type } ));
return propConvert ? propConvert.initPrivateProps(device) : device; return propConvert ? propConvert.initPrivateProps(device) : device;
} }
export function parser(data, skinCode) { export function parser(data, skinCode) {
var mapDevice = {}; var mapDevice = {};
var propConvert = skinCode ? Vue.prototype.$theme.loadPropConvert(skinCode): null; var propConvert = skinCode ? Vue.prototype.$theme.loadPropConvert(skinCode) : null;
if (data) { if (data) {
zrUtil.each(data.linkList || [], elem => { zrUtil.each(data.linkList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Link, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.Link, elem, propConvert);
}, this); }, this);
zrUtil.each(data.sectionList || [], elem => { zrUtil.each(data.sectionList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Section, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.Section, elem, propConvert);
}, this); }, this);
zrUtil.each(data.signalList || [], elem => { zrUtil.each(data.signalList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Signal, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.Signal, elem, propConvert);
}, this); }, this);
zrUtil.each(data.stationList || [], elem => { zrUtil.each(data.stationList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Station, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.Station, elem, propConvert);
}, this); }, this);
zrUtil.each(data.stationStandList || [], elem => { zrUtil.each(data.stationStandList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.StationStand, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.StationStand, elem, propConvert);
}, this); }, this);
zrUtil.each(data.stationControlList || [], elem => { zrUtil.each(data.stationControlList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.StationControl, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.StationControl, elem, propConvert);
}, this); }, this);
zrUtil.each(data.counterList || [], elem => { zrUtil.each(data.counterList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.StationCounter, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.StationCounter, elem, propConvert);
}, this); }, this);
zrUtil.each(data.delayShowList || [], elem => { zrUtil.each(data.delayShowList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.StationDelayUnlock, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.StationDelayUnlock, elem, propConvert);
}, this); }, this);
zrUtil.each(data.lineList || [], elem => { zrUtil.each(data.lineList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Line, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.Line, elem, propConvert);
}, this); }, this);
zrUtil.each(data.textList || [], elem => { zrUtil.each(data.textList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Text, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.Text, elem, propConvert);
}, this); }, this);
zrUtil.each(data.zcList || [], elem => { zrUtil.each(data.zcList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.ZcControl, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.ZcControl, elem, propConvert);
}, this); }, this);
zrUtil.each(data.buttonList || [], elem => { zrUtil.each(data.buttonList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.ButtonControl, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.ButtonControl, elem, propConvert);
}, this); }, this);
zrUtil.each(data.lcList || [], elem => { zrUtil.each(data.lcList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.LcControl, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.LcControl, elem, propConvert);
}, this); }, this);
zrUtil.each(data.tempSpeedLimitList || [], elem => { zrUtil.each(data.tempSpeedLimitList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.LimitControl, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.LimitControl, elem, propConvert);
}, this); }, this);
zrUtil.each(data.resourceList || [], elem => { zrUtil.each(data.resourceList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.ImageControl, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.ImageControl, elem, propConvert);
}, this); }, this);
zrUtil.each(data.trainList || [], elem => { zrUtil.each(data.trainList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Train, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.Train, elem, propConvert);
}, this); }, this);
zrUtil.each(data.Line || [], elem => { zrUtil.each(data.Line || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Line, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.Line, elem, propConvert);
}, this); }, this);
zrUtil.each(data.Text || [], elem => { zrUtil.each(data.Text || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Text, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.Text, elem, propConvert);
}, this); }, this);
zrUtil.each(data.trainWindowList || [], elem => { zrUtil.each(data.trainWindowList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.TrainWindow, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.TrainWindow, elem, propConvert);
if (elem.sectionCode) { if (elem.sectionCode) {
const section = mapDevice[elem.sectionCode]; const section = mapDevice[elem.sectionCode];
if (section) { if (section) {
section['trainWindowCode'] = elem.code; section['trainWindowCode'] = elem.code;
} }
} }
}, this); }, this);
zrUtil.each(data.switchList || [], elem => { zrUtil.each(data.switchList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Switch, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.Switch, elem, propConvert);
const cnodeSection = mapDevice[mapDevice[elem.code].sectionACode]; const cnodeSection = mapDevice[mapDevice[elem.code].sectionACode];
const lnodeSection = mapDevice[mapDevice[elem.code].sectionBCode]; const lnodeSection = mapDevice[mapDevice[elem.code].sectionBCode];
const rnodeSection = mapDevice[mapDevice[elem.code].sectionCCode]; const rnodeSection = mapDevice[mapDevice[elem.code].sectionCCode];
if (cnodeSection && lnodeSection && rnodeSection) { if (cnodeSection && lnodeSection && rnodeSection) {
cnodeSection['switch'] = lnodeSection['switch'] = rnodeSection['switch'] = mapDevice[elem.code]; cnodeSection['switch'] = lnodeSection['switch'] = rnodeSection['switch'] = mapDevice[elem.code];
const cnode = mapDevice[cnodeSection.linkCode]; const cnode = mapDevice[cnodeSection.linkCode];
if (cnode && cnode.leftFdCode === lnodeSection.linkCode && cnode.leftSdCode === rnodeSection.linkCode) { if (cnode && cnode.leftFdCode === lnodeSection.linkCode && cnode.leftSdCode === rnodeSection.linkCode) {
mapDevice[elem.code].intersection = { mapDevice[elem.code].intersection = {
x: cnodeSection.points[0].x, x: cnodeSection.points[0].x,
y: cnodeSection.points[0].y y: cnodeSection.points[0].y
}; };
mapDevice[elem.code].skew = { mapDevice[elem.code].skew = {
x: rnodeSection.points[rnodeSection.points.length - 2].x, x: rnodeSection.points[rnodeSection.points.length - 2].x,
y: rnodeSection.points[rnodeSection.points.length - 2].y y: rnodeSection.points[rnodeSection.points.length - 2].y
}; };
} else if (cnode && cnode.rightFdCode === lnodeSection.linkCode && cnode.rightSdCode === rnodeSection.linkCode) { } else if (cnode && cnode.rightFdCode === lnodeSection.linkCode && cnode.rightSdCode === rnodeSection.linkCode) {
mapDevice[elem.code].intersection = { mapDevice[elem.code].intersection = {
x: cnodeSection.points[cnodeSection.points.length - 1].x, x: cnodeSection.points[cnodeSection.points.length - 1].x,
y: cnodeSection.points[cnodeSection.points.length - 1].y y: cnodeSection.points[cnodeSection.points.length - 1].y
}; };
mapDevice[elem.code].skew = { mapDevice[elem.code].skew = {
x: rnodeSection.points[1].x, x: rnodeSection.points[1].x,
y: rnodeSection.points[1].y y: rnodeSection.points[1].y
}; };
} }
const section = mapDevice[cnodeSection.parentCode]; const section = mapDevice[cnodeSection.parentCode];
if (section) { if (section) {
mapDevice[elem.code].sectionName = section.name; mapDevice[elem.code].sectionName = section.name;
section['relSwitchCode'] = elem.code; section['relSwitchCode'] = elem.code;
} }
rnodeSection['layer'] = -1; rnodeSection['layer'] = -1;
} }
}, this); }, this);
} }
return mapDevice; return mapDevice;
} }
// 同步绘制数据到原始数据 // 同步绘制数据到原始数据
export function updateForList(model, map, liststr) { export function updateForList(model, state, liststr) {
const list = map[liststr]; const list = state.map[liststr];
if (list && list instanceof Array) { if (list && list instanceof Array) {
const i = list.findIndex(elem => { return elem.code == model.code; }); const i = list.findIndex(elem => { return elem.code == model.code; });
if (model._dispose) { if (model._dispose) {
i >= 0 && list.splice(i, 1); i >= 0 && list.splice(i, 1); // 删除
} else if (!list[i]) { } else if (!list[i]) {
list.push(deepClone(model)); list.push(deepClone(model)); // 新增
} else if (i >= 0) { } else if (i >= 0) {
// const item = list[i]; list[i] = deepClone(model); // item map 数据 model 页面表单数据
list[i] = deepClone(model); // item map 数据 model 页面表单数据 // state.mapDevice[model.code] = deepClone(model);
// Object.keys(model).forEach(key => { // console.log(list[i], '更新');
// if (key != 'instance') { }
// item[key] = model[key]; } else {
// } state.map[liststr] = [model];
// }); }
}
} else {
map[liststr] = [model];
}
} }
export function updateMapData(state, model) { export function updateMapData(state, model) {
const map = state.map; // const map = state.map;
if (map && model) { // const mapDevice = state.mapDevice;
switch (model._type) { if (state.map && model) {
case deviceType.Link: updateForList(model, map, 'linkList'); break; switch (model._type) {
case deviceType.Section: updateForList(model, map, 'sectionList'); break; case deviceType.Link: updateForList(model, state, 'linkList'); break;
case deviceType.Switch: updateForList(model, map, 'switchList'); break; case deviceType.Section: updateForList(model, state, 'sectionList'); break;
case deviceType.Signal: updateForList(model, map, 'signalList'); break; case deviceType.Switch: updateForList(model, state, 'switchList'); break;
case deviceType.Station: updateForList(model, map, 'stationList'); break; case deviceType.Signal: updateForList(model, state, 'signalList'); break;
case deviceType.StationStand: updateForList(model, map, 'stationStandList'); break; case deviceType.Station: updateForList(model, state, 'stationList'); break;
case deviceType.StationControl: updateForList(model, map, 'stationControlList'); break; case deviceType.StationStand: updateForList(model, state, 'stationStandList'); break;
case deviceType.StationCounter: updateForList(model, map, 'stationCounterList'); break; case deviceType.StationControl: updateForList(model, state, 'stationControlList'); break;
case deviceType.ZcControl: updateForList(model, map, 'zcControlList'); break; case deviceType.StationCounter: updateForList(model, state, 'stationCounterList'); break;
case deviceType.StationDelayUnlock:updateForList(model, map, 'stationDelayUnlockList'); break; case deviceType.ZcControl: updateForList(model, state, 'zcControlList'); break;
case deviceType.LcControl: updateForList(model, map, 'lcControlList'); break; case deviceType.StationDelayUnlock:updateForList(model, state, 'stationDelayUnlockList'); break;
case deviceType.ButtonControl: updateForList(model, map, 'buttonList'); break; case deviceType.LcControl: updateForList(model, state, 'lcControlList'); break;
case deviceType.LimitControl: updateForList(model, map, 'tempSpeedLimitList'); break; case deviceType.ButtonControl: updateForList(model, state, 'buttonList'); break;
case deviceType.ImageControl: updateForList(model, map, 'imageControl'); break; case deviceType.LimitControl: updateForList(model, state, 'tempSpeedLimitList'); break;
case deviceType.Train: updateForList(model, map, 'trainList'); break; case deviceType.ImageControl: updateForList(model, state, 'imageControl'); break;
case deviceType.TrainWindow: updateForList(model, map, 'trainWindowList'); break; case deviceType.Train: updateForList(model, state, 'trainList'); break;
case deviceType.Line: updateForList(model, map, 'lineList'); break; case deviceType.TrainWindow: updateForList(model, state, 'trainWindowList'); break;
case deviceType.Text: updateForList(model, map, 'textList'); 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'; import { setInterval, clearInterval } from 'timers';
export default { export default {
data() { data() {
return { return {
visible: false, visible: false,
userInfo: { userInfo: {
name: '', name: '',
nickname: '', nickname: '',
mobile: '', mobile: '',
email: '', email: '',
passWord: '' passWord: ''
}, },
editInfo: { editInfo: {
name: '', name: '',
nickname: '', nickname: '',
mobile: '', mobile: '',
email: '', email: '',
passWord: '' passWord: ''
}, },
nationCode: '86', nationCode: '86',
nameShow: true, nameShow: true,
nickNameShow: true, nickNameShow: true,
mobileShow: true, mobileShow: true,
emailShow: true, emailShow: true,
passwordShow: true, passwordShow: true,
mobileCode: null, mobileCode: null,
emailCode: null, emailCode: null,
passWordCode: null, passWordCode: null,
oldPassWord: null, oldPassWord: null,
newPassWord1: null, newPassWord1: null,
mobileCodeTime: 0, mobileCodeTime: 0,
emailCodeTime: 0, emailCodeTime: 0,
passWordCodeTime: 0, passWordCodeTime: 0,
emailTime: null, emailTime: null,
mobileTime: null, mobileTime: null,
passWordTime: null, passWordTime: null,
countryList: [ countryList: [
{ name: this.$t('global.china'), value: '86' }, { name: this.$t('global.china'), value: '86' },
{ name: this.$t('global.australia'), value: '61' }, { name: this.$t('global.australia'), value: '61' },
{ name: this.$t('global.england'), value: '44' }, { name: this.$t('global.england'), value: '44' },
{ name: this.$t('global.hongKong'), value: '852' }, { name: this.$t('global.hongKong'), value: '852' },
{ name: this.$t('global.Japanese'), value: '81' }, { name: this.$t('global.Japanese'), value: '81' },
{ name: this.$t('global.macao'), value: '853' }, { name: this.$t('global.macao'), value: '853' },
{ name: this.$t('global.singapore'), value: '65' }, { name: this.$t('global.singapore'), value: '65' },
{ name: this.$t('global.taiwan'), value: '886' }, { name: this.$t('global.taiwan'), value: '886' },
{ name: this.$t('global.america'), value: '1' } { name: this.$t('global.america'), value: '1' }
], ],
nationCodeInit: '86' // nationCodeInit: '86' //
}; };
}, },
computed: { computed: {
info() { info() {
return this.$store.state.user; return this.$store.state.user;
} }
}, },
methods: { methods: {
geTel(tel) { geTel(tel) {
const reg = /^(\d{3})\d{4}(\d{4})$/; const reg = /^(\d{3})\d{4}(\d{4})$/;
return tel.replace(reg, '$1****$2'); return tel.replace(reg, '$1****$2');
}, },
doShow() { doShow() {
this.visible = true; this.visible = true;
const token = getToken() || getDesignToken(); const token = getToken() || getDesignToken();
getInfo(token).then(response => { getInfo(token).then(response => {
const user = response.data; debugger;
this.userInfo = { const user = response.data;
name: user.name, this.userInfo = {
nickname: user.nickname, name: user.name,
mobile: user.mobile, nickname: user.nickname,
email: user.email, mobile: user.mobile,
passWord: '' email: user.email,
}; passWord: ''
this.oldPassWord = user.password; };
this.nationCode = user.nationCode ? user.nationCode : '86'; this.oldPassWord = user.password;
this.nationCodeInit = user.nationCode ? user.nationCode : '86'; this.nationCode = user.nationCode ? user.nationCode : '86';
}).catch(error => { this.nationCodeInit = user.nationCode ? user.nationCode : '86';
console.log(error, '请求个人信息失败'); }).catch(error => {
}); console.log(error, '请求个人信息失败');
}, });
doClose() { },
this.visible = false; doClose() {
}, this.visible = false;
switcherName() { },
this.editInfo.name = this.userInfo.name; switcherName() {
this.nameShow = !this.nameShow; this.editInfo.name = this.userInfo.name;
}, this.nameShow = !this.nameShow;
async saveName() { },
if (this.editInfo.name) { async saveName() {
try { if (this.editInfo.name) {
await getUserinfoName(this.info.id, this.editInfo.name); try {
this.userInfo.name = this.editInfo.name; await getUserinfoName(this.info.id, this.editInfo.name);
this.nameShow = !this.nameShow; this.userInfo.name = this.editInfo.name;
this.$store.commit('SET_NAME', this.editInfo.name); this.nameShow = !this.nameShow;
} catch (error) { this.$store.commit('SET_NAME', this.editInfo.name);
console.log(error, '错误'); } catch (error) {
} console.log(error, '错误');
} }
}, }
},
switcherNickname() { switcherNickname() {
this.editInfo.nickname = this.userInfo.nickname; this.editInfo.nickname = this.userInfo.nickname;
this.nickNameShow = !this.nickNameShow; this.nickNameShow = !this.nickNameShow;
}, },
async saveNickName() { async saveNickName() {
if (this.editInfo.nickname) { if (this.editInfo.nickname) {
try { try {
await getUserinfoNickname(this.info.id, this.editInfo.nickname); await getUserinfoNickname(this.info.id, this.editInfo.nickname);
this.userInfo.nickname = this.editInfo.nickname; this.userInfo.nickname = this.editInfo.nickname;
this.nickNameShow = !this.nickNameShow; this.nickNameShow = !this.nickNameShow;
this.$store.commit('SET_NICKNAME', this.editInfo.nickname); this.$store.commit('SET_NICKNAME', this.editInfo.nickname);
} catch (error) { } catch (error) {
console.log(error, '错误'); console.log(error, '错误');
} }
} }
}, },
switcherMobile() { switcherMobile() {
// this.editInfo.mobile = this.userInfo.mobile; // this.editInfo.mobile = this.userInfo.mobile;
this.mobileShow = !this.mobileShow; this.mobileShow = !this.mobileShow;
}, },
async saveMobile() { async saveMobile() {
if (this.editInfo.mobile && this.mobileCode) { if (this.editInfo.mobile && this.mobileCode) {
try { try {
const params = { const params = {
mobile: this.editInfo.mobile, mobile: this.editInfo.mobile,
nationCode: this.nationCode, nationCode: this.nationCode,
validCode: this.mobileCode validCode: this.mobileCode
}; };
await getUserinfoMobile(this.info.id, params); await getUserinfoMobile(this.info.id, params);
this.userInfo.mobile = this.editInfo.mobile; this.userInfo.mobile = this.editInfo.mobile;
this.nationCodeInit = this.nationCode; this.nationCodeInit = this.nationCode;
this.mobileShow = !this.mobileShow; this.mobileShow = !this.mobileShow;
this.mobileCode = null; this.mobileCode = null;
} catch (error) { } catch (error) {
this.$message.info(this.$t('global.codeError')); this.$message.info(this.$t('global.codeError'));
} }
} }
}, },
async sendMobileCode() { async sendMobileCode() {
const random = Math.floor((Math.random()*10000)+1); const random = Math.floor((Math.random() * 10000) + 1);
const timeCount = Date.parse(new Date()) / 1000; const timeCount = Date.parse(new Date()) / 1000;
const pass = `${timeCount}${this.nationCode}${this.editInfo.mobile}${random}`; const pass = `${timeCount}${this.nationCode}${this.editInfo.mobile}${random}`;
const param = { const param = {
mobile: this.editInfo.mobile, mobile: this.editInfo.mobile,
nationCode: this.nationCode, nationCode: this.nationCode,
rd: random, rd: random,
time: timeCount, time: timeCount,
token: md5(pass) token: md5(pass)
}; };
try { try {
this.mobileCodeTime = 30; this.mobileCodeTime = 30;
this.mobileTime = setInterval(() => { this.mobileTime = setInterval(() => {
this.mobileCodeTime--; this.mobileCodeTime--;
if (this.mobileCodeTime <= 0) { if (this.mobileCodeTime <= 0) {
this.mobileCodeTime = 0; this.mobileCodeTime = 0;
clearInterval(this.mobileTime); clearInterval(this.mobileTime);
this.mobileTime = null; this.mobileTime = null;
} }
}, 1000); }, 1000);
await getUserinfoMobileCode(param); await getUserinfoMobileCode(param);
} catch (error) { } catch (error) {
this.$message.info(this.$t('global.codeFaile')); this.$message.info(this.$t('global.codeFaile'));
} }
}, },
switcherEmail() { switcherEmail() {
// this.editInfo.email = this.userInfo.email; // this.editInfo.email = this.userInfo.email;
this.emailShow = !this.emailShow; this.emailShow = !this.emailShow;
}, },
async saveEmail() { async saveEmail() {
if (this.editInfo.email && this.emailCode) { if (this.editInfo.email && this.emailCode) {
try { try {
const params = { const params = {
email: this.editInfo.email, email: this.editInfo.email,
validCode: this.emailCode validCode: this.emailCode
}; };
await getUserinfoEmail(this.info.id, params); await getUserinfoEmail(this.info.id, params);
this.userInfo.email = this.editInfo.email; this.userInfo.email = this.editInfo.email;
this.emailShow = !this.emailShow; this.emailShow = !this.emailShow;
this.emailCode = null; this.emailCode = null;
} catch (error) { } catch (error) {
this.$message.info(this.$t('global.codeError')); this.$message.info(this.$t('global.codeError'));
} }
} }
}, },
async sendEmailCode() { async sendEmailCode() {
try { try {
this.emailCodeTime = 30; this.emailCodeTime = 30;
this.emailTime = setInterval(() => { this.emailTime = setInterval(() => {
this.emailCodeTime--; this.emailCodeTime--;
if (this.emailCodeTime <= 0) { if (this.emailCodeTime <= 0) {
this.emailCodeTime = 0; this.emailCodeTime = 0;
clearInterval(this.emailTime); clearInterval(this.emailTime);
this.emailTime = null; this.emailTime = null;
} }
}, 1000); }, 1000);
await getUserinfoEmailCode(this.editInfo.email); await getUserinfoEmailCode(this.editInfo.email);
} catch (error) { } catch (error) {
this.$message.info(this.$t('global.codeFaile')); this.$message.info(this.$t('global.codeFaile'));
} }
}, },
switcherPassWord() { switcherPassWord() {
this.passwordShow = !this.passwordShow; this.passwordShow = !this.passwordShow;
}, },
async savePassWord() { async savePassWord() {
if (this.newPassWord1.length <= 5) { if (this.newPassWord1.length <= 5) {
this.$message.info(this.$t('global.passWordLength')); this.$message.info(this.$t('global.passWordLength'));
} else { } else {
this.uploadPassword(); this.uploadPassword();
} }
}, },
async uploadPassword() { async uploadPassword() {
if (this.newPassWord1) { if (this.newPassWord1) {
// //
const param = { const param = {
password: md5(this.newPassWord1), password: md5(this.newPassWord1),
vfCode: this.passWordCode vfCode: this.passWordCode
}; };
try { try {
await getUserinfoPassword(this.info.id, param); await getUserinfoPassword(this.info.id, param);
this.passwordShow = !this.passwordShow; this.passwordShow = !this.passwordShow;
this.newPassWord1 = ''; this.newPassWord1 = '';
this.passWordCode = null; this.passWordCode = null;
} catch (error) { } catch (error) {
console.log(error, 11); console.log(error, 11);
} }
} else { } else {
this.$message.info(this.$t('global.passWordSome')); this.$message.info(this.$t('global.passWordSome'));
} }
}, },
async sendPassWordCode() { async sendPassWordCode() {
if (this.userInfo.mobile) { if (this.userInfo.mobile) {
const random = Math.floor((Math.random()*10000)+1); const random = Math.floor((Math.random() * 10000) + 1);
const timeCount = Date.parse(new Date()) / 1000; const timeCount = Date.parse(new Date()) / 1000;
const pass = `${timeCount}${this.nationCodeInit}${this.userInfo.mobile}${random}`; const pass = `${timeCount}${this.nationCodeInit}${this.userInfo.mobile}${random}`;
const param = { const param = {
mobile: this.userInfo.mobile, mobile: this.userInfo.mobile,
nationCode: this.nationCodeInit, nationCode: this.nationCodeInit,
rd: random, rd: random,
time: timeCount, time: timeCount,
token: md5(pass) token: md5(pass)
}; };
try { try {
this.passWordCodeTime = 30; this.passWordCodeTime = 30;
this.passWordTime = setInterval(() => { this.passWordTime = setInterval(() => {
this.passWordCodeTime--; this.passWordCodeTime--;
if (this.passWordCodeTime <= 0) { if (this.passWordCodeTime <= 0) {
this.passWordCodeTime = 0; this.passWordCodeTime = 0;
clearInterval(this.mobileTime); clearInterval(this.mobileTime);
this.passWordTime = null; this.passWordTime = null;
} }
}, 1000); }, 1000);
await getUserinfoMobileCode(param); await getUserinfoMobileCode(param);
} catch (error) { } catch (error) {
this.$message.info(this.$t('global.codeFaile')); this.$message.info(this.$t('global.codeFaile'));
} }
} else { } else {
this.passwordShow = !this.passwordShow; this.passwordShow = !this.passwordShow;
this.$message.info(this.$t('global.enterMobileNumber')); this.$message.info(this.$t('global.enterMobileNumber'));
} }
} }
} }
}; };
</script> </script>

View File

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

View File

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

View File

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

View File

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

View File

@ -1,76 +1,76 @@
import { getDomOffset } from '@/utils/index'; import { getDomOffset } from '@/utils/index';
const config = { const config = {
namespaced: true, namespaced: true,
state: { state: {
width: document.documentElement.clientWidth, // 地图canvas 容器 宽度 width: document.documentElement.clientWidth, // 地图canvas 容器 宽度
height: document.documentElement.clientHeight, // 地图canvas 容器 高度 height: document.documentElement.clientHeight, // 地图canvas 容器 高度
menuBarLoadedCount: 0, // menuBar加载完成 menuBarLoadedCount: 0, // menuBar加载完成
canvasSizeCount: 0, // 地图canvas 大小变更标识 canvasSizeCount: 0, // 地图canvas 大小变更标识
canvasId: '', // 地图canvas容器dom id canvasId: '', // 地图canvas容器dom id
canvasOffset: {}, // canvas dom 偏移 canvasOffset: {}, // canvas dom 偏移
canvasOffsetCount: 0 // 地图canvas 偏移变更标识 canvasOffsetCount: 0 // 地图canvas 偏移变更标识
}, },
getters: { getters: {
width: (state) => { width: (state) => {
return state.width; return state.width;
}, },
height: (state) => { height: (state) => {
return state.height; return state.height;
}, },
canvasId: (state) => { canvasId: (state) => {
return state.canvasId; return state.canvasId;
} }
}, },
mutations: { mutations: {
SET_WIDTH: (state, width) => { SET_WIDTH: (state, width) => {
state.width = width; state.width = width;
}, },
SET_HEIGHT: (state, height) => { SET_HEIGHT: (state, height) => {
state.height = height; state.height = height;
}, },
setCanvasId: (state, id) => { setCanvasId: (state, id) => {
state.canvasId = id; state.canvasId = id;
}, },
updateMenuBar: (state) => { updateMenuBar: (state) => {
state.menuBarLoadedCount += 1; state.menuBarLoadedCount += 1;
}, },
setCanvasOffset: (state, offset) => { setCanvasOffset: (state, offset) => {
state.canvasOffset = offset; state.canvasOffset = offset;
} }
}, },
actions: { actions: {
resize({ state, commit }, opt) { resize({ state, commit }, opt) {
if (opt.width) { if (opt.width) {
commit('SET_WIDTH', opt.width); commit('SET_WIDTH', opt.width);
} }
if (opt.height) { if (opt.height) {
commit('SET_HEIGHT', opt.height); commit('SET_HEIGHT', opt.height);
} }
state.canvasSizeCount += 1; state.canvasSizeCount += 1;
}, },
updateMenuBar({ commit }) { updateMenuBar({ commit }) {
commit('updateMenuBar'); commit('updateMenuBar');
}, },
setCurrentCancasId: ({state, dispatch, commit }, payLoad) => { setCurrentCancasId: ({state, dispatch, commit }, payLoad) => {
commit('setCanvasId', payLoad.id); commit('setCanvasId', payLoad.id);
dispatch('resetCanvasOffset'); dispatch('resetCanvasOffset');
}, },
resetCanvasOffset: ({ commit, state }) => { resetCanvasOffset: ({ commit, state }) => {
const mapCanvas = document.getElementById(state.canvasId); const mapCanvas = document.getElementById(state.canvasId);
if (mapCanvas) { if (mapCanvas) {
const offset = getDomOffset(mapCanvas); const offset = getDomOffset(mapCanvas);
commit('setCanvasOffset', offset); commit('setCanvasOffset', offset);
state.canvasOffsetCount += 1; state.canvasOffsetCount += 1;
} }
} }
} }
}; };
export default config; export default config;

View File

@ -1,6 +1,8 @@
import deviceType from '@/jmap/constant/deviceType'; import deviceType from '@/jmap/constant/deviceType';
import { parser, updateMapData } from '@/jmap/utils/parser'; import { parser, updateMapData } from '@/jmap/utils/parser';
import Vue from 'vue'; import Vue from 'vue';
import { deepAssign } from '@/utils/index';
/** /**
* 查询向上受影响的Devices * 查询向上受影响的Devices
* @param {Object} map * @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, namespaced: true,
state: { state: {
stepData: [], // 缓存数据
recoverStepData: [], // 缓存恢复数据
map: null, // 地图数据 map: null, // 地图数据
dataZoom: {}, // 缩放位置 dataZoom: {}, // 缩放位置
mapDevice: {}, // 解析后的地图数据 mapDevice: {}, // 解析后的地图数据
@ -220,6 +302,12 @@ const map = {
mapList: (state) => { mapList: (state) => {
return state.mapList; return state.mapList;
}, },
stepData: (state) => {
return state.stepData;
},
recoverStepData: (state) => {
return state.recoverStepData;
},
map: (state) => { map: (state) => {
return state.map; return state.map;
}, },
@ -378,6 +466,9 @@ const map = {
trainDetails: (state) => { trainDetails: (state) => {
return state.trainDetails; return state.trainDetails;
}, },
mapDevice: (state) => {
return state.mapDevice;
},
getDeviceByCode: (state) => (code) => { getDeviceByCode: (state) => (code) => {
return state.mapDevice[code]; return state.mapDevice[code];
}, },
@ -443,11 +534,13 @@ const map = {
state.dataZoom = dataZoom; state.dataZoom = dataZoom;
}, },
mapRender: (state, devices) => { mapRender: (state, devices) => {
if (state.map) { if (devices && devices.length) {
devices.forEach(elem => { updateMapData(state, elem); }); if (state.map) {
} devices.forEach(elem => { updateMapData(state, elem); });
if (Vue.prototype.$jlmap) { }
Vue.prototype.$jlmap.render(devices); if (Vue.prototype.$jlmap) {
Vue.prototype.$jlmap.render(devices);
}
} }
}, },
setTrainDetails: (state, details) => { setTrainDetails: (state, details) => {
@ -530,19 +623,7 @@ const map = {
setMapDataIdList: ({ state }, data) => { setMapDataIdList: ({ state }, data) => {
state.mapIdList[`mapDate_${data.mapId}`] = data.mapData; state.mapIdList[`mapDate_${data.mapId}`] = data.mapData;
}, },
updateMapDevices: ({ commit, state }, models) => {
updateMapDevices: ({ commit }, models) => {
return new Promise((resolve) => {
if (!(models instanceof Array)) {
models = [models];
}
commit('mapRender', models);
resolve(models);
});
},
deleteMapDevices: ({ commit, state }, models) => {
return new Promise((resolve) => { return new Promise((resolve) => {
if (!(models instanceof Array)) { if (!(models instanceof Array)) {
models = [models]; models = [models];
@ -550,16 +631,29 @@ const map = {
// 查找向上关联需要一起删除的设备 // 查找向上关联需要一起删除的设备
const effectedModelList = []; const effectedModelList = [];
models.forEach((device) => { models.forEach((model) => {
queryEffectedModels(state.map, device, effectedModelList); if (model['_dispose']) {
queryEffectedModels(state.map, model, effectedModelList);
} else {
effectedModelList.push(model);
}
}); });
effectedModelList.forEach(elem => { elem['_dispose'] = true; }); handleOperation(state, effectedModelList);
commit('mapRender', effectedModelList); commit('mapRender', effectedModelList);
resolve(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 }) {
saveMapDeviceDefaultRelations(state); saveMapDeviceDefaultRelations(state);
}, },

View File

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

View File

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

View File

@ -6,7 +6,7 @@ export function getBaseUrl() {
BASE_API = 'https://test.joylink.club/jlcloud'; BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪 // BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强 // BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 王兴杰 // BASE_API = 'http://192.168.3.41:9000'; // 杜闪
// BASE_API = 'http://192.168.3.82:9000'; // 杜康 // BASE_API = 'http://192.168.3.82:9000'; // 杜康
} else { } else {
BASE_API = process.env.VUE_APP_BASE_API; BASE_API = process.env.VUE_APP_BASE_API;

View File

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

View File

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

View File

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

View File

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

View File

@ -1,179 +1,167 @@
<template> <template>
<div> <div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" /> <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 ref="applyReject" :title="$t('approval.rejectScript')" @reloadTable="reloadTable" @create="handleConfirmReject" />
</script-operate> </div>
</div>
</template> </template>
<script> <script>
import { launchFullscreen } from '@/utils/screen'; import { launchFullscreen } from '@/utils/screen';
import { UrlConfig } from '@/router/index'; import { UrlConfig } from '@/router/index';
import { scriptDraftRecordNotify } from '@/api/simulation'; import { scriptDraftRecordNotify } from '@/api/simulation';
import ScriptOperate from './operate'; import ScriptOperate from './operate';
import { reviewScriptList,publishScript,rejectScript } from '@/api/designPlatform'; import { reviewScriptList, publishScript, rejectScript } from '@/api/designPlatform';
import { listPublishMap } from '@/api/jmap/map'; import { listPublishMap } from '@/api/jmap/map';
export default { export default {
name: 'ScriptApproval', name: 'ScriptApproval',
components: { components: {
ScriptOperate ScriptOperate
}, },
data() { data() {
return{ return {
allMapList:[], allMapList:[],
pagerConfig: { pagerConfig: {
pageSize: 'pageSize', pageSize: 'pageSize',
pageIndex: 'pageNum' pageIndex: 'pageNum'
}, },
queryForm: { queryForm: {
labelWidth: '100px', labelWidth: '100px',
reset: true, reset: true,
queryObject: { queryObject: {
mapId: { mapId: {
type: 'select', type: 'select',
label: this.$t('approval.map'), label: this.$t('approval.map'),
config: { config: {
data: [] data: []
}
},
'name':{
type: 'text',
label: this.$t('approval.scriptName')
},
'creatorName': {
type: 'text',
label: this.$t('approval.applicant')
} }
},
'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(){ queryFunction(params) {
this.loadInitData(); return reviewScriptList(params);
}, },
beforeDestroy(){ applyPassed(index, row) {
this.handleConfirmPass(row);
}, },
watch: { applyReject(index, row) {
this.$refs.applyReject.doShow(row);
}, },
methods: { scriptPreview(index, row) {
reloadTable() { const mapInfo = this.allMapList.find(elem=>{ return elem.id == row.mapId; });
if (this.queryList && this.queryList.reload) { scriptDraftRecordNotify(row.id).then(resp => {
this.queryList.reload(); 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();
goDetail() { }).catch(error => {
this.$router.push({path:``}); this.$messageBox(`${this.$t('scriptRecord.createSimulationFail')}: ${error.message}`);
}, });
async loadInitData() { },
try { handleConfirmReject(data) {
// rejectScript(data.id, data).then(resp => {
this.mapList = []; this.reloadTable();
const res = await listPublishMap(); this.$message.success(this.$t('approval.rejectScriptSuccess'));
this.allMapList=res.data; }).catch(error => {
this.mapList = res.data.map(elem => { return { value: elem.id, label: elem.name } }); this.$messageBox(`${this.$t('approval.rejectScriptFailed')}: ${error.message}`);
this.queryForm.queryObject.mapId.config.data=this.mapList; });
} catch (error) { },
console.error(error, '获取发布地图'); handleConfirmPass(data) {
} publishScript(data.id).then(resp => {
}, this.reloadTable();
queryFunction(params) { this.$message.success(this.$t('approval.passedScriptSuccess'));
return reviewScriptList(params); }).catch(error => {
}, this.$messageBox(`${this.$t('approval.passedScriptFailed')}: ${error.message}`);
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}`);
})
},
} }
} }
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
/deep/ /deep/

View File

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

View File

@ -1,9 +1,9 @@
<template> <template>
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="600px" :before-close="handleClose" center> <el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="600px" :before-close="handleClose" center>
<div> <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 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 <el-date-picker
v-model="formModel.date" v-model="formModel.date"
align="right" align="right"
@ -22,33 +22,33 @@
> >
<el-table-column <el-table-column
prop="permissionName" prop="permissionName"
label="权限名称" :label="$t('permission.permissionName')"
align="center" align="center"
/> />
<el-table-column <el-table-column
prop="amount" prop="amount"
label="权限总数" :label="$t('permission.permissionTotal')"
align="center" align="center"
width="80" width="80"
/> />
<el-table-column <el-table-column
prop="remains" prop="remains"
label="剩余权限" :label="$t('permission.permissionRemains')"
align="center" align="center"
width="80" width="80"
/> />
<el-table-column <el-table-column
prop="isPackage" prop="isPackage"
label="是否万能" :label="$t('permission.isPackage')"
align="center" align="center"
width="80" width="80"
> >
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.isPackage?'是':'否' }} {{ scope.row.isPackage? $t('global.yes'):$t('global.no') }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="分发权限数量" :label="$t('permission.numOfDistribute') "
align="center" align="center"
> >
<template slot-scope="scope"> <template slot-scope="scope">
@ -87,7 +87,7 @@ export default {
endTime: '', endTime: '',
date: '' date: ''
}, },
prdCode: '', prdId: '',
mapId: '', mapId: '',
numberMessage: '', numberMessage: '',
PermissionType: '', PermissionType: '',
@ -149,10 +149,9 @@ export default {
changeSelectDate() { changeSelectDate() {
if (this.formModel.date) { if (this.formModel.date) {
this.isLoading = true; 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) { if (this.PermissionType == PermissionType.LESSON || this.PermissionType == PermissionType.EXAM) {
data.lessonId = this.formModel.lessonId; data.lessonId = this.formModel.lessonId;
data.type = this.PermissionType;
} }
getAvailableUserPermission(data).then(res=>{ getAvailableUserPermission(data).then(res=>{
this.isLoading = false; this.isLoading = false;
@ -176,7 +175,7 @@ export default {
if (data) { if (data) {
this.formModel.lessonId = data.id; this.formModel.lessonId = data.id;
this.formModel.lessonName = data.name; this.formModel.lessonName = data.name;
this.prdCode = data.prdCode; this.prdId = data.prdId;
this.mapId = data.mapId; this.mapId = data.mapId;
this.PermissionType = data.PermissionType; this.PermissionType = data.PermissionType;
this.setTotalMax(); this.setTotalMax();
@ -185,16 +184,24 @@ export default {
handleSure() { handleSure() {
this.$refs['distributeForm'].validate((info) => { this.$refs['distributeForm'].validate((info) => {
if (info) { if (info) {
this.isLoading = true;
const model = { const model = {
startTime: this.formModel.date[0], startTime: this.formModel.date[0],
endTime: this.formModel.date[1], endTime: this.formModel.date[1],
userPermissionAndAmountVOList:[], userPermissionAndAmountVOList:[],
distribute: false distribute: false
}; };
let count = 0;
this.formModel.permissionList.forEach(data=>{ this.formModel.permissionList.forEach(data=>{
if (data.chooseNumber > 0) {
count++;
}
model.userPermissionAndAmountVOList.push({'userPermissionId':data.id, 'amount':data.chooseNumber}); 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 => { givePermission(model).then(response => {
this.isLoading = false; this.isLoading = false;

View File

@ -1,9 +1,9 @@
<template> <template>
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="600px" :before-close="handleClose" center> <el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="600px" :before-close="handleClose" center>
<div> <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 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 <el-date-picker
v-model="formModel.date" v-model="formModel.date"
align="right" align="right"
@ -22,33 +22,33 @@
> >
<el-table-column <el-table-column
prop="permissionName" prop="permissionName"
label="权限名称" :label="$t('permission.permissionName')"
align="center" align="center"
/> />
<el-table-column <el-table-column
prop="amount" prop="amount"
label="权限总数" :label="$t('permission.permissionTotal')"
align="center" align="center"
width="80" width="80"
/> />
<el-table-column <el-table-column
prop="remains" prop="remains"
label="剩余权限" :label="$t('permission.permissionRemains')"
align="center" align="center"
width="80" width="80"
/> />
<el-table-column <el-table-column
prop="isPackage" prop="isPackage"
label="是否万能" :label="$t('permission.isPackage')"
align="center" align="center"
width="80" width="80"
> >
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.isPackage?'是':'否' }} {{ scope.row.isPackage? $t('global.yes'):$t('global.no') }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="转赠权限数量" :label="$t('permission.numOfTransfer')"
align="center" align="center"
> >
<template slot-scope="scope"> <template slot-scope="scope">
@ -87,7 +87,7 @@ export default {
endTime: '', endTime: '',
date: '' date: ''
}, },
prdCode: '', prdId: '',
mapId: '', mapId: '',
numberMessage: '', numberMessage: '',
PermissionType: '', PermissionType: '',
@ -149,10 +149,9 @@ export default {
changeSelectDate() { changeSelectDate() {
if (this.formModel.date) { if (this.formModel.date) {
this.isLoading = true; 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) { if (this.PermissionType == PermissionType.LESSON || this.PermissionType == PermissionType.EXAM) {
data.lessonId = this.formModel.lessonId; data.lessonId = this.formModel.lessonId;
data.type = this.PermissionType;
} }
getAvailableUserPermission(data).then(res=>{ getAvailableUserPermission(data).then(res=>{
this.isLoading = false; this.isLoading = false;
@ -176,7 +175,7 @@ export default {
if (data) { if (data) {
this.formModel.lessonId = data.id; this.formModel.lessonId = data.id;
this.formModel.lessonName = data.name; this.formModel.lessonName = data.name;
this.prdCode = data.prdCode; this.prdId = data.prdId;
this.mapId = data.mapId; this.mapId = data.mapId;
this.PermissionType = data.PermissionType; this.PermissionType = data.PermissionType;
this.setTotalMax(); this.setTotalMax();
@ -185,16 +184,24 @@ export default {
handleSure() { handleSure() {
this.$refs['transferForm'].validate((info) => { this.$refs['transferForm'].validate((info) => {
if (info) { if (info) {
this.isLoading = true;
const model = { const model = {
startTime:`${this.formModel.date[0]} 00:00:00`, startTime:`${this.formModel.date[0]} 00:00:00`,
endTime:`${this.formModel.date[1]} 23:59:59`, endTime:`${this.formModel.date[1]} 23:59:59`,
userPermissionAndAmountVOList:[], userPermissionAndAmountVOList:[],
distribute: true distribute: true
}; };
let count = 0;
this.formModel.permissionList.forEach(data=>{ this.formModel.permissionList.forEach(data=>{
if (data.chooseNumber > 0) {
count++;
}
model.userPermissionAndAmountVOList.push({'userPermissionId':data.id, 'amount':data.chooseNumber}); 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 => { givePermission(model).then(response => {
this.isLoading = false; 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() { close() {
this.dialogVisible = false; this.dialogVisible = false;

View File

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

View File

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

View File

@ -3,10 +3,10 @@
<div class="clearfix"> <div class="clearfix">
<span>{{ $t('map.publishedMapList') }}</span> <span>{{ $t('map.publishedMapList') }}</span>
</div> </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" /> <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 /> <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"> <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 slot-scope="{ node:tnode, data }">
<span class="el-icon-tickets" :style="{color: data.valid ? 'green':''}" /> <span class="el-icon-tickets" :style="{color: data.valid ? 'green':''}" />
@ -52,11 +52,6 @@ export default {
}, },
node: { node: {
}, },
point: {
x: 0,
y: 0
},
editModel: {},
localParamName: 'publish_cityCode' localParamName: 'publish_cityCode'
}; };
}, },
@ -140,14 +135,13 @@ export default {
cityCode: elem.cityCode 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( elem.children.push(
{ {
id: '3', id: '3',
name: this.$t('designPlatform.scriptDesign'), name: this.$t('designPlatform.scriptDesign'),
type: 'scriptDesign', type: 'scriptDesign',
mapId: elem.id, mapId: elem.id,
skinCode: elem.skinCode,
cityCode: elem.cityCode cityCode: elem.cityCode
// code:elem.children.find(n => { return n.name.includes("")}) // code:elem.children.find(n => { return n.name.includes("")})
}); });
@ -197,6 +191,12 @@ export default {
color: #3ea726; color: #3ea726;
} }
} }
.text_item{
height: calc(100% - 47px);
.tree_mian_box{
height: calc(100% - 76px);
}
}
.map-list-main{ .map-list-main{
text-align:left; text-align:left;

View File

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

View File

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

View File

@ -44,23 +44,12 @@ export default {
this.initLoadData(); this.initLoadData();
}); });
}, },
// '$store.state.map.mapViewLoadedCount': function (val) {
// // this.subscribe();
// debugger;
// this.$store.dispatch('map/setTrainWindowShow', false);
// },
'$store.state.app.windowSizeCount': function() { '$store.state.app.windowSizeCount': function() {
this.setWindowSize(); this.setWindowSize();
} }
}, },
async beforeDestroy() { async beforeDestroy() {
// await this.clearAllTimer();
// if (!this.isReplay) {
// await this.quit();
// }
// await this.$store.dispatch('training/reset');
await this.$store.dispatch('map/mapClear'); await this.$store.dispatch('map/mapClear');
// EventBus.$off('clearCheckLogin');
}, },
async mounted() { async mounted() {
await this.setWindowSize(); await this.setWindowSize();
@ -103,7 +92,6 @@ export default {
const width = this.$store.state.app.width - (this.widthLeft || 450); const width = this.$store.state.app.width - (this.widthLeft || 450);
const height = this.height; const height = this.height;
this.$store.dispatch('config/resize', { width, 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"> <div class="clearfix">
<span>{{ $t('map.myMapList') }}</span> <span>{{ $t('map.myMapList') }}</span>
</div> </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 /> <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"> <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 slot-scope="{ node:tnode, data }">
<span class="el-icon-tickets" :style="{color: data.valid ? 'green':''}" /> <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 { postBuildMapImport, listMap } from '@/api/jmap/mapdraft';
import { UrlConfig } from '@/router/index'; import { UrlConfig } from '@/router/index';
import { removeSessionStorage } from '@/utils/auth'; import { removeSessionStorage } from '@/utils/auth';
import localStore from 'storejs';
import MapOperateMenu from './mapmanage/operateMenu'; import MapOperateMenu from './mapmanage/operateMenu';
export default { export default {
@ -62,9 +61,6 @@ export default {
children: 'children', children: 'children',
label: 'name' label: 'name'
}, },
node: {
},
heightUp: 450,
point: { point: {
x: 0, x: 0,
y: 0 y: 0
@ -74,11 +70,11 @@ export default {
}; };
}, },
computed: { computed: {
role() { // role() {
return this.$store.state.user.roles.includes('04') || // return this.$store.state.user.roles.includes('04') ||
this.$store.state.user.roles.includes('05') || // this.$store.state.user.roles.includes('05') ||
this.$store.state.user.roles.includes('01'); // this.$store.state.user.roles.includes('01');
} // }
}, },
watch: { watch: {
filterText(val) { filterText(val) {
@ -89,7 +85,6 @@ export default {
removeSessionStorage('demonList'); removeSessionStorage('demonList');
}, },
mounted() { mounted() {
this.heightUp = Number(localStore.get('upHeight') ? localStore.get('upHeight') : (this.height) / 2);
this.loadInitData(); this.loadInitData();
}, },
methods: { methods: {
@ -106,8 +101,6 @@ export default {
try { try {
const res = await listMap(); const res = await listMap();
res.data && res.data.forEach(elem=>{ res.data && res.data.forEach(elem=>{
// if(elem.children)
// {
elem.type = 'map'; elem.type = 'map';
elem.children = [ elem.children = [
{ {
@ -127,7 +120,6 @@ export default {
skinCode: elem.skinCode skinCode: elem.skinCode
} }
]; ];
// }
}); });
this.treeData = res.data; this.treeData = res.data;
@ -165,8 +157,6 @@ export default {
this.editModel = obj; this.editModel = obj;
this.editModel.skinCode = obj.skinCode; this.editModel.skinCode = obj.skinCode;
this.$store.dispatch('menuOperation/setPopMenu', { position: this.point, menu: menu }); this.$store.dispatch('menuOperation/setPopMenu', { position: this.point, menu: menu });
} else {
//
} }
}, },
jlmap3d() { jlmap3d() {
@ -212,9 +202,13 @@ export default {
height: 47px; height: 47px;
line-height: 47px; line-height: 47px;
} }
.tree_box{ .text_item{
height: 100%; height: calc(100% - 47px);
} .tree_box{
height: calc(100% - 89px);
overflow-y: auto;
}
}
.buttonList{ .buttonList{
padding: 8px 0px 8px 0px; padding: 8px 0px 8px 0px;
border-top: 1px #ccc solid; border-top: 1px #ccc solid;

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="app-wrapper" style="height: 100%;"> <div class="app-wrapper">
<map-create ref="mapCreate" :skin-code="skinCode" @refresh="refresh1" @editmap="handleNodeClick" /> <map-create ref="mapCreate" :skin-code="skinCode" @refresh="refresh1" />
<div v-show="listShow" class="examList" :style="{width: widthLeft+'px'}"> <div v-show="listShow" class="examList" :style="{width: widthLeft+'px'}">
<demon-list ref="demonList" :width="widthLeft" @createMap="createMap" /> <demon-list ref="demonList" :width="widthLeft" @createMap="createMap" />
</div> </div>
@ -19,7 +19,6 @@ import { launchFullscreen } from '@/utils/screen';
import localStore from 'storejs'; import localStore from 'storejs';
import { getSessionStorage, setSessionStorage } from '@/utils/auth'; import { getSessionStorage, setSessionStorage } from '@/utils/auth';
import MapCreate from './mapmanage/create'; import MapCreate from './mapmanage/create';
import { UrlConfig } from '@/router/index';
export default { export default {
name: 'DesignPlatform', name: 'DesignPlatform',
@ -71,38 +70,12 @@ export default {
drapWidth(width) { drapWidth(width) {
this.widthLeft = Number(width); this.widthLeft = Number(width);
}, },
createMap() { createMap() {
this.$refs.mapCreate.show(); this.$refs.mapCreate.show();
}, },
refresh1() { refresh1() {
this.$refs.demonList.loadInitData(); 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() { resize() {
this.widthLeft = Number(localStore.get('LeftWidth')) || this.widthLeft; this.widthLeft = Number(localStore.get('LeftWidth')) || this.widthLeft;
const width = this.$store.state.app.width - 521 - 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; const heights = this.$store.state.app.height - 90;
this.$store.dispatch('config/resize', { width: widths, height: heights }); this.$store.dispatch('config/resize', { width: widths, height: heights });
} }
} }
}; };
</script> </script>
@ -122,7 +94,7 @@ export default {
@import "src/styles/mixin.scss"; @import "src/styles/mixin.scss";
.app-wrapper { .app-wrapper {
@include clearfix; @include clearfix;
position: relative; position: relative;
height: 100%; height: 100%;
width: 100%; width: 100%;

View File

@ -43,16 +43,15 @@
<el-button type="primary" :loading="loading" @click="create">{{ $t('map.confirm') }}</el-button> <el-button type="primary" :loading="loading" @click="create">{{ $t('map.confirm') }}</el-button>
</span> </span>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { newMap, postBuildMapImport, newUsePublishMap } from '@/api/jmap/mapdraft'; import { newMap, newUsePublishMap } from '@/api/jmap/mapdraft';
import { listPublishMap } from '@/api/jmap/map'; import { listPublishMap } from '@/api/jmap/map';
import XLSX from 'xlsx'; // import XLSX from 'xlsx';
import { translate, translateSheetTitle } from '@/scripts/translate'; // import { translate, translateSheetTitle } from '@/scripts/translate';
import { sheet_to_json } from '@/utils/Export2Excel'; // import { sheet_to_json } from '@/utils/Export2Excel';
import { getSkinCodeList } from '@/api/management/mapskin'; import { getLineCodeList } from '@/api/management/mapline';
export default { export default {
name: 'MapCreate', name: 'MapCreate',
@ -127,7 +126,7 @@ export default {
}, },
initLoadData() { initLoadData() {
this.skinCodeList = []; this.skinCodeList = [];
getSkinCodeList().then(response => { getLineCodeList().then(response => {
this.skinCodeList = response.data; this.skinCodeList = response.data;
}); });
this.$Dictionary.cityType().then(list => { 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> </script>

View File

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

View File

@ -17,6 +17,7 @@ import MapEdit from './edit';
import MapSaveAs from './saveAs'; import MapSaveAs from './saveAs';
import MapPublish from './publish'; import MapPublish from './publish';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { saveMap } from '@/api/jmap/mapdraft';
export default { export default {
name: 'MapOperateMenu', name: 'MapOperateMenu',
@ -47,10 +48,10 @@ export default {
label: this.$t('map.updateObj'), label: this.$t('map.updateObj'),
handler: this.updateObj handler: this.updateObj
}, },
// { {
// label: this.$t('map.updateObjAxis'), label: this.$t('map.updateObjAxis'),
// handler: this.updateObjAxis handler: this.updateObjAxis
// }, },
{ {
label: this.$t('map.saveAs'), label: this.$t('map.saveAs'),
handler: this.saveAs handler: this.saveAs
@ -69,7 +70,15 @@ export default {
handler: this.publish handler: this.publish
}, },
menuNormal: [], menuNormal: [],
menu: [] menu: [],
updtModel: {
code: '',
scaling: '',
origin: {
x: '',
y: ''
}
}
}; };
}, },
computed: { computed: {
@ -124,12 +133,45 @@ export default {
this.$refs.edit.show('editCode'); this.$refs.edit.show('editCode');
} }
}, },
// updateObjAxis() { updateObjAxis() {
// this.doClose(); this.doClose();
// if (this.$refs && this.$refs.axisEdit) { this.getMapOrigin();
// this.$refs.axisEdit.show('editPoint'); 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() { saveAs() {
this.doClose(); this.doClose();
if (this.$refs && this.$refs.saveAs) { if (this.$refs && this.$refs.saveAs) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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