# Conflicts:
#	src/layout/components/Navbar.vue
This commit is contained in:
fan 2019-11-13 14:31:56 +08:00
commit 6bb95775b3
93 changed files with 5975 additions and 6079 deletions

View File

@ -1,5 +1,8 @@
module.exports = {
presets: [
'@vue/app'
]
}
presets: [
'@vue/app'
]
// plugins: [
// '@babel/plugin-syntax-dynamic-import'
// ]
};

View File

@ -16,14 +16,12 @@
},
"dependencies": {
"axios": "0.18.0",
"echarts": "^4.2.1",
"element-ui": "2.7.2",
"file-saver": "^1.3.3",
"js-cookie": "2.2.0",
"js-md5": "^0.7.3",
"lodash": "^4.17.11",
"normalize.css": "7.0.0",
"nprogress": "0.2.0",
"path-to-regexp": "2.4.0",
"qrcode.vue": "^1.6.2",
"script-loader": "^0.7.2",
@ -31,11 +29,8 @@
"stompjs": "^2.3.3",
"storejs": "^1.0.25",
"three": "^0.107.0",
"vue": "2.6.10",
"vue-i18n": "^8.12.0",
"vue-router": "3.0.6",
"vuedraggable": "^2.20.0",
"vuex": "3.1.0",
"xlsx": "^0.14.2",
"zrender": "^4.0.4"
},
@ -51,9 +46,11 @@
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "10.0.1",
"babel-jest": "23.6.0",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-preset-env": "1.6.1",
"babel-preset-stage-2": "6.24.1",
"chalk": "2.4.2",
"compression-webpack-plugin": "^3.0.0",
"connect": "3.6.6",
"copy-webpack-plugin": "^4.5.2",
"eslint": "5.15.3",

View File

@ -5,11 +5,23 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="icon" href="<%= BASE_URL %>favicon.png">
<!-- <link rel="stylesheet" href="https://cdn.bootcss.com/element-ui/2.12.0/theme-chalk/index.css"> -->
<link href="https://cdn.bootcss.com/nprogress/0.2.0/nprogress.min.css" rel="stylesheet">
<title><%= webpackConfig.name %></title>
<script src="/static/inflate.min.js"></script>
<script src="/static/three.min.js"></script>
<script src="https://cdn.bootcss.com/echarts/4.4.0-rc.1/echarts-en.common.js"></script>
<script src="https://cdn.bootcss.com/vue/2.6.10/vue.min.js"></script>
<script src="https://cdn.bootcss.com/vuex/3.1.0/vuex.min.js"></script>
<script src="https://cdn.bootcss.com/vue-router/3.0.6/vue-router.min.js"></script>
<script src="https://cdn.bootcss.com/nprogress/0.2.0/nprogress.min.js"></script>
<!-- <script src="https://cdn.bootcss.com/element-ui/2.12.0/index.js"></script>
<script src="https://cdn.bootcss.com/element-ui/2.12.0/locale/en.min.js"></script>
<script src="https://cdn.bootcss.com/element-ui/2.12.0/locale/zh-CN.min.js"></script> -->
</head>
<body>
<body>
<noscript>
<strong>We're sorry but <%= webpackConfig.name %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>

View File

@ -7,7 +7,7 @@
<script>
import { handleToken } from '@/utils/auth';
import { creatSubscribe, perpetualTopic, commonTopic } from '@/utils/stomp';
import { creatSubscribe, clearSubscribe, perpetualTopic, commonTopic } from '@/utils/stomp';
import DeomonTopic from '@/views/demonstration/deomonTopic';
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
import Cookies from 'js-cookie';
@ -31,19 +31,37 @@ export default {
},
mounted() {
this.prohibitSystemContextMenu();
this.subscribe();
const project = window.sessionStorage.getItem('project');
document.querySelector("link[rel*='icon']").href = ProjectIcon[project];
// window.addEventListener('beforeunload', async e => {
// const token = handleToken();
// Cookies.remove('UserDesignName');
// Cookies.remove('UserDesignToken');
// Cookies.remove('UserName');
// Cookies.remove('UserToken');
// await logout(token);
// });
var beforeUnload_time = 0;
var gap_time = 0;
var isFireFox = navigator.userAgent.indexOf('Firefox') > -1;
window.addEventListener('unload', async e => {
gap_time = new Date().getTime() - beforeUnload_time;
if (gap_time <= 5) {
await this.pageDestory();
}
});
window.addEventListener('beforeunload', async e => {
beforeUnload_time = new Date().getTime();
if (isFireFox) {
await this.pageDestory();
}
});
this.subscribe();
},
methods: {
async pageDestory() {
this.clearSubscribe();
const token = handleToken();
Cookies.remove('UserDesignName');
Cookies.remove('UserDesignToken');
Cookies.remove('UserName');
Cookies.remove('UserToken');
await logout(token);
},
resizeHandler() {
this.$store.dispatch('app/resize', {width: this._clientWidth, height: this._clientHeight});
},
@ -52,20 +70,25 @@ export default {
return false;
};
},
subscribe() {
this.$nextTick(() => {
if (!this.$route.path.includes('/login') && this.$route.path != '/404') {
const header = { group: '', 'X-Token': handleToken() };
creatSubscribe(perpetualTopic, header);
creatSubscribe(commonTopic, header);
}
});
},
subscribeMessage(res) {
if (this.$refs.deomonTopic) {
this.$refs.deomonTopic.doShow(res);
this.$store.dispatch('socket/setRoomInvite');
}
},
subscribe() {
this.$nextTick(() => {
const token = handleToken();
if (token && this.$route.path != '/404') {
const header = { group: '', 'X-Token': token };
creatSubscribe(perpetualTopic, header);
creatSubscribe(commonTopic, header);
}
});
},
clearSubscribe() {
clearSubscribe(perpetualTopic);
clearSubscribe(commonTopic);
}
}
};

View File

@ -2,265 +2,256 @@
import request from '@/utils/request';
export function postDataBd(data) {
return request({
url: `/api/audio/bd?group=${data.group}&conversationId=${data.conversationId}`,
method: 'post',
data: data.file
});
return request({
url: `/api/audio/bd?group=${data.group}&conversationId=${data.conversationId}`,
method: 'post',
data: data.file
});
}
// 创建/获取会话id
export function getConversation(data) {
return request({
url: `/api/audio/conversation`,
method: 'get',
params: {
group: data.group,
userId: data.userId,
code: data.code
}
});
return request({
url: `/api/audio/conversation`,
method: 'get',
params: {
group: data.group,
userId: data.userId,
code: data.code
}
});
}
export function postDataXf(data) {
return request({
url: `/api/audio/xf`,
method: 'post',
data: data
});
return request({
url: `/api/audio/xf`,
method: 'post',
data: data
});
}
// 获取语音历史记录
export function getHistoryVoice(code) {
return request({
url: `/api/audio/${code}/history`,
method: 'get'
});
return request({
url: `/api/audio/${code}/history`,
method: 'get'
});
}
// 文字聊天 发送文字
export function chatWithText(data, group) {
return request({
url: `/api/jointTraining/chatWithText?group=${group}`,
method: 'post',
data: {
message: data
}
});
return request({
url: `/api/jointTraining/chatWithText?group=${group}`,
method: 'post',
data: {
message: data
}
});
}
// 文字聊天 发送文字
export function chatWithAudio(file, group) {
return request({
url: `/api/jointTraining/chatWithAudio?group=${group}`,
method: 'post',
data: file
});
}
// 文字聊天 发送文字
// 生成分发二维码
export function getJoinTrainCode(data, group) {
return request({
url: `/api/jointTraining/qrCode?group=${group}`,
method: 'post',
data: data
});
return request({
url: `/api/jointTraining/qrCode?group=${group}`,
method: 'post',
data: data
});
}
// 创建房间
export function postCreateRoom(data) {
return request({
url: `/api/jointTraining/room`,
method: 'post',
data: data
});
return request({
url: `/api/jointTraining/room`,
method: 'post',
data: data
});
}
// 检查房间存在
export function checkRoomExist(params) {
return request({
url: `/api/simulationRoom`,
method: 'get',
params
});
return request({
url: `/api/simulationRoom`,
method: 'get',
params
});
}
// 获取房间详情
export function postRoomDetail(group) {
return request({
url: `/api/jointTraining/room/${group}`,
method: 'get'
});
return request({
url: `/api/jointTraining/room/${group}`,
method: 'get'
});
}
// 销毁房间
export function deljointTrainRoom(group) {
return request({
url: `/api/jointTraining/room`,
method: 'delete',
params: {
group: group
}
});
return request({
url: `/api/jointTraining/room`,
method: 'delete',
params: {
group: group
}
});
}
// 查询有权限房间列表
export function getjointTrainList() {
return request({
url: `/api/jointTraining/room/list`,
method: 'get'
});
return request({
url: `/api/jointTraining/room/list`,
method: 'get'
});
}
// 加入房间
export function getjointTraining(group) {
return request({
url: `/api/jointTraining/room/join`,
method: 'put',
params: {
group: group
}
});
return request({
url: `/api/jointTraining/room/join`,
method: 'put',
params: {
group: group
}
});
}
// 设置人员角色
export function putUserRoles(data, group) {
return request({
url: `/api/jointTraining/room/user/role?group=${group}`,
method: 'put',
data: data
});
return request({
url: `/api/jointTraining/room/user/role?group=${group}`,
method: 'put',
data: data
});
}
// 设置人员角色
// 获取房间里的用户列表
export function getJointTrainRoomUserList(group) {
return request({
url: `/api/jointTraining/room/${group}/user/list`,
method: 'get'
});
return request({
url: `/api/jointTraining/room/${group}/user/list`,
method: 'get'
});
}
// 离开房间接口
export function putJointTrainingExit(group) {
return request({
url: `/api/jointTraining/room/exit`,
method: 'put',
params: {
group: group
}
});
return request({
url: `/api/jointTraining/room/exit`,
method: 'put',
params: {
group: group
}
});
}
// 开始联合演练
export function startJointTraining(group) {
return request({
url: `/api/jointTraining/room/simulation`,
method: 'post',
params: {
group: group
}
});
return request({
url: `/api/jointTraining/room/simulation`,
method: 'post',
params: {
group: group
}
});
}
// 获取个人信息
export function getUserRoles(group) {
return request({
url: `/api/jointTraining/room/user/role`,
method: 'get',
params: {
group: group
}
});
return request({
url: `/api/jointTraining/room/user/role`,
method: 'get',
params: {
group: group
}
});
}
// 返回房间
export function putJointTrainingState() {
return request({
url: `/api/jointTraining/room/back`,
method: 'put'
});
return request({
url: `/api/jointTraining/room/back`,
method: 'put'
});
}
// 踢出用户
export function putJointTrainingUserkicked(userId, group) {
return request({
url: `/api/jointTraining/room/user`,
method: 'put',
params: {
userId: userId,
group: group
}
});
return request({
url: `/api/jointTraining/room/user`,
method: 'put',
params: {
userId: userId,
group: group
}
});
}
// 管理员结束所有人的仿真
export function putJointTrainingSimulation(group) {
return request({
url: `/api/jointTraining/room/simulation/all`,
method: 'put',
params: {
group: group
}
});
return request({
url: `/api/jointTraining/room/simulation/all`,
method: 'put',
params: {
group: group
}
});
}
// 结束仿真返回房间
export function putJointTrainingSimulationUser(group) {
return request({
url: `/api/jointTraining/room/simulation/user/exit`,
method: 'put',
params: {
group: group
}
});
return request({
url: `/api/jointTraining/room/simulation/user/exit`,
method: 'put',
params: {
group: group
}
});
}
// 进入仿真
export function putJointTrainingSimulationEntrance(group) {
return request({
url: `/api/jointTraining/room/simulation/user/entrance`,
method: 'put',
params: {
group: group
}
});
return request({
url: `/api/jointTraining/room/simulation/user/entrance`,
method: 'put',
params: {
group: group
}
});
}
/**
* 权限获取(房间权限)
*/
export function getPermissionJoint(group) {
return request({
url: '/api/jointTraining/qrCode',
method: 'get',
params: {
group: group
}
});
return request({
url: '/api/jointTraining/qrCode',
method: 'get',
params: {
group: group
}
});
}
// 添加或更新真实设备和仿真对象连接
export function setRealDevice(group, data) {
return request({
url: `/api/jointTraining/room/realDevice?group=${group}`,
method: 'post',
data: data
});
return request({
url: `/api/jointTraining/room/realDevice?group=${group}`,
method: 'post',
data: data
});
}
// 删除真实设备和仿真对象连接
export function delRealDevice(id, group) {
return request({
url: `/api/jointTraining/room/realDevice/${id}`,
method: 'delete',
params: { group: group }
});
return request({
url: `/api/jointTraining/room/realDevice/${id}`,
method: 'delete',
params: { group: group }
});
}
// 获取真实设备列表
export function getRealDevices(group) {
return request({
url: `/api/jointTraining/room/${group}/devices`,
method: 'get'
});
return request({
url: `/api/jointTraining/room/${group}/devices`,
method: 'get'
});
}

View File

@ -1,188 +1,164 @@
import request from '@/utils/request';
export function getDraftLesson(params, mapId) {
/** 根据mapId获取草稿课程 */
return request({
url: `/api/mapSystem/findDraftLessonBy/${mapId}`,
method: 'get',
params
});
}
/** 获取用户地图树 */
export function getUserMapTree(cityCode) {
return request({
url: `/api/mapSystem/findDraftMapByCityCode?cityCode=${cityCode}`,
method: 'get'
});
}
/** 运行图*/
export function getRpListByUserMapId(mapId) {
return request({
url: `/api/draftMap/runPlan/findByDraftMapId/${mapId}`,
method: 'get'
});
return request({
url: `/api/draftMap/runPlan/findByDraftMapId/${mapId}`,
method: 'get'
});
}
export function getMapList(cityCode) {
/** 根据cityCode获取地图列表 */
return request({
url: `/api/mapSystem/queryMapByCityCode/${cityCode}`,
method: 'get'
});
/** 根据cityCode获取地图列表 */
return request({
url: `/api/mapSystem/queryMapByCityCode/${cityCode}`,
method: 'get'
});
}
/** 获取用户自己的运行图详情*/
export function getRpDetailByUserMapId(planId) {
return request({
url: `/api/draftMap/runPlan/selectDiagramData/${planId}`,
method: 'get'
});
return request({
url: `/api/draftMap/runPlan/selectDiagramData/${planId}`,
method: 'get'
});
}
/** 获取用户自己创建的草稿地图详情*/
export function getUserMapDetailByMapId(mapId) {
return request({
url: `/api/mapBuild/findById/${mapId}`,
method: 'get'
});
return request({
url: `/api/mapBuild/findById/${mapId}`,
method: 'get'
});
}
/** 用户自己的运行图仿真测试*/
export function runUserPlanNotify({ planId }) {
return request({
url: `/api/draftMap/runPlan/simulationCheck/${planId}`,
method: 'get'
});
return request({
url: `/api/draftMap/runPlan/simulationCheck/${planId}`,
method: 'get'
});
}
/** 管理员获取需审核的课程列表 */
export function reviewLessonList(params) {
return request({
url: `/api/review/query/lesson`,
method: 'get',
params
});
return request({
url: `/api/review/query/lesson`,
method: 'get',
params
});
}
/** 管理员发布课程接口 */
export function adminPublishLesson(data, id) {
return request({
url: `/api/review/${id}/publishLesson`,
method: 'post',
data: data
});
return request({
url: `/api/review/${id}/publishLesson`,
method: 'post',
data: data
});
}
/** 管理员驳回课程发布申请 */
export function rejectedLessonRelease(data, id) {
return request({
url: `/api/review/lesson/${id}`,
method: 'post',
data: data
});
return request({
url: `/api/review/lesson/${id}`,
method: 'post',
data: data
});
}
/** 普通用户申请课程发布和撤销申请 */
export function releaseOrCancel(id, status) {
return request({
url: `/api/review/lesson/releaseOrCancel/${id}/${status}`,
method: 'get'
});
return request({
url: `/api/review/lesson/releaseOrCancel/${id}/${status}`,
method: 'get'
});
}
/** 管理员获取需审核的剧本列表 ok */
export function reviewScriptList(params) {
return request({
url: `/api/review/query/script`,
method: 'get',
params
});
return request({
url: `/api/review/query/script`,
method: 'get',
params
});
}
/** 管理员发布剧本 ok */
export function publishScript(id) {
return request({
url: `/api/review/${id}/publishScript`,
method: 'post'
});
return request({
url: `/api/review/${id}/publishScript`,
method: 'post'
});
}
/** 管理员剧本申请驳回 ok */
export function rejectScript(id, data) {
return request({
url: `/api/review/script/${id}`,
method: 'post',
data: data
});
return request({
url: `/api/review/script/${id}`,
method: 'post',
data: data
});
}
/** 管理员获取需审核的运行图列表 */
export function reviewRunPlanList(params) {
return request({
url: `/api/review/query/runPlan`,
method: 'get',
params
});
return request({
url: `/api/review/query/runPlan`,
method: 'get',
params
});
}
/** 管理员发布运行图 */
export function publishRunPlan(planId, data) {
return request({
url: `/api/review/${planId}/publishRunPlan`,
method: 'post',
data: data
});
return request({
url: `/api/review/${planId}/publishRunPlan`,
method: 'post',
data: data
});
}
/** 普通用户申请或撤销运行图发布 */
export function releaseOrCancelRunPlan(planId, status) {
return request({
url: `/api/review/runPlan/releaseOrCancel/${planId}/${status}`,
method: 'get'
});
return request({
url: `/api/review/runPlan/releaseOrCancel/${planId}/${status}`,
method: 'get'
});
}
/** 管理员运行图申请驳回 */
export function rejectRunPlan(id, data) {
return request({
url: `/api/review/runPlan/${id}`,
method: 'post',
data: data
});
}
/** 用户申请发布剧本或者撤销剧本申请 */
export function releaseScript(id, status) {
return request({
url: `/api/review/script/releaseOrCancel/${id}/${status}`,
method: 'get'
});
return request({
url: `/api/review/runPlan/${id}`,
method: 'post',
data: data
});
}
/** 查看课程详情 */
export function reviewLessonDetail(id) {
return request({
url: `/api/review/previewLesson/${id}`,
method: 'get'
});
return request({
url: `/api/review/previewLesson/${id}`,
method: 'get'
});
}
/** 管理员预览草稿运行图*/
export function previewRunPlan(planId) {
return request({
url: `/api/review/previewRunPlan/${planId}`,
method: 'get'
});
return request({
url: `/api/review/previewRunPlan/${planId}`,
method: 'get'
});
}
/** 加载剧本 */
export function loadDraftScript(scriptId, memberId, group) {
return request({
url: `api/simulation/${group}/scriptDraft/${scriptId}?memberId=${memberId}`,
method: 'post'
});
return request({
url: `api/simulation/${group}/scriptDraft/${scriptId}?memberId=${memberId}`,
method: 'post'
});
}
/** 获取已发布的有地图的城市列表*/
export function publisMapCityList(data) {
return request({
url: `/api/map/city?dicCode=${data}`,
method: 'get'
});
return request({
url: `/api/map/city?dicCode=${data}`,
method: 'get'
});
}

View File

@ -1,76 +1,76 @@
import request from '@/utils/request';
// 账号密码 其他系统
export function login(params) {
return request({
url: '/api/login',
method: 'post',
data: params
});
return request({
url: '/api/login',
method: 'post',
data: params
});
}
// 获取登陆url 二维码 其他系统
// 获取微信登陆二维码 url 其他系统
export function getLoginUrl(params) {
return request({
url: '/api/login/url',
method: 'get',
params: params
});
return request({
url: '/api/login/url',
method: 'get',
params: params
});
}
// 获取登陆url 小程序二维码
// 获取微信小程序登陆二维码
export function getLoginWmurl(params) {
return request({
url: '/api/login/wmurl',
method: 'get',
params: params
});
return request({
url: '/api/login/wmurl',
method: 'get',
params: params
});
}
// 获取登录信息
export function getInfo(token) {
return request({
url: '/api/login/getUserInfo',
method: 'get',
params: { token }
});
return request({
url: '/api/login/getUserInfo',
method: 'get',
params: { token }
});
}
// 登出
export function logout(token) {
return request({
url: '/api/login/logout',
method: 'get',
params: {
token
}
});
return request({
url: '/api/login/logout',
method: 'get',
params: {
token
}
});
}
// 检查登陆状态
export function checkLoginStatus(sessionId) {
return new Promise((resolve, reject) => {
request({
url: '/api/login/checkStatus',
method: 'get',
params: {
sessionId: sessionId
}
}).then(response => {
if (response.data.status === '2') {
resolve(response);
} else {
reject(response);
}
}).catch(error => {
reject(error);
});
});
return new Promise((resolve, reject) => {
request({
url: '/api/login/checkStatus',
method: 'get',
params: {
sessionId: sessionId
}
}).then(response => {
if (response.data.status === '2') {
resolve(response);
} else {
reject(response);
}
}).catch(error => {
reject(error);
});
});
}
// 检测持续在线 防止掉线在大屏或者仿真系统下
export function checkLoginLine() {
return request({
url: '/api/cache/heartBeat',
method: 'get'
});
return request({
url: '/api/cache/heartBeat',
method: 'get'
});
}

View File

@ -1,47 +1,47 @@
import request from '@/utils/request';
export function querySecheduling(group, params) {
return request({
url: `/api/scheduling/${group}/day`,
method: 'get',
params
});
return request({
url: `/api/scheduling/${group}/day`,
method: 'get',
params
});
}
export function generateScheduling(group, params) {
return request({
url: `/api/scheduling/${group}/generate`,
method: 'post',
params
});
return request({
url: `/api/scheduling/${group}/generate`,
method: 'post',
params
});
}
export function getSchedulingAllTrains(group) {
return request({
url: `/api/scheduling/${group}/train/all`,
method: 'get'
});
return request({
url: `/api/scheduling/${group}/train/all`,
method: 'get'
});
}
export function checkScheduling(group, data) {
return request({
url: `/api/scheduling/${group}/check`,
method: 'post',
data
});
return request({
url: `/api/scheduling/${group}/check`,
method: 'post',
data
});
}
export function saveScheduling(group, data) {
return request({
url: `/api/scheduling/${group}/save`,
method: 'post',
data
});
return request({
url: `/api/scheduling/${group}/save`,
method: 'post',
data
});
}
export function generateSchedulingAgain(group) {
return request({
url: `/api/scheduling/${group}/rebuild`,
method: 'delete'
});
return request({
url: `/api/scheduling/${group}/rebuild`,
method: 'delete'
});
}

View File

@ -2,33 +2,25 @@ import request from '@/utils/request';
/** 分页查找上线的剧本*/
export function getScriptPageListOnline(params) {
return request({
url: `/api/script/paging/online`,
// url: `/api/script/paging/published`,
method: 'get',
params: params
});
}
/** 通过ID查询剧本的基础信息 */
export function getScriptByIdList(id) {
return request({
url: `/api/script/${id}/basic`,
method: 'get'
});
return request({
url: `/api/script/paging/online`,
// url: `/api/script/paging/published`,
method: 'get',
params: params
});
}
/** 通过ID查询发布的剧本的详细信息 */
export function getScriptById(id) {
return request({
url: `/api/script/${id}/detail`,
method: 'get'
});
return request({
url: `/api/script/${id}/detail`,
method: 'get'
});
}
/** 通过ID查询未发布剧本的详细信息 */
export function getDraftScriptByGroup(group) {
return request({
url: `/api/simulation/${group}/script/loadedScript`,
method: 'get'
});
return request({
url: `/api/simulation/${group}/script/loadedScript`,
method: 'get'
});
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 170 KiB

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 KiB

After

Width:  |  Height:  |  Size: 106 KiB

BIN
src/assets/home/script.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

View File

@ -153,6 +153,7 @@ export default {
pleaseEnterMapName: 'Please enter a map name',
pleaseChooseSkinCode: 'Please choose skin style',
pleaseChooseLineCode:'Please Choose line type',
pleaseSelectMapSource: 'Please select the map source',
pleaseSelectAssociatedCity: 'Please select the associated city',
pleaseSelectAssociatedSkin: 'Please select associated skin',

View File

@ -152,6 +152,7 @@ export default {
pleaseEnterMapName: '请输入地图名称',
pleaseChooseSkinCode: '请选择皮肤风格',
pleaseChooseLineCode:'请选择线路类型',
pleaseSelectMapSource: '请选择地图来源',
pleaseSelectAssociatedCity: '请选择关联城市',
pleaseSelectAssociatedSkin: '请选择关联皮肤',

View File

@ -1,5 +1,5 @@
import zrender from 'zrender';
import * as zrUtil from 'zrender/src/core/util';
// import * as zrUtil from 'zrender/src/core/util';
import localStore from 'storejs';
import Options from './options';
import MouseController from './mouseController';

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -6,382 +6,404 @@ import Rect from 'zrender/src/graphic/shape/Rect';
/** 列车 */
export default class Train extends Group {
constructor(model, style) {
super();
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
this.model = model;
this.style = style;
this.z = 40;
this.size = 0;
this.section = null;
this.fontSize = style.Train.common.useSelfText?style.Train.common.nameFontSize || style.Train.common.trainTextFontSize:model.nameFontSize || style.Train.common.nameFontSize || style.Train.common.trainTextFontSize;
this.newScale = this.fontSize / style.Train.common.trainTextFontSize;
this.nameFormat = style.Train.common.useSelfFormat?style.Train.trainBody.trainNameFormat:model.nameFormat || style.Train.trainBody.trainNameFormat;
if ( style.Train.trainBody.specialTrainType.length > 0) {
style.Train.trainBody.specialTrainType.some((item) =>{
if (model.type === item.type) {
this.nameFormat = item.nameFormat;
model.serviceNumber = item.serviceNumber?item.serviceNumber : model.serviceNumber;
return true;
}
});
}
this.create();
this.setState(model);
}
constructor(model, style) {
super();
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
this.model = model;
this.style = style;
this.z = 40;
this.size = 0;
this.section = null;
this.fontSize = style.Train.common.useSelfText ? style.Train.common.nameFontSize || style.Train.common.trainTextFontSize : model.nameFontSize || style.Train.common.nameFontSize || style.Train.common.trainTextFontSize;
this.newScale = this.fontSize / style.Train.common.trainTextFontSize;
this.nameFormat = style.Train.common.useSelfFormat ? style.Train.trainBody.trainNameFormat : model.nameFormat || style.Train.trainBody.trainNameFormat;
if ( style.Train.trainBody.specialTrainType.length > 0) {
style.Train.trainBody.specialTrainType.some((item) =>{
if (model.type === item.type) {
this.nameFormat = item.nameFormat;
model.serviceNumber = item.serviceNumber ? item.serviceNumber : model.serviceNumber;
return true;
}
});
}
this.create();
this.setState(model);
}
_computed() {
const model = this.model;
const style = this.style;
if (model.trainWindowModel) {
this.point = {
x: model.trainWindowModel.point.x,
y: model.trainWindowModel.point.y
};
switch (model.directionType) {
case '01': // 未知方向
this.point.x = this.point.x + model.trainWindowModel.width / 2 + Math.abs((style.Train.common.trainWidth - model.trainWindowModel.width) / 2);
break;
case '02': // 从左向右
this.point.x = this.point.x + model.trainWindowModel.width / 2 - style.Train.trainHead.trainConntWidth * this.newScale - style.Train.common.trainWidth;
break;
case '03': // 从右向左
this.point.x = this.point.x - model.trainWindowModel.width / 2 + style.Train.trainHead.trainConntWidth * this.newScale;
break;
}
} else {
this.point = model.position;
this.traingle = null;
}
}
create() {
this._computed();
this.isChangeTrainWidth(this.model, this.style);
const model = this.model;
const style = this.style;
if (this.point) {
this.trainB = new TrainBody({
zlevel: this.zlevel,
z: this.z,
style: style,
point: this.point,
destinationStatus: model.destinationStatus,
serviceNumber: model.serviceNumber,
tripNumber: model.tripNumber,
targetCode: model.targetCode,
groupNumber: model.groupNumber,
directionType: model.directionType,
directionCode: model.directionCode,
sectionModel: model.sectionModel,
runControlStatus: model.runControlStatus,
runStatus: model.runStatus,
fontSize: this.fontSize,
nameFormat: this.nameFormat,
type: model.type,
speed: model.speed,
maLen: model.maLen,
model: model
});
this.trainL = new TrainHead({
style: style,
zlevel: this.zlevel,
z: this.z,
point: {
x: this.point.x - style.Train.common.trainHeadDistance,
y: this.point.y
},
drect: -1,
scale: this.newScale
});
_computed() {
const model = this.model;
const style = this.style;
if (model.trainWindowModel) {
this.point = {
x: model.trainWindowModel.point.x,
y: model.trainWindowModel.point.y
};
switch (model.directionType) {
case '01': // 未知方向
this.point.x = this.point.x + model.trainWindowModel.width / 2 + Math.abs((style.Train.common.trainWidth - model.trainWindowModel.width) / 2);
break;
case '02': // 从左向右
this.point.x = this.point.x + model.trainWindowModel.width / 2 - style.Train.trainHead.trainConntWidth * this.newScale - style.Train.common.trainWidth;
break;
case '03': // 从右向左
this.point.x = this.point.x - model.trainWindowModel.width / 2 + style.Train.trainHead.trainConntWidth * this.newScale;
break;
}
} else {
this.point = model.position;
this.traingle = null;
}
}
create() {
this._computed();
this.isChangeTrainWidth(this.model, this.style);
const model = this.model;
const style = this.style;
if (this.point) {
this.trainB = new TrainBody({
zlevel: this.zlevel,
z: this.z,
style: style,
point: this.point,
destinationStatus: model.destinationStatus,
serviceNumber: model.serviceNumber,
tripNumber: model.tripNumber,
targetCode: model.targetCode,
groupNumber: model.groupNumber,
directionType: model.directionType,
directionCode: model.directionCode,
sectionModel: model.sectionModel,
runControlStatus: model.runControlStatus,
runStatus: model.runStatus,
fontSize: this.fontSize,
nameFormat: this.nameFormat,
type: model.type,
speed: model.speed,
maLen: model.maLen,
model: model
});
this.trainL = new TrainHead({
style: style,
zlevel: this.zlevel,
z: this.z,
point: {
x: this.point.x - style.Train.common.trainHeadDistance,
y: this.point.y
},
drect: -1,
scale: this.newScale
});
this.trainR = new TrainHead({
style: style,
zlevel: this.zlevel,
z: this.z,
point: {
x: this.point.x + style.Train.common.trainWidth + style.Train.common.trainHeadDistance,
y: this.point.y
},
drect: 1,
scale: this.newScale
});
this.trainR = new TrainHead({
style: style,
zlevel: this.zlevel,
z: this.z,
point: {
x: this.point.x + style.Train.common.trainWidth + style.Train.common.trainHeadDistance,
y: this.point.y
},
drect: 1,
scale: this.newScale
});
this.add(this.trainB);
this.add(this.trainL);
this.add(this.trainR);
}
if (style.Train.common.haveTrainBorder) {
this.createTrainBorder();
}
}
this.add(this.trainB);
this.add(this.trainL);
this.add(this.trainR);
}
if (style.Train.common.haveTrainBorder) {
this.createTrainBorder();
}
}
// 获取设备提示坐标
getShapeTipPoint() {
}
// 获取设备提示坐标
getShapeTipPoint() {
}
// 恢复颜色状态
recover() {
this.trainB && this.trainB.setHShow(false);
this.trainB && this.trainB.setSShow(false);
this.trainB && this.trainB.setDShow(false);
this.trainB && this.trainB.setAShow(false);
this.trainL && this.trainL.setLineShow(false);
this.trainR && this.trainR.setLineShow(false);
this.trainL && this.trainL.setArrowShow(false);
this.trainR && this.trainR.setArrowShow(false);
}
// 恢复颜色状态
recover() {
this.trainB && this.trainB.setHShow(false);
this.trainB && this.trainB.setSShow(false);
this.trainB && this.trainB.setDShow(false);
this.trainB && this.trainB.setAShow(false);
// 设置服务号状态类型
setServerNoType(type) {
if (this.style.Train.trainStatusStyle.serverNoType.length>0) {
const flag = this.style.Train.trainStatusStyle.serverNoType.some((item) =>{
if (type === item.type) {
this.trainB && this.trainB.setTextTrainServerColor(item.showColor);
return true;
}
});
if (this.style.Train.trainStatusStyle.defaultServerNoColor && !flag) {
this.trainB && this.trainB.setTextTrainServerColor(this.style.Train.trainStatusStyle.defaultServerNoColor);
}
}
}
this.trainL && this.trainL.setLineShow(false);
this.trainR && this.trainR.setLineShow(false);
this.trainL && this.trainL.setArrowShow(false);
this.trainR && this.trainR.setArrowShow(false);
}
// 设置目的地状态
setDestinationStatus(status) {
if (this.style.Train.trainStatusStyle.destinationStatus.length>0) {
const flag = this.style.Train.trainStatusStyle.destinationStatus.some((item) =>{
if (status === item.status) {
switch (this.style.Train.trainStatusStyle.destinationStatusSetText) {
case 'trainTarget':
this.trainB && this.trainB.setTextTrainTargetColor(item.showColor);
break;
case 'trainServer':
this.trainB && this.trainB.setTextTrainServerColor(item.showColor);
break;
case 'trainWindowBorder':
this.trainB && this.trainB.setBodyBoxShape('stroke', item.showColor);
break;
default:
this.trainB && this.trainB.setTextTrainTargetColor(item.showColor);
}
return true;
}
});
if (this.style.Train.trainStatusStyle.defaultDestinationColor && !flag) {
switch (this.style.Train.trainStatusStyle.destinationStatusSetText) {
case 'trainTarget':
this.trainB && this.trainB.setTextTrainTargetColor(this.style.Train.trainStatusStyle.defaultDestinationColor);
break;
case 'trainServer':
this.trainB && this.trainB.setTextTrainServerColor(this.style.Train.trainStatusStyle.defaultDestinationColor);
break;
case 'trainWindowBorder':
this.trainB && this.trainB.setBodyBoxShape('stroke', this.style.Train.trainStatusStyle.defaultDestinationColor);
break;
default:
this.trainB && this.trainB.setTextTrainTargetColor(this.style.Train.trainStatusStyle.defaultDestinationColor);
}
}
}
}
// 设置服务号状态类型
setServerNoType(type) {
if (this.style.Train.trainStatusStyle.serverNoType.length > 0) {
const flag = this.style.Train.trainStatusStyle.serverNoType.some((item) =>{
if (type === item.type) {
this.trainB && this.trainB.setTextTrainServerColor(item.showColor);
return true;
}
});
if (this.style.Train.trainStatusStyle.defaultServerNoColor && !flag) {
this.trainB && this.trainB.setTextTrainServerColor(this.style.Train.trainStatusStyle.defaultServerNoColor);
}
}
}
// 设置运行方向状态类型
setDirectionType(type) {
if (this.style.Train.trainStatusStyle.directionType.length > 0) {
this.style.Train.trainStatusStyle.directionType.some((item) => {
if (type === item.type) {
this.trainL && this.trainL.setLineShow(item.lineLShow);
this.trainL && this.trainL.setArrowShow(item.arrowLShow);
this.trainR && this.trainR.setLineShow(item.lineRShow);
this.trainR && this.trainR.setArrowShow(item.arrowRShow);
return true;
}
});
}
}
// 设置列车停止方向类型
setDirectionStopType(type) {
if (this.style.Train.trainStatusStyle.directionStopType.length > 0) {
this.style.Train.trainStatusStyle.directionStopType.some((item) => {
if (type === item.type) {
this.trainL && this.trainL.setLineShow(item.lineLShow);
this.trainR && this.trainR.setLineShow(item.lineRShow);
return true;
}
});
}
}
// 设置运行状态
setRunStatus(status) {
switch (status) {
case '01': // 停止
this.setDirectionStopType(this.model.directionType); // 设置运行方向状态类型
break;
case '02': // 运行
this.setDirectionType(this.model.directionType); // 设置运行方向状态类型
break;
}
// 设置目的地状态
setDestinationStatus(status) {
if (this.style.Train.trainStatusStyle.destinationStatus.length > 0) {
const flag = this.style.Train.trainStatusStyle.destinationStatus.some((item) =>{
if (status === item.status) {
switch (this.style.Train.trainStatusStyle.destinationStatusSetText) {
case 'trainTarget':
this.trainB && this.trainB.setTextTrainTargetColor(item.showColor);
break;
case 'trainServer':
this.trainB && this.trainB.setTextTrainServerColor(item.showColor);
break;
case 'trainWindowBorder':
this.trainB && this.trainB.setBodyBoxShape('stroke', item.showColor);
break;
default:
this.trainB && this.trainB.setTextTrainTargetColor(item.showColor);
}
return true;
}
});
if (this.style.Train.trainStatusStyle.defaultDestinationColor && !flag) {
switch (this.style.Train.trainStatusStyle.destinationStatusSetText) {
case 'trainTarget':
this.trainB && this.trainB.setTextTrainTargetColor(this.style.Train.trainStatusStyle.defaultDestinationColor);
break;
case 'trainServer':
this.trainB && this.trainB.setTextTrainServerColor(this.style.Train.trainStatusStyle.defaultDestinationColor);
break;
case 'trainWindowBorder':
this.trainB && this.trainB.setBodyBoxShape('stroke', this.style.Train.trainStatusStyle.defaultDestinationColor);
break;
default:
this.trainB && this.trainB.setTextTrainTargetColor(this.style.Train.trainStatusStyle.defaultDestinationColor);
}
}
}
}
}
// 设置运行模式
setRunMode(status) {
if (this.style.Train.trainStatusStyle.runModeStatus.length > 0) {
this.style.Train.trainStatusStyle.runModeStatus.some((item) => {
if (status === item.status) {
this.trainL && this.trainL.setColor(item.trainLColor);
this.trainR &&this.trainR.setColor(item.trainRColor);
return true;
}
});
}
}
// 设置运行控制状态类型
setRunControlStatus(status) {
if (this.style.Train.trainStatusStyle.runControlStatus.length > 0) {
this.style.Train.trainStatusStyle.runControlStatus.some((item) => {
if (status === item.status) {
this.trainB && this.trainB.setHShow(item.hShow);
this.trainB && this.trainB.setSShow(item.sShow);
return true;
}
});
}
}
// 设置车门状态类型
setDoorStatus(status) {
if (this.style.Train.trainStatusStyle.doorStatus.length > 0) {
this.style.Train.trainStatusStyle.doorStatus.some((item) => {
if (status === item.status) {
this.trainB && this.trainB.setDShow(item.dShow);
return true;
}
});
}
}
// 设置通信状态类型
setCommunicationStatus() {
if (this.style.Train.trainStatusStyle.communicationStatus.length > 0) {
this.style.Train.trainStatusStyle.communicationStatus.some((item) => {
if (status === item.status) {
this.trainB && this.trainB.setTrainColor(item.trainColor);
return true;
}
});
}
}
// 设置报警状态
setAlarmStatus(status) {
if (this.style.Train.trainStatusStyle.alarmStatus.length >0) {
this.style.Train.trainStatusStyle.alarmStatus.some((item) => {
if (status === item.status) {
this.trainB && this.trainB.setAShow(item.aShow);
return true;
}
});
}
}
setTrainTypeStatus(type) {
if (this.style.Train.trainStatusStyle.trainTypeStatus) {
this.style.Train.trainStatusStyle.trainTypeStatus.some((item) => {
if ( type === item.type) {
item.serviceNumberColor && this.trainB && this.trainB.setTextTrainServerColor(item.serviceNumberColor);
item.trainNumberColor && this.trainB && this.trainB.setTextTrainNumberColor(item.trainNumberColor);
item.trainTargetColor && this.trainB && this.trainB.setTextTrainTargetColor(item.trainTargetColor);
item.groupNumberColor && this.trainB && this.trainB.setTextTrainTargetNumberColor(item.groupNumberColor);
}
});
}
}
// 设置状态
setState(model) {
this.model = model;
if (model) {
this.recover();
this.setServerNoType(model.serverNoType); // 设置服务号状态类型
this.setDestinationStatus(model.destinationStatus); // 设置目的地状态
this.setRunStatus(model.runStatus); // 设置运行状态
this.setRunMode(model.runMode); // 设置运行模式
this.setRunControlStatus(model.runControlStatus); // 设置运行控制状态类型
this.setDoorStatus(model.doorStatus); // 设置车门状态类型
this.setCommunicationStatus(model.communicationStatus); // 设置通信状态类型
this.setAlarmStatus(model.alarmStatus); // 设置报警状态
this.setTrainTypeStatus(model.type); // 根据列车类型设置列车识别号样式
}
}
// 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度
isChangeTrainWidth(model, style) {
if (!style.Train.trainBody.changeTrainWidth) { return; }
if (this.nameFormat) {
const arr = this.nameFormat.split(':');
arr.forEach(ele => {
switch (ele) {
case 'targetCode': {
this.size += (style.Train.trainNumber.targetCodePrefix || '').length;
break;
}
case 'serviceNumber': {
this.size += (style.Train.trainServer.serviceNumberPrefix || '').length;
break;
}
case 'tripNumber': {
this.size += (style.Train.trainTarget.tripNumberPrefix || '').length;
break;
}
case 'groupNumber': {
this.size += (style.Train.trainTargetNumber.groupNumberPrefix || '').length;
break;
}
}
});
} else {
this.size = 9;
}
this.style.Train.common.trainWidth = this.size * this.fontSize * this.style.Train.common.aspectRatio + this.style.Train.common.trainWidthMoreText;
}
removeTrainDetail() {
this.trainB && this.trainB.removeTrainDetail();
}
// 设置运行方向状态类型
setDirectionType(type, flag) {
if (this.style.Train.trainStatusStyle.directionType.length > 0) {
this.style.Train.trainStatusStyle.directionType.forEach((item) => {
if (type === item.type) {
let lineLShow = item.lineLShow;
let arrowLShow = item.arrowLShow;
let lineRShow = item.lineRShow;
let arrowRShow = item.arrowRShow;
if (flag) {
lineLShow = !item.lineLShow;
arrowLShow = !item.arrowLShow;
lineRShow = !item.lineRShow;
arrowRShow = !item.arrowRShow;
}
this.trainL && this.trainL.setLineShow(lineLShow);
this.trainL && this.trainL.setArrowShow(arrowLShow);
this.trainR && this.trainR.setLineShow(lineRShow);
this.trainR && this.trainR.setArrowShow(arrowRShow);
return true;
}
});
}
}
// 设置列车停止方向类型
setDirectionStopType(type) {
if (this.style.Train.trainStatusStyle.directionStopType.length > 0) {
this.style.Train.trainStatusStyle.directionStopType.forEach((item) => {
if (type === item.type) {
this.trainL && this.trainL.setLineShow(item.lineLShow);
this.trainR && this.trainR.setLineShow(item.lineRShow);
return true;
}
});
}
}
// 设置运行状态
setRunStatus(status, flag) {
switch (status) {
case '01': // 停止
this.setDirectionStopType(this.model.directionType); // 设置运行方向状态类型
break;
case '02': // 运行
this.setDirectionType(this.model.directionType, flag); // 设置运行方向状态类型
break;
}
getBoundingRect() {
const list = [this.trainB, this.trainL, this.trainR];
let rect = null;
}
// 设置运行模式
setRunMode(status) {
if (this.style.Train.trainStatusStyle.runModeStatus.length > 0) {
this.style.Train.trainStatusStyle.runModeStatus.some((item) => {
if (status === item.status) {
this.trainL && this.trainL.setColor(item.trainLColor);
this.trainR && this.trainR.setColor(item.trainRColor);
return true;
}
});
}
}
// 设置运行控制状态类型
setRunControlStatus(status) {
if (this.style.Train.trainStatusStyle.runControlStatus.length > 0) {
this.style.Train.trainStatusStyle.runControlStatus.some((item) => {
if (status === item.status) {
this.trainB && this.trainB.setHShow(item.hShow);
this.trainB && this.trainB.setSShow(item.sShow);
return true;
}
});
}
}
// 设置车门状态类型
setDoorStatus(status) {
if (this.style.Train.trainStatusStyle.doorStatus.length > 0) {
this.style.Train.trainStatusStyle.doorStatus.some((item) => {
if (status === item.status) {
this.trainB && this.trainB.setDShow(item.dShow);
return true;
}
});
}
}
// 设置通信状态类型
setCommunicationStatus() {
if (this.style.Train.trainStatusStyle.communicationStatus.length > 0) {
this.style.Train.trainStatusStyle.communicationStatus.some((item) => {
if (status === item.status) {
this.trainB && this.trainB.setTrainColor(item.trainColor);
return true;
}
});
}
}
// 设置报警状态
setAlarmStatus(status) {
if (this.style.Train.trainStatusStyle.alarmStatus.length > 0) {
this.style.Train.trainStatusStyle.alarmStatus.some((item) => {
if (status === item.status) {
this.trainB && this.trainB.setAShow(item.aShow);
return true;
}
});
}
}
setTrainTypeStatus(type) {
if (this.style.Train.trainStatusStyle.trainTypeStatus) {
this.style.Train.trainStatusStyle.trainTypeStatus.some((item) => {
if ( type === item.type) {
item.serviceNumberColor && this.trainB && this.trainB.setTextTrainServerColor(item.serviceNumberColor);
item.trainNumberColor && this.trainB && this.trainB.setTextTrainNumberColor(item.trainNumberColor);
item.trainTargetColor && this.trainB && this.trainB.setTextTrainTargetColor(item.trainTargetColor);
item.groupNumberColor && this.trainB && this.trainB.setTextTrainTargetNumberColor(item.groupNumberColor);
}
});
}
}
// 设置状态
setState(model) {
this.model = model;
// let points = [];
const flag = false;
// if (this.model.sectionModel && this.model.sectionModel.points) {
// points = this.model.sectionModel.points;
// if (points.length) {
// const pointFlag = points[0].x - points[points.length - 1].x;
// if (pointFlag > 0) {
// flag = true; // 方向去反
// }
// }
// }
if (model) {
this.recover();
this.setServerNoType(model.serverNoType); // 设置服务号状态类型
this.setDestinationStatus(model.destinationStatus); // 设置目的地状态
this.setRunStatus(model.runStatus, flag); // 设置运行状态
this.setRunMode(model.runMode); // 设置运行模式
this.setRunControlStatus(model.runControlStatus); // 设置运行控制状态类型
this.setDoorStatus(model.doorStatus); // 设置车门状态类型
this.setCommunicationStatus(model.communicationStatus); // 设置通信状态类型
this.setAlarmStatus(model.alarmStatus); // 设置报警状态
this.setTrainTypeStatus(model.type); // 根据列车类型设置列车识别号样式
}
}
// 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度
isChangeTrainWidth(model, style) {
if (!style.Train.trainBody.changeTrainWidth) { return; }
if (this.nameFormat) {
const arr = this.nameFormat.split(':');
arr.forEach(ele => {
switch (ele) {
case 'targetCode': {
this.size += (style.Train.trainNumber.targetCodePrefix || '').length;
break;
}
case 'serviceNumber': {
this.size += (style.Train.trainServer.serviceNumberPrefix || '').length;
break;
}
case 'tripNumber': {
this.size += (style.Train.trainTarget.tripNumberPrefix || '').length;
break;
}
case 'groupNumber': {
this.size += (style.Train.trainTargetNumber.groupNumberPrefix || '').length;
break;
}
}
});
} else {
this.size = 9;
}
this.style.Train.common.trainWidth = this.size * this.fontSize * this.style.Train.common.aspectRatio + this.style.Train.common.trainWidthMoreText;
}
removeTrainDetail() {
this.trainB && this.trainB.removeTrainDetail();
}
list.forEach(elem => {
if (elem) {
const tempRect = elem.getBoundingRect();
if (tempRect.x && tempRect.y && tempRect.width && tempRect.height) {
if (rect) {
rect.union(tempRect);
} else {
rect = tempRect;
}
}
}
});
getBoundingRect() {
const list = [this.trainB, this.trainL, this.trainR];
let rect = null;
return rect || new BoundingRect(0, 0, 0, 0);
}
createTrainBorder() {
const rect = Object.assign({}, this.getBoundingRect());
rect.x -= this.style.Train.common.trainWidth / 2;
rect.y -= 5;
rect.width += this.style.Train.common.trainWidth;
rect.height += 10;
list.forEach(elem => {
if (elem) {
const tempRect = elem.getBoundingRect();
if (tempRect.x && tempRect.y && tempRect.width && tempRect.height) {
if (rect) {
rect.union(tempRect);
} else {
rect = tempRect;
}
}
}
});
this.trainBorder = new Rect({
zlevel: this.zlevel,
z: this.z,
silent: true,
shape: rect,
style: {
lineDash: [3, 3],
stroke: this.style.borderColor,
fill: this.style.transparentColor
}
});
return rect || new BoundingRect(0, 0, 0, 0);
}
createTrainBorder() {
const rect = Object.assign({}, this.getBoundingRect());
rect.x -= this.style.Train.common.trainWidth / 2;
rect.y -= 5;
rect.width += this.style.Train.common.trainWidth;
rect.height += 10;
this.add(this.trainBorder);
}
this.trainBorder = new Rect({
zlevel: this.zlevel,
z: this.z,
silent: true,
shape: rect,
style: {
lineDash: [3, 3],
stroke: this.style.borderColor,
fill: this.style.transparentColor
}
});
this.add(this.trainBorder);
}
}

View File

@ -1,8 +1,8 @@
<template>
<div class="plan-schedule" style="width: 100%">
<title-bar ref="titleBar" @back="back" />
<menu-bar ref="menuBar" :skin-code="skinCode" @dispatchDialog="dispatchDialog" />
<schedule ref="schedule" :group="group" :skin-code="skinCode" :max-height="height" :max-width="width" />
<menu-bar ref="menuBar" :line-code="lineCode" @dispatchDialog="dispatchDialog" />
<schedule ref="schedule" :group="group" :line-code="lineCode" :max-height="height" :max-width="width" />
<status-bar ref="statusBar" :max-top="height" @setPosition="setPosition" />
<manage-plan-list ref="managePlanList" @dispatchDialog="dispatchDialog" />
@ -29,65 +29,65 @@ import DeleteTask from '../menusPlan/deleteTask';
import ModifyingTask from '../menusPlan/modifyingTask';
export default {
name: 'Menus',
components: {
TitleBar,
MenuBar,
StatusBar,
Schedule,
ManagePlanList,
CreateWeekPlan,
CreateTodayPlan,
ModifyingPlan,
AddTask,
DeleteTask,
ModifyingTask
},
props: {
group: {
type: String,
required: true
}
},
data() {
return {
};
},
computed: {
skinCode() {
return this.$route.query.skinCode || '02';
},
width() {
return this.$store.state.app.width;
},
height() {
return this.$store.state.app.height;
}
},
methods: {
setPosition() {
this.$nextTick(() => {
this.$refs.schedule.setPosition();
});
},
dispatchDialog(dialogObj) {
this.$nextTick(() => {
if (this.$refs[dialogObj.name]) {
this.$refs[dialogObj.name].doShow(dialogObj.params);
}
});
},
reloadTable(dialogObj) {
if (this.$refs[dialogObj.name]) {
this.$refs[dialogObj.name].reloadTable();
}
},
confirm(params) {
},
back() {
this.$emit('back');
}
}
name: 'Menus',
components: {
TitleBar,
MenuBar,
StatusBar,
Schedule,
ManagePlanList,
CreateWeekPlan,
CreateTodayPlan,
ModifyingPlan,
AddTask,
DeleteTask,
ModifyingTask
},
props: {
group: {
type: String,
required: true
}
},
data() {
return {
};
},
computed: {
lineCode() {
return this.$route.query.lineCode || '02';
},
width() {
return this.$store.state.app.width;
},
height() {
return this.$store.state.app.height;
}
},
methods: {
setPosition() {
this.$nextTick(() => {
this.$refs.schedule.setPosition();
});
},
dispatchDialog(dialogObj) {
this.$nextTick(() => {
if (this.$refs[dialogObj.name]) {
this.$refs[dialogObj.name].doShow(dialogObj.params);
}
});
},
reloadTable(dialogObj) {
if (this.$refs[dialogObj.name]) {
this.$refs[dialogObj.name].reloadTable();
}
},
confirm(params) {
},
back() {
this.$emit('back');
}
}
};
</script>

View File

@ -125,7 +125,7 @@ import { EventBus } from '@/scripts/event-bus';
export default {
name: 'PlanMenuBar',
props: {
skinCode: {
lineCode: {
type: String,
required: true
}

View File

@ -27,456 +27,428 @@ import { mapGetters } from 'vuex';
import { timeFormat } from '@/utils/date';
import { runDiagramGetTime } from '@/api/simulation';
import DataTable from '../menusPlan/components/dataTable';
import echarts from 'echarts';
export default {
name: 'PlanSchedule',
components: {
DataTable
},
props: {
group: {
type: String,
required: true
},
skinCode: {
type: String,
required: true
},
maxWidth: {
type: Number,
require: true
},
maxHeight: {
type: Number,
required: true
}
},
data() {
return {
top: 0,
height: 0,
heights: [100, 100],
runPlanId: 'plan-schedule-id',
myChart: null,
PlanConvert: {},
serviceNumberConfig: {
data: [],
highlightCurrentRow: true,
handleChange: this.serviceNumberChange,
showClose: false,
columns: [
{
prop: 'serviceNumber',
label: '表号'
},
{
width: 40
}
]
},
tripNumberConfig: {
data: [],
highlightCurrentRow: true,
handleChange: this.tripNumberChange,
showClose: false,
columns: [
{
prop: 'tripNumber',
label: '车次号'
},
{
width: 40
}
]
},
realData: {},
kmRangeCoordMap: {},
option: {
title: {
text: '',
left: 'center'
},
grid: {
top: '30px',
left: '120px',
right: '40px',
bottom: '65px',
containLabel: true,
backgroundColor: 'floralwhite'
},
toolbox: {
right: '30px',
feature: {
dataZoom: {
yAxisIndex: 'none'
},
restore: {},
saveAsImage: {}
}
},
tooltip: {
axisPointer: {
trigger: 'item',
type: 'cross'
},
formatter: this.axisTooltip,
borderWidth: 1
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: [],
axisLine: {
onZero: false,
lineStyle: {
width: 2,
color: '#d14a61'
}
},
axisLabel: {
formatter: this.xAxisLableFormat,
textStyle: {
color: '#333'
}
},
axisPointer: {
snap: true,
label: {
formatter: this.xAxisPointFormat,
backgroundColor: 'rgb(255,0,0,0.5)',
color: 'white'
}
}
}
],
yAxis: {
type: 'value',
splitLine: {
show: false
},
axisTick: {
show: false
},
axisLine: {
onZero: false,
lineStyle: {
width: 2,
color: '#d14a61'
}
},
axisLabel: {
interval: 'auto',
formatter: this.yAxisLableFormat
},
axisPointer: {
xAxisIndex: 'all',
label: {
formatter: this.yAxisPointFormat,
backgroundColor: 'rgb(0,100,0,0.5)',
color: 'white'
}
},
min: 0,
max: 0
},
series: [],
dataZoom: [
{
type: 'inside'
},
{
fiterMode: 'filter',
handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
handleSize: '80%',
handleStyle: {
color: '#fff',
shadowBlur: 3,
shadowColor: 'rgba(0, 0, 0, 0.6)',
shadowOffsetX: 2,
shadowOffsetY: 2
},
bottom: '20px'
}
]
},
absoluteTime: 2 * 3600,
indexKmRangeMap: {}
};
},
computed: {
...mapGetters('runPlan', [
'stations'
])
},
watch: {
maxWidth() {
this.setPosition();
},
maxHeight() {
this.setPosition();
},
'$store.state.runPlan.planLoadedCount': async function () {
await this.loadChartPage();
},
'$store.state.runPlan.planSizeCount': function () {
this.reSize({ width: this.$store.state.runPlan.width, height: this.$store.state.runPlan.height });
},
'$store.state.runPlan.selected.serviceNumber': function (val) {
const index = this.serviceNumberConfig.data.findIndex(elem => {
return elem.serviceNumber == val;
});
name: 'PlanSchedule',
components: {
DataTable
},
props: {
group: {
type: String,
required: true
},
lineCode: {
type: String,
required: true
},
maxWidth: {
type: Number,
require: true
},
maxHeight: {
type: Number,
required: true
}
},
data() {
return {
top: 0,
height: 0,
heights: [100, 100],
runPlanId: 'plan-schedule-id',
myChart: null,
PlanConvert: {},
serviceNumberConfig: {
data: [],
highlightCurrentRow: true,
handleChange: this.serviceNumberChange,
showClose: false,
columns: [
{
prop: 'serviceNumber',
label: '表号'
},
{
width: 40
}
]
},
tripNumberConfig: {
data: [],
highlightCurrentRow: true,
handleChange: this.tripNumberChange,
showClose: false,
columns: [
{
prop: 'tripNumber',
label: '车次号'
},
{
width: 40
}
]
},
realData: {},
kmRangeCoordMap: {},
option: {
title: {
text: '',
left: 'center'
},
grid: {
top: '30px',
left: '120px',
right: '40px',
bottom: '65px',
containLabel: true,
backgroundColor: 'floralwhite'
},
toolbox: {
right: '30px',
feature: {
dataZoom: {
yAxisIndex: 'none'
},
restore: {},
saveAsImage: {}
}
},
tooltip: {
axisPointer: {
trigger: 'item',
type: 'cross'
},
formatter: this.axisTooltip,
borderWidth: 1
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: [],
axisLine: {
onZero: false,
lineStyle: {
width: 2,
color: '#d14a61'
}
},
axisLabel: {
formatter: this.xAxisLableFormat,
textStyle: {
color: '#333'
}
},
axisPointer: {
snap: true,
label: {
formatter: this.xAxisPointFormat,
backgroundColor: 'rgb(255,0,0,0.5)',
color: 'white'
}
}
}
],
yAxis: {
type: 'value',
splitLine: {
show: false
},
axisTick: {
show: false
},
axisLine: {
onZero: false,
lineStyle: {
width: 2,
color: '#d14a61'
}
},
axisLabel: {
interval: 'auto',
formatter: this.yAxisLableFormat
},
axisPointer: {
xAxisIndex: 'all',
label: {
formatter: this.yAxisPointFormat,
backgroundColor: 'rgb(0,100,0,0.5)',
color: 'white'
}
},
min: 0,
max: 0
},
series: [],
dataZoom: [
{
type: 'inside'
},
{
fiterMode: 'filter',
handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
handleSize: '80%',
handleStyle: {
color: '#fff',
shadowBlur: 3,
shadowColor: 'rgba(0, 0, 0, 0.6)',
shadowOffsetX: 2,
shadowOffsetY: 2
},
bottom: '20px'
}
]
},
absoluteTime: 2 * 3600,
indexKmRangeMap: {}
};
},
computed: {
...mapGetters('runPlan', [
'stations'
])
},
watch: {
maxWidth() {
this.setPosition();
},
maxHeight() {
this.setPosition();
},
'$store.state.runPlan.planLoadedCount': async function () {
await this.loadChartPage();
},
'$store.state.runPlan.planSizeCount': function () {
this.reSize({ width: this.$store.state.runPlan.width, height: this.$store.state.runPlan.height });
},
'$store.state.runPlan.selected.serviceNumber': function (val) {
const index = this.serviceNumberConfig.data.findIndex(elem => {
return elem.serviceNumber == val;
});
this.$refs.serviceTable.setCurrentRow(this.serviceNumberConfig.data[index]);
},
'$store.state.runPlan.selected.tripNumber': function (val) {
const index = this.tripNumberConfig.data.findIndex(elem => {
return elem.tripNumber == val;
});
this.$refs.tripTable.setCurrentRow(this.tripNumberConfig.data[index]);
}
},
mounted() {
this.PlanConvert = this.$theme.loadPlanConvert(this.skinCode);
},
beforeDestroy() {
this.destroy();
},
methods: {
serviceNumberChange(row) {
if (row) {
this.$store.dispatch('runPlan/setSelected', { serviceNumber: row.serviceNumber, tripNumber: null });
const serviceObj = this.$store.state.runPlan.editData[row.serviceNumber];
if (serviceObj) {
this.analyticalTripNumber(serviceObj.trainMap);
}
}
},
tripNumberChange(row) {
if (row) {
this.$store.dispatch('runPlan/setSelected', { serviceNumber: this.$store.state.runPlan.selected.serviceNumber, tripNumber: row.tripNumber });
}
},
async analyticalServiceNumber(data) {
this.serviceNumberConfig.data = Object.keys(data || {})
.sort((a, b) => { return data[a].oldIndex - data[b].oldIndex; })
.map(serviceNumber => { return { serviceNumber }; });
},
async analyticalTripNumber(data) {
this.tripNumberConfig.data = Object.keys(data || {})
.sort((a, b) => { return data[a].oldIndex - data[b].oldIndex; })
.map(tripNumber => { return { tripNumber }; });
},
async setPosition() {
this.$nextTick(() => {
let top = 3;
const width = this.maxWidth * 0.85;
let height = this.maxHeight;
this.$refs.serviceTable.setCurrentRow(this.serviceNumberConfig.data[index]);
},
'$store.state.runPlan.selected.tripNumber': function (val) {
const index = this.tripNumberConfig.data.findIndex(elem => {
return elem.tripNumber == val;
});
this.$refs.tripTable.setCurrentRow(this.tripNumberConfig.data[index]);
}
},
mounted() {
this.PlanConvert = this.$theme.loadPlanConvert(this.lineCode);
},
beforeDestroy() {
this.destroy();
},
methods: {
serviceNumberChange(row) {
if (row) {
this.$store.dispatch('runPlan/setSelected', { serviceNumber: row.serviceNumber, tripNumber: null });
const serviceObj = this.$store.state.runPlan.editData[row.serviceNumber];
if (serviceObj) {
this.analyticalTripNumber(serviceObj.trainMap);
}
}
},
tripNumberChange(row) {
if (row) {
this.$store.dispatch('runPlan/setSelected', { serviceNumber: this.$store.state.runPlan.selected.serviceNumber, tripNumber: row.tripNumber });
}
},
async analyticalServiceNumber(data) {
this.serviceNumberConfig.data = Object.keys(data || {})
.sort((a, b) => { return data[a].oldIndex - data[b].oldIndex; })
.map(serviceNumber => { return { serviceNumber }; });
},
async analyticalTripNumber(data) {
this.tripNumberConfig.data = Object.keys(data || {})
.sort((a, b) => { return data[a].oldIndex - data[b].oldIndex; })
.map(tripNumber => { return { tripNumber }; });
},
async setPosition() {
this.$nextTick(() => {
let top = 3;
const width = this.maxWidth * 0.85;
let height = this.maxHeight;
const titleBar = document.getElementById('PlanTitleBar');
const menuBar = document.getElementById('PlanMenuBar');
const menuTool = document.getElementById('PlanMenuTool');
const statusBar = document.getElementById('PlanStatusBar');
const titleBar = document.getElementById('PlanTitleBar');
const menuBar = document.getElementById('PlanMenuBar');
const menuTool = document.getElementById('PlanMenuTool');
const statusBar = document.getElementById('PlanStatusBar');
if (titleBar) {
top += (titleBar.offsetHeight || 0);
}
if (titleBar) {
top += (titleBar.offsetHeight || 0);
}
if (menuBar) {
top += (menuBar.offsetHeight || 0);
}
if (menuBar) {
top += (menuBar.offsetHeight || 0);
}
if (menuTool) {
top += (menuTool.offsetHeight || 0);
}
if (menuTool) {
top += (menuTool.offsetHeight || 0);
}
if (statusBar) {
height -= (statusBar.offsetHeight || 0);
}
if (statusBar) {
height -= (statusBar.offsetHeight || 0);
}
height = height - top;
this.$store.dispatch('runPlan/resize', { width, height });
height = height - top;
this.$store.dispatch('runPlan/resize', { width, height });
if (this.top != top) {
this.top = top;
}
if (this.top != top) {
this.top = top;
}
if (this.height != height) {
this.height = height - 20 * 2;
}
});
},
async loadChartPage() {
try {
let series = [];
const stations = this.$store.state.runPlan.stations;
const planData = this.$store.state.runPlan.planData;
if (this.height != height) {
this.height = height - 20 * 2;
}
});
},
async loadChartPage() {
try {
let series = [];
const stations = this.$store.state.runPlan.stations;
const planData = this.$store.state.runPlan.planData;
this.viewDisabled = true;
this.kmRangeCoordMap = this.PlanConvert.convertStationsToMap(stations);
series = this.pushModels(series, [this.PlanConvert.initializeYaxis(stations)]);
series = this.pushModels(series, this.PlanConvert.convertDataToModels(planData, stations, this.kmRangeCoordMap, { color: '#000', width: 0.5 }));
await this.loadInitData(series);
await this.analyticalServiceNumber(this.$store.state.runPlan.editData);
this.viewDisabled = false;
this.viewDisabled = true;
this.kmRangeCoordMap = this.PlanConvert.convertStationsToMap(stations);
series = this.pushModels(series, [this.PlanConvert.initializeYaxis(stations)]);
series = this.pushModels(series, this.PlanConvert.convertDataToModels(planData, stations, this.kmRangeCoordMap, { color: '#000', width: 0.5 }));
await this.loadInitData(series);
await this.analyticalServiceNumber(this.$store.state.runPlan.editData);
this.viewDisabled = false;
} catch (error) {
this.viewDisabled = false;
this.$messageBox(`加载运行图数据失败`);
}
},
async loadInitData(series) {
this.myChart && this.myChart.showLoading();
await this.xAxisInit();
await this.yAxisInit();
await this.loadInitChart(series);
this.myChart && this.myChart.hideLoading();
},
pushModels(series, models) {
if (models && models.length) {
models.forEach(elem => {
if (elem) {
series.push(elem);
}
});
}
} catch (error) {
this.viewDisabled = false;
this.$messageBox(`加载运行图数据失败`);
}
},
async loadInitData(series) {
this.myChart && this.myChart.showLoading();
await this.xAxisInit();
await this.yAxisInit();
await this.loadInitChart(series);
this.myChart && this.myChart.hideLoading();
},
pushModels(series, models) {
if (models && models.length) {
models.forEach(elem => {
if (elem) {
series.push(elem);
}
});
}
return series;
},
popModels(series, models) {
if (models && models.length) {
models.forEach(elem => {
const index = series.indexOf(elem);
if (index >= 0) {
series.split(index, 1);
}
});
}
return series;
},
loadInitChart(series) {
return new Promise((resolve, reject) => {
try {
this.destroy();
return series;
},
loadInitChart(series) {
return new Promise((resolve, reject) => {
try {
const that = this;
// echart
require.config(
{
paths: {
echarts: './js/dist'
}
}
);
//
require(
[
'echarts',
'echarts/lib/chart/line'
],
function (ec) {
that.destroy();
let startValue = 3600 + this.PlanConvert.TranslationTime;
const offsetTime = 3600;
let startValue = 3600 + that.PlanConvert.TranslationTime;
const offsetTime = 3600;
runDiagramGetTime(this.group).then(resp => {
startValue = resp.data - this.PlanConvert.TranslationTime;
this.option.dataZoom[0].startValue = this.option.dataZoom[1].startValue = startValue - offsetTime;
this.option.dataZoom[0].endValue = this.option.dataZoom[1].endValue = startValue + offsetTime;
this.option.series = series;
this.myChart = echarts.init(document.getElementById(this.runPlanId));
if (this.myChart) {
this.myChart.setOption(this.option);
this.reSize({ width: this.$store.state.runPlan.width, height: this.$store.state.runPlan.height });
this.myChart.on('click', this.mouseClick);
}
});
resolve(true);
} catch (error) {
reject(error);
}
});
runDiagramGetTime(that.group).then(resp => {
startValue = resp.data - that.PlanConvert.TranslationTime;
that.option.dataZoom[0].startValue = that.option.dataZoom[1].startValue = startValue - offsetTime;
that.option.dataZoom[0].endValue = that.option.dataZoom[1].endValue = startValue + offsetTime;
that.option.series = series;
that.myChart = ec.init(document.getElementById(that.runPlanId));
if (that.myChart) {
that.myChart.setOption(that.option);
that.reSize({ width: that.$store.state.runPlan.width, height: that.$store.state.runPlan.height });
that.myChart.on('click', that.mouseClick);
}
});
resolve(true);
}
);
} catch (error) {
reject(error);
}
});
},
xAxisPointFormat(params) {
return timeFormat(params.value);
},
yAxisPointFormat(params) {
return this.PlanConvert.computedFormatYAxis(this.stations, params);
},
xAxisLableFormat(value, index) {
if (value % 60 === 0) {
return timeFormat(value);
}
},
yAxisLableFormat(value, index) {
return '';
},
xAxisInit() {
const list = [];
for (var time = 0 + this.PlanConvert.TranslationTime; time < 3600 * 24 + this.PlanConvert.TranslationTime; time++) {
list.push(time);
}
},
xAxisPointFormat(params) {
return timeFormat(params.value);
},
yAxisPointFormat(params) {
return this.PlanConvert.computedFormatYAxis(this.stations, params);
},
xAxisLableFormat(value, index) {
if (value % 60 === 0) {
return timeFormat(value);
}
},
yAxisLableFormat(value, index) {
return '';
},
xAxisInit() {
const list = [];
for (var time = 0 + this.PlanConvert.TranslationTime; time < 3600 * 24 + this.PlanConvert.TranslationTime; time++) {
list.push(time);
}
const startValue = 3600 * 6;
const offsetTime = 3600 * 1;
const startValue = 3600 * 6;
const offsetTime = 3600 * 1;
this.option.xAxis[0].data = list;
if (!this.option.dataZoom[0].startValue) {
this.option.dataZoom[0].startValue = this.option.dataZoom[1].startValue = startValue - offsetTime;
}
this.option.xAxis[0].data = list;
if (!this.option.dataZoom[0].startValue) {
this.option.dataZoom[0].startValue = this.option.dataZoom[1].startValue = startValue - offsetTime;
}
if (!this.option.dataZoom[0].endValue) {
this.option.dataZoom[0].endValue = this.option.dataZoom[1].endValue = startValue + offsetTime;
}
},
yAxisInit() {
if (Object.keys(this.PlanConvert).length) {
this.option.yAxis.min = this.PlanConvert.computedYaxisMinValue(this.stations);
this.option.yAxis.max = this.PlanConvert.computedYaxisMaxValue(this.stations);
}
},
axisTooltip(param) {
const station = this.stations[Math.floor((param.data[1] - this.PlanConvert.EdgeHeight) / this.PlanConvert.CoordMultiple)] || { name: '', kmRange: '' };
return [
`Point Data <hr size=1 style=" margin: 3px 0">`,
`车站名称: ${station.name}<br>`,
`车站公里标: ${station.kmRange} km <br>`,
`到站时间: ${timeFormat(param.data[0] + this.PlanConvert.TranslationTime)} (${param.data[0]})<br>`
].join('');
},
mouseClick(params) {
const model = {
serviceNumber: params.seriesName
};
this.$store.dispatch('runPlan/setSelected', model);
},
reSize(opt) {
if (this.myChart) {
this.myChart.resize({
width: opt.width,
height: opt.height,
silent: false
});
}
},
destroy() {
if (this.myChart && this.myChart.isDisposed) {
this.myChart.dispose();
this.myChart = null;
}
},
scheduleTouch() {
if (!this.option.dataZoom[0].endValue) {
this.option.dataZoom[0].endValue = this.option.dataZoom[1].endValue = startValue + offsetTime;
}
},
yAxisInit() {
if (Object.keys(this.PlanConvert).length) {
this.option.yAxis.min = this.PlanConvert.computedYaxisMinValue(this.stations);
this.option.yAxis.max = this.PlanConvert.computedYaxisMaxValue(this.stations);
}
},
axisTooltip(param) {
const station = this.stations[Math.floor((param.data[1] - this.PlanConvert.EdgeHeight) / this.PlanConvert.CoordMultiple)] || { name: '', kmRange: '' };
return [
`Point Data <hr size=1 style=" margin: 3px 0">`,
`车站名称: ${station.name}<br>`,
`车站公里标: ${station.kmRange} km <br>`,
`到站时间: ${timeFormat(param.data[0] + this.PlanConvert.TranslationTime)} (${param.data[0]})<br>`
].join('');
},
mouseClick(params) {
const model = {
serviceNumber: params.seriesName
};
this.$store.dispatch('runPlan/setSelected', model);
},
reSize(opt) {
if (this.myChart) {
this.myChart.resize({
width: opt.width,
height: opt.height,
silent: false
});
}
},
destroy() {
if (this.myChart && this.myChart.isDisposed) {
this.myChart.dispose();
this.myChart = null;
}
},
scheduleTouch() {
},
trainNumTouch() {
},
trainNumTouch() {
}
}
}
}
};
</script>
<style scoped rel="stylesheet/scss" lang="scss" scoped>
<style scoped rel="stylesheet/scss" lang="scss">
@import "src/styles/mixin.scss";
#PlanSchedule {

View File

@ -1,8 +1,8 @@
<template>
<div class="plan-schedule" style="width: 100%">
<title-bar ref="titleBar" @back="back" />
<menu-bar ref="menuBar" :skin-code="skinCode" @dispatchDialog="dispatchDialog" />
<schedule ref="schedule" :group="group" :skin-code="skinCode" :max-height="height" :max-width="width" />
<menu-bar ref="menuBar" :line-code="lineCode" @dispatchDialog="dispatchDialog" />
<schedule ref="schedule" :group="group" :line-code="lineCode" :max-height="height" :max-width="width" />
<status-bar ref="statusBar" :max-top="height" @setPosition="setPosition" />
<manage-plan-list ref="managePlanList" @dispatchDialog="dispatchDialog" />
@ -29,65 +29,65 @@ import DeleteTask from '../menusPlan/deleteTask';
import ModifyingTask from '../menusPlan/modifyingTask';
export default {
name: 'Menus',
components: {
TitleBar,
MenuBar,
StatusBar,
Schedule,
ManagePlanList,
CreateWeekPlan,
CreateTodayPlan,
ModifyingPlan,
AddTask,
DeleteTask,
ModifyingTask
},
props: {
group: {
type: String,
required: true
}
},
data() {
return {
};
},
computed: {
skinCode() {
return this.$route.query.skinCode || '02';
},
width() {
return this.$store.state.app.width;
},
height() {
return this.$store.state.app.height;
}
},
methods: {
setPosition() {
this.$nextTick(() => {
this.$refs.schedule.setPosition();
});
},
dispatchDialog(dialogObj) {
this.$nextTick(() => {
if (this.$refs[dialogObj.name]) {
this.$refs[dialogObj.name].doShow(dialogObj.params);
}
});
},
reloadTable(dialogObj) {
if (this.$refs[dialogObj.name]) {
this.$refs[dialogObj.name].reloadTable();
}
},
confirm(params) {
},
back() {
this.$emit('back');
}
}
name: 'Menus',
components: {
TitleBar,
MenuBar,
StatusBar,
Schedule,
ManagePlanList,
CreateWeekPlan,
CreateTodayPlan,
ModifyingPlan,
AddTask,
DeleteTask,
ModifyingTask
},
props: {
group: {
type: String,
required: true
}
},
data() {
return {
};
},
computed: {
skinCode() {
return this.$route.query.skinCode || '02';
},
width() {
return this.$store.state.app.width;
},
height() {
return this.$store.state.app.height;
}
},
methods: {
setPosition() {
this.$nextTick(() => {
this.$refs.schedule.setPosition();
});
},
dispatchDialog(dialogObj) {
this.$nextTick(() => {
if (this.$refs[dialogObj.name]) {
this.$refs[dialogObj.name].doShow(dialogObj.params);
}
});
},
reloadTable(dialogObj) {
if (this.$refs[dialogObj.name]) {
this.$refs[dialogObj.name].reloadTable();
}
},
confirm(params) {
},
back() {
this.$emit('back');
}
}
};
</script>

View File

@ -125,7 +125,7 @@ import { EventBus } from '@/scripts/event-bus';
export default {
name: 'PlanMenuBar',
props: {
skinCode: {
lineCode: {
type: String,
required: true
}

View File

@ -1,153 +1,133 @@
<template>
<div id="PlanSchedule" :style="{top: top+'px', height: height+'px'}">
<div class="left">
<div :id="runPlanId"></div>
</div>
<div class="right">
<data-table ref="serviceTable" :height="height/2" :config="serviceNumberConfig" @touch="scheduleTouch"
:style="{top: top-height/2+'px'}"></data-table>
<data-table ref="tripTable" :height="height/2" :config="tripNumberConfig" @touch="trainNumTouch"
:style="{top: top-height/2+'px'}"></data-table>
</div>
<div id="PlanSchedule" :style="{top: top+'px', height: height+'px'}">
<div class="left">
<div :id="runPlanId" />
</div>
<div class="right">
<data-table
ref="serviceTable"
:height="height/2"
:config="serviceNumberConfig"
:style="{top: top-height/2+'px'}"
@touch="scheduleTouch"
/>
<data-table
ref="tripTable"
:height="height/2"
:config="tripNumberConfig"
:style="{top: top-height/2+'px'}"
@touch="trainNumTouch"
/>
</div>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import { timeFormat } from '@/utils/date';
import { runDiagramGetTime } from '@/api/simulation';
import DataTable from '../menusPlan/components/dataTable';
import { mapGetters } from 'vuex';
import { timeFormat } from '@/utils/date';
import { runDiagramGetTime } from '@/api/simulation';
import DataTable from '../menusPlan/components/dataTable';
import echarts from 'echarts';
export default {
name: 'PlanSchedule',
props: {
group: {
type: String,
required: true
},
skinCode: {
type: String,
required: true
},
maxWidth: {
type: Number,
require: true
},
maxHeight: {
type: Number,
required: true
}
export default {
name: 'PlanSchedule',
components: {
DataTable
},
props: {
group: {
type: String,
required: true
},
components: {
DataTable
lineCode: {
type: String,
required: true
},
data() {
return {
top: 0,
height: 0,
heights: [100, 100],
runPlanId: 'plan-schedule-id',
myChart: null,
PlanConvert: {},
serviceNumberConfig: {
data: [],
highlightCurrentRow: true,
handleChange: this.serviceNumberChange,
showClose: false,
columns: [
{
prop: 'serviceNumber',
label: '表号',
},
{
width: 40
}
]
maxWidth: {
type: Number,
require: true
},
maxHeight: {
type: Number,
required: true
}
},
data() {
return {
top: 0,
height: 0,
heights: [100, 100],
runPlanId: 'plan-schedule-id',
myChart: null,
PlanConvert: {},
serviceNumberConfig: {
data: [],
highlightCurrentRow: true,
handleChange: this.serviceNumberChange,
showClose: false,
columns: [
{
prop: 'serviceNumber',
label: '表号'
},
{
width: 40
}
]
},
tripNumberConfig: {
data: [],
highlightCurrentRow: true,
handleChange: this.tripNumberChange,
showClose: false,
columns: [
{
prop: 'tripNumber',
label: '车次号'
},
{
width: 40
}
]
},
realData: {},
kmRangeCoordMap: {},
option: {
title: {
text: '',
left: 'center'
},
tripNumberConfig: {
data: [],
highlightCurrentRow: true,
handleChange: this.tripNumberChange,
showClose: false,
columns: [
{
prop: 'tripNumber',
label: '车次号',
},
{
width: 40
}
]
grid: {
top: '30px',
left: '120px',
right: '40px',
bottom: '65px',
containLabel: true,
backgroundColor: 'floralwhite'
},
realData: {},
kmRangeCoordMap: {},
option: {
title: {
text: '',
left: 'center'
},
grid: {
top: '30px',
left: '120px',
right: '40px',
bottom: '65px',
containLabel: true,
backgroundColor: 'floralwhite'
},
toolbox: {
right: '30px',
feature: {
dataZoom: {
yAxisIndex: 'none'
},
restore: {},
saveAsImage: {}
}
},
tooltip: {
axisPointer: {
trigger: 'item',
type: 'cross'
toolbox: {
right: '30px',
feature: {
dataZoom: {
yAxisIndex: 'none'
},
formatter: this.axisTooltip,
borderWidth: 1,
restore: {},
saveAsImage: {}
}
},
tooltip: {
axisPointer: {
trigger: 'item',
type: 'cross'
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: [],
axisLine: {
onZero: false,
lineStyle: {
width: 2,
color: '#d14a61'
}
},
axisLabel: {
formatter: this.xAxisLableFormat,
textStyle: {
color: '#333'
}
},
axisPointer: {
snap: true,
label: {
formatter: this.xAxisPointFormat,
backgroundColor: 'rgb(255,0,0,0.5)',
color: 'white',
}
}
}
],
yAxis: {
type: 'value',
splitLine: {
show: false
},
axisTick: {
show: false,
},
formatter: this.axisTooltip,
borderWidth: 1
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: [],
axisLine: {
onZero: false,
lineStyle: {
@ -156,317 +136,329 @@
}
},
axisLabel: {
interval: 'auto',
formatter: this.yAxisLableFormat,
formatter: this.xAxisLableFormat,
textStyle: {
color: '#333'
}
},
axisPointer: {
xAxisIndex: 'all',
snap: true,
label: {
formatter: this.yAxisPointFormat,
backgroundColor: 'rgb(0,100,0,0.5)',
color: 'white',
formatter: this.xAxisPointFormat,
backgroundColor: 'rgb(255,0,0,0.5)',
color: 'white'
}
},
min: 0,
max: 0,
}
}
],
yAxis: {
type: 'value',
splitLine: {
show: false
},
series: [],
dataZoom: [
{
type: 'inside',
},
{
fiterMode: 'filter',
handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
handleSize: '80%',
handleStyle: {
color: '#fff',
shadowBlur: 3,
shadowColor: 'rgba(0, 0, 0, 0.6)',
shadowOffsetX: 2,
shadowOffsetY: 2
},
bottom: '20px'
axisTick: {
show: false
},
axisLine: {
onZero: false,
lineStyle: {
width: 2,
color: '#d14a61'
}
]
},
axisLabel: {
interval: 'auto',
formatter: this.yAxisLableFormat
},
axisPointer: {
xAxisIndex: 'all',
label: {
formatter: this.yAxisPointFormat,
backgroundColor: 'rgb(0,100,0,0.5)',
color: 'white'
}
},
min: 0,
max: 0
},
absoluteTime: 2 * 3600,
indexKmRangeMap: {}
series: [],
dataZoom: [
{
type: 'inside'
},
{
fiterMode: 'filter',
handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
handleSize: '80%',
handleStyle: {
color: '#fff',
shadowBlur: 3,
shadowColor: 'rgba(0, 0, 0, 0.6)',
shadowOffsetX: 2,
shadowOffsetY: 2
},
bottom: '20px'
}
]
},
absoluteTime: 2 * 3600,
indexKmRangeMap: {}
};
},
watch: {
maxWidth() {
this.setPosition();
},
maxHeight() {
this.setPosition();
},
'$store.state.runPlan.planLoadedCount': async function () {
await this.loadChartPage();
},
'$store.state.runPlan.planSizeCount': function () {
this.reSize({ width: this.$store.state.runPlan.width, height: this.$store.state.runPlan.height });
},
'$store.state.runPlan.selected.serviceNumber': function (val) {
const index = this.serviceNumberConfig.data.findIndex(elem => {
return elem.serviceNumber == val;
});
this.$refs.serviceTable.setCurrentRow(this.serviceNumberConfig.data[index]);
},
'$store.state.runPlan.selected.tripNumber': function (val) {
const index = this.tripNumberConfig.data.findIndex(elem => {
return elem.tripNumber == val;
});
this.$refs.tripTable.setCurrentRow(this.tripNumberConfig.data[index]);
}
},
computed: {
...mapGetters('runPlan', [
'stations'
])
},
mounted() {
this.PlanConvert = this.$theme.loadPlanConvert(this.lineCode);
},
beforeDestroy() {
this.destroy();
},
methods: {
serviceNumberChange(row) {
if (row) {
this.$store.dispatch('runPlan/setSelected', { serviceNumber: row.serviceNumber, tripNumber: null });
const serviceObj = this.$store.state.runPlan.editData[row.serviceNumber];
if (serviceObj) {
this.analyticalTripNumber(serviceObj.trainMap);
}
}
},
watch: {
maxWidth() {
this.setPosition();
},
maxHeight() {
this.setPosition();
},
'$store.state.runPlan.planLoadedCount': async function () {
await this.loadChartPage();
},
'$store.state.runPlan.planSizeCount': function () {
this.reSize({ width: this.$store.state.runPlan.width, height: this.$store.state.runPlan.height });
},
'$store.state.runPlan.selected.serviceNumber': function (val) {
let index = this.serviceNumberConfig.data.findIndex(elem => {
return elem.serviceNumber == val;
})
this.$refs.serviceTable.setCurrentRow(this.serviceNumberConfig.data[index]);
},
'$store.state.runPlan.selected.tripNumber': function (val) {
let index = this.tripNumberConfig.data.findIndex(elem => {
return elem.tripNumber == val;
})
this.$refs.tripTable.setCurrentRow(this.tripNumberConfig.data[index]);
tripNumberChange(row) {
if (row) {
this.$store.dispatch('runPlan/setSelected', { serviceNumber: this.$store.state.runPlan.selected.serviceNumber, tripNumber: row.tripNumber });
}
},
computed: {
...mapGetters('runPlan', [
'stations'
])
async analyticalServiceNumber(data) {
this.serviceNumberConfig.data = Object.keys(data || {})
.sort((a, b) => { return data[a].oldIndex - data[b].oldIndex; })
.map(serviceNumber => { return { serviceNumber }; });
},
mounted() {
this.PlanConvert = this.$theme.loadPlanConvert(this.skinCode);
async analyticalTripNumber(data) {
this.tripNumberConfig.data = Object.keys(data || {})
.sort((a, b) => { return data[a].oldIndex - data[b].oldIndex; })
.map(tripNumber => { return { tripNumber }; });
},
beforeDestroy() {
this.destroy();
async setPosition() {
this.$nextTick(() => {
let top = 3;
const width = this.maxWidth * 0.85;
let height = this.maxHeight;
const titleBar = document.getElementById('PlanTitleBar');
const menuBar = document.getElementById('PlanMenuBar');
const menuTool = document.getElementById('PlanMenuTool');
const statusBar = document.getElementById('PlanStatusBar');
if (titleBar) {
top += (titleBar.offsetHeight || 0);
}
if (menuBar) {
top += (menuBar.offsetHeight || 0);
}
if (menuTool) {
top += (menuTool.offsetHeight || 0);
}
if (statusBar) {
height -= (statusBar.offsetHeight || 0);
}
height = height - top;
this.$store.dispatch('runPlan/resize', { width, height });
if (this.top != top) {
this.top = top;
}
if (this.height != height) {
this.height = height - 20 * 2;
}
});
},
methods: {
serviceNumberChange(row) {
if (row) {
this.$store.dispatch('runPlan/setSelected', { serviceNumber: row.serviceNumber, tripNumber: null });
let serviceObj = this.$store.state.runPlan.editData[row.serviceNumber]
if (serviceObj) {
this.analyticalTripNumber(serviceObj.trainMap);
}
}
},
tripNumberChange(row) {
if (row) {
this.$store.dispatch('runPlan/setSelected', { serviceNumber: this.$store.state.runPlan.selected.serviceNumber, tripNumber: row.tripNumber });
}
},
async analyticalServiceNumber(data) {
this.serviceNumberConfig.data = Object.keys(data || {})
.sort((a, b) => { return data[a].oldIndex - data[b].oldIndex })
.map(serviceNumber => { return { serviceNumber } });
},
async analyticalTripNumber(data) {
this.tripNumberConfig.data = Object.keys(data || {})
.sort((a, b) => { return data[a].oldIndex - data[b].oldIndex })
.map(tripNumber => { return { tripNumber } });
},
async setPosition() {
this.$nextTick(() => {
let top = 3;
let width = this.maxWidth * 0.85;
let height = this.maxHeight;
async loadChartPage() {
try {
let series = [];
const stations = this.$store.state.runPlan.stations;
const planData = this.$store.state.runPlan.planData;
let titleBar = document.getElementById('PlanTitleBar');
let menuBar = document.getElementById('PlanMenuBar');
let menuTool = document.getElementById('PlanMenuTool');
let statusBar = document.getElementById('PlanStatusBar');
this.viewDisabled = true;
this.kmRangeCoordMap = this.PlanConvert.convertStationsToMap(stations);
series = this.pushModels(series, [this.PlanConvert.initializeYaxis(stations)]);
series = this.pushModels(series, this.PlanConvert.convertDataToModels(planData, stations, this.kmRangeCoordMap, { color: '#000', width: 0.5 }));
await this.loadInitData(series);
await this.analyticalServiceNumber(this.$store.state.runPlan.editData);
this.viewDisabled = false;
if (titleBar) {
top += (titleBar.offsetHeight || 0);
}
if (menuBar) {
top += (menuBar.offsetHeight || 0);
}
if (menuTool) {
top += (menuTool.offsetHeight || 0);
}
if (statusBar) {
height -= (statusBar.offsetHeight || 0);
}
height = height - top;
this.$store.dispatch('runPlan/resize', { width, height });
if (this.top != top) {
this.top = top;
}
if (this.height != height) {
this.height = height - 20 * 2;
}
})
},
async loadChartPage() {
try {
let series = [];
let stations = this.$store.state.runPlan.stations;
let planData = this.$store.state.runPlan.planData;
this.viewDisabled = true;
this.kmRangeCoordMap = this.PlanConvert.convertStationsToMap(stations);
series = this.pushModels(series, [this.PlanConvert.initializeYaxis(stations)]);
series = this.pushModels(series, this.PlanConvert.convertDataToModels(planData, stations, this.kmRangeCoordMap, { color: '#000', width: 0.5 }));
await this.loadInitData(series);
await this.analyticalServiceNumber(this.$store.state.runPlan.editData);
this.viewDisabled = false;
} catch (error) {
this.viewDisabled = false;
this.$messageBox(`加载运行图数据失败`);
}
},
async loadInitData(series) {
this.myChart && this.myChart.showLoading();
await this.xAxisInit();
await this.yAxisInit();
await this.loadInitChart(series);
this.myChart && this.myChart.hideLoading();
},
pushModels(series, models) {
if (models && models.length) {
models.forEach(elem => {
if (elem) {
series.push(elem);
}
})
}
return series;
},
popModels(series, models) {
if (models && models.length) {
models.forEach(elem => {
let index = series.indexOf(elem);
if (index >= 0) {
series.split(index, 1);
}
})
}
return series;
},
loadInitChart(series) {
return new Promise((resolve, reject) => {
try {
let that = this;
//echart
require.config(
{
paths: {
echarts: './js/dist'
}
}
);
//
require(
[
'echarts',
'echarts/lib/chart/line',
],
function (ec) {
that.destroy();
let startValue = 3600 + that.PlanConvert.TranslationTime;
let offsetTime = 3600;
runDiagramGetTime(that.group).then(resp => {
startValue = resp.data - that.PlanConvert.TranslationTime;
that.option.dataZoom[0].startValue = that.option.dataZoom[1].startValue = startValue - offsetTime;
that.option.dataZoom[0].endValue = that.option.dataZoom[1].endValue = startValue + offsetTime;
that.option.series = series;
that.myChart = ec.init(document.getElementById(that.runPlanId));
if (that.myChart) {
that.myChart.setOption(that.option);
that.reSize({ width: that.$store.state.runPlan.width, height: that.$store.state.runPlan.height });
that.myChart.on('click', that.mouseClick);
}
})
resolve(true);
}
);
} catch (error) {
reject(error);
} catch (error) {
this.viewDisabled = false;
this.$messageBox(`加载运行图数据失败`);
}
},
async loadInitData(series) {
this.myChart && this.myChart.showLoading();
await this.xAxisInit();
await this.yAxisInit();
await this.loadInitChart(series);
this.myChart && this.myChart.hideLoading();
},
pushModels(series, models) {
if (models && models.length) {
models.forEach(elem => {
if (elem) {
series.push(elem);
}
});
},
xAxisPointFormat(params) {
return timeFormat(params.value);
},
yAxisPointFormat(params) {
return this.PlanConvert.computedFormatYAxis(this.stations, params);
},
xAxisLableFormat(value, index) {
if (value % 60 === 0) {
return timeFormat(value);
}
},
yAxisLableFormat(value, index) {
return '';
},
xAxisInit() {
let list = [];
for (var time = 0 + this.PlanConvert.TranslationTime; time < 3600 * 24 + this.PlanConvert.TranslationTime; time++) {
list.push(time);
}
let startValue = 3600 * 6;
let offsetTime = 3600 * 1;
this.option.xAxis[0].data = list;
if (!this.option.dataZoom[0].startValue) {
this.option.dataZoom[0].startValue = this.option.dataZoom[1].startValue = startValue - offsetTime;
}
if (!this.option.dataZoom[0].endValue) {
this.option.dataZoom[0].endValue = this.option.dataZoom[1].endValue = startValue + offsetTime;
}
},
yAxisInit() {
if (Object.keys(this.PlanConvert).length) {
this.option.yAxis.min = this.PlanConvert.computedYaxisMinValue(this.stations);
this.option.yAxis.max = this.PlanConvert.computedYaxisMaxValue(this.stations);
}
},
axisTooltip(param) {
let station = this.stations[Math.floor((param.data[1] - this.PlanConvert.EdgeHeight) / this.PlanConvert.CoordMultiple)] || { name: '', kmRange: '' };
return [
`Point Data <hr size=1 style=" margin: 3px 0">`,
`车站名称: ${station.name}<br>`,
`车站公里标: ${station.kmRange} km <br>`,
`到站时间: ${timeFormat(param.data[0] + this.PlanConvert.TranslationTime)} (${param.data[0]})<br>`
].join('');
},
mouseClick(params) {
let model = {
serviceNumber: params.seriesName
}
this.$store.dispatch('runPlan/setSelected', model);
},
reSize(opt) {
if (this.myChart) {
this.myChart.resize({
width: opt.width,
height: opt.height,
silent: false
});
}
},
destroy() {
if (this.myChart && this.myChart.isDisposed) {
this.myChart.dispose();
this.myChart = null;
}
},
scheduleTouch() {
},
trainNumTouch() {
}
return series;
},
popModels(series, models) {
if (models && models.length) {
models.forEach(elem => {
const index = series.indexOf(elem);
if (index >= 0) {
series.split(index, 1);
}
});
}
return series;
},
loadInitChart(series) {
return new Promise((resolve, reject) => {
try {
this.destroy();
let startValue = 3600 + this.PlanConvert.TranslationTime;
const offsetTime = 3600;
runDiagramGetTime(this.group).then(resp => {
startValue = resp.data - this.PlanConvert.TranslationTime;
this.option.dataZoom[0].startValue = this.option.dataZoom[1].startValue = startValue - offsetTime;
this.option.dataZoom[0].endValue = this.option.dataZoom[1].endValue = startValue + offsetTime;
this.option.series = series;
this.myChart = echarts.init(document.getElementById(this.runPlanId));
if (this.myChart) {
this.myChart.setOption(this.option);
this.reSize({ width: this.$store.state.runPlan.width, height: this.$store.state.runPlan.height });
this.myChart.on('click', this.mouseClick);
}
});
resolve(true);
} catch (error) {
reject(error);
}
});
},
xAxisPointFormat(params) {
return timeFormat(params.value);
},
yAxisPointFormat(params) {
return this.PlanConvert.computedFormatYAxis(this.stations, params);
},
xAxisLableFormat(value, index) {
if (value % 60 === 0) {
return timeFormat(value);
}
},
yAxisLableFormat(value, index) {
return '';
},
xAxisInit() {
const list = [];
for (var time = 0 + this.PlanConvert.TranslationTime; time < 3600 * 24 + this.PlanConvert.TranslationTime; time++) {
list.push(time);
}
const startValue = 3600 * 6;
const offsetTime = 3600 * 1;
this.option.xAxis[0].data = list;
if (!this.option.dataZoom[0].startValue) {
this.option.dataZoom[0].startValue = this.option.dataZoom[1].startValue = startValue - offsetTime;
}
if (!this.option.dataZoom[0].endValue) {
this.option.dataZoom[0].endValue = this.option.dataZoom[1].endValue = startValue + offsetTime;
}
},
yAxisInit() {
if (Object.keys(this.PlanConvert).length) {
this.option.yAxis.min = this.PlanConvert.computedYaxisMinValue(this.stations);
this.option.yAxis.max = this.PlanConvert.computedYaxisMaxValue(this.stations);
}
},
axisTooltip(param) {
const station = this.stations[Math.floor((param.data[1] - this.PlanConvert.EdgeHeight) / this.PlanConvert.CoordMultiple)] || { name: '', kmRange: '' };
return [
`Point Data <hr size=1 style=" margin: 3px 0">`,
`车站名称: ${station.name}<br>`,
`车站公里标: ${station.kmRange} km <br>`,
`到站时间: ${timeFormat(param.data[0] + this.PlanConvert.TranslationTime)} (${param.data[0]})<br>`
].join('');
},
mouseClick(params) {
const model = {
serviceNumber: params.seriesName
};
this.$store.dispatch('runPlan/setSelected', model);
},
reSize(opt) {
if (this.myChart) {
this.myChart.resize({
width: opt.width,
height: opt.height,
silent: false
});
}
},
destroy() {
if (this.myChart && this.myChart.isDisposed) {
this.myChart.dispose();
this.myChart = null;
}
},
scheduleTouch() {
},
trainNumTouch() {
}
}
};
</script>
<style scoped rel="stylesheet/scss" lang="scss" scoped>
<style scoped rel="stylesheet/scss" lang="scss">
@import "src/styles/mixin.scss";
#PlanSchedule {
@ -486,4 +478,4 @@
float: right;
}
}
</style>
</style>

View File

@ -1,8 +1,8 @@
<template>
<div class="plan-schedule" style="width: 100%">
<title-bar ref="titleBar" @back="back" />
<menu-bar ref="menuBar" :skin-code="skinCode" @dispatchDialog="dispatchDialog" />
<schedule ref="schedule" :group="group" :skin-code="skinCode" :max-height="height" :max-width="width" />
<menu-bar ref="menuBar" :line-code="lineCode" @dispatchDialog="dispatchDialog" />
<schedule ref="schedule" :group="group" :line-code="lineCode" :max-height="height" :max-width="width" />
<status-bar ref="statusBar" :max-top="height" @setPosition="setPosition" />
<manage-plan-list ref="managePlanList" @dispatchDialog="dispatchDialog" />
@ -29,65 +29,65 @@ import DeleteTask from '../menusPlan/deleteTask';
import ModifyingTask from '../menusPlan/modifyingTask';
export default {
name: 'Menus',
components: {
TitleBar,
MenuBar,
StatusBar,
Schedule,
ManagePlanList,
CreateWeekPlan,
CreateTodayPlan,
ModifyingPlan,
AddTask,
DeleteTask,
ModifyingTask
},
props: {
group: {
type: String,
required: true
}
},
data() {
return {
};
},
computed: {
skinCode() {
return this.$route.query.skinCode || '02';
},
width() {
return this.$store.state.app.width;
},
height() {
return this.$store.state.app.height;
}
},
methods: {
setPosition() {
this.$nextTick(() => {
this.$refs.schedule.setPosition();
});
},
dispatchDialog(dialogObj) {
this.$nextTick(() => {
if (this.$refs[dialogObj.name]) {
this.$refs[dialogObj.name].doShow(dialogObj.params);
}
});
},
reloadTable(dialogObj) {
if (this.$refs[dialogObj.name]) {
this.$refs[dialogObj.name].reloadTable();
}
},
confirm(params) {
},
back() {
this.$emit('back');
}
}
name: 'Menus',
components: {
TitleBar,
MenuBar,
StatusBar,
Schedule,
ManagePlanList,
CreateWeekPlan,
CreateTodayPlan,
ModifyingPlan,
AddTask,
DeleteTask,
ModifyingTask
},
props: {
group: {
type: String,
required: true
}
},
data() {
return {
};
},
computed: {
lineCode() {
return this.$route.query.lineCode || '02';
},
width() {
return this.$store.state.app.width;
},
height() {
return this.$store.state.app.height;
}
},
methods: {
setPosition() {
this.$nextTick(() => {
this.$refs.schedule.setPosition();
});
},
dispatchDialog(dialogObj) {
this.$nextTick(() => {
if (this.$refs[dialogObj.name]) {
this.$refs[dialogObj.name].doShow(dialogObj.params);
}
});
},
reloadTable(dialogObj) {
if (this.$refs[dialogObj.name]) {
this.$refs[dialogObj.name].reloadTable();
}
},
confirm(params) {
},
back() {
this.$emit('back');
}
}
};
</script>

View File

@ -125,7 +125,7 @@ import { EventBus } from '@/scripts/event-bus';
export default {
name: 'PlanMenuBar',
props: {
skinCode: {
lineCode: {
type: String,
required: true
}

View File

@ -27,6 +27,7 @@ import { mapGetters } from 'vuex';
import { timeFormat } from '@/utils/date';
import { runDiagramGetTime } from '@/api/simulation';
import DataTable from '../menusPlan/components/dataTable';
import echarts from 'echarts';
export default {
name: 'PlanSchedule',
@ -38,7 +39,7 @@ export default {
type: String,
required: true
},
skinCode: {
lineCode: {
type: String,
required: true
},
@ -237,7 +238,7 @@ export default {
}
},
mounted() {
this.PlanConvert = this.$theme.loadPlanConvert(this.skinCode);
this.PlanConvert = this.$theme.loadPlanConvert(this.lineCode);
},
beforeDestroy() {
this.destroy();
@ -358,42 +359,24 @@ export default {
loadInitChart(series) {
return new Promise((resolve, reject) => {
try {
const that = this;
// echart
require.config(
{
paths: {
echarts: './js/dist'
}
}
);
//
require(
[
'echarts',
'echarts/lib/chart/line'
],
function (ec) {
that.destroy();
this.destroy();
let startValue = 3600 + that.PlanConvert.TranslationTime;
const offsetTime = 3600;
let startValue = 3600 + this.PlanConvert.TranslationTime;
const offsetTime = 3600;
runDiagramGetTime(that.group).then(resp => {
startValue = resp.data - that.PlanConvert.TranslationTime;
that.option.dataZoom[0].startValue = that.option.dataZoom[1].startValue = startValue - offsetTime;
that.option.dataZoom[0].endValue = that.option.dataZoom[1].endValue = startValue + offsetTime;
that.option.series = series;
that.myChart = ec.init(document.getElementById(that.runPlanId));
if (that.myChart) {
that.myChart.setOption(that.option);
that.reSize({ width: that.$store.state.runPlan.width, height: that.$store.state.runPlan.height });
that.myChart.on('click', that.mouseClick);
}
});
resolve(true);
runDiagramGetTime(this.group).then(resp => {
startValue = resp.data - this.PlanConvert.TranslationTime;
this.option.dataZoom[0].startValue = this.option.dataZoom[1].startValue = startValue - offsetTime;
this.option.dataZoom[0].endValue = this.option.dataZoom[1].endValue = startValue + offsetTime;
this.option.series = series;
this.myChart = echarts.init(document.getElementById(this.runPlanId));
if (this.myChart) {
this.myChart.setOption(this.option);
this.reSize({ width: this.$store.state.runPlan.width, height: this.$store.state.runPlan.height });
this.myChart.on('click', this.mouseClick);
}
);
});
resolve(true);
} catch (error) {
reject(error);
}
@ -476,7 +459,7 @@ export default {
}
};
</script>
<style scoped rel="stylesheet/scss" lang="scss" scoped>
<style scoped rel="stylesheet/scss" lang="scss">
@import "src/styles/mixin.scss";
#PlanSchedule {

View File

@ -1,34 +1,34 @@
class Theme {
constructor(code) {
this._code = '02';
this._mapMenu = {
'01': 'chengdu_04',
'02': 'fuzhou_01',
'03': 'beijing_01',
'04': 'chengdu_03',
'05': 'fuzhou_01' // 国际版运行图皮肤 指向05 福州线路
};
}
constructor(code) {
this._code = '02';
this._mapMenu = {
'01': 'chengdu_04',
'02': 'fuzhou_01',
'03': 'beijing_01',
'04': 'chengdu_03',
'05': 'fuzhou_01' // 国际版运行图皮肤 指向05 福州线路
};
}
// 加载菜单组件
loadMenuComponent(code) {
return Object.assign({}, require(`./${this._mapMenu[code || this._code]}/menus/index`).default);
}
// 加载菜单组件
loadMenuComponent(code) {
return Object.assign({}, require(`./${this._mapMenu[code || this._code]}/menus/index`).default);
}
// 加载运行图计划表组件
loadPlanComponent(code) {
return Object.assign({}, require(`./${this._mapMenu[code || this._code]}/planSchedule/index`).default);
}
// 加载运行图计划表组件
loadPlanComponent(code) {
return Object.assign({}, require(`./${this._mapMenu[code || this._code]}/planSchedule/index`).default);
}
// 加载运行图解析和转化函数
loadPlanConvert(code) {
return require(`./${this._mapMenu[code || this._code]}/planConvert`).default;
}
// 加载运行图解析和转化函数
loadPlanConvert(code) {
return require(`./${this._mapMenu[code || this._code]}/planConvert`).default;
}
// 共有字段转换
loadPropConvert(code) {
return require(`./${this._mapMenu[code || this._code]}/model`).default;
}
// 共有字段转换
loadPropConvert(code) {
return require(`./${this._mapMenu[code || this._code]}/model`).default;
}
}
export default Theme;

View File

@ -1,8 +1,8 @@
<template>
<div class="plan-schedule" style="width: 100%">
<title-bar ref="titleBar" @back="back" />
<menu-bar ref="menuBar" :skin-code="skinCode" @dispatchDialog="dispatchDialog" />
<schedule ref="schedule" :skin-code="skinCode" :group="group" :max-height="height" :max-width="width" />
<menu-bar ref="menuBar" :line-code="lineCode" @dispatchDialog="dispatchDialog" />
<schedule ref="schedule" :line-code="lineCode" :group="group" :max-height="height" :max-width="width" />
<status-bar ref="statusBar" :max-top="height" @setPosition="setPosition" />
<manage-plan-list ref="managePlanList" @dispatchDialog="dispatchDialog" />
@ -54,8 +54,8 @@ export default {
};
},
computed: {
skinCode() {
return this.$route.query.skinCode || '02';
lineCode() {
return this.$route.query.lineCode || '02';
},
width() {
return this.$store.state.app.width;

View File

@ -123,236 +123,236 @@ import { mapGetters } from 'vuex';
import { EventBus } from '@/scripts/event-bus';
export default {
name: 'PlanMenuBar',
props: {
skinCode: {
type: String,
required: true
}
},
data() {
return {
classA: -1,
classB: -1,
tempClassA: -1,
tempClassB: -1,
menu: [
{
title: this.$t('menu.file'),
children: [
]
},
{
title: this.$t('menu.view'),
children: [
// {
// title: '',
// },
// {
// title: '',
// },
// {
// title: ''
// }
]
},
{
title: this.$t('menu.edit'),
children: [
// {
// title: '',
// click: this.handleEditPlanningTrain
// },
// {
// title: '',
// click: this.handleAddTask
// },
// {
// title: '',
// click: this.handleDeleteTask
// },
// {
// title: '',
// click: this.handleModifyingPlanId
// },
// {
// title: '',
// click: this.handleTranslationalMulTrain
// }
]
},
{
title: this.$t('menu.tool'),
children: [
{
title: this.$t('menu.viewPlanList'),
click: this.handleViewPlanSchedule,
width: 150
},
{
title: this.$t('menu.createAWeekPlan'),
click: this.handleCreateWeekPlan,
width: 150
},
{
title: this.$t('menu.loadTheDayPlan'),
click: this.handleReloadTodayPlan,
width: 150
}
// {
// title: '',
// click: this.handleValidityCheck
// }
]
},
{
title: this.$t('menu.help'),
children: [
]
}
]
};
},
computed: {
...mapGetters('training', [
'mode'
]),
...mapGetters('map', [
'stationList'
])
},
watch: {
tempClassA() {
this.classA = this.$store.state.menuOperation.break ? -1 : this.tempClassA;
},
tempClassB() {
this.classB = this.$store.state.menuOperation.break ? -1 : this.tempClassB;
},
'$store.state.menuOperation.break': function (val) {
if (val) {
this.classA = this.classB = -1;
} else {
this.classA = this.tempClassA;
this.classB = this.tempClassB;
}
}
},
mounted() {
this.initMenu();
},
methods: {
initMenu() {
this.clickEvent();
this.closeMenu();
},
clickEvent() {
const self = this;
window.onclick = function (e) {
self.closeMenu(false);
};
},
noShowingChildren(children) {
if (!children || children.length <= 0) {
return true;
}
return false;
},
hasShowingChildren(children) {
if (children && children.length > 0) {
return true;
}
return false;
},
closeMenu() {
this.classA = this.tempClassA = -1;
this.classB = this.tempClassB = -1;
},
hookClick(item, event) {
this.closeMenu();
// launchFullscreen();
setTimeout(() => {
if (item && typeof item.click == 'function') {
item.click();
}
}, 500);
},
popupMenuA(item, index) {
this.clickEvent();
this.tempClassA = index;
this.tempClassB = -1;
},
popupMenuB(item, index) {
this.tempClassB = index;
},
openLoadFile(item) {
const obj = this.$refs[item.title][0];
if (obj.files) {
const file = obj.files[0];
item.click(file);
obj.value = '';
}
},
doClose() {
this.$nextTick(() => {
EventBus.$emit('closeMenu');
});
},
//
refresh() {
this.closeMenu(true);
EventBus.$emit('refresh');
},
undeveloped() {
this.doClose();
this.$alert(this.$t('menu.achieving'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
callback: action => {
}
});
},
//
handleEditPlanningTrain() {
this.$emit('dispatchDialog', { name: 'modifyingPlan' });
},
//
handleAddTask() {
const params = this.$store.state.runPlan.selected;
this.$emit('dispatchDialog', { name: 'addTask', params });
},
//
handleDeleteTask() {
const params = this.$store.state.runPlan.selected;
this.$emit('dispatchDialog', { name: 'deleteTask', params });
},
//
handleModifyingTask() {
const params = this.$store.state.runPlan.selected;
this.$emit('dispatchDialog', { name: 'modifyingTask', params });
},
//
handleModifyingPlanId() {
this.$emit('dispatchDialog', { name: 'modifyingPlanId' });
},
//
handleTranslationalMulTrain() {
this.$emit('dispatchDialog', { name: 'translationalMulTrain' });
},
//
handleViewPlanSchedule() {
this.$emit('dispatchDialog', { name: 'managePlanList' });
},
//
handleCreateWeekPlan() {
this.$emit('dispatchDialog', { name: 'createWeekPlan' });
},
//
handleReloadTodayPlan() {
this.$emit('dispatchDialog', { name: 'createTodayPlan' });
},
//
handleValidityCheck() {
}
}
name: 'PlanMenuBar',
props: {
lineCode: {
type: String,
required: true
}
},
data() {
return {
classA: -1,
classB: -1,
tempClassA: -1,
tempClassB: -1,
menu: [
{
title: this.$t('menu.file'),
children: [
]
},
{
title: this.$t('menu.view'),
children: [
// {
// title: '',
// },
// {
// title: '',
// },
// {
// title: ''
// }
]
},
{
title: this.$t('menu.edit'),
children: [
// {
// title: '',
// click: this.handleEditPlanningTrain
// },
// {
// title: '',
// click: this.handleAddTask
// },
// {
// title: '',
// click: this.handleDeleteTask
// },
// {
// title: '',
// click: this.handleModifyingPlanId
// },
// {
// title: '',
// click: this.handleTranslationalMulTrain
// }
]
},
{
title: this.$t('menu.tool'),
children: [
{
title: this.$t('menu.viewPlanList'),
click: this.handleViewPlanSchedule,
width: 150
},
{
title: this.$t('menu.createAWeekPlan'),
click: this.handleCreateWeekPlan,
width: 150
},
{
title: this.$t('menu.loadTheDayPlan'),
click: this.handleReloadTodayPlan,
width: 150
}
// {
// title: '',
// click: this.handleValidityCheck
// }
]
},
{
title: this.$t('menu.help'),
children: [
]
}
]
};
},
computed: {
...mapGetters('training', [
'mode'
]),
...mapGetters('map', [
'stationList'
])
},
watch: {
tempClassA() {
this.classA = this.$store.state.menuOperation.break ? -1 : this.tempClassA;
},
tempClassB() {
this.classB = this.$store.state.menuOperation.break ? -1 : this.tempClassB;
},
'$store.state.menuOperation.break': function (val) {
if (val) {
this.classA = this.classB = -1;
} else {
this.classA = this.tempClassA;
this.classB = this.tempClassB;
}
}
},
mounted() {
this.initMenu();
},
methods: {
initMenu() {
this.clickEvent();
this.closeMenu();
},
clickEvent() {
const self = this;
window.onclick = function (e) {
self.closeMenu(false);
};
},
noShowingChildren(children) {
if (!children || children.length <= 0) {
return true;
}
return false;
},
hasShowingChildren(children) {
if (children && children.length > 0) {
return true;
}
return false;
},
closeMenu() {
this.classA = this.tempClassA = -1;
this.classB = this.tempClassB = -1;
},
hookClick(item, event) {
this.closeMenu();
// launchFullscreen();
setTimeout(() => {
if (item && typeof item.click == 'function') {
item.click();
}
}, 500);
},
popupMenuA(item, index) {
this.clickEvent();
this.tempClassA = index;
this.tempClassB = -1;
},
popupMenuB(item, index) {
this.tempClassB = index;
},
openLoadFile(item) {
const obj = this.$refs[item.title][0];
if (obj.files) {
const file = obj.files[0];
item.click(file);
obj.value = '';
}
},
doClose() {
this.$nextTick(() => {
EventBus.$emit('closeMenu');
});
},
//
refresh() {
this.closeMenu(true);
EventBus.$emit('refresh');
},
undeveloped() {
this.doClose();
this.$alert(this.$t('menu.achieving'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
callback: action => {
}
});
},
//
handleEditPlanningTrain() {
this.$emit('dispatchDialog', { name: 'modifyingPlan' });
},
//
handleAddTask() {
const params = this.$store.state.runPlan.selected;
this.$emit('dispatchDialog', { name: 'addTask', params });
},
//
handleDeleteTask() {
const params = this.$store.state.runPlan.selected;
this.$emit('dispatchDialog', { name: 'deleteTask', params });
},
//
handleModifyingTask() {
const params = this.$store.state.runPlan.selected;
this.$emit('dispatchDialog', { name: 'modifyingTask', params });
},
//
handleModifyingPlanId() {
this.$emit('dispatchDialog', { name: 'modifyingPlanId' });
},
//
handleTranslationalMulTrain() {
this.$emit('dispatchDialog', { name: 'translationalMulTrain' });
},
//
handleViewPlanSchedule() {
this.$emit('dispatchDialog', { name: 'managePlanList' });
},
//
handleCreateWeekPlan() {
this.$emit('dispatchDialog', { name: 'createWeekPlan' });
},
//
handleReloadTodayPlan() {
this.$emit('dispatchDialog', { name: 'createTodayPlan' });
},
//
handleValidityCheck() {
}
}
};
</script>

View File

@ -27,453 +27,436 @@ import { mapGetters } from 'vuex';
import { timeFormat } from '@/utils/date';
import { runDiagramGetTime } from '@/api/simulation';
import DataTable from '../menusPlan/components/dataTable';
import echarts from 'echarts';
export default {
name: 'PlanSchedule',
components: {
DataTable
},
props: {
group: {
type: String,
required: true
},
skinCode: {
type: String,
required: true
},
maxWidth: {
type: Number,
required: true
},
maxHeight: {
type: Number,
required: true
}
},
data() {
return {
top: 0,
height: 0,
heights: [100, 100],
runPlanId: 'plan-schedule-id',
myChart: null,
PlanConvert: {},
serviceNumberConfig: {
data: [],
highlightCurrentRow: true,
handleChange: this.serviceNumberChange,
showClose: false,
columns: [
{
prop: 'serviceNumber',
label: this.$t('menu.serviceNumber')
},
{
width: 40
}
]
},
tripNumberConfig: {
data: [],
highlightCurrentRow: true,
handleChange: this.tripNumberChange,
showClose: false,
columns: [
{
prop: 'tripNumber',
label: this.$t('menu.tripNumber')
},
{
width: 40
}
]
},
realData: {},
kmRangeCoordMap: {},
option: {
title: {
text: '',
left: 'center'
},
grid: {
top: '30px',
left: '120px',
right: '40px',
bottom: '65px',
containLabel: true,
backgroundColor: 'floralwhite'
},
toolbox: {
right: '30px',
feature: {
dataZoom: {
yAxisIndex: 'none'
},
restore: {},
saveAsImage: {}
}
},
tooltip: {
axisPointer: {
trigger: 'item',
type: 'cross'
},
formatter: this.axisTooltip,
borderWidth: 1
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: [],
axisLine: {
onZero: false,
lineStyle: {
width: 2,
color: '#d14a61'
}
},
axisLabel: {
formatter: this.xAxisLableFormat,
textStyle: {
color: '#333'
}
},
axisPointer: {
snap: true,
label: {
formatter: this.xAxisPointFormat,
backgroundColor: 'rgb(255,0,0,0.5)',
color: 'white'
}
}
}
],
yAxis: {
type: 'value',
splitLine: {
show: false
},
axisTick: {
show: false
},
axisLine: {
onZero: false,
lineStyle: {
width: 2,
color: '#d14a61'
}
},
axisLabel: {
interval: 'auto',
formatter: this.yAxisLableFormat
},
axisPointer: {
xAxisIndex: 'all',
label: {
formatter: this.yAxisPointFormat,
backgroundColor: 'rgb(0,100,0,0.5)',
color: 'white'
}
},
min: 0,
max: 0
},
series: [],
dataZoom: [
{
type: 'inside'
},
{
fiterMode: 'filter',
handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
handleSize: '80%',
handleStyle: {
color: '#fff',
shadowBlur: 3,
shadowColor: 'rgba(0, 0, 0, 0.6)',
shadowOffsetX: 2,
shadowOffsetY: 2
},
bottom: '20px'
}
]
},
absoluteTime: 2 * 3600,
indexKmRangeMap: {}
};
},
computed: {
...mapGetters('runPlan', [
'stations'
])
},
watch: {
maxWidth() {
this.setPosition();
},
maxHeight() {
this.setPosition();
},
'$store.state.runPlan.planLoadedCount': async function () {
await this.loadChartPage();
},
'$store.state.runPlan.planSizeCount': function () {
this.reSize({ width: this.$store.state.runPlan.width, height: this.$store.state.runPlan.height });
},
'$store.state.runPlan.selected.serviceNumber': function (val) {
const index = this.serviceNumberConfig.data.findIndex(elem => {
return elem.serviceNumber == val;
});
name: 'PlanSchedule',
components: {
DataTable
},
props: {
group: {
type: String,
required: true
},
lineCode: {
type: String,
required: true
},
maxWidth: {
type: Number,
required: true
},
maxHeight: {
type: Number,
required: true
}
},
data() {
return {
top: 0,
height: 0,
heights: [100, 100],
runPlanId: 'plan-schedule-id',
myChart: null,
PlanConvert: {},
serviceNumberConfig: {
data: [],
highlightCurrentRow: true,
handleChange: this.serviceNumberChange,
showClose: false,
columns: [
{
prop: 'serviceNumber',
label: this.$t('menu.serviceNumber')
},
{
width: 40
}
]
},
tripNumberConfig: {
data: [],
highlightCurrentRow: true,
handleChange: this.tripNumberChange,
showClose: false,
columns: [
{
prop: 'tripNumber',
label: this.$t('menu.tripNumber')
},
{
width: 40
}
]
},
realData: {},
kmRangeCoordMap: {},
option: {
title: {
text: '',
left: 'center'
},
grid: {
top: '30px',
left: '120px',
right: '40px',
bottom: '65px',
containLabel: true,
backgroundColor: 'floralwhite'
},
toolbox: {
right: '30px',
feature: {
dataZoom: {
yAxisIndex: 'none'
},
restore: {},
saveAsImage: {}
}
},
tooltip: {
axisPointer: {
trigger: 'item',
type: 'cross'
},
formatter: this.axisTooltip,
borderWidth: 1
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: [],
axisLine: {
onZero: false,
lineStyle: {
width: 2,
color: '#d14a61'
}
},
axisLabel: {
formatter: this.xAxisLableFormat,
textStyle: {
color: '#333'
}
},
axisPointer: {
snap: true,
label: {
formatter: this.xAxisPointFormat,
backgroundColor: 'rgb(255,0,0,0.5)',
color: 'white'
}
}
}
],
yAxis: {
type: 'value',
splitLine: {
show: false
},
axisTick: {
show: false
},
axisLine: {
onZero: false,
lineStyle: {
width: 2,
color: '#d14a61'
}
},
axisLabel: {
interval: 'auto',
formatter: this.yAxisLableFormat
},
axisPointer: {
xAxisIndex: 'all',
label: {
formatter: this.yAxisPointFormat,
backgroundColor: 'rgb(0,100,0,0.5)',
color: 'white'
}
},
min: 0,
max: 0
},
series: [],
dataZoom: [
{
type: 'inside'
},
{
fiterMode: 'filter',
handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
handleSize: '80%',
handleStyle: {
color: '#fff',
shadowBlur: 3,
shadowColor: 'rgba(0, 0, 0, 0.6)',
shadowOffsetX: 2,
shadowOffsetY: 2
},
bottom: '20px'
}
]
},
absoluteTime: 2 * 3600,
indexKmRangeMap: {}
};
},
computed: {
...mapGetters('runPlan', [
'stations'
])
},
watch: {
maxWidth() {
this.setPosition();
},
maxHeight() {
this.setPosition();
},
'$store.state.runPlan.planLoadedCount': async function () {
await this.loadChartPage();
},
'$store.state.runPlan.planSizeCount': function () {
this.reSize({ width: this.$store.state.runPlan.width, height: this.$store.state.runPlan.height });
},
'$store.state.runPlan.selected.serviceNumber': function (val) {
const index = this.serviceNumberConfig.data.findIndex(elem => {
return elem.serviceNumber == val;
});
this.$refs.serviceTable.setCurrentRow(this.serviceNumberConfig.data[index]);
},
'$store.state.runPlan.selected.tripNumber': function (val) {
const index = this.tripNumberConfig.data.findIndex(elem => {
return elem.tripNumber == val;
});
this.$refs.tripTable.setCurrentRow(this.tripNumberConfig.data[index]);
}
},
mounted() {
this.PlanConvert = this.$theme.loadPlanConvert(this.skinCode);
},
beforeDestroy() {
this.destroy();
},
methods: {
serviceNumberChange(row) {
if (row) {
this.$store.dispatch('runPlan/setSelected', { serviceNumber: row.serviceNumber, tripNumber: null });
const serviceObj = this.$store.state.runPlan.editData[row.serviceNumber];
if (serviceObj) {
this.analyticalTripNumber(serviceObj.trainMap);
}
}
},
tripNumberChange(row) {
if (row) {
this.$store.dispatch('runPlan/setSelected', { serviceNumber: this.$store.state.runPlan.selected.serviceNumber, tripNumber: row.tripNumber });
}
},
async analyticalServiceNumber(data) {
this.serviceNumberConfig.data = Object.keys(data || {})
.sort((a, b) => { return data[a].oldIndex - data[b].oldIndex; })
.map(serviceNumber => { return { serviceNumber }; });
},
async analyticalTripNumber(data) {
this.tripNumberConfig.data = Object.keys(data || {})
.sort((a, b) => { return data[a].oldIndex - data[b].oldIndex; })
.map(tripNumber => { return { tripNumber }; });
},
async setPosition() {
this.$nextTick(() => {
let top = 3;
const width = this.maxWidth * 0.85;
let height = this.maxHeight;
this.$refs.serviceTable.setCurrentRow(this.serviceNumberConfig.data[index]);
},
'$store.state.runPlan.selected.tripNumber': function (val) {
const index = this.tripNumberConfig.data.findIndex(elem => {
return elem.tripNumber == val;
});
this.$refs.tripTable.setCurrentRow(this.tripNumberConfig.data[index]);
}
},
mounted() {
this.PlanConvert = this.$theme.loadPlanConvert(this.lineCode);
},
beforeDestroy() {
this.destroy();
},
methods: {
serviceNumberChange(row) {
if (row) {
this.$store.dispatch('runPlan/setSelected', { serviceNumber: row.serviceNumber, tripNumber: null });
const serviceObj = this.$store.state.runPlan.editData[row.serviceNumber];
if (serviceObj) {
this.analyticalTripNumber(serviceObj.trainMap);
}
}
},
tripNumberChange(row) {
if (row) {
this.$store.dispatch('runPlan/setSelected', { serviceNumber: this.$store.state.runPlan.selected.serviceNumber, tripNumber: row.tripNumber });
}
},
async analyticalServiceNumber(data) {
this.serviceNumberConfig.data = Object.keys(data || {})
.sort((a, b) => { return data[a].oldIndex - data[b].oldIndex; })
.map(serviceNumber => { return { serviceNumber }; });
},
async analyticalTripNumber(data) {
this.tripNumberConfig.data = Object.keys(data || {})
.sort((a, b) => { return data[a].oldIndex - data[b].oldIndex; })
.map(tripNumber => { return { tripNumber }; });
},
async setPosition() {
this.$nextTick(() => {
let top = 3;
const width = this.maxWidth * 0.85;
let height = this.maxHeight;
const titleBar = document.getElementById('PlanTitleBar');
const menuBar = document.getElementById('PlanMenuBar');
const menuTool = document.getElementById('PlanMenuTool');
const statusBar = document.getElementById('PlanStatusBar');
const titleBar = document.getElementById('PlanTitleBar');
const menuBar = document.getElementById('PlanMenuBar');
const menuTool = document.getElementById('PlanMenuTool');
const statusBar = document.getElementById('PlanStatusBar');
if (titleBar) {
top += (titleBar.offsetHeight || 0);
}
if (titleBar) {
top += (titleBar.offsetHeight || 0);
}
if (menuBar) {
top += (menuBar.offsetHeight || 0);
}
if (menuBar) {
top += (menuBar.offsetHeight || 0);
}
if (menuTool) {
top += (menuTool.offsetHeight || 0);
}
if (menuTool) {
top += (menuTool.offsetHeight || 0);
}
if (statusBar) {
height -= (statusBar.offsetHeight || 0);
}
if (statusBar) {
height -= (statusBar.offsetHeight || 0);
}
height = height - top;
this.$store.dispatch('runPlan/resize', { width, height });
height = height - top;
this.$store.dispatch('runPlan/resize', { width, height });
if (this.top != top) {
this.top = top;
}
if (this.top != top) {
this.top = top;
}
if (this.height != height) {
this.height = height - 20 * 2;
}
});
},
async loadChartPage() {
try {
let series = [];
const planData = this.$store.state.runPlan.planData || [];
const stations = this.$store.state.runPlan.stations || [];
if (this.height != height) {
this.height = height - 20 * 2;
}
});
},
async loadChartPage() {
try {
let series = [];
const planData = this.$store.state.runPlan.planData || [];
const stations = this.$store.state.runPlan.stations || [];
this.viewDisabled = true;
this.kmRangeCoordMap = this.PlanConvert.convertStationsToMap(stations);
series = this.pushModels(series, [this.PlanConvert.initializeYaxis(stations)]);
series = this.pushModels(series, this.PlanConvert.convertDataToModels(planData, stations, this.kmRangeCoordMap, { width: 0.5 }));
await this.loadInitData(series);
await this.analyticalServiceNumber(this.$store.state.runPlan.editData);
this.viewDisabled = false;
this.viewDisabled = true;
this.kmRangeCoordMap = this.PlanConvert.convertStationsToMap(stations);
series = this.pushModels(series, [this.PlanConvert.initializeYaxis(stations)]);
series = this.pushModels(series, this.PlanConvert.convertDataToModels(planData, stations, this.kmRangeCoordMap, { width: 0.5 }));
await this.loadInitData(series);
await this.analyticalServiceNumber(this.$store.state.runPlan.editData);
this.viewDisabled = false;
} catch (error) {
this.viewDisabled = false;
this.$messageBox(this.$t('error.loadingOperationGraphFailed'));
}
},
async loadInitData(series) {
this.myChart && this.myChart.showLoading();
await this.xAxisInit();
await this.yAxisInit();
await this.loadInitChart(series);
this.myChart && this.myChart.hideLoading();
},
pushModels(series, models) {
if (models && models.length) {
models.forEach(elem => {
if (elem) {
series.push(elem);
}
});
}
} catch (error) {
this.viewDisabled = false;
this.$messageBox(this.$t('error.loadingOperationGraphFailed'));
}
},
async loadInitData(series) {
this.myChart && this.myChart.showLoading();
await this.xAxisInit();
await this.yAxisInit();
await this.loadInitChart(series);
this.myChart && this.myChart.hideLoading();
},
pushModels(series, models) {
if (models && models.length) {
models.forEach(elem => {
if (elem) {
series.push(elem);
}
});
}
return series;
},
popModels(series, models) {
if (models && models.length) {
models.forEach(elem => {
const index = series.indexOf(elem);
if (index >= 0) {
series.split(index, 1);
}
});
}
return series;
},
popModels(series, models) {
if (models && models.length) {
models.forEach(elem => {
const index = series.indexOf(elem);
if (index >= 0) {
series.split(index, 1);
}
});
}
return series;
},
loadInitChart(series) {
return new Promise((resolve, reject) => {
try {
const that = this;
// echart
require.config(
{
paths: {
echarts: './js/dist'
}
}
);
//
require(
[
'echarts',
'echarts/lib/chart/line'
],
function (ec) {
that.destroy();
return series;
},
loadInitChart(series) {
return new Promise((resolve, reject) => {
try {
this.destroy();
let startValue = 3600 + that.PlanConvert.TranslationTime;
const offsetTime = 3600;
let startValue = 3600 + this.PlanConvert.TranslationTime;
const offsetTime = 3600;
runDiagramGetTime(that.group).then(resp => {
startValue = resp.data - that.PlanConvert.TranslationTime;
that.option.dataZoom[0].startValue = that.option.dataZoom[1].startValue = startValue - offsetTime;
that.option.dataZoom[0].endValue = that.option.dataZoom[1].endValue = startValue + offsetTime;
that.option.series = series;
that.myChart = ec.init(document.getElementById(that.runPlanId));
if (that.myChart) {
that.myChart.setOption(that.option);
that.reSize({ width: that.$store.state.runPlan.width, height: that.$store.state.runPlan.height });
that.myChart.on('click', that.mouseClick);
}
resolve(true);
});
}
);
} catch (error) {
reject(error);
}
});
},
xAxisPointFormat(params) {
return timeFormat(params.value);
},
yAxisPointFormat(params) {
return this.PlanConvert.computedFormatYAxis(this.stations, params);
},
xAxisLableFormat(value, index) {
if (value % 60 === 0) {
return timeFormat(value);
}
},
yAxisLableFormat(value, index) {
return '';
},
xAxisInit() {
const list = [];
for (var time = 0 + this.PlanConvert.TranslationTime; time < 3600 * 24 + this.PlanConvert.TranslationTime; time++) {
list.push(time);
}
runDiagramGetTime(this.group).then(resp => {
startValue = resp.data - this.PlanConvert.TranslationTime;
this.option.dataZoom[0].startValue = this.option.dataZoom[1].startValue = startValue - offsetTime;
this.option.dataZoom[0].endValue = this.option.dataZoom[1].endValue = startValue + offsetTime;
this.option.series = series;
this.myChart = echarts.init(document.getElementById(this.runPlanId));
if (this.myChart) {
this.myChart.setOption(this.option);
this.reSize({ width: this.$store.state.runPlan.width, height: this.$store.state.runPlan.height });
this.myChart.on('click', this.mouseClick);
}
});
resolve(true);
} catch (error) {
reject(error);
}
});
},
xAxisPointFormat(params) {
return timeFormat(params.value);
},
yAxisPointFormat(params) {
return this.PlanConvert.computedFormatYAxis(this.stations, params);
},
xAxisLableFormat(value, index) {
if (value % 60 === 0) {
return timeFormat(value);
}
},
yAxisLableFormat(value, index) {
return '';
},
xAxisInit() {
const list = [];
for (var time = 0 + this.PlanConvert.TranslationTime; time < 3600 * 24 + this.PlanConvert.TranslationTime; time++) {
list.push(time);
}
const startValue = 3600 * 6;
const offsetTime = 3600 * 1;
const startValue = 3600 * 6;
const offsetTime = 3600 * 1;
this.option.xAxis[0].data = list;
if (!this.option.dataZoom[0].startValue) {
this.option.dataZoom[0].startValue = this.option.dataZoom[1].startValue = startValue - offsetTime;
}
this.option.xAxis[0].data = list;
if (!this.option.dataZoom[0].startValue) {
this.option.dataZoom[0].startValue = this.option.dataZoom[1].startValue = startValue - offsetTime;
}
if (!this.option.dataZoom[0].endValue) {
this.option.dataZoom[0].endValue = this.option.dataZoom[1].endValue = startValue + offsetTime;
}
},
yAxisInit() {
if (Object.keys(this.PlanConvert).length) {
this.option.yAxis.min = this.PlanConvert.computedYaxisMinValue(this.stations);
this.option.yAxis.max = this.PlanConvert.computedYaxisMaxValue(this.stations);
}
},
axisTooltip(param) {
const station = this.stations[Math.floor((param.data[1] - this.PlanConvert.EdgeHeight) / this.PlanConvert.CoordMultiple)] || { name: '', kmRange: '' };
return [
`Point Data <hr size=1 style=" margin: 3px 0">`,
`${this.$t('menu.stationName') + station.name}<br>`,
`${this.$t('menu.stationKilometerMark') + station.kmRange} km <br>`,
`${this.$t('menu.arrivalTime2') + timeFormat(param.data[0] + this.PlanConvert.TranslationTime)} (${param.data[0]})<br>`
].join('');
},
mouseClick(params) {
const model = {
serviceNumber: params.seriesName
};
this.$store.dispatch('runPlan/setSelected', model);
},
reSize(opt) {
if (this.myChart) {
this.myChart.resize({
width: opt.width,
height: opt.height,
silent: false
});
}
},
destroy() {
if (this.myChart && this.myChart.isDisposed) {
this.myChart.dispose();
this.myChart = null;
}
},
scheduleTouch() {
if (!this.option.dataZoom[0].endValue) {
this.option.dataZoom[0].endValue = this.option.dataZoom[1].endValue = startValue + offsetTime;
}
},
yAxisInit() {
if (Object.keys(this.PlanConvert).length) {
this.option.yAxis.min = this.PlanConvert.computedYaxisMinValue(this.stations);
this.option.yAxis.max = this.PlanConvert.computedYaxisMaxValue(this.stations);
}
},
axisTooltip(param) {
const station = this.stations[Math.floor((param.data[1] - this.PlanConvert.EdgeHeight) / this.PlanConvert.CoordMultiple)] || { name: '', kmRange: '' };
return [
`Point Data <hr size=1 style=" margin: 3px 0">`,
`${this.$t('menu.stationName') + station.name}<br>`,
`${this.$t('menu.stationKilometerMark') + station.kmRange} km <br>`,
`${this.$t('menu.arrivalTime2') + timeFormat(param.data[0] + this.PlanConvert.TranslationTime)} (${param.data[0]})<br>`
].join('');
},
mouseClick(params) {
const model = {
serviceNumber: params.seriesName
};
this.$store.dispatch('runPlan/setSelected', model);
},
reSize(opt) {
if (this.myChart) {
this.myChart.resize({
width: opt.width,
height: opt.height,
silent: false
});
}
},
destroy() {
if (this.myChart && this.myChart.isDisposed) {
this.myChart.dispose();
this.myChart = null;
}
},
scheduleTouch() {
},
trainNumTouch() {
},
trainNumTouch() {
}
}
}
}
};
</script>
<style scoped rel="stylesheet/scss" lang="scss">

View File

@ -6,20 +6,18 @@ import ElementUI from 'element-ui';
import ElementLocale from 'element-ui/lib/locale';
import 'element-ui/lib/theme-chalk/index.css';
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n
import '@/styles/index.scss'; // global css
import LangStorage from '@/utils/lang';
import App from './App';
import VueI18n from 'vue-i18n';
import store from './store';
import router from './router';
import '@/icons'; // icon
import '@/permission'; // permission control
import '@/scripts/GlobalPlugin';
// import '@/directives';
import '@/directive/dialogDrag/index.js';
import '@/directive/dialogDragWidth/index.js';
import '@/directive/drag/index.js';
@ -34,17 +32,17 @@ Vue.use(VueI18n);
Vue.config.productionTip = false;
export const i18n = new VueI18n({
locale: LangStorage.getLang('zh'),
messages
locale: LangStorage.getLang('zh'),
messages
});
ElementLocale.i18n((key, value) => i18n.t(key, value));
new Vue({
el: '#app',
router,
store,
i18n,
render: h => h(App)
el: '#app',
router,
store,
i18n,
render: h => h(App)
});

View File

@ -2,7 +2,7 @@ import Vue from 'vue';
import store from '@/store';
import router from './router';
import NProgress from 'nprogress'; // Progress 进度条
import 'nprogress/nprogress.css';// Progress 进度条样式
// import 'nprogress/nprogress.css';// Progress 进度条样式
import { admin, userDesign} from './router';
import { getToken, getDesignToken} from '@/utils/auth'; // 验权
import { LoginParams } from '@/utils/login';
@ -104,6 +104,7 @@ function handleRoute(to, from, next, routeInfo) {
router.beforeEach((to, from, next) => {
NProgress.start();
const routeInfo = getRouteInfo(to);
if (routeInfo.getTokenInfo()) {
// 已登录
@ -126,6 +127,14 @@ router.beforeEach((to, from, next) => {
}
});
NProgress.configure({
easing: 'ease', // 动画方式
speed: 500, // 递增进度条的速度
showSpinner: false, // 是否显示加载ico
trickleSpeed: 200, // 自动递增间隔
minimum: 0.3 // 初始化时的最小百分比
});
router.afterEach(() => {
// 结束Progress
NProgress.done();

View File

@ -1,104 +1,105 @@
import Vue from 'vue';
// import Vue from 'vue';
import Router from 'vue-router';
// import VueRouter from 'vue-router';
Vue.use(Router);
// Vue.use(Router);
/* Layout */
import Layout from '@/layout';
import Login from '@/views/login/index';
const Layout = () => import('@/layout');
const Login = () => import('@/views/login/index');
import Jlmap3dedit from '@/views/jlmap3d/edit/jlmap3dedit';
import Jlmap3d from '@/views/jlmap3d/drive/jl3ddrive';
import Display from '@/views/display/index';
import DesignDisplay from '@/views/display/designIndex';
const Jlmap3dedit = () => import('@/views/jlmap3d/edit/jlmap3dedit');
const Jlmap3d = () => import('@/views/jlmap3d/drive/jl3ddrive');
const Display = () => import('@/views/display/index');
const DesignDisplay = () => import('@/views/display/designIndex');
import TrainRoom from '@/views/trainRoom/index';
import JointTraining from '@/views/jointTraining/index';
const TrainRoom = () => import('@/views/trainRoom/index');
const JointTraining = () => import('@/views/jointTraining/index');
import Error401 from '@/views/error-page/401';
import Errpr404 from '@/views/error-page/404';
const Error401 = () => import('@/views/error-page/401');
const Errpr404 = () => import('@/views/error-page/404');
import MapProduct from '@/views/system/product/index';
import Dictionary from '@/views/system/dictionary/index';
import DictionaryDetail from '@/views/system/dictionaryDetail/index';
import UserControl from '@/views/system/userControl/index';
import UserTraining from '@/views/system/userTraining/index';
import UserExam from '@/views/system/userExam/index';
import UserSimulation from '@/views/system/userSimulation/index';
import ExistingSimulation from '@/views/system/existingSimulation/index';
import CacheControl from '@/views/system/cacheControl/index';
import SystemGenerate from '@/views/system/systemGenerate/index';
import IbpDraw from '@/views/system/ibpDraw/index';
const MapProduct = () => import('@/views/system/product/index');
const Dictionary = () => import('@/views/system/dictionary/index');
const DictionaryDetail = () => import('@/views/system/dictionaryDetail/index');
const UserControl = () => import('@/views/system/userControl/index');
const UserTraining = () => import('@/views/system/userTraining/index');
const UserExam = () => import('@/views/system/userExam/index');
const UserSimulation = () => import('@/views/system/userSimulation/index');
const ExistingSimulation = () => import('@/views/system/existingSimulation/index');
const CacheControl = () => import('@/views/system/cacheControl/index');
const SystemGenerate = () => import('@/views/system/systemGenerate/index');
const IbpDraw = () => import('@/views/system/ibpDraw/index');
import Mapedit from '@/views/mapdraft/index';
const Mapedit = () => import('@/views/mapdraft/index');
import Taskmanage from '@/views/lesson/taskmanage/list';
import TrainingRuleList from '@/views/lesson/trainingRule/list';
import TrainingRuleEdit from '@/views/lesson/trainingRule/detail/index';
import Trainingmanage from '@/views/lesson/trainingmanage/index';
import LessonEdit from '@/views/lesson/lessoncategory/index';
import LessonHome from '@/views/lesson/home';
import LessonDetail from '@/views/lesson/details';
const Taskmanage = () => import('@/views/lesson/taskmanage/list');
const TrainingRuleList = () => import('@/views/lesson/trainingRule/list');
const TrainingRuleEdit = () => import('@/views/lesson/trainingRule/detail/index');
const Trainingmanage = () => import('@/views/lesson/trainingmanage/index');
const LessonEdit = () => import('@/views/lesson/lessoncategory/index');
const LessonHome = () => import('@/views/lesson/home');
const LessonDetail = () => import('@/views/lesson/details');
import ScriptmanageHome from '@/views/scriptManage/home';
import ScriptDisplay from '@/views/scriptManage/display/index';
const ScriptmanageHome = () => import('@/views/scriptManage/home');
const ScriptDisplay = () => import('@/views/scriptManage/display/index');
import TeachDetail from '@/views/teach/detail/index';
import TeachHome from '@/views/teach/index';
import Pay from '@/views/components/pay/index';
const TeachDetail = () => import('@/views/teach/detail/index');
const TeachHome = () => import('@/views/teach/index');
const Pay = () => import('@/views/components/pay/index');
import ExamHome from '@/views/exam/index';
import ExamResult from '@/views/exam/result';
import ExamDetail from '@/views/exam/detail/examDetail';
import ExamCourseDetail from '@/views/exam/detail/courseDetail';
const ExamHome = () => import('@/views/exam/index');
const ExamResult = () => import('@/views/exam/result');
const ExamDetail = () => import('@/views/exam/detail/examDetail');
const ExamCourseDetail = () => import('@/views/exam/detail/courseDetail');
import DemonstrationDetail from '@/views/demonstration/detail/index';
const DemonstrationDetail = () => import('@/views/demonstration/detail/index');
import PlanMonitorEditTool from '@/views/planMonitor/editTool/index';
import PlanMonitorEditUserTool from '@/views/planMonitor/editTool/userindex';
import PlanMonitorDetail from '@/views/planMonitor/detail';
const PlanMonitorEditTool = () => import('@/views/planMonitor/editTool/index');
const PlanMonitorEditUserTool = () => import('@/views/planMonitor/editTool/userindex');
const PlanMonitorDetail = () => import('@/views/planMonitor/detail');
import DesignPlatformHome from '@/views/designPlatform/home';
import DesignPlatform from '@/views/designPlatform/index';
import MapPreview from '@/views/designPlatform/mapPreview';
const DesignPlatformHome = () => import('@/views/designPlatform/home');
const DesignPlatform = () => import('@/views/designPlatform/index');
const MapPreview = () => import('@/views/designPlatform/mapPreview');
import DesignPlatformUser from '@/views/designUser/index';
const DesignPlatformUser = () => import('@/views/designUser/index');
import Package from '@/views/package/index';
import PackageDraft from '@/views/package/draft/ruleForm';
import PackageDetail from '@/views/package/detail';
const Package = () => import('@/views/package/index');
const PackageDraft = () => import('@/views/package/draft/ruleForm');
const PackageDetail = () => import('@/views/package/detail');
import PublishMap from '@/views/publish/publishMap/index';
import PublishMapDetail from '@/views/publish/publishMap/list'; // 发布历史
import ProductStatus from '@/views/publish/productStatus/index';
import PublishLesson from '@/views/publish/publishLesson/index';
import RunPlanTemplate from '@/views/publish/runPlanTemplate/index';
import RunPlanCommon from '@/views/publish/runPlanCommon/index';
import RunPlanCommonDraft from '@/views/publish/runPlanCommon/draft';
import RunPlanEveryDay from '@/views/publish/runPlanEveryDay/index';
import RunplanView from '@/views/publish/runPlanEveryDay/runPlanView';
import PublishExamRule from '@/views/publish/examRule/index';
import PublishExamRuleDraft from '@/views/publish/examRule/draft/index';
const PublishMap = () => import('@/views/publish/publishMap/index');
const PublishMapDetail = () => import('@/views/publish/publishMap/list'); // 发布历史
const ProductStatus = () => import('@/views/publish/productStatus/index');
const PublishLesson = () => import('@/views/publish/publishLesson/index');
const RunPlanTemplate = () => import('@/views/publish/runPlanTemplate/index');
const RunPlanCommon = () => import('@/views/publish/runPlanCommon/index');
const RunPlanCommonDraft = () => import('@/views/publish/runPlanCommon/draft');
const RunPlanEveryDay = () => import('@/views/publish/runPlanEveryDay/index');
const RunplanView = () => import('@/views/publish/runPlanEveryDay/runPlanView');
const PublishExamRule = () => import('@/views/publish/examRule/index');
const PublishExamRuleDraft = () => import('@/views/publish/examRule/draft/index');
import TrainingPlatform from '@/views/trainingPlatform/index';
const TrainingPlatform = () => import('@/views/trainingPlatform/index');
import Commodity from '@/views/orderauthor/commodity/index';
import CommodityDraft from '@/views/orderauthor/commodity/draft';
import OrderList from '@/views/orderauthor/order/list';
import OrderDraft from '@/views/orderauthor/order/draft';
import Author from '@/views/orderauthor/author/index';
import AuthorDraft from '@/views/orderauthor/author/draft/ruleForm';
import Permission from '@/views/orderauthor/permission/index';
import PermissionDetail from '@/views/orderauthor/permission/detail';
import PermissionDraft from '@/views/orderauthor/permission/package/ruleForm';
import PermissionCreate from '@/views/orderauthor/permission/create/index';
import UserRules from '@/views/orderauthor/rules/index';
import UserRulesDetail from '@/views/orderauthor/rules/detail';
const Commodity = () => import('@/views/orderauthor/commodity/index');
const CommodityDraft = () => import('@/views/orderauthor/commodity/draft');
const OrderList = () => import('@/views/orderauthor/order/list');
const OrderDraft = () => import('@/views/orderauthor/order/draft');
const Author = () => import('@/views/orderauthor/author/index');
const AuthorDraft = () => import('@/views/orderauthor/author/draft/ruleForm');
const Permission = () => import('@/views/orderauthor/permission/index');
const PermissionDetail = () => import('@/views/orderauthor/permission/detail');
const PermissionDraft = () => import('@/views/orderauthor/permission/package/ruleForm');
const PermissionCreate = () => import('@/views/orderauthor/permission/create/index');
const UserRules = () => import('@/views/orderauthor/rules/index');
const UserRulesDetail = () => import('@/views/orderauthor/rules/detail');
import LessonApproval from '@/views/approval/lesson/index';
import ScriptApproval from '@/views/approval/script/index';
import RunPlanApproval from '@/views/approval/runPlan/index';
import News from '@/views/news/index';
const LessonApproval = () => import('@/views/approval/lesson/index');
const ScriptApproval = () => import('@/views/approval/script/index');
const RunPlanApproval = () => import('@/views/approval/runPlan/index');
const News = () => import('@/views/news/index');
import { loginTitle } from '@/scripts/ConstDic';
import { getSessionStorage } from '@/utils/auth';
@ -134,7 +135,7 @@ export const userSimulation = '013'; // 仿真系统
export const userScreen = '014'; // 大屏系统
export const userPlan = '015'; // 计划系统
export const userDesign = '016'; // 设计系统
const isDev = process.env.NODE_ENV === 'development';
// const isDev = process.env.NODE_ENV === 'development';
export const UrlConfig = {
display: '/display',

View File

@ -1,16 +1,16 @@
module.exports = {
title: '',
title: '',
/**
/**
* @type {boolean} true | false
* @description Whether fix the header
*/
fixedHeader: false,
fixedHeader: false,
/**
/**
* @type {boolean} true | false
* @description Whether show the logo in sidebar
*/
sidebarLogo: false
sidebarLogo: false
};

View File

@ -1,4 +1,4 @@
import Vue from 'vue';
// import Vue from 'vue';
import Vuex from 'vuex';
import app from './modules/app';
import settings from './modules/settings';
@ -17,7 +17,7 @@ import ibp from './modules/ibp';
import getters from './getters';
Vue.use(Vuex);
// Vue.use(Vuex);
const store = new Vuex.Store({
modules: {

View File

@ -74,7 +74,6 @@ const user = {
setDesignToken(token);
commit('SET_TOKENDESIGN', token);
const header = { group: '', 'X-Token': getDesignToken() };
creatSubscribe(perpetualTopic, header);
creatSubscribe(commonTopic, header);
};
} else {

View File

@ -5,58 +5,58 @@ import md5 from 'js-md5';
// 时间转换格式
export function parseTime(time, cFormat) {
if (arguments.length === 0) {
return null;
}
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}';
let date;
if (typeof time === 'object') {
date = time;
} else {
if (('' + time).length === 10) time = parseInt(time) * 1000;
date = new Date(time);
}
const formatObj = {
y: date.getFullYear(),
m: date.getMonth() + 1,
d: date.getDate(),
h: date.getHours(),
i: date.getMinutes(),
s: date.getSeconds(),
a: date.getDay()
};
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
let value = formatObj[key];
if (key === 'a') return ['一', '二', '三', '四', '五', '六', '日'][value - 1];
if (result.length > 0 && value < 10) {
value = '0' + value;
}
return value || 0;
});
return time_str;
if (arguments.length === 0) {
return null;
}
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}';
let date;
if (typeof time === 'object') {
date = time;
} else {
if (('' + time).length === 10) time = parseInt(time) * 1000;
date = new Date(time);
}
const formatObj = {
y: date.getFullYear(),
m: date.getMonth() + 1,
d: date.getDate(),
h: date.getHours(),
i: date.getMinutes(),
s: date.getSeconds(),
a: date.getDay()
};
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
let value = formatObj[key];
if (key === 'a') return ['一', '二', '三', '四', '五', '六', '日'][value - 1];
if (result.length > 0 && value < 10) {
value = '0' + value;
}
return value || 0;
});
return time_str;
}
// 判断多久之前
export function formatTime(time, option) {
time = +time * 1000;
const d = new Date(time);
const now = Date.now();
time = +time * 1000;
const d = new Date(time);
const now = Date.now();
const diff = (now - d) / 1000;
const diff = (now - d) / 1000;
if (diff < 30) {
return '刚刚';
} else if (diff < 3600) { // less 1 hour
return Math.ceil(diff / 60) + '分钟前';
} else if (diff < 3600 * 24) {
return Math.ceil(diff / 3600) + '小时前';
} else if (diff < 3600 * 24 * 2) {
return '1天前';
}
if (option) {
return parseTime(time, option);
} else {
return d.getMonth() + 1 + '月' + d.getDate() + '日' + d.getHours() + '时' + d.getMinutes() + '分';
}
if (diff < 30) {
return '刚刚';
} else if (diff < 3600) { // less 1 hour
return Math.ceil(diff / 60) + '分钟前';
} else if (diff < 3600 * 24) {
return Math.ceil(diff / 3600) + '小时前';
} else if (diff < 3600 * 24 * 2) {
return '1天前';
}
if (option) {
return parseTime(time, option);
} else {
return d.getMonth() + 1 + '月' + d.getDate() + '日' + d.getHours() + '时' + d.getMinutes() + '分';
}
}
/**
@ -65,46 +65,46 @@ export function formatTime(time, option) {
* @param {*} isFixed - 父级是否position: fixed
*/
export function getDomOffset(dom) {
let pol = 0;
let pot = 0;
let offsetLeft = 0;
let offsetTop = 0;
while (dom) {
if (pol != dom.offsetLeft) {
offsetLeft += dom.offsetLeft;
pol = dom.offsetLeft;
}
if (pot != dom.offsetTop) {
offsetTop += dom.offsetTop;
pot = dom.offsetTop;
}
dom = dom.offsetParent;
}
const offset = {
x: offsetLeft,
y: offsetTop
};
return offset;
let pol = 0;
let pot = 0;
let offsetLeft = 0;
let offsetTop = 0;
while (dom) {
if (pol != dom.offsetLeft) {
offsetLeft += dom.offsetLeft;
pol = dom.offsetLeft;
}
if (pot != dom.offsetTop) {
offsetTop += dom.offsetTop;
pot = dom.offsetTop;
}
dom = dom.offsetParent;
}
const offset = {
x: offsetLeft,
y: offsetTop
};
return offset;
}
/**
* 矩形碰撞检测
*/
export function checkRectCollision(rect1, rect2) {
const center1 = { x: rect1.point.x + rect1.width / 2, y: rect1.point.y + rect1.height / 2 };
const center2 = { x: rect2.point.x + rect2.width / 2, y: rect2.point.y + rect2.height / 2 };
if (
// 横向判断 和 纵向判断
Math.abs(center1.x - center2.x) < rect1.width / 2 + rect2.width / 2 &&
const center1 = { x: rect1.point.x + rect1.width / 2, y: rect1.point.y + rect1.height / 2 };
const center2 = { x: rect2.point.x + rect2.width / 2, y: rect2.point.y + rect2.height / 2 };
if (
// 横向判断 和 纵向判断
Math.abs(center1.x - center2.x) < rect1.width / 2 + rect2.width / 2 &&
Math.abs(center1.y - center2.y) < rect1.height / 2 + rect2.height / 2
) {
return true;
}
return false;
) {
return true;
}
return false;
}
export function getSessionId() {
return md5([Math.random().toFixed(5), +new Date()].join('_'));
return md5([Math.random().toFixed(5), +new Date()].join('_'));
}
/*
@ -112,49 +112,49 @@ export function getSessionId() {
* data 目标时间
*/
export function getCountTime(data) {
const stationDate = parseInt(data);
const date = Date.parse(new Date()) / 1000;
const time = stationDate - date;
if (time > 0) {
let h = Math.floor(time / (60 * 60));
let m = Math.floor(time / 60) - (h * 60);
let s = Math.floor(time) - (h * 60 * 60) - (m * 60);
if (h <= 9) h = '0' + h;
if (m <= 9) m = '0' + m;
if (s <= 9) s = '0' + s;
return `${h}:${m}:${s}`;
} else {
return -1;
}
const stationDate = parseInt(data);
const date = Date.parse(new Date()) / 1000;
const time = stationDate - date;
if (time > 0) {
let h = Math.floor(time / (60 * 60));
let m = Math.floor(time / 60) - (h * 60);
let s = Math.floor(time) - (h * 60 * 60) - (m * 60);
if (h <= 9) h = '0' + h;
if (m <= 9) m = '0' + m;
if (s <= 9) s = '0' + s;
return `${h}:${m}:${s}`;
} else {
return -1;
}
}
// 对象 深拷贝
export function deepClone(item) {
const target = item.constructor === Array ? [] : {}; // 判断复制的目标是数组还是对象
for (const keys in item) {
if (item.hasOwnProperty(keys) && keys != 'instance') { // instance 对面不拷贝
if (item[keys] && typeof item[keys] === 'object') { // 如果值是对象,就递归一下
target[keys] = item[keys].constructor === Array ? [] : {};
target[keys] = deepClone(item[keys]);
} else {
target[keys] = item[keys];
}
}
}
return target;
const target = item.constructor === Array ? [] : {}; // 判断复制的目标是数组还是对象
for (const keys in item) {
if (item.hasOwnProperty(keys) && keys != 'instance') { // instance 对面不拷贝
if (item[keys] && typeof item[keys] === 'object') { // 如果值是对象,就递归一下
target[keys] = item[keys].constructor === Array ? [] : {};
target[keys] = deepClone(item[keys]);
} else {
target[keys] = item[keys];
}
}
}
return target;
}
export function deepAssign(obj, item) {
const target = item.constructor === Array ? [] : {}; // 判断复制的目标是数组还是对象
for (const keys in item) {
if (item.hasOwnProperty(keys) && keys != 'instance') { // instance 对面不拷贝
if (item[keys] && typeof item[keys] === 'object') { // 如果值是对象,就递归一下
target[keys] = item[keys].constructor === Array ? [] : {};
target[keys] = deepClone(item[keys]);
} else {
target[keys] = item[keys];
}
}
}
return Object.assign(obj, target);
const target = item.constructor === Array ? [] : {}; // 判断复制的目标是数组还是对象
for (const keys in item) {
if (item.hasOwnProperty(keys) && keys != 'instance') { // instance 对面不拷贝
if (item[keys] && typeof item[keys] === 'object') { // 如果值是对象,就递归一下
target[keys] = item[keys].constructor === Array ? [] : {};
target[keys] = deepClone(item[keys]);
} else {
target[keys] = item[keys];
}
}
}
return Object.assign(obj, target);
}

View File

@ -2,17 +2,17 @@ import Cookies from 'js-cookie';
const I18N_LANG = 'user_lang';
export default {
setLang(lang) {
Cookies.set(I18N_LANG, lang);
window.location.reload();
},
getLang(defaultLang) {
const localLang = Cookies.get(I18N_LANG);
setLang(lang) {
Cookies.set(I18N_LANG, lang);
window.location.reload();
},
getLang(defaultLang) {
const localLang = Cookies.get(I18N_LANG);
if (localLang == null) {
return defaultLang;
} else {
return localLang;
}
}
if (localLang == null) {
return defaultLang;
} else {
return localLang;
}
}
};

View File

@ -9,57 +9,57 @@ const BASE_API = getBaseUrl();
// 创建axios实例
const service = axios.create({
baseURL: BASE_API, // api的base_url
withCredentials: true, // 跨域请求时是否需要使用凭证
timeout: 60000 // 请求超时时间
baseURL: BASE_API, // api的base_url
withCredentials: true, // 跨域请求时是否需要使用凭证
timeout: 600000 // 请求超时时间
});
// request拦截器
service.interceptors.request.use(config => {
if (handleToken()) {
config.headers['X-Token'] = handleToken(); // 让每个请求携带自定义token 请根据实际情况自行修改
}
if (config.time) {
config.timeout = config.time; // 让每个请求携带自定义token 请根据实际情况自行修改
}
return config;
if (handleToken()) {
config.headers['X-Token'] = handleToken(); // 让每个请求携带自定义token 请根据实际情况自行修改
}
if (config.time) {
config.timeout = config.time; // 让每个请求携带自定义token 请根据实际情况自行修改
}
return config;
}, error => {
// Do something with request error
Promise.reject(error);
// Do something with request error
Promise.reject(error);
});
// respone拦截器
service.interceptors.response.use(
response => {
/** code为非200是抛错 可结合自己业务进行修改*/
const res = response.data;
if (res.code != 200) {
// 50008:非法的token; 50012:其他客户端登录了; 50014:Token 过期了;
if (res.code == 40004 || res.code == 40005 || res.code == 40003) {
// eslint-disable-next-line no-undef
EventBus.$emit('stop');
// eslint-disable-next-line no-undef
EventBus.$emit('viewLoading', false);
// eslint-disable-next-line no-undef
EventBus.$emit('clearCheckLogin');
MessageBox.confirm('你已被登出,请重新登录', '确定登出', {
confirmButtonText: '重新登录',
showCancelButton: false,
type: 'warning'
}).then(() => {
store.dispatch('FedLogOut', gainClientId()).then(() => {
location.reload();// 为了重新实例化vue-router对象 避免bug
});
});
}
return Promise.reject(res);
} else {
return response.data;
}
},
error => {
return Promise.reject(error);
}
response => {
/** code为非200是抛错 可结合自己业务进行修改*/
const res = response.data;
if (res.code != 200) {
// 50008:非法的token; 50012:其他客户端登录了; 50014:Token 过期了;
if (res.code == 40004 || res.code == 40005 || res.code == 40003) {
// eslint-disable-next-line no-undef
EventBus.$emit('stop');
// eslint-disable-next-line no-undef
EventBus.$emit('viewLoading', false);
// eslint-disable-next-line no-undef
EventBus.$emit('clearCheckLogin');
MessageBox.confirm('你已被登出,请重新登录', '确定登出', {
confirmButtonText: '重新登录',
showCancelButton: false,
type: 'warning'
}).then(() => {
store.dispatch('FedLogOut', gainClientId()).then(() => {
location.reload();// 为了重新实例化vue-router对象 避免bug
});
});
}
return Promise.reject(res);
} else {
return response.data;
}
},
error => {
return Promise.reject(error);
}
);
export default service;

View File

@ -3,305 +3,305 @@ import { timeFormat } from '@/utils/date';
/** 创建一个车次数据点*/
export function createMartPoint(opt) {
const rotate = opt.directionCode === '2' ? 45 : (opt.directionCode === '1' ? -45 : 0);
const position = opt.type ? 'insideBottomLeft' : 'insideTopLeft';
return {
coord: opt.coord,
name: opt.name,
label: {
normal: {
rotate: rotate,
formatter: '{b}',
backgroundColor: 'rgb(242,242,242,0.1)',
color: 'black',
position: position
}
}
};
const rotate = opt.directionCode === '2' ? 45 : (opt.directionCode === '1' ? -45 : 0);
const position = opt.type ? 'insideBottomLeft' : 'insideTopLeft';
return {
coord: opt.coord,
name: opt.name,
label: {
normal: {
rotate: rotate,
formatter: '{b}',
backgroundColor: 'rgb(242,242,242,0.1)',
color: 'black',
position: position
}
}
};
}
/** 创建一个车次数据序列*/
export function createSeriesModel(opt, lineStyle) {
if (opt) {
return {
z: opt.z || 5,
zlevel: opt.zlevel || 0,
type: 'line',
name: opt.name,
data: opt.data,
sampling: 'average',
lineStyle: lineStyle || {},
markPoint: {
symbol: 'roundRect',
symbolSize: 1,
data: opt.markPointData
}
};
}
if (opt) {
return {
z: opt.z || 5,
zlevel: opt.zlevel || 0,
type: 'line',
name: opt.name,
data: opt.data,
sampling: 'average',
lineStyle: lineStyle || {},
markPoint: {
symbol: 'roundRect',
symbolSize: 1,
data: opt.markPointData
}
};
}
}
/** 创建标记横线*/
export function createMarkLineModels(stations, computedYaxis) {
const markLineModel = {};
if (stations && stations.length) {
markLineModel.type = 'line';
markLineModel.name = 'markline';
markLineModel.markLine = {};
markLineModel.markLine.silent = true;
markLineModel.markLine.data = [];
markLineModel.markLine.lineStyle = { color: '#B0C4DE', width: 0.5 };
markLineModel.markLine.symbol = 'none';
stations.forEach((elem, index) => {
markLineModel.markLine.data.push(
{
label: {
show: true,
position: 'start',
formatter: elem.name,
color: 'black'
},
lineStyle: {
type: 'solid',
width: 0.5,
opacity: 0.5
},
yAxis: computedYaxis(elem, index)
}
);
});
}
return markLineModel;
const markLineModel = {};
if (stations && stations.length) {
markLineModel.type = 'line';
markLineModel.name = 'markline';
markLineModel.markLine = {};
markLineModel.markLine.silent = true;
markLineModel.markLine.data = [];
markLineModel.markLine.lineStyle = { color: '#B0C4DE', width: 0.5 };
markLineModel.markLine.symbol = 'none';
stations.forEach((elem, index) => {
markLineModel.markLine.data.push(
{
label: {
show: true,
position: 'start',
formatter: elem.name,
color: 'black'
},
lineStyle: {
type: 'solid',
width: 0.5,
opacity: 0.5
},
yAxis: computedYaxis(elem, index)
}
);
});
}
return markLineModel;
}
/** 创建不会重复颜色的内部对象*/
export const hexColor = {
colorIndex: 0,
difValue: 0.25, // 一般为0.25
oddColor: null,
eveColor: null,
oldColor: null,
newColor: null,
colorList: [
'#000000', '#0000FF', '#8A2BE2', '#A52A2A', '#DEB887', '#5F9EA0', '#7FFF00', '#FF7F50', '#6495ED', '#DC143C',
'#00FFFF', '#008B8B', '#B8860B', '#BDB76B', '#8B008B', '#FF8C00', '#9932CC', '#8FBC8F', '#FF1493', '#00BFFF',
'#FF00FF', '#FFD700', '#FF69B4', '#FF4500', '#DB7093', '#4169E1', '#6A5ACD', '#00FF7F', '#EE82EE', '#40E0D0'
],
colors: [
'#B9C671', '#6C9040', '#79C671', '#71A5C6', '#C6A071', '#71C689', '#'
],
randomHsl: function () {
const h = Math.random();
const s = Math.random();
const l = Math.random();
return [h, s, l];
},
hslToRgb: function (h, s, l) {
let r, g, b;
colorIndex: 0,
difValue: 0.25, // 一般为0.25
oddColor: null,
eveColor: null,
oldColor: null,
newColor: null,
colorList: [
'#000000', '#0000FF', '#8A2BE2', '#A52A2A', '#DEB887', '#5F9EA0', '#7FFF00', '#FF7F50', '#6495ED', '#DC143C',
'#00FFFF', '#008B8B', '#B8860B', '#BDB76B', '#8B008B', '#FF8C00', '#9932CC', '#8FBC8F', '#FF1493', '#00BFFF',
'#FF00FF', '#FFD700', '#FF69B4', '#FF4500', '#DB7093', '#4169E1', '#6A5ACD', '#00FF7F', '#EE82EE', '#40E0D0'
],
colors: [
'#B9C671', '#6C9040', '#79C671', '#71A5C6', '#C6A071', '#71C689', '#'
],
randomHsl: function () {
const h = Math.random();
const s = Math.random();
const l = Math.random();
return [h, s, l];
},
hslToRgb: function (h, s, l) {
let r, g, b;
if (s === 0) {
r = g = b = l; // achromatic
} else {
const hue2rgb = function hue2rgb(p, q, t) {
if (t < 0) t += 1;
if (t > 1) t -= 1;
if (t < 1 / 6) return p + (q - p) * 6 * t;
if (t < 1 / 2) return q;
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
return p;
};
if (s === 0) {
r = g = b = l; // achromatic
} else {
const hue2rgb = function hue2rgb(p, q, t) {
if (t < 0) t += 1;
if (t > 1) t -= 1;
if (t < 1 / 6) return p + (q - p) * 6 * t;
if (t < 1 / 2) return q;
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
return p;
};
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
const p = 2 * l - q;
r = hue2rgb(p, q, h + 1 / 3);
g = hue2rgb(p, q, h);
b = hue2rgb(p, q, h - 1 / 3);
}
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
const p = 2 * l - q;
r = hue2rgb(p, q, h + 1 / 3);
g = hue2rgb(p, q, h);
b = hue2rgb(p, q, h - 1 / 3);
}
return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];
},
rgbToHsl: function (r, g, b) {
// eslint-disable-next-line no-sequences
r /= 255, g /= 255, b /= 255;
const max = Math.max(r, g, b); const min = Math.min(r, g, b);
let h; let s; const l = (max + min) / 2;
return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];
},
rgbToHsl: function (r, g, b) {
// eslint-disable-next-line no-sequences
r /= 255, g /= 255, b /= 255;
const max = Math.max(r, g, b); const min = Math.min(r, g, b);
let h; let s; const l = (max + min) / 2;
if (max === min) {
h = s = 0; // achromatic
} else {
const d = max - min;
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
switch (max) {
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
case g: h = (b - r) / d + 2; break;
case b: h = (r - g) / d + 4; break;
}
h /= 6;
}
if (max === min) {
h = s = 0; // achromatic
} else {
const d = max - min;
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
switch (max) {
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
case g: h = (b - r) / d + 2; break;
case b: h = (r - g) / d + 4; break;
}
h /= 6;
}
return [h, s, l];
},
// 固定颜色
colorFixed() {
var color = this.colorList[this.colorIndex++ % this.colorList.length];
return color;
},
// 随机颜色
colorRandom() {
return '#' + (Math.random() * 0xffffff << 0).toString(16);
},
// 生成和前一个不同的随机颜色
colorContrast() {
this.newColor = this.randomHsl(); // 获取随机的hsl,并且给一个默认的hsl
this.newColor[1] = 0.7 + this.newColor[1] * 0.2; // [0.7 - 0.9] 排除过灰颜色
this.newColor[2] = 0.4 + this.newColor[2] * 0.2; // [0.4 - 0.8] 排除过亮过暗色
return [h, s, l];
},
// 固定颜色
colorFixed() {
var color = this.colorList[this.colorIndex++ % this.colorList.length];
return color;
},
// 随机颜色
colorRandom() {
return '#' + (Math.random() * 0xffffff << 0).toString(16);
},
// 生成和前一个不同的随机颜色
colorContrast() {
this.newColor = this.randomHsl(); // 获取随机的hsl,并且给一个默认的hsl
this.newColor[1] = 0.7 + this.newColor[1] * 0.2; // [0.7 - 0.9] 排除过灰颜色
this.newColor[2] = 0.4 + this.newColor[2] * 0.2; // [0.4 - 0.8] 排除过亮过暗色
/** 如果oldColor不为空时要根据车次号保证两次生成的颜色差值为difValue*/
this.oldColor = Number(this.colorIndex) % 2 ? this.oddColor : this.eveColor;
if (this.oldColor) {
/** 保证本次的颜色和上次的不一致*/
for (let i = 0; i < this.newColor.length && i < this.oldColor.length; i++) {
if (i === 0 && Math.abs(this.newColor[i].toFixed(2) - this.oldColor[i].toFixed(2)) < this.difValue) {
this.colorRandom();
break;
}
}
}
/** 如果oldColor不为空时要根据车次号保证两次生成的颜色差值为difValue*/
this.oldColor = Number(this.colorIndex) % 2 ? this.oddColor : this.eveColor;
if (this.oldColor) {
/** 保证本次的颜色和上次的不一致*/
for (let i = 0; i < this.newColor.length && i < this.oldColor.length; i++) {
if (i === 0 && Math.abs(this.newColor[i].toFixed(2) - this.oldColor[i].toFixed(2)) < this.difValue) {
this.colorRandom();
break;
}
}
}
/** 保存之前的颜色状态*/
if (Number(this.colorIndex) % 2) {
this.oddColor = this.newColor;
} else {
this.eveColor = this.newColor;
}
/** 保存之前的颜色状态*/
if (Number(this.colorIndex) % 2) {
this.oddColor = this.newColor;
} else {
this.eveColor = this.newColor;
}
this.colorIndex += 1;
return `#${this.hslToRgb(...this.newColor).map(e => { return Number(e).toString(16); }).join('')}`;
},
// 渐进颜色
colorProgressiveColor() {
},
toCreate: function () {
return this.colorRandom();
}
this.colorIndex += 1;
return `#${this.hslToRgb(...this.newColor).map(e => { return Number(e).toString(16); }).join('')}`;
},
// 渐进颜色
colorProgressiveColor() {
},
toCreate: function () {
return this.colorRandom();
}
};
/** 对list数据进行排序, 相同元素保持原有顺序*/
export function sortListByCallBack(list, callback) {
list.map((elem, index) => { elem[`oldIndex`] = index; });
list.sort((a, b) => {
return callback(a, b) || a.oldIndex - b.oldIndex;
});
return list;
list.map((elem, index) => { elem[`oldIndex`] = index; });
list.sort((a, b) => {
return callback(a, b) || a.oldIndex - b.oldIndex;
});
return list;
}
/** 将数字转换成asc码*/
export function numToAsc(num) {
const nmA = 'A'.charCodeAt(0);
const nmZ = 'Z'.charCodeAt(0);
const len = nmZ - nmA + 1;
let str = '';
const nmA = 'A'.charCodeAt(0);
const nmZ = 'Z'.charCodeAt(0);
const len = nmZ - nmA + 1;
let str = '';
while (num >= 0) {
str = String.fromCharCode(num % len + nmA) + str;
num = Math.floor(num / len) - 1;
}
while (num >= 0) {
str = String.fromCharCode(num % len + nmA) + str;
num = Math.floor(num / len) - 1;
}
return str;
return str;
}
/** 将asc码转换成数字*/
export function ascToNum(asc) {
const base = 'A'.charCodeAt() - 1;
let idx = asc.length - 1;
let num = 0;
let mulFactor = 1;
while (idx >= 0) {
num += (asc[idx].charCodeAt() - base) * mulFactor;
mulFactor *= 26;
idx -= 1;
}
const base = 'A'.charCodeAt() - 1;
let idx = asc.length - 1;
let num = 0;
let mulFactor = 1;
while (idx >= 0) {
num += (asc[idx].charCodeAt() - base) * mulFactor;
mulFactor *= 26;
idx -= 1;
}
return num;
return num;
}
/** 根据索引获取单元格的数据*/
export function getCellValue(Sheet, index) {
let value;
const cell = Sheet[index];
if (cell) {
value = cell.w || cell.v;
}
let value;
const cell = Sheet[index];
if (cell) {
value = cell.w || cell.v;
}
return value;
return value;
}
/** 转换sheet数据为json数据*/
export function convertSheetToList(Sheet, isReverse) {
const dataList = [];
const dataList = [];
if (Sheet) {
const refarea = Sheet['!ref'];
const regular = /([a-zA-Z]+)([0-9]+):([a-zA-Z]+)([0-9]+)/i;
if (Sheet) {
const refarea = Sheet['!ref'];
const regular = /([a-zA-Z]+)([0-9]+):([a-zA-Z]+)([0-9]+)/i;
if (refarea == null) return []; // "A1:M698"
if (regular.test(refarea)) {
/** 正则转换解析行列数据*/
const CoordList = regular.exec(refarea);
/** 转换数据为二维数组*/
const colBeg = ascToNum(CoordList[1]);
const colEnd = ascToNum(CoordList[3]);
const rowBeg = Number(CoordList[2]);
const rowEnd = Number(CoordList[4]);
if (refarea == null) return []; // "A1:M698"
if (regular.test(refarea)) {
/** 正则转换解析行列数据*/
const CoordList = regular.exec(refarea);
/** 转换数据为二维数组*/
const colBeg = ascToNum(CoordList[1]);
const colEnd = ascToNum(CoordList[3]);
const rowBeg = Number(CoordList[2]);
const rowEnd = Number(CoordList[4]);
if (isReverse) {
for (let i = colBeg - 1; i < colEnd; i++) {
dataList.push([]);
for (let j = rowBeg; j <= rowEnd; j++) {
dataList[dataList.length - 1].push(getCellValue(Sheet, numToAsc(i) + j));
}
}
} else {
for (let i = rowBeg; i <= rowEnd; i++) {
dataList.push([]);
for (let j = colBeg - 1; j < colEnd; j++) {
dataList[dataList.length - 1].push(getCellValue(Sheet, numToAsc(j) + i));
}
}
}
}
}
if (isReverse) {
for (let i = colBeg - 1; i < colEnd; i++) {
dataList.push([]);
for (let j = rowBeg; j <= rowEnd; j++) {
dataList[dataList.length - 1].push(getCellValue(Sheet, numToAsc(i) + j));
}
}
} else {
for (let i = rowBeg; i <= rowEnd; i++) {
dataList.push([]);
for (let j = colBeg - 1; j < colEnd; j++) {
dataList[dataList.length - 1].push(getCellValue(Sheet, numToAsc(j) + i));
}
}
}
}
}
return dataList;
return dataList;
}
/** 通过time将时间格式化*/
export function formatTime(time) {
if (Number.isInteger(time)) {
return timeFormat(time);
} else {
return '';
}
if (Number.isInteger(time)) {
return timeFormat(time);
} else {
return '';
}
}
/** 通过code将名称格式化*/
export function formatName(code) {
let name = '';
const device = store.getters['map/getDeviceByCode'](code);
if (device) {
name = device.name;
}
return name;
let name = '';
const device = store.getters['map/getDeviceByCode'](code);
if (device) {
name = device.name;
}
return name;
}
/** 将时间格式化前补零*/
export function prefixTime(time) {
let str = `${time}` || '';
if (str) {
const list = str.split(':');
str = list.map(elem => {
return `00000${elem}`.substr(-2);
}).join(':');
}
let str = `${time}` || '';
if (str) {
const list = str.split(':');
str = list.map(elem => {
return `00000${elem}`.substr(-2);
}).join(':');
}
return str;
return str;
}

View File

@ -2,12 +2,11 @@ import Vue from 'vue';
import StompClient from '@/utils/sock';
import store from '@/store';
export const perpetualTopic = '/user/topic/message'; // 公用topic
export const displayTopic = '/user/queue/simulation'; // 其他仿真topic
export const screenTopic = '/user/queue/simulation/bigScreen'; // 大屏仿真
export const planTopic = '/user/queue/simulation/plan'; // 测试运行仿真
export const commonTopic = '/topic/message'; // 公共topic(不区分用户)
export const designDisplayTopic = '/user/queue/simulation/design'; // 设计平台仿真订阅路径
export const perpetualTopic = '/user/topic/message'; // 公用topic
export const commonTopic = '/topic/message'; // 公共topic(不区分用户)
// 建立连接并订阅地址
export function creatSubscribe(topic, header) {
@ -15,6 +14,7 @@ export function creatSubscribe(topic, header) {
if (!Vue.prototype.$stomp) {
Vue.prototype.$stomp = new StompClient();
}
Vue.prototype.$stomp.subscribe(topic, callback, header);
} catch (error) {
console.error('websocket订阅失败');

View File

@ -135,9 +135,9 @@ export default {
this.$refs.applyReject.doShow(row);
},
scriptPreview(index, row) {
// const mapInfo = this.allMapList.find(elem=>{ return elem.id == row.mapId; });
const mapInfo = this.allMapList.find(elem=>{ return elem.id == row.mapId; });
scriptDraftRecordNotify(row.id).then(resp => {
const query = { mapId: row.mapId, group: resp.data, scriptId: row.id, try:0};
const query = { mapId: row.mapId, group: resp.data, scriptId: row.id, try:0, lineCode:mapInfo.lineCode};
this.$router.push({ path: `${UrlConfig.design.display}/demon`, query });
launchFullscreen();
}).catch(error => {

View File

@ -183,6 +183,7 @@ export default {
this.formModel.permissionList = jsonData;
} else {
this.isDisabled = true;
this.formModel.permissionList = [];
}
}).catch(()=>{
this.$messageBox(this.$t('error.getPermissionListFailed'));

View File

@ -184,6 +184,7 @@ export default {
this.formModel.permissionList = jsonData;
} else {
this.isDisabled = true;
this.formModel.permissionList = [];
}
}).catch(()=>{
this.$messageBox(this.$t('error.getPermissionListFailed'));

View File

@ -7,169 +7,169 @@ import echarts from 'echarts';
import { getRelevanceMapList, getSimulationPrdList } from '@/api/statistics';
export default {
props: {
id: {
type: String,
default: 'chart'
},
size: {
type: Object,
required: true
}
},
data() {
return {
option: {
backgroundColor: '#F0F2F5',
title: {
top: 20,
text: this.$t('dashboard.simulationStatistics'),
textStyle: {
fontWeight: 'normal',
fontSize: 18,
color: '#000000'
},
left: 'center'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
lineStyle: {
color: '#57617B'
}
}
},
legend: {
top: 20,
orient: 'vertical',
icon: 'rect',
itemWidth: 14,
itemHeight: 5,
itemGap: 13,
data: [],
right: '4%',
textStyle: {
fontSize: 12,
color: '#C0C0C0'
}
},
grid: {
top: 100,
left: '2%',
right: '2%',
bottom: '2%',
containLabel: true
},
xAxis: [{
type: 'category',
boundaryGap: true,
axisLine: {
lineStyle: {
color: '#57617B'
}
},
data: []
}],
yAxis: [{
type: 'value',
name: '(s)',
axisTick: {
show: false
},
axisLine: {
lineStyle: {
color: '#57617B'
}
},
axisLabel: {
margin: 10,
textStyle: {
fontSize: 14
}
},
splitLine: {
lineStyle: {
color: '#57617B'
}
}
}],
series: []
},
chart: null
};
},
watch: {
size() {
return this.chart.resize({...this.size, silent: false});
}
},
async created() {
await this.loadExamData();
},
mounted() {
this.initChart();
},
beforeDestroy() {
if (!this.chart) {
return;
}
this.chart.dispose();
this.chart = null;
},
methods: {
initChart() {
this.chart = echarts.init(document.getElementById(this.id));
this.chart.setOption(this.option);
},
async loadExamData() {
const data = [];
const resp = await getRelevanceMapList();
if (resp) {
const info = resp.data || [];
for (var i = 0; i < info.length; i++) {
const item = { ...info[i], data: []};
const rest = await getSimulationPrdList(info[i].id);
if (rest) {
item.data = rest.data || [];
}
data.push(item);
}
}
props: {
id: {
type: String,
default: 'chart'
},
size: {
type: Object,
required: true
}
},
data() {
return {
option: {
backgroundColor: '#F0F2F5',
title: {
top: 20,
text: this.$t('dashboard.simulationStatistics'),
textStyle: {
fontWeight: 'normal',
fontSize: 18,
color: '#000000'
},
left: 'center'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
lineStyle: {
color: '#57617B'
}
}
},
legend: {
top: 20,
orient: 'vertical',
icon: 'rect',
itemWidth: 14,
itemHeight: 5,
itemGap: 13,
data: [],
right: '4%',
textStyle: {
fontSize: 12,
color: '#C0C0C0'
}
},
grid: {
top: 100,
left: '2%',
right: '2%',
bottom: '2%',
containLabel: true
},
xAxis: [{
type: 'category',
boundaryGap: true,
axisLine: {
lineStyle: {
color: '#57617B'
}
},
data: []
}],
yAxis: [{
type: 'value',
name: '(s)',
axisTick: {
show: false
},
axisLine: {
lineStyle: {
color: '#57617B'
}
},
axisLabel: {
margin: 10,
textStyle: {
fontSize: 14
}
},
splitLine: {
lineStyle: {
color: '#57617B'
}
}
}],
series: []
},
chart: null
};
},
watch: {
size() {
return this.chart.resize({...this.size, silent: false});
}
},
async created() {
await this.loadExamData();
},
mounted() {
this.initChart();
},
beforeDestroy() {
if (!this.chart) {
return;
}
this.chart.dispose();
this.chart = null;
},
methods: {
initChart() {
this.chart = echarts.init(document.getElementById(this.id));
this.chart.setOption(this.option);
},
async loadExamData() {
const data = [];
const resp = await getRelevanceMapList();
if (resp) {
const info = resp.data || [];
for (var i = 0; i < info.length; i++) {
const item = { ...info[i], data: []};
const rest = await getSimulationPrdList(info[i].id);
if (rest) {
item.data = rest.data || [];
}
data.push(item);
}
}
this.option.series = [];
this.option.legend.data = [];
this.option.xAxis[0].data = [this.$t('dashboard.comprehensiveExerciseCloudPlatform'),
this.option.series = [];
this.option.legend.data = [];
this.option.xAxis[0].data = [this.$t('dashboard.comprehensiveExerciseCloudPlatform'),
this.$t('dashboard.driverSimulatedDrivingSystem'), this.$t('dashboard.ATSLineAdjustmentWorkstation'), this.$t('dashboard.ATSLocalWorkstation')];
data.forEach(elem => {
this.option.legend.data.push(elem.name);
this.option.series.push({
name: elem.name,
type: 'bar',
smooth: true,
symbol: 'circle',
symbolSize: 5,
showSymbol: false,
lineStyle: {
normal: {
width: 1
}
},
data: [0, 0, 0, 0]
});
});
data.forEach(elem => {
this.option.legend.data.push(elem.name);
this.option.series.push({
name: elem.name,
type: 'bar',
smooth: true,
symbol: 'circle',
symbolSize: 5,
showSymbol: false,
lineStyle: {
normal: {
width: 1
}
},
data: [0, 0, 0, 0]
});
});
data.forEach((elem, i) => {
elem.data.forEach(item => {
const index = this.option.xAxis[0].data.findIndex(name => { return name == item.statsProjectName; });
if (index >= 0) {
this.option.series[i].data[index] = item.duration;
}
});
});
data.forEach((elem, i) => {
elem.data.forEach(item => {
const index = this.option.xAxis[0].data.findIndex(name => { return name == item.statsProjectName; });
if (index >= 0) {
this.option.series[i].data[index] = item.duration;
}
});
});
this.chart.setOption(this.option);
}
}
this.chart.setOption(this.option);
}
}
};
</script>

View File

@ -14,171 +14,171 @@ import echarts from 'echarts';
import { getExamTree, getstatsExamList, getExamChart } from '@/api/statistics';
export default {
props: {
id: {
type: String,
default: 'chart'
},
size: {
type: Object,
required: true
}
},
data() {
return {
lessonId: '',
lessonList: [],
option: {
backgroundColor: '#F0F2F5',
title: {
top: 20,
text: this.$t('dashboard.testStatistics'),
textStyle: {
fontWeight: 'normal',
fontSize: 18,
color: '#000000'
},
left: 'center'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
lineStyle: {
color: '#57617B'
}
}
},
legend: {
top: 20,
orient: 'vertical',
icon: 'rect',
itemWidth: 14,
itemHeight: 5,
itemGap: 13,
data: [],
right: '4%',
textStyle: {
fontSize: 12,
color: '#C0C0C0'
}
},
grid: {
top: 100,
left: '2%',
right: '2%',
bottom: '2%',
containLabel: true
},
xAxis: [{
type: 'category',
boundaryGap: true,
axisLine: {
lineStyle: {
color: '#57617B'
}
},
data: []
}],
yAxis: [{
type: 'value',
name: '(score)',
axisTick: {
show: false
},
axisLine: {
lineStyle: {
color: '#57617B'
}
},
axisLabel: {
margin: 10,
textStyle: {
fontSize: 14
}
},
splitLine: {
lineStyle: {
color: '#57617B'
}
}
}],
series: []
},
chart: null
};
},
watch: {
size() {
return this.chart.resize({...this.size, silent: false});
},
async lessonId(val) {
await this.loadExamData(val);
}
},
mounted() {
this.initChart();
},
beforeDestroy() {
if (!this.chart) {
return;
}
this.chart.dispose();
this.chart = null;
},
methods: {
initChart() {
getExamTree().then(resp => {
this.lessonList = resp.data || [];
this.$nextTick(() => {
if (this.lessonList[0]) {
this.lessonId = this.lessonList[0].statsProjectId;
}
});
});
this.chart = echarts.init(document.getElementById(this.id));
this.chart.setOption(this.option);
},
async loadExamData(lessonId) {
const serieName = (this.lessonList[this.lessonList.findIndex(elem => { return elem.statsProjectId == lessonId; })] || {}).statsProjectName || '';
this.option.series = [];
this.option.xAxis[0].data = [];
this.option.legend.data = [serieName];
this.option.series = [{
name: serieName,
type: 'bar',
smooth: true,
symbol: 'circle',
symbolSize: 5,
showSymbol: false,
lineStyle: {
normal: {
width: 1
}
},
data: []
}];
props: {
id: {
type: String,
default: 'chart'
},
size: {
type: Object,
required: true
}
},
data() {
return {
lessonId: '',
lessonList: [],
option: {
backgroundColor: '#F0F2F5',
title: {
top: 20,
text: this.$t('dashboard.testStatistics'),
textStyle: {
fontWeight: 'normal',
fontSize: 18,
color: '#000000'
},
left: 'center'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
lineStyle: {
color: '#57617B'
}
}
},
legend: {
top: 20,
orient: 'vertical',
icon: 'rect',
itemWidth: 14,
itemHeight: 5,
itemGap: 13,
data: [],
right: '4%',
textStyle: {
fontSize: 12,
color: '#C0C0C0'
}
},
grid: {
top: 100,
left: '2%',
right: '2%',
bottom: '2%',
containLabel: true
},
xAxis: [{
type: 'category',
boundaryGap: true,
axisLine: {
lineStyle: {
color: '#57617B'
}
},
data: []
}],
yAxis: [{
type: 'value',
name: '(score)',
axisTick: {
show: false
},
axisLine: {
lineStyle: {
color: '#57617B'
}
},
axisLabel: {
margin: 10,
textStyle: {
fontSize: 14
}
},
splitLine: {
lineStyle: {
color: '#57617B'
}
}
}],
series: []
},
chart: null
};
},
watch: {
size() {
return this.chart.resize({...this.size, silent: false});
},
async lessonId(val) {
await this.loadExamData(val);
}
},
mounted() {
this.initChart();
},
beforeDestroy() {
if (!this.chart) {
return;
}
this.chart.dispose();
this.chart = null;
},
methods: {
initChart() {
getExamTree().then(resp => {
this.lessonList = resp.data || [];
this.$nextTick(() => {
if (this.lessonList[0]) {
this.lessonId = this.lessonList[0].statsProjectId;
}
});
});
this.chart = echarts.init(document.getElementById(this.id));
this.chart.setOption(this.option);
},
async loadExamData(lessonId) {
const serieName = (this.lessonList[this.lessonList.findIndex(elem => { return elem.statsProjectId == lessonId; })] || {}).statsProjectName || '';
this.option.series = [];
this.option.xAxis[0].data = [];
this.option.legend.data = [serieName];
this.option.series = [{
name: serieName,
type: 'bar',
smooth: true,
symbol: 'circle',
symbolSize: 5,
showSymbol: false,
lineStyle: {
normal: {
width: 1
}
},
data: []
}];
if (lessonId) {
const resp = await getstatsExamList({lessonId});
if (resp) {
const info = resp.data || [];
for (var i = 0; i < info.length; i++) {
var scores = [];
const exam = info[i];
this.option.xAxis[0].data.push(exam.statsProjectName);
const rest = await getExamChart({examId: exam.statsProjectId});
if (rest) {
scores = (rest.data || []).map(elem => { return elem.score; });
}
this.option.series[0].data = scores;
}
}
}
if (lessonId) {
const resp = await getstatsExamList({lessonId});
if (resp) {
const info = resp.data || [];
for (var i = 0; i < info.length; i++) {
var scores = [];
const exam = info[i];
this.option.xAxis[0].data.push(exam.statsProjectName);
const rest = await getExamChart({examId: exam.statsProjectId});
if (rest) {
scores = (rest.data || []).map(elem => { return elem.score; });
}
this.option.series[0].data = scores;
}
}
}
this.chart.setOption(this.option);
}
}
this.chart.setOption(this.option);
}
}
};
</script>
<style scoped>

View File

@ -7,169 +7,169 @@ import echarts from 'echarts';
import { getLessonList, getLessonTimeChart } from '@/api/statistics';
export default {
props: {
id: {
type: String,
default: 'chart'
},
size: {
type: Object,
required: true
}
},
data() {
return {
option: {
backgroundColor: '#F0F2F5',
title: {
top: 20,
text: this.$t('dashboard.courseStatistics'),
textStyle: {
fontWeight: 'normal',
fontSize: 18,
color: '#000000'
},
left: 'center'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
lineStyle: {
color: '#57617B'
}
}
},
legend: {
top: 20,
orient: 'vertical',
icon: 'rect',
itemWidth: 14,
itemHeight: 5,
itemGap: 13,
data: [],
right: '4%',
textStyle: {
fontSize: 12,
color: '#C0C0C0'
}
},
grid: {
top: 100,
left: '2%',
right: '2%',
bottom: '2%',
containLabel: true
},
xAxis: [{
type: 'category',
boundaryGap: true,
axisLine: {
lineStyle: {
color: '#57617B'
}
},
data: []
}],
yAxis: [{
type: 'value',
name: '(s)',
axisTick: {
show: false
},
axisLine: {
lineStyle: {
color: '#57617B'
}
},
axisLabel: {
margin: 10,
textStyle: {
fontSize: 14
}
},
splitLine: {
lineStyle: {
color: '#57617B'
}
}
}],
series: []
},
chart: null
};
},
watch: {
size() {
return this.chart.resize({...this.size, silent: false});
}
},
async created() {
await this.loadLessonData();
},
mounted() {
this.initChart();
},
beforeDestroy() {
if (!this.chart) {
return;
}
this.chart.dispose();
this.chart = null;
},
methods: {
initChart() {
this.chart = echarts.init(document.getElementById(this.id));
this.chart.setOption(this.option);
},
async loadLessonData() {
const data = [];
const resp = await getLessonList();
if (resp) {
const info = resp.data || [];
for (var i = 0; i < info.length; i++) {
const item = { ...info[i], data: []};
const rest = await getLessonTimeChart({id: info[i].statsProjectId});
if (rest) {
item.data = rest.data || [];
}
data.push(item);
}
}
props: {
id: {
type: String,
default: 'chart'
},
size: {
type: Object,
required: true
}
},
data() {
return {
option: {
backgroundColor: '#F0F2F5',
title: {
top: 20,
text: this.$t('dashboard.courseStatistics'),
textStyle: {
fontWeight: 'normal',
fontSize: 18,
color: '#000000'
},
left: 'center'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
lineStyle: {
color: '#57617B'
}
}
},
legend: {
top: 20,
orient: 'vertical',
icon: 'rect',
itemWidth: 14,
itemHeight: 5,
itemGap: 13,
data: [],
right: '4%',
textStyle: {
fontSize: 12,
color: '#C0C0C0'
}
},
grid: {
top: 100,
left: '2%',
right: '2%',
bottom: '2%',
containLabel: true
},
xAxis: [{
type: 'category',
boundaryGap: true,
axisLine: {
lineStyle: {
color: '#57617B'
}
},
data: []
}],
yAxis: [{
type: 'value',
name: '(s)',
axisTick: {
show: false
},
axisLine: {
lineStyle: {
color: '#57617B'
}
},
axisLabel: {
margin: 10,
textStyle: {
fontSize: 14
}
},
splitLine: {
lineStyle: {
color: '#57617B'
}
}
}],
series: []
},
chart: null
};
},
watch: {
size() {
return this.chart.resize({...this.size, silent: false});
}
},
async created() {
await this.loadLessonData();
},
mounted() {
this.initChart();
},
beforeDestroy() {
if (!this.chart) {
return;
}
this.chart.dispose();
this.chart = null;
},
methods: {
initChart() {
this.chart = echarts.init(document.getElementById(this.id));
this.chart.setOption(this.option);
},
async loadLessonData() {
const data = [];
const resp = await getLessonList();
if (resp) {
const info = resp.data || [];
for (var i = 0; i < info.length; i++) {
const item = { ...info[i], data: []};
const rest = await getLessonTimeChart({id: info[i].statsProjectId});
if (rest) {
item.data = rest.data || [];
}
data.push(item);
}
}
this.option.series = [];
this.option.legend.data = [];
this.option.xAxis[0].data = [this.$t('dashboard.controlRightsTraining'),
this.$t('dashboard.signalTraining'),this.$t('dashboard.turnoutTraining'), this.$t('dashboard.sectionTraining'), this.$t('dashboard.stationTraining')];
data.forEach(elem => {
this.option.legend.data.push(elem.statsProjectName);
this.option.series.push({
name: elem.statsProjectName,
type: 'bar',
smooth: true,
symbol: 'circle',
symbolSize: 5,
showSymbol: false,
lineStyle: {
normal: {
width: 1
}
},
data: [0, 0, 0, 0, 0]
});
});
this.option.series = [];
this.option.legend.data = [];
this.option.xAxis[0].data = [this.$t('dashboard.controlRightsTraining'),
this.$t('dashboard.signalTraining'), this.$t('dashboard.turnoutTraining'), this.$t('dashboard.sectionTraining'), this.$t('dashboard.stationTraining')];
data.forEach(elem => {
this.option.legend.data.push(elem.statsProjectName);
this.option.series.push({
name: elem.statsProjectName,
type: 'bar',
smooth: true,
symbol: 'circle',
symbolSize: 5,
showSymbol: false,
lineStyle: {
normal: {
width: 1
}
},
data: [0, 0, 0, 0, 0]
});
});
data.forEach((elem, i) => {
elem.data.forEach(item => {
const index = this.option.xAxis[0].data.findIndex(name => { return name == item.statsProjectName; });
if (index >= 0) {
this.option.series[i].data[index] = item.duration;
}
});
});
data.forEach((elem, i) => {
elem.data.forEach(item => {
const index = this.option.xAxis[0].data.findIndex(name => { return name == item.statsProjectName; });
if (index >= 0) {
this.option.series[i].data[index] = item.duration;
}
});
});
this.chart.setOption(this.option);
}
}
this.chart.setOption(this.option);
}
}
};
</script>

View File

@ -14,184 +14,184 @@ import echarts from 'echarts';
import { listUserPermision } from '@/api/management/author';
export default {
props: {
id: {
type: String,
default: 'chart'
},
size: {
type: Object,
required: true
}
},
data() {
return {
option: {
backgroundColor: '#fefefe',
title: {
text: '',
subtext: '',
subtextStyle: {
color: '#909399'
},
y: 20,
left: 'center'
},
tooltip: {
},
grid: [{
top: '17%',
width: '45%',
bottom: '5%',
left: 50,
containLabel: true
}],
xAxis: {
type: 'category',
show: false,
axisLabel: {
interval: 0,
rotate: 60
},
splitLine: {
show: false
},
data: []
},
yAxis: {
type: 'value',
show: false,
minInterval: 1,
name: this.$t('dashboard.permissions')
},
series: [{
type: 'bar',
z: 3,
barWidth: 25,
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(
0, 0, 0, 1,
[
{offset: 0, color: '#83bff6'},
{offset: 0.5, color: '#188df0'},
{offset: 1, color: '#188df0'}
]
)
},
emphasis: {
color: new echarts.graphic.LinearGradient(
0, 0, 0, 1,
[
{offset: 0, color: '#2378f7'},
{offset: 0.7, color: '#2378f7'},
{offset: 1, color: '#83bff6'}
]
)
}
},
tooltip: {
formatter: params => { return `${params.marker} ${params.name}: ${params.value}`; }
},
data: []
}, {
type: 'pie',
radius: [0, '72%'],
center: ['74%', '55%'],
tooltip: {
formatter: params => { return `${params.marker} ${params.name}: ${params.percent}% ${params.value}个)`; }
},
data: []
}]
},
mapName: null,
mapNameList: [],
permissionList: [],
chart: null
};
},
watch: {
size() {
return this.chart.resize({...this.size, silent: false});
},
async mapName(val) {
await this.loadExamData(val);
}
},
mounted() {
this.initChart();
},
beforeDestroy() {
if (!this.chart) {
return;
}
this.chart.dispose();
this.chart = null;
},
methods: {
initChart() {
listUserPermision({pageSize: 9000, pageNum: 1}).then(resp => {
this.permissionList = resp.data.list.filter(elem => { return parseInt(elem.status) > 0; });
this.mapNameList = [...new Set(this.permissionList.filter(elem => { return elem.mapName; }).map(elem => { return elem.mapName; }))];
this.$nextTick(() => { this.mapName = this.mapNameList[0] || ''; });
});
this.chart = echarts.init(document.getElementById(this.id));
this.chart.setOption(this.option);
},
async loadExamData(mapName) {
if (mapName) {
var permissionDict = {};
var permissionList = await this.$Dictionary.permissionType();
(permissionList ||[]).forEach(elem => {
permissionDict[elem.code] = elem.name;
});
var permissionMap = {
'ATS现地工作站-课程权限': 0,
'ATS行调工作站-课程权限': 0,
'ATS现地工作站-考试权限': 0,
'ATS行调工作站-考试权限': 0,
'ATS现地工作站-仿真权限': 0,
'ATS行调工作站-仿真权限': 0,
'综合演练云平台-仿真权限': 0,
'司机模拟驾驶系统-仿真权限': 0,
'大屏系统权限': 0
};
props: {
id: {
type: String,
default: 'chart'
},
size: {
type: Object,
required: true
}
},
data() {
return {
option: {
backgroundColor: '#fefefe',
title: {
text: '',
subtext: '',
subtextStyle: {
color: '#909399'
},
y: 20,
left: 'center'
},
tooltip: {
},
grid: [{
top: '17%',
width: '45%',
bottom: '5%',
left: 50,
containLabel: true
}],
xAxis: {
type: 'category',
show: false,
axisLabel: {
interval: 0,
rotate: 60
},
splitLine: {
show: false
},
data: []
},
yAxis: {
type: 'value',
show: false,
minInterval: 1,
name: this.$t('dashboard.permissions')
},
series: [{
type: 'bar',
z: 3,
barWidth: 25,
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(
0, 0, 0, 1,
[
{offset: 0, color: '#83bff6'},
{offset: 0.5, color: '#188df0'},
{offset: 1, color: '#188df0'}
]
)
},
emphasis: {
color: new echarts.graphic.LinearGradient(
0, 0, 0, 1,
[
{offset: 0, color: '#2378f7'},
{offset: 0.7, color: '#2378f7'},
{offset: 1, color: '#83bff6'}
]
)
}
},
tooltip: {
formatter: params => { return `${params.marker} ${params.name}: ${params.value}`; }
},
data: []
}, {
type: 'pie',
radius: [0, '72%'],
center: ['74%', '55%'],
tooltip: {
formatter: params => { return `${params.marker} ${params.name}: ${params.percent}% ${params.value}个)`; }
},
data: []
}]
},
mapName: null,
mapNameList: [],
permissionList: [],
chart: null
};
},
watch: {
size() {
return this.chart.resize({...this.size, silent: false});
},
async mapName(val) {
await this.loadExamData(val);
}
},
mounted() {
this.initChart();
},
beforeDestroy() {
if (!this.chart) {
return;
}
this.chart.dispose();
this.chart = null;
},
methods: {
initChart() {
listUserPermision({pageSize: 9000, pageNum: 1}).then(resp => {
this.permissionList = resp.data.list.filter(elem => { return parseInt(elem.status) > 0; });
this.mapNameList = [...new Set(this.permissionList.filter(elem => { return elem.mapName; }).map(elem => { return elem.mapName; }))];
this.$nextTick(() => { this.mapName = this.mapNameList[0] || ''; });
});
this.chart = echarts.init(document.getElementById(this.id));
this.chart.setOption(this.option);
},
async loadExamData(mapName) {
if (mapName) {
var permissionDict = {};
var permissionList = await this.$Dictionary.permissionType();
(permissionList || []).forEach(elem => {
permissionDict[elem.code] = elem.name;
});
var permissionMap = {
'ATS现地工作站-课程权限': 0,
'ATS行调工作站-课程权限': 0,
'ATS现地工作站-考试权限': 0,
'ATS行调工作站-考试权限': 0,
'ATS现地工作站-仿真权限': 0,
'ATS行调工作站-仿真权限': 0,
'综合演练云平台-仿真权限': 0,
'司机模拟驾驶系统-仿真权限': 0,
'大屏系统权限': 0
};
(this.permissionList.filter(elem => { return elem.mapName == mapName; })|| []).forEach(elem => {
if (elem.prdName == Object.keys(permissionMap)[Object.keys(permissionMap).length -1]) {
permissionMap[`${elem.prdName}`] = elem.remains;
} else {
permissionMap[`${elem.prdName}-${permissionDict[elem.permissionType]}`] = elem.remains;
}
});
(this.permissionList.filter(elem => { return elem.mapName == mapName; }) || []).forEach(elem => {
if (elem.prdName == Object.keys(permissionMap)[Object.keys(permissionMap).length - 1]) {
permissionMap[`${elem.prdName}`] = elem.remains;
} else {
permissionMap[`${elem.prdName}-${permissionDict[elem.permissionType]}`] = elem.remains;
}
});
const keys = Object.keys(permissionMap);
const values = Object.values(permissionMap);
const sum = values.reduce((total, num) => { return total + num; });
const keys = Object.keys(permissionMap);
const values = Object.values(permissionMap);
const sum = values.reduce((total, num) => { return total + num; });
this.option.title.text = this.$t('dashboard.residualPermissionDistributionMap') + ` —— ${mapName}`;
this.option.title.subtext = this.$t('dashboard.totalPermissions') + `${sum}` + this.$t('dashboard.individual');
this.option.title.text = this.$t('dashboard.residualPermissionDistributionMap') + ` —— ${mapName}`;
this.option.title.subtext = this.$t('dashboard.totalPermissions') + `${sum}` + this.$t('dashboard.individual');
this.option.xAxis.show = true;
this.option.yAxis.show = true;
this.option.xAxis.show = true;
this.option.yAxis.show = true;
this.option.xAxis.data = keys;
this.option.xAxis.data = keys;
this.option.series[0].data = values;
this.option.series[1].data = keys.filter(name => { return permissionMap[name]; } ).map(name => { return {name, value: permissionMap[name]}; });
} else {
this.option.title.text =this.$t('dashboard.residualPermissionDistributionMap') + ``+ this.$t('dashboard.noMapLineDataYetAvailable') +``;
this.option.title.subtext = this.$t('dashboard.totalPermissions') + `0` + this.$t('dashboard.individual');
this.option.xAxis.show = false;
this.option.yAxis.show = false;
this.option.xAxis.data = [];
this.option.series[0].data = [];
this.option.series[1].data = [];
}
this.option.series[0].data = values;
this.option.series[1].data = keys.filter(name => { return permissionMap[name]; } ).map(name => { return {name, value: permissionMap[name]}; });
} else {
this.option.title.text = this.$t('dashboard.residualPermissionDistributionMap') + `` + this.$t('dashboard.noMapLineDataYetAvailable') + ``;
this.option.title.subtext = this.$t('dashboard.totalPermissions') + `0` + this.$t('dashboard.individual');
this.option.xAxis.show = false;
this.option.yAxis.show = false;
this.option.xAxis.data = [];
this.option.series[0].data = [];
this.option.series[1].data = [];
}
this.chart.setOption(this.option);
}
}
this.chart.setOption(this.option);
}
}
};
</script>
<style scoped>

View File

@ -25,7 +25,7 @@
</template>
<script>
// import { getPublishMapInfo } from '@/api/jmap/map';
import { getPublishMapInfo } from '@/api/jmap/map';
import { getGoodsTryUse } from '@/api/management/goods';
import { PermissionType } from '@/scripts/ConstDic';
import { launchFullscreen } from '@/utils/screen';
@ -61,7 +61,8 @@ export default {
pmsList: []
},
jointShow: false,
jointGroup: ''
jointGroup: '',
lineCode:''
};
},
computed: {
@ -84,6 +85,10 @@ export default {
mapId() {
return this.$route.query.mapId;
}
// lineCode() {
// // return this.$route.query.lineCode;
// }
},
watch: {
'$route': function (val) {
@ -97,6 +102,7 @@ export default {
async loadInitData() {
this.loading = true;
try {
const res = await getPublishMapInfo(this.mapId);
const resp = await getSubSystemDetail(this.$route.params.subSystem);
this.tryUser = 0;
this.loading = false;
@ -105,7 +111,7 @@ export default {
id: resp.data.mapPrd.id,
name: resp.data.mapPrd.name,
mapId: this.mapId,
lineCode: resp.data.mapPrd.lineCode,
lineCode: res.data.lineCode,
remarks: resp.data.mapPrd.remarks,
prdType: resp.data.mapPrd.prdType,
prdId: resp.data.mapPrd.id,
@ -226,6 +232,7 @@ export default {
const data = { mapId: this.courseModel.mapId, mapPrdId: this.currentPrdId };
this.buttonLoading = true;
simulationNotify(data).then(resp => {
const query = { lineCode: this.courseModel.lineCode, group: resp.data, prdType: this.courseModel.prdType, mapId: this.courseModel.mapId, code: this.currentPrdId, goodsId: this.goodsId, try: this.tryUser };
this.$router.push({ path: `${UrlConfig.display}/demon`, query: query });
launchFullscreen();

View File

@ -90,7 +90,7 @@ export default {
switch (obj.type) {
case 'scriptDesign': {
setSessionStorage('designType', 'scriptDesign');
this.$router.push({ path: `${UrlConfig.design.scriptHome}/${obj.mapId}` });
this.$router.push({ path: `${UrlConfig.design.scriptHome}/${obj.mapId}?lineCode=${obj.lineCode}` });
break;
}
case 'lessonDesign': {
@ -141,7 +141,8 @@ export default {
name: this.$t('designPlatform.scriptDesign'),
type: 'scriptDesign',
mapId: elem.id,
cityCode: elem.cityCode
cityCode: elem.cityCode,
lineCode: elem.lineCode
// code:elem.children.find(n => { return n.name.includes("")})
});
elem.children.push(

View File

@ -19,9 +19,9 @@
<script>
import home1 from '@/assets/home/home1.png';
import home2 from '@/assets/home/home2.png';
import home3 from '@/assets/home/demon1.jpg';
import home3 from '@/assets/home/script.png';
import home4 from '@/assets/home/tring1.png';
import home5 from '@/assets/home/tring4.jpg';
import home5 from '@/assets/home/demon1.jpg';
import home6 from '@/assets/home/demon2.jpg';
export default {

View File

@ -29,7 +29,6 @@ export default {
listShow: true,
widthLeft: Number(localStore.get('LeftWidth')) || 450,
productList: [],
skinCode: '',
currentWidth: ''
};
},

View File

@ -88,7 +88,7 @@ export default {
{ required: true, message: this.$t('rules.pleaseEnterMapName'), trigger: 'blur' }
],
lineCode: [
{ required: true, message: this.$t('rules.pleaseChooseSkinCode'), trigger: 'change' }
{ required: true, message: this.$t('rules.pleaseChooseLineCode'), trigger: 'change' }
]
},
pullRules: {

View File

@ -70,8 +70,8 @@ export default {
title() {
return this.$t('display.faultChoose.selectFault');
},
skinCode() {
return this.$route.query.skinCode;
lineCode() {
return this.$route.query.lineCode;
}
},
mounted() {
@ -109,7 +109,7 @@ export default {
doShow() {
this.dialogShow = true;
this.queryList.data = [];
getFailureGenerateRules({ skin: this.skinCode, group: this.group }).then(response => {
getFailureGenerateRules({ skin: this.lineCode, group: this.group }).then(response => {
const data = response.data;
data.forEach(elem => {
this.queryList.data.push({

View File

@ -26,14 +26,14 @@ export default {
}
},
watch: {
'$route.query.skinCode': function (code) {
'$route.query.lineCode': function (code) {
if (code) {
this.menus = this.$theme.loadPlanComponent(code);
}
}
},
mounted() {
this.menus = this.$theme.loadPlanComponent(this.$route.query.skinCode);
this.menus = this.$theme.loadPlanComponent(this.$route.query.lineCode);
},
methods: {
doShow() {

View File

@ -18,6 +18,7 @@ import { mapGetters } from 'vuex';
import { runDiagramGetTime } from '@/api/simulation';
import { getPublishMapInfo } from '@/api/jmap/map';
import { timeFormat } from '@/utils/date';
import echarts from 'echarts';
export default {
name: 'RunPlanView',
@ -177,7 +178,6 @@ export default {
},
mounted() {
getPublishMapInfo(this.$route.query.mapId).then(res=>{
// this.PlanConvert = this.$theme.loadPlanConvert(this.$route.query.lineCode);
this.PlanConvert = this.$theme.loadPlanConvert(res.data.lineCode);
this.loadChartPage();
});
@ -214,46 +214,29 @@ export default {
loadInitChart(series) {
return new Promise((resolve, reject) => {
try {
const that = this;
// echart
require.config(
{
paths: {
echarts: './js/dist'
}
}
);
//
require(
[
'echarts',
'echarts/lib/chart/line'
],
function (ec) {
if (that.myChart && that.myChart.isDisposed) {
that.myChart.clear();
}
if (this.myChart && this.myChart.isDisposed) {
this.myChart.clear();
}
let startValue = 3600 + that.PlanConvert.TranslationTime;
const offsetTime = 3600;
runDiagramGetTime(that.group).then(resp => {
startValue = resp.data - that.PlanConvert.TranslationTime;
that.option.dataZoom[0].startValue = that.option.dataZoom[1].startValue = startValue - offsetTime;
that.option.dataZoom[0].endValue = that.option.dataZoom[1].endValue = startValue + offsetTime;
that.option.series = series;
that.myChart = ec.init(document.getElementById(that.runPlanId));
if (that.myChart) {
that.myChart.setOption(that.option);
that.reSize({ width: document.documentElement.clientWidth, height: document.documentElement.clientHeight - 55 });
}
resolve(true);
});
let startValue = 3600 + this.PlanConvert.TranslationTime;
const offsetTime = 3600;
runDiagramGetTime(this.group).then(resp => {
startValue = resp.data - this.PlanConvert.TranslationTime;
this.option.dataZoom[0].startValue = this.option.dataZoom[1].startValue = startValue - offsetTime;
this.option.dataZoom[0].endValue = this.option.dataZoom[1].endValue = startValue + offsetTime;
this.option.series = series;
this.myChart = echarts.init(document.getElementById(this.runPlanId));
if (this.myChart) {
this.myChart.setOption(this.option);
this.reSize({ width: document.documentElement.clientWidth, height: document.documentElement.clientHeight - 55 });
}
);
});
resolve(true);
} catch (error) {
reject(error);
}
});
},
updateRunPlanData(data) {
const stations = this.$store.state.runPlan.stations;

View File

@ -70,279 +70,279 @@ import { hexColor } from '@/utils/runPlan';
import EditTable from '@/views/components/editTable/index';
export default {
name: 'AddQuest',
components: {
EditTable
},
props: {
group: {
type: String,
required: true
}
},
data() {
return {
show: false,
loading: false,
runPlanList: [],
groupNumberList: [],
formModel: {
id: '',
mode: '',
planDate: '',
runPlanName: ''
},
tableForm: {
index: true,
columns: [
{
title: this.$t('display.schedule.driverNumber'),
prop: 'driverCode',
type: 'text'
},
{
title: this.$t('display.schedule.trainNumber'),
prop: 'trainCode',
type: 'select',
width: '150',
options: () => { return this.groupNumberList; },
editable: true,
editing: true
},
{
title: this.$t('display.schedule.onlineSection'),
prop: 'onlineSection',
type: 'text'
},
{
title: this.$t('display.schedule.onlineServerNumber'),
prop: 'onlineServerNumber',
type: 'text'
},
{
title: this.$t('display.schedule.onlineTargetNumber'),
prop: 'onlineTargetNumber',
type: 'text'
},
{
title: this.$t('display.schedule.onlineTime'),
prop: 'onlineTime',
type: 'text'
},
{
title: this.$t('display.schedule.onlineTripNumber'),
prop: 'onlineTripNumber',
type: 'text',
format: (row) => { return `${row.onlineDirectionCode}${row.onlineTripNumber}`; }
},
{
title: this.$t('display.schedule.outDepot'),
prop: 'outDepot',
type: 'text'
},
{
title: this.$t('display.schedule.outDepotStatus'),
prop: 'outStatus',
type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.outStatus, 'Whether'); },
tagType: (row) => {
switch (row.outStatus) {
case true: return 'success';
case false: return 'danger';
}
}
},
{
title: this.$t('display.schedule.offlineSection'),
prop: 'offlineSection',
type: 'text'
},
{
title: this.$t('display.schedule.offlineServerNumber'),
prop: 'offlineServerNumber',
type: 'text'
},
{
title: this.$t('display.schedule.offlineTargetNumber'),
prop: 'offlineTargetNumber',
type: 'text'
},
{
title: this.$t('display.schedule.offlineTime'),
prop: 'offlineTime',
type: 'text'
},
{
title: this.$t('display.schedule.offlineTripNumber'),
prop: 'offlineTripNumber',
type: 'text',
format: (row) => { return `${row.offlineDirectionCode}${row.offlineTripNumber}`; }
},
{
title: this.$t('display.schedule.inDepot'),
prop: 'inDepot',
type: 'text'
},
{
title: this.$t('display.schedule.inDepotStatus'),
prop: 'inStatus',
type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.inStatus, 'Whether'); },
tagType: (row) => {
switch (row.inStatus) {
case true: return 'success';
case false: return 'danger';
}
}
}
]
},
tableData: []
};
},
computed: {
title() {
return this.$t('display.schedule.schedulePlan');
}
},
created() {
this.loadInitData();
},
methods: {
doShow() {
this.formModel.day = '';
this.show = true;
},
doClose() {
this.show = false;
},
loadInitData() {
this.groupNumberList = [];
getSchedulingAllTrains(this.group).then(resp => {
this.groupNumberList = resp.data.map(elem => { return {value: elem.code, label: elem.groupNumber}; });
});
},
handleQuery(day) {
if (day) {
this.loading = true;
querySecheduling(this.group, {day}).then(resp => {
if (!resp.data) {
this.$confirm(this.$t('display.schedule.noSchedulePlan'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
this.handleGenerate(day);
}).catch(() => {
this.clearData();
this.loading = false;
});
} else {
this.tableData = this.initTableData(resp.data.planList || []);
this.formModel.id = resp.data.id;
this.formModel.planDate = resp.data.planDate;
this.formModel.runPlanName = resp.data.runPlanName;
this.$message.success(`${this.$t('display.schedule.loadData')} ${day} ${this.$t('display.schedule.schedulePlanSuccess')}`);
this.loading = false;
}
}).catch(error => {
this.clearData();
if (error.code == 30002) {
this.handleReGenerate(day);
} else {
this.$messageBox(`${error.message}`);
this.loading = false;
}
});
}
},
handleGenerate(day) {
generateScheduling(this.group, {day}).then(resp => {
this.loading = false;
this.tableData = this.initTableData(resp.data.planList || []);
this.formModel.id = resp.data.id;
this.formModel.planDate = resp.data.planDate;
this.formModel.runPlanName = resp.data.runPlanName;
this.$message.success(this.$t('display.schedule.createSchedulePlanSuccess'));
}).catch(error => {
this.loading = false;
this.clearData();
this.$messageBox(`${error.message}`);
});
},
handleReGenerate(day) {
generateSchedulingAgain(this.group).then(resp => {
this.loading = false;
this.tableData = this.initTableData(resp.data.planList || []);
this.formModel.id = resp.data.id;
this.formModel.planDate = resp.data.planDate;
this.formModel.runPlanName = resp.data.runPlanName;
this.$message.success(this.$t('display.schedule.regenerateSchedulePlanSuccess'));
}).catch(error => {
this.loading = false;
this.clearData();
this.$messageBox(`${error.message}`);
});
},
handleCheck() {
if (this.formModel.planDate) {
checkScheduling(this.group, this.tableData).then(resp => {
const data = resp.data;
this.setConflictList(data.conflictList);
if (data.pass) {
this.$message.success(this.$t('display.schedule.checkPassed'));
} else {
this.$message.warning(this.$t('display.schedule.checkFailed'));
}
}).catch(error => {
this.$messageBox(`${this.$t('display.schedule.checkSchedulePlanFailed')}: ${error.message}`);
});
} else {
this.$messageBox(this.$t('display.schedule.selectSchedulePlan'));
}
},
handleSave() {
if (this.formModel.planDate) {
saveScheduling(this.group, this.tableData).then(resp => {
this.$message.success(this.$t('display.schedule.saveSchedulePlanSuccess'));
}).catch(() => {
this.$messageBox(this.$t('display.schedule.saveSchedulePlanFail'));
});
} else {
this.$messageBox(this.$t('display.schedule.selectSchedulePlan'));
}
name: 'AddQuest',
components: {
EditTable
},
props: {
group: {
type: String,
required: true
}
},
data() {
return {
show: false,
loading: false,
runPlanList: [],
groupNumberList: [],
formModel: {
id: '',
mode: '',
planDate: '',
runPlanName: ''
},
tableForm: {
index: true,
columns: [
{
title: this.$t('display.schedule.driverNumber'),
prop: 'driverCode',
type: 'text'
},
{
title: this.$t('display.schedule.trainNumber'),
prop: 'trainCode',
type: 'select',
width: '150',
options: () => { return this.groupNumberList; },
editable: true,
editing: true
},
{
title: this.$t('display.schedule.onlineSection'),
prop: 'onlineSection',
type: 'text'
},
{
title: this.$t('display.schedule.onlineServerNumber'),
prop: 'onlineServerNumber',
type: 'text'
},
{
title: this.$t('display.schedule.onlineTargetNumber'),
prop: 'onlineTargetNumber',
type: 'text'
},
{
title: this.$t('display.schedule.onlineTime'),
prop: 'onlineTime',
type: 'text'
},
{
title: this.$t('display.schedule.onlineTripNumber'),
prop: 'onlineTripNumber',
type: 'text',
format: (row) => { return `${row.onlineDirectionCode}${row.onlineTripNumber}`; }
},
{
title: this.$t('display.schedule.outDepot'),
prop: 'outDepot',
type: 'text'
},
{
title: this.$t('display.schedule.outDepotStatus'),
prop: 'outStatus',
type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.outStatus, 'Whether'); },
tagType: (row) => {
switch (row.outStatus) {
case true: return 'success';
case false: return 'danger';
}
}
},
{
title: this.$t('display.schedule.offlineSection'),
prop: 'offlineSection',
type: 'text'
},
{
title: this.$t('display.schedule.offlineServerNumber'),
prop: 'offlineServerNumber',
type: 'text'
},
{
title: this.$t('display.schedule.offlineTargetNumber'),
prop: 'offlineTargetNumber',
type: 'text'
},
{
title: this.$t('display.schedule.offlineTime'),
prop: 'offlineTime',
type: 'text'
},
{
title: this.$t('display.schedule.offlineTripNumber'),
prop: 'offlineTripNumber',
type: 'text',
format: (row) => { return `${row.offlineDirectionCode}${row.offlineTripNumber}`; }
},
{
title: this.$t('display.schedule.inDepot'),
prop: 'inDepot',
type: 'text'
},
{
title: this.$t('display.schedule.inDepotStatus'),
prop: 'inStatus',
type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.inStatus, 'Whether'); },
tagType: (row) => {
switch (row.inStatus) {
case true: return 'success';
case false: return 'danger';
}
}
}
]
},
tableData: []
};
},
computed: {
title() {
return this.$t('display.schedule.schedulePlan');
}
},
created() {
this.loadInitData();
},
methods: {
doShow() {
this.formModel.day = '';
this.show = true;
},
doClose() {
this.show = false;
},
loadInitData() {
this.groupNumberList = [];
getSchedulingAllTrains(this.group).then(resp => {
this.groupNumberList = resp.data.map(elem => { return {value: elem.code, label: elem.groupNumber}; });
});
},
handleQuery(day) {
if (day) {
this.loading = true;
querySecheduling(this.group, {day}).then(resp => {
if (!resp.data) {
this.$confirm(this.$t('display.schedule.noSchedulePlan'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
this.handleGenerate(day);
}).catch(() => {
this.clearData();
this.loading = false;
});
} else {
this.tableData = this.initTableData(resp.data.planList || []);
this.formModel.id = resp.data.id;
this.formModel.planDate = resp.data.planDate;
this.formModel.runPlanName = resp.data.runPlanName;
this.$message.success(`${this.$t('display.schedule.loadData')} ${day} ${this.$t('display.schedule.schedulePlanSuccess')}`);
this.loading = false;
}
}).catch(error => {
this.clearData();
if (error.code == 30002) {
this.handleReGenerate(day);
} else {
this.$messageBox(`${error.message}`);
this.loading = false;
}
});
}
},
handleGenerate(day) {
generateScheduling(this.group, {day}).then(resp => {
this.loading = false;
this.tableData = this.initTableData(resp.data.planList || []);
this.formModel.id = resp.data.id;
this.formModel.planDate = resp.data.planDate;
this.formModel.runPlanName = resp.data.runPlanName;
this.$message.success(this.$t('display.schedule.createSchedulePlanSuccess'));
}).catch(error => {
this.loading = false;
this.clearData();
this.$messageBox(`${error.message}`);
});
},
handleReGenerate(day) {
generateSchedulingAgain(this.group).then(resp => {
this.loading = false;
this.tableData = this.initTableData(resp.data.planList || []);
this.formModel.id = resp.data.id;
this.formModel.planDate = resp.data.planDate;
this.formModel.runPlanName = resp.data.runPlanName;
this.$message.success(this.$t('display.schedule.regenerateSchedulePlanSuccess'));
}).catch(error => {
this.loading = false;
this.clearData();
this.$messageBox(`${error.message}`);
});
},
handleCheck() {
if (this.formModel.planDate) {
checkScheduling(this.group, this.tableData).then(resp => {
const data = resp.data;
this.setConflictList(data.conflictList);
if (data.pass) {
this.$message.success(this.$t('display.schedule.checkPassed'));
} else {
this.$message.warning(this.$t('display.schedule.checkFailed'));
}
}).catch(error => {
this.$messageBox(`${this.$t('display.schedule.checkSchedulePlanFailed')}: ${error.message}`);
});
} else {
this.$messageBox(this.$t('display.schedule.selectSchedulePlan'));
}
},
handleSave() {
if (this.formModel.planDate) {
saveScheduling(this.group, this.tableData).then(resp => {
this.$message.success(this.$t('display.schedule.saveSchedulePlanSuccess'));
}).catch(() => {
this.$messageBox(this.$t('display.schedule.saveSchedulePlanFail'));
});
} else {
this.$messageBox(this.$t('display.schedule.selectSchedulePlan'));
}
},
handleRowStyle({rowIndex}) {
const row = this.tableData[rowIndex];
return row['$conflict']? `background: ${row['$conflict']}`: `background: #fff`;
},
setConflictList(list) {
this.tableData.forEach(elem => { elem['$conflict'] = null; });
if (list && list.length) {
list.forEach(idList => {
const color = hexColor.colorRandom();
this.tableData.forEach(elem => {
if (idList.includes(parseInt(elem.id))) {
elem['$conflict'] = color;
}
});
});
}
this.tableData = [...this.tableData];
},
initTableData(tableData) {
tableData.forEach(elem => {
elem['$conflict'] = null;
});
},
handleRowStyle({rowIndex}) {
const row = this.tableData[rowIndex];
return row['$conflict'] ? `background: ${row['$conflict']}` : `background: #fff`;
},
setConflictList(list) {
this.tableData.forEach(elem => { elem['$conflict'] = null; });
if (list && list.length) {
list.forEach(idList => {
const color = hexColor.colorRandom();
this.tableData.forEach(elem => {
if (idList.includes(parseInt(elem.id))) {
elem['$conflict'] = color;
}
});
});
}
this.tableData = [...this.tableData];
},
initTableData(tableData) {
tableData.forEach(elem => {
elem['$conflict'] = null;
});
return tableData;
},
clearData() {
this.formModel.planDate = '';
this.tableData = [];
}
}
return tableData;
},
clearData() {
this.formModel.planDate = '';
this.tableData = [];
}
}
};
</script>
<style scoped rel="stylesheet/scss" lang="scss">

View File

@ -34,12 +34,8 @@
ref="menuSchema"
:offset="offset"
:group="group"
@runPlanLoadShow="runPlanLoadShow"
@runPlanViewShow="runPlanViewShow"
@faultChooseShow="faultChooseShow"
@runQuestLoadShow="runQuestLoadShow"
@runAddRolesLoadShow="runAddRolesLoadShow"
@switchMode="switchMode"
@selectQuest="selectQuest"
/>
<menu-system-time ref="menuSystemTime" :offset="offset" :right="right" :group="group" />
@ -48,18 +44,11 @@
<Jl3d-Simulation v-show="simulationShow" ref="Jl3dSimulation" :panel-show="simulationShow" @showpanel="showpanel" />
<Jl3d-Drive v-show="drivingShow" ref="Jl3dDrive" :panel-show="drivingShow" @showdriving="showdriving" />
<fault-choose ref="faultChoose" :group="group" />
<run-plan-Load ref="runPlanLoad" :group="group" />
<run-plan-view ref="runPlanView" :group="group" />
<add-quest ref="addQuest" @selectQuest="selectQuest" />
<scheduling v-if="isShowScheduling" ref="scheduling" :group="group" />
</div>
</template>
<script>
import RunPlanLoad from './demon/runPlanLoad';
import RunPlanView from './demon/runPlanView';
import FaultChoose from './demon/faultChoose';
import MapSystemDraft from '@/views/mapsystem/index';
import MenuExam from '@/views/display/menuExam';
import MenuLesson from '@/views/display/menuLesson';
@ -70,7 +59,6 @@ import MenuSchema from '@/views/display/menuSchema';
import MenuSystemTime from '@/views/display/menuSystemTime';
import MenuPlan from '@/views/display/menuPlan';
import MenuScript from '@/views/display/menuScript';
import AddQuest from './demon/addQuest';
import Scheduling from './demon/scheduling';
import { mapGetters } from 'vuex';
import { getTrainingDetail, getTrainingStepsDetail } from '@/api/jmap/training';
@ -90,10 +78,6 @@ import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive';
export default {
name: 'DisplayDraft',
components: {
RunPlanLoad,
RunPlanView,
FaultChoose,
AddQuest,
MenuExam,
MenuLesson,
MenuReplay,
@ -459,15 +443,6 @@ export default {
this.endViewLoading();
}
},
//
async runQuestLoadShow() {
this.$refs.addQuest.doShow();
},
async runAddRolesLoadShow() {
// this.$refs.addQuest.doShow();
const row = {id: this.$route.query.scriptId};
this.$refs.addQuest.handleLoad(1, row);
},
//
async selectQuest(row, id, mapLocation, roleName) {
try {
@ -564,15 +539,6 @@ export default {
this.panelShow = true;
this.drivingShow = false;
},
runPlanViewShow() {
this.$refs.runPlanView.doShow();
},
runPlanLoadShow() {
this.$refs.runPlanLoad.doShow();
},
faultChooseShow() {
this.$refs.faultChoose.doShow();
},
setWindowSize() {
this.$nextTick(() => {
const width = this.size ? this.size.width : this.width;

View File

@ -157,9 +157,9 @@ export default {
this.$store.dispatch('training/simulationStart').then(() => {
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().getFullYear()} ${model.initTime}`));
});
}).catch(() => {
}).catch(error => {
this.isDisable = false;
this.$messageBox(this.$t('display.demon.startSimulationFail'));
this.$messageBox(error.message + '' + this.$t('display.demon.startSimulationFail'));
});
},
end() {

View File

@ -1,25 +1,35 @@
<template>
<div class="schema" :style="{top: offset+'px'}">
<el-select v-if="isScript" v-model="swch" size="small" :placeholder="$t('display.schema.selectProduct')" @change="switchMode">
<el-option v-for="item in swchList" :key="item.value" :label="item.name" :value="item.value" />
</el-select>
<div>
<div class="schema" :style="{top: offset+'px'}">
<el-select v-if="isScript" v-model="swch" size="small" :placeholder="$t('display.schema.selectProduct')" @change="switchMode">
<el-option v-for="item in swchList" :key="item.value" :label="item.name" :value="item.value" />
</el-select>
<el-button-group>
<!-- viewRunQuest -->
<el-button v-if="isDemon && isDesignPlatform" size="small" :disabled="viewDisabled" type="success" @click="viewScriptRoles">{{ $t('display.schema.selectRoles') }}</el-button>
<el-button v-if="isDemon && !isDesignPlatform" size="small" :disabled="viewDisabled" type="success" @click="viewRunQuest">{{ $t('display.schema.loadScript') }}</el-button>
<el-button v-if="notScript && runing" size="small" :disabled="viewDisabled" @click="viewRunPlan">{{ $t('display.schema.previewRunDiagram') }}</el-button>
<el-button v-if="!runing && !isPlan && notScript" size="small" :disabled="viewDisabled" type="warning" @click="loadRunPlan">{{ $t('display.schema.loadRunDiagram') }}</el-button>
<el-button v-if="mode==OperateMode.FAULT" size="small" type="danger" @click="setFault">{{ $t('display.schema.faultSetting') }}</el-button>
</el-button-group>
<el-button-group>
<!-- viewRunQuest -->
<el-button v-if="isDemon && isDesignPlatform" size="small" :disabled="viewDisabled" type="success" @click="viewScriptRoles">{{ $t('display.schema.selectRoles') }}</el-button>
<el-button v-if="isDemon && !isDesignPlatform" size="small" :disabled="viewDisabled" type="success" @click="viewRunQuest">{{ $t('display.schema.loadScript') }}</el-button>
<el-button v-if="notScript && runing" size="small" :disabled="viewDisabled" @click="viewRunPlan">{{ $t('display.schema.previewRunDiagram') }}</el-button>
<el-button v-if="!runing && !isPlan && notScript" size="small" :disabled="viewDisabled" type="warning" @click="loadRunPlan">{{ $t('display.schema.loadRunDiagram') }}</el-button>
<el-button v-if="mode==OperateMode.FAULT" size="small" type="danger" @click="setFault">{{ $t('display.schema.faultSetting') }}</el-button>
</el-button-group>
<el-radio-group v-if="!isPlan" v-model="mode" size="small" @change="changeOperateMode(mode)">
<el-radio-button class="mode" :label="OperateMode.NORMAL">{{ $t('display.schema.normalOperation') }}</el-radio-button>
<el-radio-button class="mode" :label="OperateMode.FAULT">{{ $t('display.schema.faultOperation') }}</el-radio-button>
</el-radio-group>
<el-radio-group v-if="!isPlan" v-model="mode" size="small" @change="changeOperateMode(mode)">
<el-radio-button class="mode" :label="OperateMode.NORMAL">{{ $t('display.schema.normalOperation') }}</el-radio-button>
<el-radio-button class="mode" :label="OperateMode.FAULT">{{ $t('display.schema.faultOperation') }}</el-radio-button>
</el-radio-group>
</div>
<fault-choose v-if="isDemon || isPlan || isScript" ref="faultChoose" :group="group" />
<run-plan-Load ref="runPlanLoad" :group="group" />
<run-plan-view ref="runPlanView" :group="group" />
<add-quest ref="addQuest" @selectQuest="selectQuest" />
</div>
</template>
<script>
import RunPlanLoad from './demon/runPlanLoad';
import RunPlanView from './demon/runPlanView';
import FaultChoose from './demon/faultChoose';
import AddQuest from './demon/addQuest';
import { mapGetters } from 'vuex';
import { OperateMode } from '@/scripts/ConstDic';
import { getStationList, queryRunPlan } from '@/api/runplan';
@ -28,6 +38,12 @@ import {getRpDetailByUserMapId} from '@/api/designPlatform';
export default {
name: 'MenuSchema',
components: {
RunPlanLoad,
RunPlanView,
FaultChoose,
AddQuest
},
props: {
group: {
type: String,
@ -44,7 +60,7 @@ export default {
OperateMode: OperateMode,
viewDisabled: true,
runing: false,
swch: '02',
swch: '01',
swchList: [
{ value: '01', name: '现地' },
{ value: '02', name: '行调' }
@ -62,8 +78,7 @@ export default {
return this.$route.params.mode === 'plan';
},
isScript() {
// return this.$route.params.mode === 'script';
return false;
return this.$route.params.mode === 'script';
},
isDemon() {
return this.$route.params.mode === 'demon';
@ -96,7 +111,6 @@ export default {
getStationList(opt.mapId).then(response => {
this.$store.dispatch('runPlan/setStations', response.data).then(() => {
if (this.$route.params.mode == 'plan') {
// debugger;
if (this.$route.query.from == 'user') {
//
getRpDetailByUserMapId(this.$route.query.planId).then(resp => {
@ -144,19 +158,23 @@ export default {
this.runing = run;
},
setFault() {
this.$emit('faultChooseShow');
this.$refs.faultChoose.doShow();
},
loadRunPlan() {
this.$emit('runPlanLoadShow');
this.$refs.runPlanLoad.doShow();
},
viewRunPlan() {
this.$emit('runPlanViewShow');
this.$refs.runPlanView.doShow();
},
viewRunQuest() {
this.$emit('runQuestLoadShow');
this.$refs.addQuest.doShow();
},
viewScriptRoles() {
this.$emit('runAddRolesLoadShow');
const row = {id: this.$route.query.scriptId};
this.$refs.addQuest.handleLoad(1, row);
},
selectQuest(row, id, mapLocation, roleName) {
this.$emit('selectQuest', row, id, mapLocation, roleName);
},
switchMode(swch) {
this.$emit('switchMode', swch);

View File

@ -17,7 +17,7 @@
</p>
<p class="list-item">
<span class="list-label">{{ $t('exam.examTimeAvailable') + ':' }}</span>
<span class="list-elem">{{ parseInt(examDetails.duration) / 60 + $t('exam.minutes') }}</span>
<span class="list-elem" v-html="parseInt(examDetails.duration) / 60 + $t('exam.minutes')" />
</p>
<p class="list-item">
<span class="list-label">{{ $t('exam.fullMarksInTheExam') + ':' }}</span>
@ -74,7 +74,7 @@ export default {
endTime: '',
fullPoint: '',
passingPoint: '',
duration: '',
duration: 0,
type: ''
},
typeList: [],

View File

@ -180,7 +180,7 @@ export default {
this.group = this.$route.query.group;
this.$store.dispatch('training/over').then(() => {
putJointTrainingSimulationUser(this.group).then(() => {
this.$router.push({ path: `/trainroom`, query: { group: this.group } });
this.$router.replace({ path: `/trainroom`, query: { group: this.group, lineCode:this.$route.query.lineCode } });
exitFullscreen();
});
});

View File

@ -251,14 +251,7 @@ export default {
},
//
onContextMenu(em) {
const path = window.location.href;
let mouseWheelFlag = false;
if (path.includes('design/userlist/map/draw')) {
mouseWheelFlag = true;
}
if (!mouseWheelFlag) { //
this.$emit('onMenu', em);
}
this.$emit('onMenu', em);
},
//
mapViewLoaded(loading) {

View File

@ -352,16 +352,18 @@ export default {
this.ibpShow = false;
},
showIbp(deviceCode) {
this.drivingShow = false;
this.panelShow = false;
this.ibpShow = true;
if (!deviceCode || !ibpData[deviceCode]) {
Message.warning({message: this.$t('error.ibpNoDraw'), duration: 0, showClose: true, type: 'error'});
return;
} else {
Message.closeAll();
if (!this.ibpShow) {
this.drivingShow = false;
this.panelShow = false;
this.ibpShow = true;
if (!deviceCode || !ibpData[deviceCode]) {
Message.warning({message: this.$t('error.ibpNoDraw'), duration: 0, showClose: true, type: 'error'});
return;
} else {
Message.closeAll();
}
this.$refs.ibpPlate.show(deviceCode, this.ibpPart);
}
this.$refs.ibpPlate.show(deviceCode, this.ibpPart);
},
hidepanel() {
this.panelShow = false;

View File

@ -97,7 +97,6 @@ export default {
},
async mounted() {
this.userId = this.$store.state.user.id;
console.log(this.$route.query);
await this.loadRunData(this.$route.query);
},
methods: {

View File

@ -8,7 +8,7 @@
<el-button size="small" :disabled="!recoverStepData.length" @click="recover">恢复</el-button>
</el-button-group>
</div>
<jlmap-visual ref="jlmapVisual" @onSelect="clickEvent" />
<jlmap-visual ref="jlmapVisual" @onSelect="clickEvent" @onMenu="onContextmenu" />
</div>
<div class="map-draft">
<div v-show="viewDraft === 'draft'" class="box">
@ -49,7 +49,7 @@
</template>
<script>
import { saveMap, getMapDetail, verifyMap, postBuildMapImport } from '@/api/jmap/mapdraft';
import { ViewMode, TrainingMode } from '@/scripts/ConstDic';
import { ViewMode, TrainingMode, getDeviceMenuByDeviceType } from '@/scripts/ConstDic';
import { checkLoginLine } from '@/api/login';
import JlmapVisual from '@/views/jlmap/index';
import MapOperate from './mapoperate/index';
@ -59,7 +59,6 @@ import { mapGetters } from 'vuex';
import ConfigMap from './configMap';
import DataRelation from './dataRelation/index';
// import { deepAssign } from '@/utils/index';
export default {
name: 'MapView',
@ -204,16 +203,16 @@ export default {
this.selected = device || null;
this.selected && this.handleSelectControlPage(device);
},
// onContextmenu(em) {
// this.point = {
// x: em.clientX,
// y: em.clientY
// };
// if (!em.deviceType) {
// var menu = getDeviceMenuByDeviceType('Cancel');
// this.$store.dispatch('menuOperation/setPopMenu', { position: this.point, menu: menu });
// }
// },
onContextmenu(em) {
this.point = {
x: em.clientX,
y: em.clientY
};
if (!em.deviceType) {
var menu = getDeviceMenuByDeviceType('Cancel');
this.$store.dispatch('menuOperation/setPopMenu', { position: this.point, menu: menu });
}
},
saveMapEvent() {
if (this.$refs.jlmapVisual) {
const map = this.$store.state.map.map;

View File

@ -231,7 +231,6 @@ export default {
cancelButtonText: this.$t('map.cancel'),
type: 'warning'
}).then(() => {
// _that.$emit('delMapModel', selected);
_that.$emit('updateMapModel', {...selected, _dispose: true});
_that.deviceSelect();
}).catch(() => {

View File

@ -241,7 +241,6 @@ export default {
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
// _that.$emit('delMapModel', selected);
_that.$emit('updateMapModel', {...selected, _dispose: true});
_that.deviceSelect();
}).catch(() => {

View File

@ -233,7 +233,6 @@ export default {
cancelButtonText: this.$t('map.cancel'),
type: 'warning'
}).then(() => {
// _that.$emit('delMapModel', selected);
_that.$emit('updateMapModel', {...selected, _dispose: true});
_that.deviceSelect();
}).catch(() => {

View File

@ -215,7 +215,6 @@ export default {
cancelButtonText: this.$t('map.cancel'),
type: 'warning'
}).then(() => {
// _that.$emit('delMapModel', selected);
_that.$emit('updateMapModel', {...selected, _dispose: true});
_that.deviceSelect();
}).catch(() => {

View File

@ -322,9 +322,6 @@ export default {
updateMapModel(obj) {
this.$emit('updateMapModel', obj);
},
// delMapModel(obj) {
// this.$emit('delMapModel', obj);
// },
setCenter(code) {
this.$emit('setCenter', code);
}

View File

@ -211,7 +211,6 @@ export default {
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
// _that.$emit('delMapModel', selected);
_that.$emit('updateMapModel', {...selected, _dispose: true});
_that.deviceSelect();
}).catch(() => {

View File

@ -202,7 +202,6 @@ export default {
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
// _that.$emit('delMapModel', selected);
_that.$emit('updateMapModel', {...selected, _dispose: true});
_that.deviceSelect();
}).catch(() => {

View File

@ -244,7 +244,6 @@ export default {
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
// _that.$emit('delMapModel', selected);
_that.$emit('updateMapModel', {...selected, _dispose: true});
_that.deviceSelect();
}).catch(() => {

View File

@ -423,7 +423,6 @@ export default {
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
// _that.$emit('delMapModel', selected);
_that.$emit('updateMapModel', {...selected, _dispose: true});
_that.deviceSelect();
}).catch(() => {

View File

@ -232,7 +232,6 @@ export default {
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
// _that.$emit('delMapModel', _that.selected);
_that.$emit('updateMapModel', {...selected, _dispose: true});
_that.deviceSelect();
}).catch(() => {

View File

@ -286,7 +286,6 @@ export default {
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
// _that.$emit('delMapModel', selected);
_that.$emit('updateMapModel', {...selected, _dispose: true});
_that.deviceSelect();
}).catch(() => {

View File

@ -327,7 +327,6 @@ export default {
// /
handleDelete(selected) {
const models = [];
// const remove = [];
this.sectionList.forEach(elem => {
if (elem.type == '03' && elem.relSwitchCode == selected.code) {
models.push(deepAssign({ _type: 'Section', code: elem.code }, { _dispose: true }));
@ -339,8 +338,6 @@ export default {
}
});
models.push(deepAssign(selected, { _dispose: true }));
// this.$emit('delMapModel', selected);
// this.$emit('delMapModel', remove);
this.$emit('updateMapModel', models);
},
findLinkData(code) {
@ -389,7 +386,6 @@ export default {
},
//
removeSwitchSection() {
// const remove = [];
const models = [];
if (this.sectionList && this.sectionList.length) {
this.sectionList.forEach(elem => {
@ -403,7 +399,6 @@ export default {
models.push(elem);
}
});
// this.$emit('delMapModel', remove);
this.$emit('updateMapModel', models);
}
},

View File

@ -222,7 +222,6 @@ export default {
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
// _that.$emit('delMapModel', selected);
_that.$emit('updateMapModel', {...selected, _dispose: true});
_that.deviceSelect();
}).catch(() => {

View File

@ -161,7 +161,7 @@ export default {
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
this.$emit('delMapModel', train);
this.$emit('updateMapModel', {...train, _dispose: true});
this.deviceSelect();
}).catch(() => {
this.$message.info(this.$t('tip.cancelledDelete'));
@ -177,7 +177,10 @@ export default {
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
this.$emit('delMapModel', this.trainList);
this.trainList.forEach(item => {
item['_dispose'] = true;
});
this.$emit('updateMapModel', this.trainList);
this.deviceSelect();
}).catch(() => {
this.$message.info(this.$t('tip.cancelledDelete'));

View File

@ -16,7 +16,6 @@
<el-tab-pane class="view-control" :label="$t('map.batchOperation')" name="three">
<div style="height: 100%">
<el-scrollbar wrap-class="scrollbar-wrapper">
<!-- style="display: flex;justify-content: center;" -->
<div style="text-align:center;">
<el-button type="danger" size="big" @click="removeTrainWindow">{{ $t('map.deleteTrainWindow') }}</el-button>
<el-button type="primary" size="big" style="margin-top:10px" @click="createTrainWindow">{{ $t('map.createTrainWindow') }}</el-button>
@ -59,7 +58,8 @@ export default {
},
width: 0,
height: 0,
sectionCode: ''
sectionCode: '',
isReversal: false
},
rules: {
code: [
@ -119,7 +119,8 @@ export default {
map: {
name: this.$t('map.mapData'),
item: [
{ prop: 'sectionCode', label: this.$t('map.trainWindowSectionCode'), type: 'select', optionLabel: 'code&&name', optionValue: 'code', options: this.filterSectionList }
{ prop: 'sectionCode', label: this.$t('map.trainWindowSectionCode'), type: 'select', optionLabel: 'code&&name', optionValue: 'code', options: this.filterSectionList },
{ prop: 'isReversal', label: '车头翻转', type: 'checkbox' }
]
}
}
@ -155,7 +156,8 @@ export default {
_type: 'TrainWindow',
code: getUID('TrainWindow'),
trainWindowShow: true,
point: {}
point: {},
isReversal: false
};
if (opts) {
@ -221,10 +223,11 @@ export default {
this.trainWindowList.forEach(elem => {
remove.push({
_type: 'TrainWindow',
code: elem.code
code: elem.code,
_dispose: true
});
});
this.$emit('delMapModel', remove);
this.$emit('updateMapModel', remove);
}
}).catch(() => {
this.$message.info(this.$t('tip.cancelledDelete'));
@ -240,10 +243,11 @@ export default {
this.trainWindowList.forEach(elem => {
remove.push({
_type: 'TrainWindow',
code: elem.code
code: elem.code,
_dispose: true
});
});
this.$emit('delMapModel', remove);
this.$emit('updateMapModel', remove);
}
if (collection && collection.length) {
@ -284,7 +288,6 @@ export default {
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
// _that.$emit('delMapModel', selected);
_that.$emit('updateMapModel', {...selected, _dispose: true});
_that.deviceSelect();
}).catch(() => {

View File

@ -209,7 +209,6 @@ export default {
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
// _that.$emit('delMapModel', selected);
_that.$emit('updateMapModel', {...selected, _dispose: true});
_that.deviceSelect();
}).catch(() => {

View File

@ -7,7 +7,7 @@
<script>
import MapCommon from './common/index';
import { handleToken } from '@/utils/auth';
import { creatSubscribe, clearSubscribe, displayTopic, screenTopic, planTopic, designDisplayTopic} from '@/utils/stomp';
import { creatSubscribe, clearSubscribe, displayTopic, planTopic, designDisplayTopic} from '@/utils/stomp';
import { sendCommand } from '@/api/jmap/training';
import { getSessionStorage } from '@/utils/auth';
@ -106,9 +106,7 @@ export default {
this.clearSubscribe();
const header = { group: this.group || '', 'X-Token': handleToken() };
if (this.mode === 'dp') {
creatSubscribe(screenTopic, header);
} else if (this.mode === 'plan') {
if (this.mode === 'plan') {
creatSubscribe(planTopic, header);
} else {
creatSubscribe(this.isDesignPlatform ? designDisplayTopic : displayTopic, header);
@ -117,9 +115,7 @@ export default {
await this.$store.dispatch('training/setHasSubscribed');
},
clearSubscribe() {
if (this.mode === 'dp') {
clearSubscribe(screenTopic);
} else if (this.mode === 'plan') {
if (this.mode === 'plan') {
clearSubscribe(planTopic);
} else {
clearSubscribe(this.isDesignPlatform ? designDisplayTopic : displayTopic);

View File

@ -30,6 +30,7 @@ import {getRpDetailByUserMapId, getUserMapDetailByMapId} from '@/api/designPlatf
import { loadMapDataById } from '@/utils/loaddata';
import { getPublishMapInfo } from '@/api/jmap/map';
import DataTable from './menus/components/dataTable';
import echarts from 'echarts';
export default {
name: 'PlanSchedule',
@ -467,35 +468,16 @@ export default {
loadInitChart() {
return new Promise((resolve, reject) => {
try {
const that = this;
// echart
require.config(
{
paths: {
echarts: './js/dist'
}
}
);
//
require(
[
'echarts',
'echarts/lib/chart/line'
],
function (ec) {
if (that.myChart && that.myChart.isDisposed) {
that.myChart.clear();
}
if (that.$route.query.planName) {
that.option.title.text = that.mapName;
}
that.myChart = ec.init(document.getElementById(that.runPlanId));
that.myChart.setOption(that.option);
that.reSize({ width: that.$store.state.runPlan.width, height: that.$store.state.runPlan.height });
// that.myChart.on('click', that.mouseClick);
resolve(true);
}
);
if (this.myChart && this.myChart.isDisposed) {
this.myChart.clear();
}
if (this.$route.query.planName) {
this.option.title.text = this.mapName;
}
this.myChart = echarts.init(document.getElementById(this.runPlanId));
this.myChart.setOption(this.option);
this.reSize({ width: this.$store.state.runPlan.width, height: this.$store.state.runPlan.height });
resolve(true);
} catch (error) {
reject(error);
}

View File

@ -14,6 +14,7 @@ import { mapGetters } from 'vuex';
import { getStationList, queryRunPlan, queryRunPlanTemplate, queryRunPlanDaily } from '@/api/runplan';
import { timeFormat } from '@/utils/date';
import { UrlConfig } from '@/router/index';
import echarts from 'echarts';
export default {
name: 'RunPlan',
@ -279,32 +280,15 @@ export default {
loadInitChart() {
return new Promise((resolve, reject) => {
try {
const that = this;
// echart
require.config(
{
paths: {
echarts: './js/dist'
}
}
);
//
require(
[
'echarts',
'echarts/lib/chart/line'
],
function (ec) {
if (that.myChart && that.myChart.isDisposed) {
that.myChart.clear();
}
that.myChart = ec.init(document.getElementById(that.runPlanId));
that.myChart.setOption(that.option);
that.reSize({ width: that.$store.state.runPlan.width, height: that.$store.state.runPlan.height });
// that.myChart.on('click', that.mouseClick);
resolve(true);
}
);
if (this.myChart && this.myChart.isDisposed) {
this.myChart.clear();
}
this.myChart = echarts.init(document.getElementById(this.runPlanId));
this.myChart.setOption(this.option);
this.reSize({ width: this.$store.state.runPlan.width, height: this.$store.state.runPlan.height });
// this.myChart.on('click', this.mouseClick);
resolve(true);
} catch (error) {
reject(error);
}

View File

@ -126,7 +126,7 @@ export default {
},
drawUp(index, row) {
scriptRecordNotify(row.id).then(resp => {
const query = { mapId: row.mapId, group: resp.data, scriptId: row.id, lang:row.lang };
const query = { mapId: row.mapId, group: resp.data, scriptId: row.id, lang:row.lang, lineCode:this.$route.query.lineCode };
this.$router.push({ path: `${UrlConfig.scriptDisplay}/script`, query });
launchFullscreen();
}).catch(error => {
@ -253,7 +253,7 @@ export default {
},
previewScript(index, row) {
scriptDraftRecordNotify(row.id).then(resp => {
const query = { mapId: row.mapId, group: resp.data, scriptId: row.id, try:0};
const query = { mapId: row.mapId, group: resp.data, scriptId: row.id, try:0, lineCode:this.$route.query.lineCode};
this.$router.push({ path: `${UrlConfig.design.display}/demon`, query });
launchFullscreen();
}).catch(error => {

View File

@ -59,8 +59,6 @@ export default {
}[this.roleType];
}
},
mounted() {
},
methods: {
doShow(roleType) {
this.roleType = roleType;
@ -71,7 +69,7 @@ export default {
},
commit() {
const userList = this.personList.filter(e => { return e.select; }).map(e=> { return e.node; });
this.$emit('dispatch', {roleType: this.roleType, userList: userList});
this.$emit('dispatch', {roleType: this.roleType, userList});
this.visible = false;
},
cancel() {

View File

@ -135,6 +135,7 @@ export default {
height: 30px;
line-height: 30px;
padding-left: 10px;
display: flow-root;
}
.delete {

View File

@ -145,6 +145,7 @@ export default {
height: 30px;
line-height: 30px;
padding-left: 10px;
display: flow-root;
&:hover {
background: #D6E0F2;

View File

@ -164,7 +164,7 @@ export default {
if (user.userRole) {
if (index >= 0) {
this.checkUserState(user, this.members[index]);
this.members.splice(index, 1, Object.assign(this.members[index], this.transformUser(user)));
this.members.splice(index, 1, this.transformUser(user));
} else {
this.checkUserState(user, null);
this.members.push(this.transformUser(user));
@ -205,16 +205,21 @@ export default {
};
if (old) {
if (old.userRole) {
if (!user.inRoom) {
this.$store.dispatch('socket/setChatContent', {...message, roomTip: `${user.nickName}退出房间`});
if (!user.userRole) {
this.$store.dispatch('socket/setChatContent', {...message, roomTip: `${user.nickName}被提出房间`});
if (this.userId == user.id) {
this.jumpOutRoom();
}
} else if (old.userRole) {
if (old.inRoom && !user.inRoom) {
this.$store.dispatch('socket/setChatContent', {...message, roomTip: `${user.nickName}离线`});
if (this.userId == user.id) {
this.jumpOutRoom();
}
}
if (!old.inRoom && user.inRoom) {
this.$store.dispatch('socket/setChatContent', {...message, roomTip: `${user.nickName}进入房间`});
this.$store.dispatch('socket/setChatContent', {...message, roomTip: `${user.nickName}在线`});
}
if (user.inSimulation) {
@ -223,11 +228,6 @@ export default {
this.jumpInSimulation();
}
}
} else {
this.$store.dispatch('socket/setChatContent', {...message, roomTip: `${user.nickName}被提出房间`});
if (this.userId == user.id) {
this.jumpOutRoom();
}
}
} else {
this.$store.dispatch('socket/setChatContent', {...message, roomTip: `${user.nickName}进入房间`});

View File

@ -6,6 +6,10 @@ const defaultSettings = require('./src/settings.js');
const CopyWebpackPlugin = require('copy-webpack-plugin');
// const CompressionWebpackPlugin = require('compression-webpack-plugin');
// const productionGzipExtensions = ['js', 'css'];
// const isProduction = process.env.NODE_ENV === 'production';
function resolve(dir) {
return path.join(__dirname, dir);
}
@ -47,25 +51,39 @@ module.exports = {
// },
// after: require('./mock/mock-server.js')
},
configureWebpack: {
// provide the app's title in webpack's name field, so that
// it can be accessed in index.html to inject the correct title.
name: name,
resolve: {
configureWebpack: config => {
config.name = name;
config.resolve = {
extensions: ['.js', '.vue', '.json'],
alias: {
'@': resolve('src')
}
},
plugins: [
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, './static'),
to: 'static',
ignore: ['.*']
}
])
]
};
config.plugins.push(new CopyWebpackPlugin([
{
from: path.resolve(__dirname, './static'),
to: 'static',
ignore: ['.*']
}
]));
// if (isProduction) {
// config.plugins.push(new CompressionWebpackPlugin({
// algorithm: 'gzip',
// test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
// threshold: 10240,
// minRatio: 0.8
// }));
// }
config.externals = { // 配置使用CDN
'vue': 'Vue',
'vuex': 'Vuex',
'vue-router': 'VueRouter',
'nprogress': 'NProgress',
'echarts': 'echarts'
};
},
chainWebpack(config) {
config.plugins.delete('preload'); // TODO: need test
@ -137,6 +155,27 @@ module.exports = {
minChunks: 3, // minimum common number
priority: 5,
reuseExistingChunk: true
},
jmap: {
name: 'chunk-jmap',
test: resolve('src/jmap'), // can customize your rules
minChunks: 3, // minimum common number
priority: 5,
reuseExistingChunk: true
},
jlmap3d: {
name: 'chunk-jlmap3d',
test: resolve('src/jlmap3d'), // can customize your rules
minChunks: 3, // minimum common number
priority: 5,
reuseExistingChunk: true
},
ibp: {
name: 'chunk-ibp',
test: resolve('src/ibp'), // can customize your rules
minChunks: 3, // minimum common number
priority: 5,
reuseExistingChunk: true
}
}
});