This commit is contained in:
sunzhenyu 2019-09-03 16:50:15 +08:00
parent 6c325be953
commit 3d977cc124
298 changed files with 15486 additions and 12200 deletions

3
.gitignore vendored
View File

@ -6,7 +6,8 @@ yarn-debug.log*
yarn-error.log*
package-lock.json
tests/**/coverage/
src/utils/baseUrl*
/src/utils/baseUrl.js
/src/utils/
# Editor directories and files
.idea

View File

@ -1,7 +1,7 @@
<template>
<div id="app">
<router-view />
<deomon-topic ref="deomonTopic"/>
<deomon-topic ref="deomonTopic" />
</div>
</template>
@ -9,12 +9,16 @@
import { handleToken } from '@/utils/auth';
import { creatSubscribe, perpetualTopic } from '@/utils/stomp';
import DeomonTopic from '@/views/demonstration/deomonTopic';
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
export default {
name: 'App',
components: {
DeomonTopic
// QuickMenu
},
mixins: [
WindowResizeHandler
],
watch: {
'$store.state.socket.roomInvite': function (val) {
if (val.creatorId) {
@ -27,6 +31,9 @@ export default {
this.subscribe();
},
methods: {
resizeHandler() {
this.$store.dispatch('app/resize', {width: this._clientWidth, height: this._clientHeight});
},
prohibitSystemContextMenu() {
window.document.oncontextmenu = function () {
return false;

View File

@ -10,14 +10,6 @@ export function getLessonPermissonPageList(params) {
});
}
// 根据ID获取权限数据
// export function getLessonPermissonDetail(id) {
// return request({
// url: `/api/permission/${id}`,
// method: 'get'
// });
// }
/** 创建课程权限*/
export function createLessonPermisson(data) {
return request({
@ -26,10 +18,36 @@ export function createLessonPermisson(data) {
data: data
});
}
/** 获取权限详情*/
export function getPermissonDetail(id) {
return request({
url: `/api/permission/${id}/package`,
method: 'get'
});
}
/** 修改权限*/
export function putPermissonDetail(data) {
return request({
url: `/api/permission/${data.id}`,
method: 'put',
data: data
});
}
/** 一键生成所有权限*/
export function postPermissonList(mapId) {
return request({
url: `/api/permission/${mapId}/generate`,
method: 'post'
});
}
/** 获取用户某课程某段时间内可用的权限数量*/
export function getTotalRemains(params) {
return request({
url: '/api/permission/totalRemains',
url: '/api/userPermission/totalRemains',
method: 'get',
params: params
});
@ -37,7 +55,7 @@ export function getTotalRemains(params) {
/** 设置权限失效或有效*/
export function setLessonPermisson(data) {
return request({
url: `/api/permission/${data.id}/status`,
url: `/api/userPermission/${data.id}/status`,
method: 'put',
data: data
});
@ -48,7 +66,7 @@ export function setLessonPermisson(data) {
*/
export function queryPermissionSimulation(data) {
return request({
url: `/api/permission/${data.mapId}/${data.prdCode}/simulation`,
url: `/api/userPermission/${data.mapId}/${data.prdCode}/simulation`,
method: 'get'
});
}
@ -56,38 +74,28 @@ export function queryPermissionSimulation(data) {
/** 获取大屏权限列表*/
export function queryPermissionScreen() {
return request({
url: `/api/permission/bigScreen`,
url: `/api/userPermission/bigScreen`,
method: 'get'
});
}
/** 更新课程权限*/
/*
export function updateLessonPermisson(data) {
return request({
url: '/api/permission',
method: 'put',
data: data
});
}
*/
/** 删除课程权限*/
/*
export function deleteLessonPermisson(id) {
return request({
url: '/api/permission/' + id,
method: 'delete'
});
}
*/
/**
* 用户权限列表
*/
export function listPermision(params) {
return request({
url: `/api/userPermission`,
method: 'get',
params: params
});
}
/**
* 个人权限列表
*/
export function listUserPermision(params) {
return request({
url: `/api/permission/my`,
url: `/api/userPermission/my`,
method: 'get',
params: params
});
@ -101,10 +109,10 @@ export function getDistribute(id) {
});
}
/** 用户权限列表 */
/** 设置权限所有者 */
export function putPermissionOwner(data) {
return request({
url: `/api/permission/${data.id}/owner`,
url: `/api/userPermission/${data.id}/owner`,
method: 'put',
data: data.owner
});

View File

@ -1,6 +1,6 @@
import request from '@/utils/request';
/** 上课权限获取*/
/** 权限转增*/
export function getLessons(data) {
return request({
url: '/api/distribute/getLessons',
@ -9,15 +9,41 @@ export function getLessons(data) {
});
}
/** 上课权限分发*/
/** 权限分发*/
export function giveLessons(data) {
return request({
url: '/api/distribute/givePermission',
url: '/api/distribute/distribute',
method: 'post',
data: data
});
}
/** 权限转增*/
export function permissionTurnAdd(data) {
return request({
url: '/api/distribute/transfer',
method: 'post',
data: data
});
}
/** 从订单分发权限(获取二维码)*/
export function postDistribute(data) {
return request({
url: `/api/distribute/${data.code}/distribute`,
method: 'post',
data: data
});
}
/** 权限获取*/
export function getPermission(state) {
return request({
url: `/api/distribute/getPermission?state=${state}`,
method: 'get'
});
}
/** 接收课程权限*/
export function receiveLessons(data) {
return request({

View File

@ -66,7 +66,7 @@ export function getCommodityDetailById(id) {
*/
export function updataCommodityList(data) {
return request({
url: `/api/goods`,
url: `/api/goods/${data.id}`,
method: 'put',
data: data
});

View File

@ -277,20 +277,14 @@ export function deleteRunPlanTemplate(planId) {
}
/** 生成通用每日运行图*/
export function generateCommonRunPlanEveryDay(planId) {
export function generateCommonRunPlanEveryDay(planId, params) {
return request({
url: `/api/runPlan/template/generate/${planId}`,
method: 'post'
method: 'post',
params
});
}
/** 生成用户每日运行图*/
export function generateUserRunPlanEveryDay(planId, group) {
return request({
url: `/api/runPlan/daily/privilege/${planId}?group=${group}`,
method: 'post'
});
}
/** 获取运行计划每日列表*/
export function runPlanEveryDayList(params) {
return request({
@ -309,20 +303,12 @@ export function deleteRunPlanEveryDay(planId) {
}
/** 获取地图运行图的车次号*/
export function getPublishMapTrainNos(skinCode) {
return request({
url: `/api/runPlan/daily/${skinCode}/trainNos`,
method: 'get'
});
}
/** 获取服务号、车组号*/
export function getPublishMapTrainServerNos(skinCode) {
return request({
url: `/api/runPlan/daily/${skinCode}/serverNos`,
method: 'get'
});
}
// export function getPublishMapTrainNos(skinCode) {
// return request({
// url: `/api/runPlan/daily/${skinCode}/trainNos`,
// method: 'get'
// });
// }
/** 分页查询加载计划*/
export function getRunPlanLoadList(params) {
@ -374,3 +360,11 @@ export function queryRunPlanDaily(planId) {
method: 'get'
});
}
/** 获取模板运行图列表*/
export function listAllTempLateRunPlan() {
return request({
url: `/api/runPlan/template/all`,
method: 'get'
});
}

46
src/api/scheduling.js Normal file
View File

@ -0,0 +1,46 @@
import request from '@/utils/request';
export function querySecheduling(group, 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
});
}
export function getSchedulingAllTrains(group) {
return request({
url: `/api/scheduling/${group}/train/all`,
method: 'get'
});
}
export function checkScheduling(group) {
return request({
url: `/api/scheduling/${group}/check`,
method: 'post'
});
}
export function saveScheduling(group, data) {
return request({
url: `/api/scheduling/${group}/save`,
method: 'post',
data
});
}
export function generateSchedulingAgain(group) {
return request({
url: `/api/scheduling/${group}/rebuild`,
method: 'delete'
});
}

View File

@ -160,14 +160,6 @@ export function getEveryDayRunPlanData(group) {
});
}
/** 生成手机同步仿真二维码*/
// export function getSimulationQrCodeUrl(group) {
// return request({
// url: `/api/simulation/${group}/qrCode`,
// method: 'post'
// });
// }
/** 录制脚本仿真*/
export function scriptRecordNotify(scriptId) {
return request({
@ -239,7 +231,7 @@ export function selectScriptMembers(group, data) {
export function modifyScriptMemberSex(group, playerId, data) {
return request({
url: `/api/simulation/${group}/scriptWrite/player/${playerId}?gender=${data.gender}`,
method: 'put',
method: 'put'
});
}
@ -293,85 +285,6 @@ export function modifyScriptAction(group, actionId, data) {
});
}
// /** 根据成员角色查询设备列表*/
// export function getDevicesByRole(group, params) {
// return request({
// url: `/api/simulation/${group}/role/devices`,
// method: 'get',
// params
// });
// }
// /** 获取任务录制的成员角色列表 */
// export function getMembersByGroup(group) {
// return request({
// url: `/api/simulation/${group}/questRecord/members`,
// method: 'get'
// });
// }
// /** 添加任务角色成员 */
// export function postQuestMember(group, data) {
// return request({
// url: `/api/simulation/${group}/questRecord/member`,
// method: 'post',
// data
// });
// }
// /** 删除任务角色成员 */
// export function deleteQuestMember(group, memberId) {
// return request({
// url: `/api/simulation/${group}/questRecord/member/${memberId}`,
// method: 'delete'
// });
// }
// // /** 添加/修改任务角色行为 */
// export function postMemberBehavior(group, memberId, data) {
// return request({
// url: `/api/simulation/${group}/questRecord/${memberId}/behavior`,
// method: 'post',
// data
// });
// }
// /** 删除任务角色行为 */
// export function deleteMemberBehavior(group, memberId, behaviorId) {
// return request({
// url: `/api/simulation/${group}/questRecord/${memberId}/behavior/${behaviorId}`,
// method: 'delete'
// });
// }
// /** 删除任务角色行为动作 */
// export function deleteMemberBehaviorAction(group, memberId, behaviorId, actionId) {
// return request({
// url: `/api/simulation/${group}/questRecord/${memberId}/behavior/${behaviorId}/action/${actionId}`,
// method: 'delete'
// });
// }
// /** 添加/修改任务角色行为动作 */
// export function postMemberBehaviorAction(group, memberId, behaviorId, data) {
// return request({
// url: `/api/simulation/${group}/questRecord/${memberId}/behavior/${behaviorId}/action`,
// method: 'post',
// data
// });
// }
// /** 添加/修改任务目标条件*/
// export function postTargetConditionAction(group, data) {
// return request({
// url: `/api/simulation/${group}/questRecord/targetCondition`,
// method: 'post',
// data
// });
// }
// /** 删除任务目标条件*/
// export function deleteTargetConditionAction(group, tcId) {
// return request({
// url: `/api/simulation/${group}/questRecord/targetCondition/${tcId}`,
// method: 'delete'
// });
// }
/** 分页查询存在的仿真 */
export function getExistingSimulation(params) {
return request({
@ -396,14 +309,6 @@ export function getDeviceCodeByDeviceType(group, params) {
params
});
}
// /** 根据设备类型获取设备条件列表 */
// export function getDeviceCoditionByDeviceType(params) {
// return request({
// url: `/api/simulation/deviceType/conditions`,
// method: 'get',
// params
// });
// }
/** 获取任务录制的数据 */
export function getScriptRecord(group) {
@ -486,3 +391,20 @@ export function executeScript(group) {
method: 'post'
});
}
/** 生成用户自己的当日运行图*/
export function generateDayRunPlan(planId, group) {
return request({
url: `/api/simulation/${group}/loadRunPlan/${planId}`,
method: 'post'
});
}
/** 创建排班计划仿真*/
export function schedulingNotify(params) {
return request({
url: `/api/scheduling/simulation`,
method: 'post',
params
});
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 794 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 MiB

After

Width:  |  Height:  |  Size: 13 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -63,8 +63,7 @@
:sortable="column.sortable"
>
<template slot-scope="scope">
<el-tag :type="column.tagType(scope.row, scope.$index)">{{ column.columnValue(scope.row,
scope.$index) }}</el-tag>
<el-tag v-if="column.columnValue(scope.row, scope.$index)" :type="column.tagType(scope.row, scope.$index)">{{ column.columnValue(scope.row, scope.$index) }}</el-tag>
</template>
</el-table-column>
<el-table-column
@ -118,8 +117,7 @@
:type="button.type ? button.type : 'primary'"
:disabled="isTableBtnDisabled(button, scope.$index, scope.row)"
@click="button.handleClick(scope.$index, scope.row) "
>{{ getTableBtnName(button.name,
scope.$index, scope.row) }}</el-button>
>{{ getTableBtnName(button.name, scope.$index, scope.row) }}</el-button>
</template>
</template>
</el-table-column>
@ -454,6 +452,9 @@ export default {
},
currentChoose() {
return this.choose;
},
refresh() {
this.queryList.data = [...this.queryList.data];
}
}

View File

@ -13,7 +13,7 @@ export default {
trainingRule: 'Training rules',
trainingManage: 'Training management',
taskManage: 'Task management',
scriptManage: 'Script management',
scriptManage: 'Script',
teachSystem: 'Teaching',
@ -28,13 +28,14 @@ export default {
replayManage: 'Playback',
permissionManage: 'Permission',
selfPermission: 'My Permission',
pulishManage: 'Publication',
publishMapManage: 'Publishing map management',
productStateManage: 'Product state management',
publishLessonManage: 'Publishing lesson management',
runPlanTemplateManage: 'Template plan management',
runPlanCommonManage: 'General plan management',
runPlanCommonManage: 'Loading Plan Managemen',
runPlanEveryDayManage: 'Daily plan Management',
examRuleManage: 'Management of examination rules',
@ -43,6 +44,7 @@ export default {
orderManage: 'Order management',
authorityManage: 'authority management',
authorityTransferManage: 'Privilege distribution management',
userRulesManage: 'User Rights Statistics',
addCommodity: 'Adding goods',
addOrder: 'Adding orders',
addCoursePermissions: 'Adding course permissions',

View File

@ -144,6 +144,6 @@ export default {
line: '线路:',
permissionList: '权限列表:',
remove: '移除',
append: '添加',
append: '添 加',
release: '发布'
};

View File

@ -46,7 +46,7 @@ export default {
renew: '续费',
productName: '产品名称',
recovery: '回收',
permissionPack: '权限',
permissionPack: '权限',
privilegeTransferQRCode: '权限转赠二维码',
generatingQRCode: '生成二维码',
transferQRCode: '转赠二维码',

View File

@ -10,7 +10,7 @@ export default {
permissionStatus: '权限状态',
permissionUseType: '公用/专用',
permissionTotal: '权限总数',
permissionRemains: '生于权限',
permissionRemains: '剩余权限',
isForever: '是否永久',
startTime: '开始时间',
endTime: '结束时间',

View File

@ -28,13 +28,14 @@ export default {
replayManage: '回放管理',
permissionManage: '权限管理',
selfPermission: '我的权限',
pulishManage: '发布内容管理',
publishMapManage: '发布地图管理',
productStateManage: '产品状态管理',
publishLessonManage: '发布课程管理',
runPlanTemplateManage: '模板运行图管理',
runPlanCommonManage: '通用运行图管理',
runPlanCommonManage: '加载计划运行图管理',
runPlanEveryDayManage: '每日运行图管理',
examRuleManage: '试题规则管理',
@ -43,6 +44,7 @@ export default {
orderManage: '订单管理',
authorityManage: '权限管理',
authorityTransferManage: '权限分发管理',
userRulesManage: '用户权限统计',
addCommodity: '添加商品',
addOrder: '添加订单',
addCoursePermissions: '添加课程权限',
@ -51,9 +53,9 @@ export default {
dataDictionary: '数据字典',
dataDictionaryDetails: '数据字典明细',
userManage: '用户管理',
userTrainingManage: '用户实训管理',
userExamManage: '用户考试管理',
userSimulationManage: '用户仿真管理',
userTrainingManage: '用户实训统计',
userExamManage: '用户考试统计',
userSimulationManage: '用户仿真统计',
existingSimulation: '存在仿真管理',
ibpDraw: 'Ibp盘绘制'

View File

@ -4,32 +4,33 @@ const deviceRender = {};
/** IbpText渲染配置*/
deviceRender[deviceType.IbpText] = {
zlevel: 1
zlevel: 3
};
/** SquareButton渲染配置*/
deviceRender[deviceType.SquareButton] = {
zlevel: 1
zlevel: 3
};
/** WarnButton渲染配置*/
deviceRender[deviceType.WarnButton] = {
zlevel: 1
zlevel: 3
};
/** Arrow渲染配置*/
deviceRender[deviceType.Arrow] = {
zlevel: 1
zlevel: 2
};
/** RotatingButton渲染配置*/
deviceRender[deviceType.RotatingButton] = {
zlevel: 1
zlevel: 3
};
/** Tip渲染配置*/
deviceRender[deviceType.Tip] = {
zlevel: 1
/** TipBox渲染配置*/
deviceRender[deviceType.TipBox] = {
zlevel: 2,
z: 2
};
/** BackGround渲染配置*/
@ -39,6 +40,43 @@ deviceRender[deviceType.Background] = {
/** CircularLamp渲染配置 */
deviceRender[deviceType.CircularLamp] = {
zlevel: 3
};
/** AppendageBox渲染配置 */
deviceRender[deviceType.AppendageBox] = {
zlevel: 1
};
/** IbpLine渲染配置 */
deviceRender[deviceType.IbpLine] = {
zlevel: 1
};
/** Elevator 渲染配置 */
deviceRender[deviceType.Elevator] = {
zlevel: 2,
z: 1
};
/** Key 渲染配置 */
deviceRender[deviceType.Key] = {
zlevel: 4
};
/** TeleTerminal 渲染配置 */
deviceRender[deviceType.TeleTerminal] = {
zlevel: 3
};
/** Clock 渲染配置*/
deviceRender[deviceType.Clock] = {
zlevel: 3
};
/** RotateTip 渲染配置 */
deviceRender[deviceType.RotateTip] = {
zlevel: 3
};
export default deviceRender;

View File

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

File diff suppressed because one or more lines are too long

View File

@ -7,6 +7,7 @@ import Painter from './painter';
import deviceState from '../jmap/constant/deviceState';
import deviceType from './constant/deviceType';
import {calculateDCenter, createBoundingRect, modelFactory} from './utils/parser';
import { updateIbpData } from './utils/parser';
const renderer = 'canvas';
const devicePixelRatio = 1;
@ -24,6 +25,9 @@ class IbpPan {
// 设备数据
this.ibpDevice = {};
// 展示的画布大小
this.canvasSize = {};
// 默认状态
this.defaultStateDict = this.loadDefaultState();
@ -39,7 +43,7 @@ class IbpPan {
this.$painter = new Painter(this);
this.$painter.updateZrSize({width: this.$ibpZr.getWidth(), height: this.$ibpZr.getHeight()});
this.$painter.updateTransform(this.$options);
this.$painter.updateTransform(this.$options, this.canvasSize);
this.optionsHandler = this.setOptions.bind(this);
@ -60,23 +64,27 @@ class IbpPan {
return defaultStateDict;
}
setMap(config, ibpDevice) {
// 保存皮肤类型
// 保存平移缩放数据
if (config.config) {
this.$options.scaleRate = config.scaling;
this.$options.offsetX = config.origin.x;
this.$options.offsetY = config.origin.y;
this.$painter.updateTransform({ scaleRate: config.scaling, offsetX: config.origin.x, offsetY: config.origin.y });
}
// 保存原始数据
this.data = config;
// 保存需展现的画布大小
this.canvasSize = {
x: 0,
y: 0,
width: config.background.width,
height: config.background.height
};
// 解析地图数据
this.ibpDevice = ibpDevice;
// 加载对应皮肤
// this.style = this.loadStyle(this.skinCode);
// 数据加载完成 回调
if (this.methods.dataLoaded instanceof Function) { this.methods.dataLoaded(this.ibpDevice); }
@ -86,6 +94,7 @@ class IbpPan {
// 视图加载完成 回调
if (this.methods.viewLoaded instanceof Function) { this.methods.viewLoaded(this.ibpDevice); }
this.$painter.updateTransform(this.$options, this.canvasSize);
}
setDefaultState() {
@ -97,7 +106,7 @@ class IbpPan {
setOptions(opts) {
const options = this.pullBack(opts);
this.$options.update(options);
this.$painter.updateTransform(this.$options);
this.$painter.updateTransform(this.$options, this.canvasSize);
if (this.$options.disabled == true) {
this.$mouseController.disable();
@ -122,16 +131,16 @@ class IbpPan {
}
render(list) {
console.log('-*-*-*-*-', list);
(list || []).forEach(elem => {
const code = elem.code;
const type = elem._type;
updateIbpData(elem);
const oDevice = this.ibpDevice[code] || {instance: null, event: null, model: modelFactory(type, elem)};
const nDevice = Object.assign(oDevice.model || {}, elem);
const nDevice = {instance: null, event: null, model: Object.assign(oDevice.model || {}, elem)};
this.$painter.delete(oDevice);
if (!elem._dispose) {
this.ibpDevice[code] = nDevice;
this.$painter.add(nDevice);
this.$painter.add(nDevice, true);
}
});
@ -234,7 +243,22 @@ class IbpPan {
this.ibpDevice = {};
this.$painter.clear();
}
initClockTime(initTime) {
Object.values(this.ibpDevice)
.forEach(elem => {
if (elem.model._type === deviceType.Clock) {
this.$painter.initClockTime(elem, initTime);
}
});
}
setClockStart(started) {
Object.values(this.ibpDevice)
.forEach(elem => {
if (elem.model._type === deviceType.Clock) {
this.$painter.setClockStart(elem, started);
}
});
}
dispose() {
this.off(this.events.Pan, this.optionsHandler);
this.off(this.events.Zoom, this.optionsHandler);

View File

@ -1,207 +0,0 @@
import * as zrUtil from 'zrender/src/core/util';
import * as vector from 'zrender/src/core/vector';
import Group from 'zrender/src/container/Group';
import deviceType from './constant/deviceType';
import shapefactory from './shape/factory';
import TransformHandle from './transformHandle';
class Painter {
constructor(ibp) {
// 父级实例
this.$ibp = ibp;
this.$ibpZr = ibp.getZr();
// 图层数据
this.ibpInstanceLevel = {};
// 初始图层
this.initLevels();
// 视图控制器
this.$transformHandle = new TransformHandle(this);
}
/**
* 初始绘图实例
* @param {*} dom
* @param {*} config
*/
initLevels() {
// 添加父级图层
this.parentLevel = new Group({ name: '__parent__' });
this.$ibpZr.add(this.parentLevel);
// 添加子级图层
zrUtil.each(Object.values(deviceType), (type) => {
const level = new Group({ name: `__${type}__` });
this.ibpInstanceLevel[type] = level;
this.parentLevel.add(level);
});
}
/**
* 重绘视图
* @param {*} ibpDevice
*/
repaint(ibpDevice) {
// 清空视图
this.clear();
// 创建视图
Object.values(ibpDevice).forEach(device => {
this.add(device);
});
}
/**
* 添加视图
* @param {*} device
*/
add(device) {
device = Object.assign(device, { event: this.$ibp.$mouseController });
const instance = shapefactory(device, this.$ibp);
if (instance) {
device.instance = instance;
this.$transformHandle.transformView(instance);
this.ibpInstanceLevel[device.model._type].add(instance);
}
}
/**
* 删除视图
* @param {*} device
*/
delete(device) {
const instance = device.instance;
if (instance) {
this.ibpInstanceLevel[device.model._type].remove(instance);
}
}
/**
* 更新视图
* @param {*} device
*/
update(device) {
if (device) {
if (device.model._dispose) {
this.delete(device);
} else {
const instance = device.instance;
if (instance) {
instance.setState(device);
}
}
}
}
/**
* 绘制ipb时更改draggable 和注册事件
*/
drawIbp(device) {
if (device) {
const instance = device.instance;
if (instance) {
instance.setDraggable();
}
}
}
/**
* 更新transform变化
* @param {*} opt
*/
updateTransform(opt,) {
this.$transformHandle.updateTransform(opt);
}
/**
* 更新zrender尺寸
* @param {*} opt
*/
updateZrSize(opt) {
this.$transformHandle.updateZrSize(opt);
}
/**
* 过去坐标提示位置
* @param {*} opts
*/
getShapeTipPoint(instance, opts) {
if (instance) {
var point = instance.getShapeTipPoint(opts);
if (point) {
// 矩阵变换
var transform = this.$transformHandle.transform;
var transPoint = vector.applyTransform([], [point.x, point.y], transform);
return {
x: transPoint[0],
y: transPoint[1]
};
}
}
}
/**
* 设置图层可见
* @param {*} code
*/
setLevelVisible(list) {
zrUtil.each(Object.values(deviceType), type => {
const level = this.ibpInstanceLevel[type];
if (list.includes(type)) {
level.show();
} else {
level.hide();
}
}, this);
}
/**
* 刷新图层
*/
refresh() {
this.$ibpZr.refresh();
}
/**
* 清除图层
*/
clearLevel(type) {
const level = this.ibpInstanceLevel[type];
if (level) {
level.removeAll();
}
}
/**
* 清除canvas
*/
clear() {
zrUtil.each(Object.values(this.ibpInstanceLevel), (level) => {
level && level.removeAll();
}, this);
this.refresh();
}
/**
* 销毁图层
*/
dispose() {
this.ibpInstanceLevel = {};
this.parentLevel = null;
}
/**
* 父级图层
*/
getParentLevel() {
return this.parentLevel;
}
}
export default Painter;

View File

@ -1,13 +1,18 @@
import Group from 'zrender/src/container/Group';
import Image from 'zrender/src/graphic/Image';
import alarmpic from '@/assets/ibp_images/alarm.png';
import store from '@/store';
export default class alarm extends Group {
constructor(device) {
super();
this.model = device.model;
this.event = device.event;
this.zlevel = device.model.zlevel;
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.create();
}
@ -15,20 +20,27 @@ export default class alarm extends Group {
const model = this.model;
this.imageBg = new Image({
zlevel: this.zlevel,
draggable: model.draggable || false,
draggable: false,
style: {
image: alarmpic,
x: model.point.x,
y: model.point.y,
width: 70,
height: 74
width: model.width,
height: model.width/71*74
}
});
this.add(this.imageBg);
this.transformScale();
}
/** 缩放按钮 */
transformScale() {
this.imageBg.origin = [this.model.point.x, this.model.point.y];
this.imageBg.scale =[this.model.width/71, this.model.width/71];
this.imageBg.dirty();
}
setDraggable() {
this.arrow.attr('draggable', true);
this.imageBg.attr('draggable', true);
this.createMouseEvent();
}
createMouseEvent() {
@ -39,6 +51,13 @@ export default class alarm extends Group {
mousedown(e) {
this.event.disable();
if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
}
this.offsetX = e.offsetX;
this.offsetY = e.offsetY;
this.dragging = true;
}
mousemove(e) {
@ -46,7 +65,11 @@ export default class alarm extends Group {
mouseup(e) {
this.event.enable();
this.model.point.x = this.model.point.x + e.offsetX;
this.model.point.y = this.model.point.y + e.offsetY;
if (this.dragging) {
this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX);
this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY);
this.dragging = false;
}
}
}

View File

@ -0,0 +1,65 @@
import Group from 'zrender/src/container/Group';
import Image from 'zrender/src/graphic/Image';
import AppendageBoxImage from '@/assets/ibp_images/appendage_box.png';
import store from '@/store';
export default class AppendageBox extends Group {
constructor(device) {
super();
this.model = device.model;
this.event = device.event;
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.create();
}
create() {
this.appendageBox = new Image({
zlevel: this.zlevel,
z: this.z,
draggable: false,
style: {
image: AppendageBoxImage,
x: this.model.point.x,
y: this.model.point.y,
width: this.model.width,
height: this.model.height
}
});
this.add(this.appendageBox);
}
setDraggable() {
this.appendageBox.attr('draggable', true);
this.createMouseEvent();
}
createMouseEvent() {
this.on('mousedown', this.mousedown, this);
this.on('mousemove', this.mousemove, this);
this.on('mouseup', this.mouseup, this);
}
mousedown(e) {
this.event.disable();
if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
}
this.offsetX = e.offsetX;
this.offsetY = e.offsetY;
this.dragging = true;
}
mousemove() {
}
mouseup(e) {
this.event.enable();
if (this.dragging) {
this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX);
this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY);
this.dragging = false;
}
}
}

View File

@ -2,12 +2,16 @@ import Polygon from 'zrender/src/graphic/shape/Polygon';
import Group from 'zrender/src/container/Group';
import {arrow} from '@/jmap/shape/utils/ShapePoints';
// import { updateIbpData } from '@/ibp/utils/parser';
import store from '@/store';
class Arrow extends Group {
constructor(device) {
super();
this.event = device.event;
this.model = device.model;
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.create();
}
@ -16,13 +20,12 @@ class Arrow extends Group {
this.arrow = new Polygon({
zlevel: model.zlevel,
z: model.z,
draggable: model.draggable || false,
draggable: false,
shape: {
points: arrow(this.model.point.x, this.model.point.y, this.model.length, 10)
points: arrow(this.model.point.x, this.model.point.y, this.model.length, this.model.width)
},
style: {
stroke: model.stroke,
lineWidth: model.lineWidth,
fill: model.fill
}
});
@ -36,6 +39,14 @@ class Arrow extends Group {
this.transformRotation(0);
break;
}
case 'top': {
this.transformRotation(90);
break;
}
case 'bottom': {
this.transformRotation(270);
break;
}
case 'right': {
this.transformRotation(180);
break;
@ -63,18 +74,25 @@ class Arrow extends Group {
this.on('mousemove', this.mousemove, this);
this.on('mouseup', this.mouseup, this);
}
mousedown() {
mousedown(e) {
this.event.disable();
console.log('鼠标按下');
if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
}
this.offsetX = e.offsetX;
this.offsetY = e.offsetY;
this.dragging = true;
}
mousemove() {
console.log('鼠标移动');
}
mouseup(e) {
this.event.enable();
this.model.point.x = this.model.point.x + e.offsetX;
this.model.point.y = this.model.point.y + e.offsetY;
console.log('鼠标抬起', this.model);
if (this.dragging) {
this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX);
this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY);
this.dragging = false;
}
}
}

View File

@ -9,20 +9,30 @@ export default class background extends Group {
this.model = device.model;
this.zlevel = device.model.zlevel;
this.z = 1;
this.imageBgArray = [];
// this.model.width = 4100;
// this.model.height = 900;
this.create();
}
create() {
this.imageBg = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
x: 0,
y: 0,
image: ibpBg,
width: 2048,
height: 1024
const widthNum = Math.ceil(parseInt(this.model.width)/2048);
const heightNum = Math.ceil(parseInt(this.model.height)/1024);
for (let i = 0; i<widthNum; i++) {
for (let j = 0; j<heightNum; j++) {
const imageBg = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
x: i*2048,
y: j*1024,
image: ibpBg,
width: 2048,
height: 1024
}
});
this.imageBgArray.push(imageBg);
}
});
}
this.tailorRect = new Rect({
zlevel: this.zlevel,
z: this.z,
@ -36,16 +46,11 @@ export default class background extends Group {
this.tailorBgImage();
}
tailorBgImage() {
// this.imageBg.setClipPath(this.tailorRect);
this.add(this.imageBg);
}
setInitialPosition(opt) {
const x = this.imageBg.style.x;
const y = this.imageBg.style.y;
this.imageBg.setStyle('x', x-opt.offsetX);
this.imageBg.setStyle('y', y-opt.offsetY);
this.tailorRect.setShape('x', x-opt.offsetX);
this.tailorRect.setShape('y', y-opt.offsetY);
const _this = this;
this.imageBgArray.forEach( function(elem) {
elem.setClipPath(_this.tailorRect);
_this.add(elem);
});
}
setDraggable() {
}

View File

@ -10,6 +10,7 @@ import yellowButtonPic from '@/assets/ibp_images/yellow_button.png';
import yellowButtonPicOn from '@/assets/ibp_images/yellow_button_on.png';
import grayButtonPic from '@/assets/ibp_images/gray_button.png';
import grayButtonPicOn from '@/assets/ibp_images/gray_button_on.png';
import store from '@/store';
export default class button extends Group {
static colors = new Map([
@ -26,15 +27,20 @@ export default class button extends Group {
]);
constructor(device) {
super();
this.event = device.event;
this.model = device.model;
this.zlevel = device.model.zlevel;
this.event = device.event;
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.create();
}
create() {
const model = this.model;
this.imageBg = new Image({
zlevel: this.zlevel,
draggable: model.draggable || false,
draggable: false,
style: {
image: this.getImagePic(),
x: model.point.x,
@ -44,6 +50,14 @@ export default class button extends Group {
}
});
this.add(this.imageBg);
this.transformScale();
}
/** 缩放按钮 */
transformScale() {
this.imageBg.origin = [this.model.point.x, this.model.point.y];
this.imageBg.scale =[this.model.width/70, this.model.width/70];
this.imageBg.dirty();
}
getImagePic() {
@ -52,7 +66,7 @@ export default class button extends Group {
}
setDraggable() {
this.arrow.attr('draggable', true);
this.imageBg.attr('draggable', true);
this.createMouseEvent();
}
createMouseEvent() {
@ -65,17 +79,17 @@ export default class button extends Group {
setState(model) {
switch (model.status) {
case 'on': {
// 关闭
this.close();
// 开放
this.open();
this.model.status='on';
break;
}
case 'off': {
// 开放
this.open();
// 关闭
this.close();
this.model.status='off';
break;
}
}
}
}
@ -98,13 +112,24 @@ export default class button extends Group {
mousedown(e) {
this.event.disable();
if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
}
this.offsetX = e.offsetX;
this.offsetY = e.offsetY;
this.dragging = true;
}
mousemove(e) {
mousemove() {
}
mouseup(e) {
this.event.enable();
this.model.point.x = this.model.point.x + e.offsetX;
this.model.point.y = this.model.point.y + e.offsetY;
if (this.dragging) {
this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX);
this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY);
this.dragging = false;
}
}
// 关闭
close() {

View File

@ -1,5 +1,6 @@
import Group from 'zrender/src/container/Group';
import Circle from 'zrender/src/graphic/shape/Circle';
import store from '@/store';
export default class CircularLamp extends Group {
constructor(device) {
@ -8,6 +9,9 @@ export default class CircularLamp extends Group {
this.event = device.event;
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.create();
}
@ -15,7 +19,7 @@ export default class CircularLamp extends Group {
this.lamp = new Circle({
zlevel: this.zlevel,
z: this.z,
draggable: this.model.draggable||false,
draggable: false,
shape: {
cx: this.model.point.x,
cy: this.model.point.y,
@ -40,15 +44,24 @@ export default class CircularLamp extends Group {
this.on('mousemove', this.mousemove, this);
this.on('mouseup', this.mouseup, this);
}
mousedown() {
mousedown(e) {
this.event.disable();
console.log('鼠标按下');
if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
}
this.offsetX = e.offsetX;
this.offsetY = e.offsetY;
this.dragging = true;
}
mousemove() {
console.log('鼠标移动');
}
mouseup() {
mouseup(e) {
this.event.enable();
console.log('鼠标抬起');
if (this.dragging) {
this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX);
this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY);
this.dragging = false;
}
}
}

251
src/ibp/shape/clock.js Normal file
View File

@ -0,0 +1,251 @@
import Group from 'zrender/src/container/Group';
import Image from 'zrender/src/graphic/Image';
import clock0 from '@/assets/ibp_images/clock/clock_0.png';
import clock1 from '@/assets/ibp_images/clock/clock_1.png';
import clock2 from '@/assets/ibp_images/clock/clock_2.png';
import clock3 from '@/assets/ibp_images/clock/clock_3.png';
import clock4 from '@/assets/ibp_images/clock/clock_4.png';
import clock5 from '@/assets/ibp_images/clock/clock_5.png';
import clock6 from '@/assets/ibp_images/clock/clock_6.png';
import clock7 from '@/assets/ibp_images/clock/clock_7.png';
import clock8 from '@/assets/ibp_images/clock/clock_8.png';
import clock9 from '@/assets/ibp_images/clock/clock_9.png';
import clockBg from '@/assets/ibp_images/clock/clock_bg.png';
import clockColon from '@/assets/ibp_images/clock/clock_colon.png';
export default class clock extends Group {
constructor(device) {
super();
this.event = device.event;
this.model = device.model;
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this.event = device.event;
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.initTime = 0;
this.create();
}
create() {
this.clockBg = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: clockBg,
x: this.model.point.x,
y: this.model.point.y,
width: this.model.width,
height: this.model.width/493*156
}
});
this.num1 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: this.getImagePic('0'),
x: this.model.point.x+this.model.width*0.1,
y: this.model.point.y+this.model.width*0.052,
width: this.model.width*0.1,
height: this.model.width*0.1/37*74
}
});
this.num2 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: this.getImagePic('0'),
x: this.model.point.x+this.model.width*0.22,
y: this.model.point.y+this.model.width*0.052,
width: this.model.width*0.1,
height: this.model.width*0.1/37*74
}
});
this.num3 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: this.getImagePic('0'),
x: this.model.point.x+this.model.width*0.39,
y: this.model.point.y+this.model.width*0.052,
width: this.model.width*0.1,
height: this.model.width*0.1/37*74
}
});
this.num4 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: this.getImagePic('0'),
x: this.model.point.x+this.model.width*0.52,
y: this.model.point.y+this.model.width*0.052,
width: this.model.width*0.1,
height: this.model.width*0.1/37*74
}
});
this.num5 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: this.getImagePic('0'),
x: this.model.point.x+this.model.width*0.69,
y: this.model.point.y+this.model.width*0.052,
width: this.model.width*0.1,
height: this.model.width*0.1/37*74
}
});
this.num6 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: this.getImagePic('0'),
x: this.model.point.x+this.model.width*0.82,
y: this.model.point.y+this.model.width*0.052,
width: this.model.width*0.1,
height: this.model.width*0.1/37*74
}
});
this.clockColon1 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: clockColon,
x: this.model.point.x+this.model.width*0.16,
y: this.model.point.y-this.model.width*0.028,
width: this.model.width*0.37,
height: this.model.width/1*0.37
}
});
this.clockColon2 = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: clockColon,
x: this.model.point.x+this.model.width*0.46,
y: this.model.point.y-this.model.width*0.028,
width: this.model.width*0.37,
height: this.model.width/1*0.37
}
});
this.add(this.clockBg);
this.add(this.num1);
this.add(this.num2);
this.add(this.num3);
this.add(this.num4);
this.add(this.num5);
this.add(this.num6);
this.add(this.clockColon1);
this.add(this.clockColon2);
}
getImagePic(context) {
let pic = clock0;
switch (context) {
case '0':
pic = clock0;
break;
case '1':
pic = clock1;
break;
case '2':
pic = clock2;
break;
case '3':
pic = clock3;
break;
case '4':
pic = clock4;
break;
case '5':
pic = clock5;
break;
case '6':
pic = clock6;
break;
case '7':
pic = clock7;
break;
case '8':
pic = clock8;
break;
case '9':
pic = clock9;
break;
}
return pic;
}
setClockStart() {
const _this = this;
this.timer = setInterval(() => {
_this.handleClock(_this);
}, 1000);
}
handleClock(_this) {
_this.initTime += 1000;
const newDate = new Date();
newDate.setTime(_this.initTime);
let seconds = newDate.getSeconds() +'';
let minutes = newDate.getMinutes() + '';
let hours = newDate.getHours() + '';
if (seconds.length<2) {
seconds = '0' + seconds;
}
if (minutes.length<2) {
minutes = '0' + minutes;
}
if (hours.length<2) {
hours = '0'+ hours;
}
_this.setNumPic(6, seconds.charAt(1));
_this.setNumPic(5, seconds.charAt(0));
_this.setNumPic(4, minutes.charAt(1));
_this.setNumPic(3, minutes.charAt(0));
_this.setNumPic(2, hours.charAt(1));
_this.setNumPic(1, hours.charAt(0));
}
setNumPic(num, context) {
switch (num) {
case 1:
this.num1.setStyle('image', this.getImagePic(context));
break;
case 2:
this.num2.setStyle('image', this.getImagePic(context));
break;
case 3:
this.num3.setStyle('image', this.getImagePic(context));
break;
case 4:
this.num4.setStyle('image', this.getImagePic(context));
break;
case 5:
this.num5.setStyle('image', this.getImagePic(context));
break;
case 6:
this.num6.setStyle('image', this.getImagePic(context));
}
}
setClockTime(initTime) {
this.initTime = initTime;
const newDate = new Date();
newDate.setTime(initTime);
let seconds = newDate.getSeconds() +'';
let minutes = newDate.getMinutes() + '';
let hours = newDate.getHours() + '';
if (seconds.length<2) {
seconds = '0' + seconds;
}
if (minutes.length<2) {
minutes = '0' + minutes;
}
if (hours.length<2) {
hours = '0'+ hours;
}
this.setNumPic(6, seconds.charAt(1));
this.setNumPic(5, seconds.charAt(0));
this.setNumPic(4, minutes.charAt(1));
this.setNumPic(3, minutes.charAt(0));
this.setNumPic(2, hours.charAt(1));
this.setNumPic(1, hours.charAt(0));
}
setDraggable() {
}
}

129
src/ibp/shape/elevator.js Normal file
View File

@ -0,0 +1,129 @@
import Group from 'zrender/src/container/Group';
import ElevatorBack from './elevatorBack';
import ElevatorArrow from './elevatorArrow';
import store from '@/store';
export default class elevator extends Group {
constructor(device) {
super();
this.event = device.event;
this.model = device.model;
this.create();
}
create() {
const model = this.model;
this.grouper=new Group({
id: '111',
// width: model.width,
// height: model.height,
position: [model.point.x, model.point.y],
draggable: false
});
this.elevatorBack = new ElevatorBack({model: {
zlevel: model.zlevel,
z: model.z,
// model.draggable ||
draggable: false,
point: {
x: model.point.x,
y: model.point.y
},
width: model.width,
height: model.height,
fillColor: model.fillColor ||'#313131',
stroke: model.fillColor ||'#313131',
lineWidth: 0
}
});
this.elevatorArrowTop=new ElevatorArrow({model: {
zlevel: model.zlevel,
z: model.z,
draggable: false,
point: {
x: model.width/6*4.7,
y: model.height/8*0.1
},
width: model.width/6*0.8,
status: this.getStatus('top'),
orientation: 'top'
}});
this.elevatorArrowBottom=new ElevatorArrow({model: {
zlevel: model.zlevel,
z: model.z,
draggable: false,
point: {
x: model.width/6*1.3,
y: model.height/8*7.9
},
width: model.width/6*0.8,
status: this.getStatus('bottom'),
orientation: 'bottom'
}});
this.grouper.add(this.elevatorBack);
this.grouper.add(this.elevatorArrowTop);
this.grouper.add(this.elevatorArrowBottom);
this.add(this.grouper);
}
getStatus(status) {
if (this.model.direction=='none') {
return 'off';
} else {
return status==this.model.direction? 'on':'off';
}
}
setStatus(model) {
if (model.direction=='none') {
this.elevatorArrowBottom.setStatus('off');
this.elevatorArrowTop.setStatus('off');
} else if (model.direction=='top') {
this.elevatorArrowBottom.setStatus('off');
this.elevatorArrowTop.setStatus('on');
} else if (model.direction=='bottom') {
this.elevatorArrowBottom.setStatus('on');
this.elevatorArrowTop.setStatus('off');
}
}
setDraggable() {
this.grouper.attr('draggable', true);
this.createMouseEvent();
}
createMouseEvent() {
this.on('mousedown', this.mousedown, this);
this.on('mousemove', this.mousemove, this);
this.on('mouseup', this.mouseup, this);
}
mousedown(e) {
this.event.disable();
if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
}
this.draggroup =this.grouper;
this.deltPostion =[e.event.zrX-this.draggroup.position[0], e.event.zrY-this.draggroup.position[1]];
}
mousemove(e) {
if (this.draggroup !=null) {
var new_pos =[e.event.zrX, e.event.zrY];
this.draggroup.position=[new_pos[0]-this.deltPostion[0], new_pos[1]-this.deltPostion[1]];
this.draggroup.dirty();
}
}
mouseup(e) {
this.event.enable();
this.draggroup=null;
}
}

View File

@ -0,0 +1,114 @@
import Group from 'zrender/src/container/Group';
import Image from 'zrender/src/graphic/Image';
import elevatorArrowPic from '@/assets/ibp_images/elevatorArrow.png';
import elevatorArrowPicOn from '@/assets/ibp_images/elevatorArrow_on.png';
export default class elevatorArrow extends Group {
constructor(device) {
super();
this.model = device.model;
this.zlevel = device.model.zlevel;
this.create();
}
create() {
const model = this.model;
this.imageBg = new Image({
zlevel: this.zlevel,
z: model.z,
draggable: false,
style: {
image: this.getStatus(),
x: model.point.x,
y: model.point.y,
width: 31,
height: 60
}
});
// debugger;
this.add(this.imageBg);
this.getOrientate();
this.transformScale();
}
getOrientate() {
switch (this.model.orientation) {
case 'top': {
this.transformRotation(0);
break;
}
case 'bottom': {
this.transformRotation(180);
break;
}
}
}
// 整体旋转箭头
transformRotation(rotate) {
this.imageBg.origin = [this.model.point.x, this.model.point.y];
this.imageBg.rotation = Math.PI / 180 * Number(rotate);
this.imageBg.dirty();
}
/** 缩放按钮 */
transformScale() {
this.imageBg.origin = [this.model.point.x, this.model.point.y];
this.imageBg.scale =[this.model.width/31, this.model.width/31];
this.imageBg.dirty();
}
getStatus() {
if (this.model.status) {
switch (this.model.status) {
case 'on': {
return elevatorArrowPicOn;
}
case 'off': {
return elevatorArrowPic;
}
}
} else {
return elevatorArrowPic;
}
}
setStatus(data) {
let imageBack;
switch (data) {
case 'on': {
imageBack=elevatorArrowPicOn;
break;
}
case 'off': {
imageBack=elevatorArrowPic;
break;
}
}
this.imageBg.setStyle({image: imageBack});
}
// setDraggable() {
// this.arrow.attr('draggable', true);
// this.createMouseEvent();
// }
// createMouseEvent() {
// this.on('mousedown', this.mousedown, this);
// this.on('mousemove', this.mousemove, this);
// this.on('mouseup', this.mouseup, this);
// }
// mousedown(e) {
// this.event.disable();
// }
// mousemove(e) {
// }
// mouseup(e) {
// this.event.enable();
// this.model.point.x = this.model.point.x + e.offsetX;
// this.model.point.y = this.model.point.y + e.offsetY;
// }
}

View File

@ -0,0 +1,34 @@
import * as toolpath from 'zrender/src/tool/path';
import Group from 'zrender/src/container/Group';
export default class elevatorBack extends Group {
constructor(device) {
super();
this.event = device.event;
this.model = device.model;
this.create();
}
create() {
// debugger;
const model = this.model;
const tempString='M'+model.width/6+' '+model.height/8*6+' L'+model.width/6*4+
' 0 L'+model.width/6*5+' 0 A '+model.width/6+' '+model.width/6+' 0 0 1 '+
model.width/6*5+' '+model.height/4+'L '+model.width/3+' '+model.height+' L'+model.width/6+
' '+model.height+' '+'A'+model.width/6+' '+model.width/6+' 0 0 1 '+model.width/6+' '+model.height/8*6;
this.elevatorBack = toolpath.createFromString(tempString, {
zlevel: model.zlevel,
z: model.z,
draggable: false,
style: {
x: model.point.x,
y: model.point.y,
brushType: 'fill',
fill: this.model.fillColor || '#313131',
lineWidth: 0
}
});
this.add(this.elevatorBack);
}
}

View File

@ -3,12 +3,34 @@ import deviceType from '../constant/deviceType';
import Background from './background';
import CircularLamp from './circularLamp';
import IbpText from './ibpText';
import Alarm from './alarm';
import IbpLine from './ibpLine';
import Button from './button';
import TipBox from './ibpTipBox';
import AppendageBox from './appendageBox';
import RotatingButton from './rotatingButton';
import Elevator from './elevator';
import Key from './key';
import TeleTerminal from './teleTerminal';
import Clock from './clock';
import RotateTip from './rotateTip';
const ibpShape = {};
ibpShape[deviceType.Arrow] = Arrow;
ibpShape[deviceType.Background] = Background;
ibpShape[deviceType.CircularLamp] = CircularLamp;
ibpShape[deviceType.IbpText] = IbpText;
ibpShape[deviceType.Alarm] = Alarm;
ibpShape[deviceType.IbpLine] = IbpLine;
ibpShape[deviceType.SquareButton] = Button;
ibpShape[deviceType.TipBox] = TipBox;
ibpShape[deviceType.AppendageBox] = AppendageBox;
ibpShape[deviceType.RotatingButton] = RotatingButton;
ibpShape[deviceType.Elevator] = Elevator;
ibpShape[deviceType.Key] = Key;
ibpShape[deviceType.TeleTerminal] = TeleTerminal;
ibpShape[deviceType.Clock] = Clock;
ibpShape[deviceType.RotateTip] = RotateTip;
function shapefactory(device, ibp) {
const type = device.model._type;

67
src/ibp/shape/ibpLine.js Normal file
View File

@ -0,0 +1,67 @@
import Group from 'zrender/src/container/Group';
import Line from 'zrender/src/graphic/shape/Line';
import store from '@/store';
export default class ibpLine extends Group {
constructor(device) {
super();
this.model = device.model;
this.event = device.event;
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.create();
}
create() {
const model = this.model;
this.ibpLine = new Line({
zlevel: model.zlevel,
z: model.z,
draggable: false,
shape: {
x1: this.model.point1.x,
y1: this.model.point1.y,
x2: this.model.point2.x,
y2: this.model.point2.y
},
style: {
lineWidth: this.model.lineWidth,
stroke: this.model.fillColor
}
});
this.add(this.ibpLine);
}
setDraggable() {
this.ibpLine.attr('draggable', true);
this.createMouseEvent();
}
createMouseEvent() {
this.on('mousedown', this.mousedown, this);
this.on('mousemove', this.mousemove, this);
this.on('mouseup', this.mouseup, this);
}
mousedown(e) {
this.event.disable();
if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
}
this.offsetX = e.offsetX;
this.offsetY = e.offsetY;
this.dragging = true;
}
mousemove() {
}
mouseup(e) {
this.event.enable();
if (this.dragging) {
this.model.point1.x = this.model.point1.x - this.offsetX + e.offsetX;
this.model.point1.y = this.model.point1.y - this.offsetY + e.offsetY;
this.model.point2.x = this.model.point2.x - this.offsetX + e.offsetX;
this.model.point2.y = this.model.point2.y - this.offsetY + e.offsetY;
this.dragging = false;
}
}
}

View File

@ -1,14 +1,17 @@
import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text';
import { updateIbpData } from '@/ibp/utils/parser';
import store from '@/store';
export default class button extends Group {
export default class ibpText extends Group {
constructor(device) {
super();
this.model = device.model;
this.event = device.event;
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.create();
}
create() {
@ -17,10 +20,10 @@ export default class button extends Group {
zlevel: model.zlevel,
z: model.z,
silent: model.silent || false,
draggable: model.draggable || false,
draggable: false,
style: {
x: model.x,
y: model.y,
x: model.point.x,
y: model.point.y,
fontWeight: model.fontWeight,
fontSize: model.fontSize,
fontFamily: model.fontFamily,
@ -29,7 +32,8 @@ export default class button extends Group {
textFill: model.textFill,
textAlign: model.textAlign,
textPosition: model.textPosition || 'inside',
textVerticalAlign: model.textVerticalAlign || null
textVerticalAlign: model.textVerticalAlign || null,
textLineHeight: model.fontSize
}
});
this.add(this.textName);
@ -43,18 +47,24 @@ export default class button extends Group {
this.on('mousemove', this.mousemove, this);
this.on('mouseup', this.mouseup, this);
}
mousedown() {
mousedown(e) {
this.event.disable();
console.log('鼠标按下');
if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
}
this.offsetX = e.offsetX;
this.offsetY = e.offsetY;
this.dragging = true;
}
mousemove() {
console.log('鼠标移动');
}
mouseup(e) {
this.event.enable();
this.model.x = this.model.x + e.offsetX;
this.model.y = this.model.y + e.offsetY;
console.log('鼠标抬起', this.model);
updateIbpData(this.model, 'update');
if (this.dragging) {
this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX);
this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY);
this.dragging = false;
}
}
}

View File

@ -0,0 +1,64 @@
import Group from 'zrender/src/container/Group';
import Rect from 'zrender/src/graphic/shape/Rect';
import store from '@/store';
export default class ibpTipBox extends Group {
constructor(device) {
super();
this.model = device.model;
this.event = device.event;
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.create();
}
create() {
const model = this.model;
this.tipBox = new Rect({
zlevel: model.zlevel,
z: model.z,
draggable: false,
shape: {
x: this.model.point.x,
y: this.model.point.y,
width: this.model.width,
height: this.model.height
},
style: {
fill: this.model.fillColor
}
});
this.add(this.tipBox);
}
setDraggable() {
this.tipBox.attr('draggable', true);
this.createMouseEvent();
}
createMouseEvent() {
this.on('mousedown', this.mousedown, this);
this.on('mousemove', this.mousemove, this);
this.on('mouseup', this.mouseup, this);
}
mousedown(e) {
this.event.disable();
if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
}
this.offsetX = e.offsetX;
this.offsetY = e.offsetY;
this.dragging = true;
}
mousemove() {
}
mouseup(e) {
this.event.enable();
if (this.dragging) {
this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX);
this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY);
this.dragging = false;
}
}
}

104
src/ibp/shape/key.js Normal file
View File

@ -0,0 +1,104 @@
import Group from 'zrender/src/container/Group';
import Image from 'zrender/src/graphic/Image';
import keyPic from '@/assets/ibp_images/key.png';
import keyPicOn from '@/assets/ibp_images/key_on.png';
import store from '@/store';
export default class key extends Group {
constructor(device) {
super();
this.model = device.model;
this.zlevel = device.model.zlevel;
this.event = device.event;
this.offsetX = 0;
this.offsetY = 0;
this.create();
}
create() {
const model = this.model;
this.imageBg = new Image({
zlevel: this.zlevel,
z: model.z,
draggable: false,
style: {
image: this.getRotateColor(),
x: model.point.x,
y: model.point.y,
width: 314,
height: 932
}
});
this.add(this.imageBg);
this.transformScale();
}
/** 缩放按钮 */
transformScale() {
this.imageBg.origin = [this.model.point.x, this.model.point.y];
this.imageBg.scale =[this.model.width/314, this.model.width/314];
this.imageBg.dirty();
}
getRotateColor() {
if (this.model.status) {
switch (this.model.status) {
case 'on': {
return keyPicOn;
}
case 'off': {
return keyPic;
}
}
} else {
return keyPic;
}
}
setStatus(model) {
switch (model.status) {
case 'on': {
// 开放
this.imageBg.setStyle({image: keyPicOn});
this.model.status='on';
break;
}
case 'off': {
// 关闭
this.imageBg.setStyle({image: keyPic});
this.model.status='off';
break;
}
}
}
setDraggable() {
this.imageBg.attr('draggable', true);
this.createMouseEvent();
}
createMouseEvent() {
this.on('mousedown', this.mousedown, this);
this.on('mousemove', this.mousemove, this);
this.on('mouseup', this.mouseup, this);
}
mousedown(e) {
this.event.disable();
if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
}
this.offsetX = e.offsetX;
this.offsetY = e.offsetY;
}
mousemove(e) {
}
mouseup(e) {
this.event.enable();
this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX);
this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY);
}
}

View File

@ -2,6 +2,7 @@ import Group from 'zrender/src/container/Group';
import Image from 'zrender/src/graphic/Image';
import rotateBlack from '@/assets/ibp_images/rotate_black.png';
import rotateRed from '@/assets/ibp_images/rotate_red.png';
import store from '@/store';
export default class rotateTip extends Group {
@ -9,6 +10,10 @@ export default class rotateTip extends Group {
super();
this.model = device.model;
this.zlevel = device.model.zlevel;
this.event = device.event;
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.create();
}
@ -16,18 +21,26 @@ export default class rotateTip extends Group {
const model = this.model;
this.imageBg = new Image({
zlevel: this.zlevel,
draggable: model.draggable || false,
draggable: false,
style: {
image: this.getRotateColor(),
x: model.point.x,
y: model.point.y,
width: 70,
height: 74
width: 68,
height: 60
}
});
this.add(this.imageBg);
this.transformScale();
}
/** 缩放按钮 */
transformScale() {
this.imageBg.origin = [this.model.point.x, this.model.point.y];
this.imageBg.scale =[this.model.width/68, this.model.width/68];
this.imageBg.dirty();
}
getRotateColor() {
if (this.model.color) {
switch (this.model.color) {
@ -44,7 +57,7 @@ export default class rotateTip extends Group {
}
setDraggable() {
this.arrow.attr('draggable', true);
this.imageBg.attr('draggable', true);
this.createMouseEvent();
}
createMouseEvent() {
@ -55,6 +68,13 @@ export default class rotateTip extends Group {
mousedown(e) {
this.event.disable();
if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
}
this.offsetX = e.offsetX;
this.offsetY = e.offsetY;
this.dragging = true;
}
mousemove(e) {
@ -62,7 +82,10 @@ export default class rotateTip extends Group {
mouseup(e) {
this.event.enable();
this.model.point.x = this.model.point.x + e.offsetX;
this.model.point.y = this.model.point.y + e.offsetY;
if (this.dragging) {
this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX);
this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY);
this.dragging = false;
}
}
}

View File

@ -0,0 +1,64 @@
import Group from 'zrender/src/container/Group';
import Image from 'zrender/src/graphic/Image';
import Keyhole from '@/assets/ibp_images/keyhole.png';
import store from '@/store';
export default class RotatingButton extends Group {
constructor(device) {
super();
this.model = device.model;
this.event = device.event;
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.create();
}
create() {
this.rotatingButton = new Image({
zlevel: this.zlevel,
z: this.z,
draggable: false,
style: {
image: Keyhole,
x: this.model.point.x,
y: this.model.point.y,
width: this.model.width,
height: this.model.width/434*381
}
});
this.add(this.rotatingButton);
}
setDraggable() {
this.rotatingButton.attr('draggable', true);
this.createMouseEvent();
}
createMouseEvent() {
this.on('mousedown', this.mousedown, this);
this.on('mousemove', this.mousemove, this);
this.on('mouseup', this.mouseup, this);
}
mousedown(e) {
this.event.disable();
if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
}
this.offsetX = e.offsetX;
this.offsetY = e.offsetY;
this.dragging = true;
}
mousemove() {
}
mouseup(e) {
this.event.enable();
if (this.dragging) {
this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX);
this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY);
this.dragging = false;
}
}
}

View File

@ -0,0 +1,75 @@
import Group from 'zrender/src/container/Group';
import Image from 'zrender/src/graphic/Image';
import teleTerminalPic from '@/assets/ibp_images/telephone_terminal.png';
import store from '@/store';
export default class alarm extends Group {
constructor(device) {
super();
this.event = device.event;
this.model = device.model;
this.zlevel = device.model.zlevel;
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.create();
}
create() {
const model = this.model;
this.imageBg = new Image({
zlevel: this.zlevel,
draggable: false,
style: {
image: teleTerminalPic,
x: model.point.x,
y: model.point.y,
width: 150,
height: 150
}
});
this.add(this.imageBg);
this.transformScale();
}
/** 缩放按钮 */
transformScale() {
this.imageBg.origin = [this.model.point.x, this.model.point.y];
this.imageBg.scale =[this.model.width/150, this.model.width/150];
this.imageBg.dirty();
}
setDraggable() {
this.imageBg.attr('draggable', true);
this.createMouseEvent();
}
createMouseEvent() {
this.on('mousedown', this.mousedown, this);
this.on('mousemove', this.mousemove, this);
this.on('mouseup', this.mouseup, this);
}
mousedown(e) {
this.event.disable();
if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model);
return;
}
this.offsetX = e.offsetX;
this.offsetY = e.offsetY;
this.dragging = true;
}
mousemove(e) {
}
mouseup(e) {
this.event.enable();
if (this.dragging) {
this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX);
this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY);
this.dragging = false;
}
}
}

View File

@ -33,7 +33,6 @@ class TransformHandle {
view.decomposeTransform();
this.revisibleView(view);
}
// return view;
}
// 处理所有视图缩放/平移
@ -47,7 +46,26 @@ class TransformHandle {
}
// 更新偏移量
updateTransform(opts) {
updateTransform(opts, canvasSize) {
if (canvasSize) {
const elRect = this.parentLevel.getBoundingRect();
const zrRect = this.rect;
if (canvasSize.x - opts.offsetX > 0) {
opts.offsetX = -elRect.x;
}
if (canvasSize.y - opts.offsetY > 0) {
opts.offsetY = -elRect.y;
}
if (elRect.x + canvasSize.width < zrRect.width) {
opts.offsetX -= zrRect.width - (elRect.x + canvasSize.width);
}
if (elRect.y + canvasSize.height < zrRect.height) {
opts.offsetY -= zrRect.height - (elRect.y + canvasSize.height);
}
}
this.transform = createTransform(opts);
this.transformAll();
}

View File

@ -2,6 +2,7 @@ import * as zrUtil from 'zrender/src/core/util';
import * as matrix from 'zrender/src/core/matrix';
import deviceType from '../constant/deviceType';
import deviceRender from '../constant/deviceRender';
import store from '@/store';
export function createTransform(opts) {
let transform = matrix.create();
@ -37,13 +38,12 @@ export function createModel(type, model, propConvert) {
return { instance: null, event: null, model: propConvert ? propConvert.initPrivateProps(tempModel) : tempModel };
}
export function parser(data, config) {
export function parser(data) {
var ibpDevice = {};
const propConvert = null;
// var propConvert = skinCode ? Vue.prototype.$theme.loadPropConvert(skinCode): null;
if (data) {
Object.assign(data.background, config);
Object.assign(data.background);
ibpDevice[data.background.code] = createModel(deviceType.Background, data.background, propConvert);
zrUtil.each(data.textList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.IbpText, elem, propConvert);
@ -57,8 +57,8 @@ export function parser(data, config) {
ibpDevice[elem.code] = createModel(deviceType.CircularLamp, elem, propConvert);
}, this);
zrUtil.each(data.warnButtonList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.WarnButton, elem, propConvert);
zrUtil.each(data.alarmList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.Alarm, elem, propConvert);
}, this);
zrUtil.each(data.arrowList || [], elem => {
@ -69,10 +69,284 @@ export function parser(data, config) {
ibpDevice[elem.code] = createModel(deviceType.RotatingButton, elem, propConvert);
}, this);
zrUtil.each(data.tipList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.Tip, elem, propConvert);
zrUtil.each(data.tipBoxList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.TipBox, elem, propConvert);
}, this);
zrUtil.each(data.ibpLineList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.IbpLine, elem, propConvert);
}, this);
zrUtil.each(data.appendageBoxList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.AppendageBox, elem, propConvert);
}, this);
zrUtil.each(data.elevatorList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.Elevator, elem, propConvert);
}, this);
zrUtil.each(data.keyList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.Key, elem, propConvert);
}, this);
zrUtil.each(data.teleTerminalList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.TeleTerminal, elem, propConvert);
}, this);
zrUtil.each(data.clockList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.Clock, elem, propConvert);
});
zrUtil.each(data.rotateTipList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.RotateTip, elem, propConvert);
});
}
return ibpDevice;
}
export function updateIbpData(device) {
const ibpData = store.getters['ibp/ibp'];
switch (device._type) {
case deviceType.Background : {
ibpData.background = device;
break;
}
case deviceType.IbpText : {
if (ibpData.textList && ibpData.textList.length > 0) {
let newDevice = true;
for (let i=0; i<ibpData.textList.length; i++) {
if (device.code === ibpData.textList[i].code) {
device.dispose ? ibpData.textList.splice(i, 1) :ibpData.textList[i] = device;
newDevice = false;
}
}
if (newDevice) {
ibpData.textList.push(device);
}
} else {
ibpData.textList = [device];
}
break;
}
case deviceType.SquareButton : {
if (ibpData.squareButtonList && ibpData.squareButtonList.length > 0) {
let newDevice = true;
for (let i=0; i<ibpData.squareButtonList.length; i++) {
if (device.code === ibpData.squareButtonList[i].code) {
device.dispose ? ibpData.squareButtonList.splice(i, 1):ibpData.squareButtonList[i] = device;
newDevice = false;
}
}
if (newDevice) {
ibpData.squareButtonList.push(device);
}
} else {
ibpData.squareButtonList = [device];
}
break;
}
case deviceType.Arrow : {
if (ibpData.arrowList && ibpData.arrowList.length > 0) {
let newDevice = true;
for (let i=0; i<ibpData.arrowList.length; i++) {
if (device.code === ibpData.arrowList[i].code) {
device.dispose ? ibpData.arrowList.splice(i, 1):ibpData.arrowList[i] = device;
newDevice = false;
}
}
if (newDevice) {
ibpData.arrowList.push(device);
}
} else {
ibpData.arrowList = [device];
}
break;
}
case deviceType.RotatingButton : {
if (ibpData.rotatingButtonList && ibpData.rotatingButtonList.length > 0) {
let newDevice = true;
for (let i=0; i<ibpData.rotatingButtonList.length; i++) {
if (device.code === ibpData.rotatingButtonList[i].code) {
device.dispose ? ibpData.rotatingButtonList.splice(i, 1):ibpData.rotatingButtonList[i] = device;
newDevice = false;
}
}
if (newDevice) {
ibpData.rotatingButtonList.push(device);
}
} else {
ibpData.rotatingButtonList = [device];
}
break;
}
case deviceType.TipBox : {
if (ibpData.tipBoxList && ibpData.tipBoxList.length > 0) {
let newDevice = true;
for (let i=0; i<ibpData.tipBoxList.length; i++) {
if (device.code === ibpData.tipBoxList[i].code) {
device.dispose ? ibpData.tipBoxList.splice(i, 1):ibpData.tipBoxList[i] = device;
newDevice = false;
}
}
if (newDevice) {
ibpData.tipBoxList.push(device);
}
} else {
ibpData.tipBoxList = [device];
}
break;
}
case deviceType.CircularLamp : {
if (ibpData.circularLampList && ibpData.circularLampList.length > 0) {
let newDevice = true;
for (let i=0; i<ibpData.circularLampList.length; i++) {
if (device.code === ibpData.circularLampList[i].code) {
device.dispose ? ibpData.circularLampList.splice(i, 1):ibpData.circularLampList[i] = device;
newDevice = false;
}
}
if (newDevice) {
ibpData.circularLampList.push(device);
}
} else {
ibpData.circularLampList = [device];
}
break;
}
case deviceType.IbpLine : {
if (ibpData.ibpLineList && ibpData.ibpLineList.length > 0) {
let newDevice = true;
for (let i=0; i<ibpData.ibpLineList.length; i++) {
if (device.code === ibpData.ibpLineList[i].code) {
device.dispose ? ibpData.ibpLineList.splice(i, 1):ibpData.ibpLineList[i] = device;
newDevice = false;
}
}
if (newDevice) {
ibpData.ibpLineList.push(device);
}
} else {
ibpData.ibpLineList = [device];
}
break;
}
case deviceType.AppendageBox : {
if (ibpData.appendageBoxList && ibpData.appendageBoxList.length > 0) {
let newDevice = true;
for (let i=0; i<ibpData.appendageBoxList.length; i++) {
if (device.code === ibpData.appendageBoxList[i].code) {
device.dispose ? ibpData.appendageBoxList.splice(i, 1):ibpData.appendageBoxList[i] = device;
newDevice = false;
}
}
if (newDevice) {
ibpData.appendageBoxList.push(device);
}
} else {
ibpData.appendageBoxList = [device];
}
break;
}
case deviceType.Alarm : {
if (ibpData.alarmList && ibpData.alarmList.length > 0) {
let newDevice = true;
for (let i=0; i<ibpData.alarmList.length; i++) {
if (device.code === ibpData.alarmList[i].code) {
device.dispose ? ibpData.alarmList.splice(i, 1):ibpData.alarmList[i] = device;
newDevice = false;
}
}
if (newDevice) {
ibpData.alarmList.push(device);
}
} else {
ibpData.alarmList = [device];
}
break;
}
case deviceType.Elevator : {
if (ibpData.elevatorList && ibpData.elevatorList.length > 0) {
let newDevice = true;
for (let i=0; i<ibpData.elevatorList.length; i++) {
if (device.code === ibpData.elevatorList[i].code) {
device.dispose ? ibpData.elevatorList.splice(i, 1):ibpData.elevatorList[i] = device;
newDevice = false;
}
}
if (newDevice) {
ibpData.elevatorList.push(device);
}
} else {
ibpData.elevatorList = [device];
}
break;
}
case deviceType.Key : {
if (ibpData.keyList && ibpData.keyList.length > 0) {
let newDevice = true;
for (let i=0; i<ibpData.keyList.length; i++) {
if (device.code === ibpData.keyList[i].code) {
device.dispose ? ibpData.keyList.splice(i, 1):ibpData.keyList[i] = device;
newDevice = false;
}
}
if (newDevice) {
ibpData.keyList.push(device);
}
} else {
ibpData.keyList = [device];
}
break;
}
case deviceType.TeleTerminal : {
if (ibpData.teleTerminalList && ibpData.teleTerminalList.length > 0) {
let newDevice = true;
for (let i=0; i<ibpData.teleTerminalList.length; i++) {
if (device.code === ibpData.teleTerminalList[i].code) {
device.dispose ? ibpData.teleTerminalList.splice(i, 1):ibpData.teleTerminalList[i] = device;
newDevice = false;
}
}
if (newDevice) {
ibpData.teleTerminalList.push(device);
}
} else {
ibpData.teleTerminalList = [device];
}
break;
}
case deviceType.Clock : {
if (ibpData.clockList && ibpData.clockList.length > 0) {
let newDevice = true;
for (let i=0; i<ibpData.clockList.length; i++) {
if (device.code === ibpData.clockList[i].code) {
device.dispose ? ibpData.clockList.splice(i, 1):ibpData.clockList[i] = device;
newDevice = false;
}
}
if (newDevice) {
ibpData.clockList.push(device);
}
} else {
ibpData.clockList = [device];
}
}
case deviceType.RotateTip: {
if (ibpData.rotateTipList && ibpData.rotateTipList.length > 0) {
let newDevice = true;
for (let i=0; i<ibpData.rotateTipList.length; i++) {
if (device.code === ibpData.rotateTipList[i].code) {
device.dispose ? ibpData.rotateTipList.splice(i, 1): ibpData.rotateTipList[i] = device;
newDevice = false;
}
}
if (newDevice) {
ibpData.rotateTipList.push(device);
}
} else {
ibpData.rotateTipList = [device];
}
}
}
store.dispatch('ibp/setIbpData', ibpData);
}

View File

@ -50,18 +50,17 @@ export function JLmapDriving(dom, data, skinCode) {
renderer.domElement.style.top = '0';
var renderercctv = new THREE.WebGLRenderer();
renderercctv.setSize(dom.offsetWidth*0.2, dom.offsetHeight*0.2);
renderercctv.setSize(dom.offsetWidth*0.2, dom.offsetHeight*0.2);
renderercctv.domElement.style.position = 'absolute';
renderercctv.domElement.style.top = '0';
document.getElementById('jlsimulation').appendChild(renderer.domElement);
document.getElementById('jlcctv').appendChild(renderercctv.domElement);
// 定义相机
//let camera = SetCamera(dom);
// let camera = SetCamera(dom);
// 定义场景(渲染容器)
const scene = SetScene();
const speed = 0;
let drivingcode = null;
@ -104,8 +103,8 @@ export function JLmapDriving(dom, data, skinCode) {
controls3.enabled = true;
scene.add(controls3.getObject());
let cameracctv = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 150);
cameracctv.position.set( 5, -3,27 );
const cameracctv = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 150);
cameracctv.position.set( 5, -3, 27 );
cameracctv.rotation.y = Math.PI/5*3;
camera.add(cameracctv);
@ -135,9 +134,8 @@ export function JLmapDriving(dom, data, skinCode) {
// 判断渲染是否开启
if (scope.animateswitch == true) {
// 根据相机渲染场景
renderercctv.render(scene,cameracctv);
renderer.render(scene, camera);
renderercctv.render(scene, cameracctv);
// updatcontrols();
// renderercctv
controls3.update();
@ -193,7 +191,7 @@ export function JLmapDriving(dom, data, skinCode) {
this.updatestoptime = function(stime) {
scope.stime = stime;
};
this.updatedrivedata = function(drivedata){
this.updatedrivedata = function(drivedata) {
scope.drivecount += 1;
scope.drivedata = drivedata;
};

View File

@ -564,9 +564,14 @@ THREE.FBXLoader = ( function () {
}
if ( materialNode.Opacity ) {
parameters.opacity = parseFloat( materialNode.Opacity.value );
if(materialNode.Opacity.value<1 && materialNode.Opacity.value>0.9){
parameters.side = THREE.DoubleSide;
parameters.transparent = true;
parameters.alphaTest = 0.7;
parameters.opacity = 1;
}else{
parameters.opacity = parseFloat( materialNode.Opacity.value );
}
}
if ( parameters.opacity < 1.0 ) {

View File

@ -14,14 +14,13 @@ export function TrainList() {
this.initpromise = function(data,scene,assetloader,mixers,actionss){
return new Promise(function(resolve, reject){
//遍历列车数据
for(let i=0;i<data.length;i++){
let newmesh,ntracks1,ntracks2,tclip,fclip;
for(let n=assetloader.modellist.length-1;n>=0;n--){
if(assetloader.modellist[n].deviceType == "train"){
newmesh = assetloader.modellist[n].mesh.clone(true);
ntracks1 = assetloader.modellist[n].animations.slice(24,52);
@ -152,6 +151,7 @@ export function TrainList() {
newmesh.speed = 0;
newmesh.speeds = 0;
newmesh.progress = null;
newmesh.startmark = 0;
scope.list[data[i].code] = newmesh;

View File

@ -304,9 +304,9 @@ class SkinCode extends defaultStyle {
};
this[deviceType.Station] = {
text: {
show: true // 公里标名称显示
},
// text: {
// show: true // 公里标名称显示
// },
kmPostShow: true, // 公里标显示
kilometerPosition: 'down', // 公里标位置
fontWeight: 'bold' // 文字错细

View File

@ -300,9 +300,9 @@ class SkinCode extends defaultStyle {
};
this[deviceType.Station] = {
text: {
show: true // 公里标名称显示
},
// text: {
// show: true // 公里标名称显示
// },
kmPostShow: false, // 公里标显示
kilometerPosition: 'up' // 公里标朝向
};

View File

@ -297,9 +297,9 @@ class SkinCode extends defaultStyle {
};
this[deviceType.Station] = {
text: {
show: true // 公里标名称显示
},
// text: {
// show: true // 公里标名称显示
// },
kmPostShow: false, // 公里标显示
kilometerPosition: 'up' // 公里标朝向
};

View File

@ -279,9 +279,9 @@ class SkinCode extends defaultStyle {
};
this[deviceType.Station] = {
text: {
show: true // 公里标名称显示
},
// text: {
// show: true // 公里标名称显示
// },
kmPostShow: true, // 公里标显示
kilometerPosition: 'up' // 公里标朝向
};

View File

@ -20,9 +20,6 @@ class Jlmap {
// 鼠标事件
this.events = { __Pan: 'pan', __Zoom: 'zoom', Selected: 'selected', Contextmenu: 'contextmenu', DataZoom: 'dataZoom'};
// 原始数据
this.data = {};
// 皮肤参数
this.skinCode = '';
@ -83,12 +80,10 @@ class Jlmap {
this.$options.scaleRate = map.skinVO.scaling || 1;
this.$options.offsetX = map.skinVO.origin ? map.skinVO.origin.x : 0;
this.$options.offsetY = map.skinVO.origin ? map.skinVO.origin.y : 0;
// 更新视图大小
this.$painter.updateTransform({ scaleRate: this.$options.scaleRate, offsetX: this.$options.offsetX, offsetY: this.$options.offsetY });
}
// 保存原始数据
this.data = map;
// 解析地图数据
this.mapDevice = mapDevice;
@ -103,7 +98,6 @@ class Jlmap {
// 视图加载完成 回调
if (this.methods.viewLoaded instanceof Function) { this.methods.viewLoaded(this.mapDevice); }
}
setDefaultState() {
@ -158,7 +152,6 @@ class Jlmap {
const type = elem._type;
const oDevice = this.mapDevice[code] || deviceFactory(type, elem);
const nDevice = Object.assign(oDevice || {}, elem);
this.dataSync(nDevice);
this.$painter.delete(oDevice);
if (!elem._dispose) {
this.mapDevice[code] = nDevice;
@ -275,52 +268,6 @@ class Jlmap {
return payload || {};
}
dataSync(model) {
var prop = null;
var type = model._type;
var code = model.code;
switch (type) {
case deviceType.Link: prop = 'linkList'; break;
case deviceType.Section: prop = 'sectionList'; break;
case deviceType.Switch: prop = 'switchList'; break;
case deviceType.Signal: prop = 'signalList'; break;
case deviceType.Station: prop = 'stationList'; break;
case deviceType.StationStand: prop = 'stationStandList'; break;
case deviceType.StationControl: prop = 'stationControlList'; break;
case deviceType.StationCounter: prop = 'stationCounterList'; break;
case deviceType.ZcControl: prop = 'zcControlList'; break;
case deviceType.StationDelayUnlock: prop = 'stationDelayUnlockList'; break;
case deviceType.LcControl: prop = 'lcControlList'; break;
case deviceType.ButtonControl: prop = 'buttonList'; break;
case deviceType.LimitControl: prop = 'tempSpeedLimitList'; break;
case deviceType.ImageControl: prop = 'imageControl'; break;
case deviceType.Train: prop = 'trainList'; break;
case deviceType.TrainWindow: prop = 'trainWindowList'; break;
case deviceType.Line: prop = 'lineList'; break;
case deviceType.Text: prop = 'textList'; break;
}
const list = this.data[prop] || [];
const idex = list.findIndex(elem => { return elem.code == code; });
if (list) {
if (model._dispose) {
idex >= 0 && list.splice(idex, 1);
} else {
const elem = list[idex];
if (elem) {
Object.keys(model).forEach(key => {
if (key != 'instance') {
elem[key] = model[key];
}
});
} else {
list.push(Object.assign({}, model));
}
}
}
}
getZr() {
return this.$zr;
}

View File

@ -99,8 +99,8 @@ class EMouse extends Group {
this.sectionTextBorder && this.sectionTextBorder.show();
this.lineBorder && this.lineBorder.show();
const instance = this.getInstanceByCode(this.device.model.trainWindowCode);
if (instance && instance.mouseEnter) {
instance.mouseEnter(e);
if (instance && instance.mouseEvent && instance.mouseEvent.mouseEnter) {
instance.mouseEvent.mouseEnter(e);
}
}
}
@ -118,8 +118,8 @@ class EMouse extends Group {
this.sectionTextBorder && this.sectionTextBorder.hide();
this.lineBorder && this.lineBorder.hide();
const instance = this.getInstanceByCode(this.device.model.trainWindowCode);
if (instance && instance.mouseLeave) {
instance.mouseLeave(e);
if (instance && instance.mouseEvent && instance.mouseEvent.mouseLeave) {
instance.mouseEvent.mouseLeave(e);
}
}
}

View File

@ -21,7 +21,7 @@ export default class Station extends Group {
const model = this.model;
const style = this.style;
if (style.Station.text.show) {
if (model.visible) {
// 公里标名称是否显示
this.stationText = new ETextName({
zlevel: this.zlevel,
@ -38,29 +38,29 @@ export default class Station extends Group {
textFill: model.nameFontColor
});
this.add(this.stationText);
}
if (style.Station.kmPostShow) {
const path = window.location.href;
if (style.Station.kmPostShow || path.includes('/map/draw')) {
// 公里标是否显示
let direction = 1;
if (this.style.Station.kilometerPosition == 'up') {
direction = -1;
let direction = 1;
if (this.style.Station.kilometerPosition == 'up') {
direction = -1;
}
this.mileageText = new ETextName({
zlevel: this.zlevel,
z: this.z,
position: [0, 0],
x: model.position.x,
y: model.position.y + ((parseInt(model.nameFont) + 2) * direction),
fontWeight: model.fontWeight,
fontSize: model.kmPostFont || 18,
fontFamily: style.fontFamily,
text: model.kmPost,
textAlign: 'middle',
textVerticalAlign: 'top',
textFill: model.kmPostFontColor
});
this.add(this.mileageText);
}
this.mileageText = new ETextName({
zlevel: this.zlevel,
z: this.z,
position: [0, 0],
x: model.position.x,
y: model.position.y + ((parseInt(model.nameFont) + 2) * direction),
fontWeight: model.fontWeight,
fontSize: model.kmPostFont || 18,
fontFamily: style.fontFamily,
text: model.kmPost,
textAlign: 'middle',
textVerticalAlign: 'top',
textFill: model.kmPostFontColor
});
this.add(this.mileageText);
}
}

View File

@ -42,9 +42,9 @@ class EMouse extends Group {
// 创建道岔边框
craeteSwitchBorder() {
const sectionA = this.device.model.sectionAInstance.instance;
const sectionB = this.device.model.sectionBInstance.instance;
const sectionC = this.device.model.sectionCInstance.instance;
const sectionA = this.getInstanceByCode(this.device.model.sectionACode);
const sectionB = this.getInstanceByCode(this.device.model.sectionBCode);
const sectionC = this.getInstanceByCode(this.device.model.sectionCCode);
const rect = this.device.getBoundingRect();
sectionA && rect.union(sectionA.getBoundingRect());
@ -83,8 +83,8 @@ class EMouse extends Group {
const section = store.getters['map/getDeviceByCode'](this.device.model.sectionACode) || {};
const parentSection = store.getters['map/getDeviceByCode'](section.parentCode) || {};
const instance = this.getInstanceByCode(parentSection.trainWindowCode);
if (instance && instance.mouseLeave) {
instance.mouseLeave(e);
if (instance && instance.mouseEvent && instance.mouseEvent.mouseLeave) {
instance.mouseEvent.mouseLeave(e);
}
}
}
@ -101,8 +101,8 @@ class EMouse extends Group {
const section = store.getters['map/getDeviceByCode'](this.device.model.sectionACode) || {};
const parentSection = store.getters['map/getDeviceByCode'](section.parentCode) || {};
const instance = this.getInstanceByCode(parentSection.trainWindowCode);
if (instance && instance.mouseEnter) {
instance.mouseEnter(e);
if (instance && instance.mouseEvent && instance.mouseEvent.mouseEnter) {
instance.mouseEvent.mouseEnter(e);
}
}

View File

@ -0,0 +1,37 @@
export default class EMouse {
constructor(device) {
this.device = device;
}
mouseover(e) {
if (this.device.prdType) {
this.device.setVisible(true);
const instance = this.device.getInstanceByCode(this.device.model.sectionCode);
if (instance && instance.mouseEvent && instance.mouseEvent.mouseover) {
instance.mouseEvent.mouseEnter(e);
}
}
}
mouseout(e) {
if (this.device.prdType) {
this.device.setVisible(false || this.device.model.trainWindowShow);
const instance = this.device.getInstanceByCode(this.device.model.sectionCode);
if (instance && instance.mouseEvent && instance.mouseEvent.mouseout) {
instance.mouseEvent.mouseLeave(e);
}
}
}
mouseEnter(e) {
if (this.device.prdType) {
this.device.setVisible(true);
}
}
mouseLeave(e) {
if (this.device.prdType ) {
this.device.setVisible(false);
}
}
}

View File

@ -1,6 +1,7 @@
/* 车次窗*/
import Polygon from 'zrender/src/graphic/shape/Polygon';
import Group from 'zrender/src/container/Group';
import EMouse from './EMouse';
import store from '@/store';
class TrainWindow extends Group {
@ -14,6 +15,7 @@ class TrainWindow extends Group {
this.z = 9;
this.prdType = store.state.training.prdType;
this.create(model);
this.createMouseEvent();
this.setState(model);
}
create(model) {
@ -22,6 +24,12 @@ class TrainWindow extends Group {
}
}
createMouseEvent() {
this.mouseEvent = new EMouse(this);
this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); });
this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); });
}
/** 创建车次窗*/
createTrainWindow() {
const model = this.model;
@ -44,9 +52,7 @@ class TrainWindow extends Group {
lineWidth: this.style.TrainWindow.lineWidth,
stroke: this.style.TrainWindow.lineColor,
fill: this.style.transparentColor
},
onmouseover: (e) => { this.mouseover(e); },
onmouseout: (e) => { this.mouseout(e); }
}
});
this.add(this.trainRect);
}
@ -72,38 +78,6 @@ class TrainWindow extends Group {
getInstanceByCode(code) {
return (store.getters['map/getDeviceByCode'](code) || {}).instance;
}
mouseout(e) {
if (this.prdType) {
this.setVisible(false);
const instance = this.getInstanceByCode(this.model.sectionCode);
if (instance && instance.mouseEvent && instance.mouseEvent.mouseout) {
instance.mouseEvent.mouseLeave(e);
}
}
}
mouseover(e) {
if (this.prdType) {
this.setVisible(true);
const instance = this.getInstanceByCode(this.model.sectionCode);
if (instance && instance.mouseEvent && instance.mouseEvent.mouseover) {
instance.mouseEvent.mouseEnter(e);
}
}
}
mouseEnter(e) {
if (this.prdType) {
this.setVisible(true);
}
}
mouseLeave(e) {
if (this.prdType ) {
this.setVisible(false);
}
}
}
export default TrainWindow;

View File

@ -1,423 +1,464 @@
<template>
<el-dialog class="fuzhou_01 train-control" :title="title" :visible.sync="show" width="320px" :before-close="doClose"
:zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag>
<el-form size="small" label-width="90px" :model="formModel" :rules="rules" ref="form">
<el-form-item label="车 组 号:" prop="trainNumber">
<el-select v-model="formModel.trainNumber" :id="domIdTrainNumber" filterable
:disabled="trainNumberIsDisabled" @change="trainNumberChange">
<el-option v-for="train in trainList" :key="train.groupNumber" :label="train.groupNumber"
:value="train.groupNumber">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="trainType" label-width='0px'>
<el-radio-group v-model="formModel.trainType" :id="domIdTrainType" style="margin-left: 15px;"
:disabled="trainTypeIsDisabled" @change="trainTypeChange">
<el-radio :label="'01'">计划车</el-radio>
<el-radio :label="'02'">头码车</el-radio>
<el-radio :label="'03'">人工车</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item prop="serverNo">
<span slot="label">&emsp;&emsp;</span>
<el-input v-model="formModel.serverNo" :id="domIdServerNo" :disabled="serverNoIsDisabled"
@change="serverNoChange">
</el-input>
</el-form-item>
<el-form-item label="车 次 号:" prop="trainNo">
<el-input v-model="formModel.trainNo" :id="domIdTrainNo" :disabled="trainNoIsDisabled"
@change="trainNoChange"></el-input>
</el-form-item>
<el-form-item label="目的地号:" prop="targetCode">
<el-input v-model="formModel.targetCode" :id="domIdTargetCode" :disabled="targetCodeIsDisabled"
@change="targetCodeChange">
</el-input>
</el-form-item>
</el-form>
<el-row justify="center" class="button-group">
<el-col :span="10" :offset="2">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button>
</el-col>
<el-col :span="8" :offset="4">
<el-button :id="domIdCancel" @click="cancel"> </el-button>
</el-col>
</el-row>
<confirm-train ref="confirmTrain"></confirm-train>
<notice-info ref="noticeInfo"></notice-info>
</el-dialog>
<el-dialog
v-dialogDrag
class="fuzhou_01 train-control"
:title="title"
:visible.sync="show"
width="320px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-form ref="form" size="small" label-width="90px" :model="formModel" :rules="rules">
<el-form-item label="车 组 号:" prop="trainNumber">
<el-select
:id="domIdTrainNumber"
v-model="formModel.trainNumber"
filterable
:disabled="trainNumberIsDisabled"
@change="trainNumberChange"
>
<el-option
v-for="train in trainList"
:key="train.groupNumber"
:label="train.groupNumber"
:value="train.groupNumber"
/>
</el-select>
</el-form-item>
<el-form-item prop="trainType" label-width="0px">
<el-radio-group
:id="domIdTrainType"
v-model="formModel.trainType"
style="margin-left: 15px;"
:disabled="trainTypeIsDisabled"
@change="trainTypeChange"
>
<el-radio :label="'01'">计划车</el-radio>
<el-radio :label="'02'">头码车</el-radio>
<el-radio :label="'03'">人工车</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item prop="serverNo">
<span slot="label">&emsp;&emsp;</span>
<el-input
:id="domIdServerNo"
v-model="formModel.serverNo"
:disabled="serverNoIsDisabled"
@change="serverNoChange"
/>
</el-form-item>
<el-form-item label="车 次 号:" prop="trainNo">
<el-input
:id="domIdTrainNo"
v-model="formModel.trainNo"
:disabled="trainNoIsDisabled"
@change="trainNoChange"
/>
</el-form-item>
<el-form-item label="目的地号:" prop="targetCode">
<el-input
:id="domIdTargetCode"
v-model="formModel.targetCode"
:disabled="targetCodeIsDisabled"
@change="targetCodeChange"
/>
</el-form-item>
</el-form>
<el-row justify="center" class="button-group">
<el-col :span="10" :offset="2">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button>
</el-col>
<el-col :span="8" :offset="4">
<el-button :id="domIdCancel" @click="cancel"> </el-button>
</el-col>
</el-row>
<confirm-train ref="confirmTrain" />
<notice-info ref="noticeInfo" />
</el-dialog>
</template>
<script>
import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import { getPublishTrainList } from '@/api/jmap/map';
import ConfirmTrain from './childDialog/confirmTrain';
import NoticeInfo from './childDialog/childDialog/noticeInfo'
import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import { getPublishTrainList } from '@/api/jmap/map';
import ConfirmTrain from './childDialog/confirmTrain';
import NoticeInfo from './childDialog/childDialog/noticeInfo';
export default {
name: 'TrainControl',
components: {
ConfirmTrain,
NoticeInfo
},
data() {
return {
trainList: [],
formModel: {
trainNo: '',
trainNumber: '',
trainType: '01',
serverNo: '',
targetCode: '',
},
export default {
name: 'TrainControl',
components: {
ConfirmTrain,
NoticeInfo
},
data() {
return {
trainList: [],
formModel: {
trainNo: '',
trainNumber: '',
trainType: '01',
serverNo: '',
targetCode: ''
},
rules: {
trainNumber: [
{ required: true, message: '请选择车组号', trigger: 'change' }
],
trainType: [
{ required: true, message: '请选择一个列车类型', trigger: 'change' }
],
serverNo: [
{ required: true, message: '请输入表号', trigger: 'blur' }
],
trainNo: [
{ required: true, message: '请输入车次号', trigger: 'blur' }
],
targetCode: [
{ required: true, message: '请输入目的地号', trigger: 'blur' }
]
},
operation: null,
dialogShow: false,
loading: false,
direction: 0
}
},
computed: {
...mapGetters('map', [
'map'
]),
trainNoIsDisabled() {
return false;
},
serverNoIsDisabled() {
return false;
},
targetCodeIsDisabled() {
return false;
},
trainNumberIsDisabled() {
if (this.operation != OperationEvent.Train.addTrainId.menu.operation) {
return true;
}
},
trainTypeIsDisabled() {
if (this.operation != OperationEvent.Train.addTrainId.menu.operation) {
return true;
}
},
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdTrainNumber() {
if (this.dialogShow) {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 添加列车识别号*/
return OperationEvent.Train.addTrainId.trainNumberChange.domId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/
return OperationEvent.Train.editTrainId.trainNumberChange.domId;
}
}
},
domIdTrainNo() {
if (this.dialogShow) {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 添加列车识别号*/
return OperationEvent.Train.addTrainId.trainNoChange.domId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/
return OperationEvent.Train.editTrainId.trainNoChange.domId;
}
}
},
domIdTrainType() {
if (this.dialogShow) {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 添加列车识别号*/
return OperationEvent.Train.addTrainId.trainTypeChange.domId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/
return OperationEvent.Train.editTrainId.trainTypeChange.domId;
}
}
},
domIdServerNo() {
if (this.dialogShow) {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 添加列车识别号*/
return OperationEvent.Train.addTrainId.serverNoChange.domId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/
return OperationEvent.Train.editTrainId.serverNoChange.domId;
}
}
},
domIdTargetCode() {
if (this.dialogShow) {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 添加列车识别号*/
return OperationEvent.Train.addTrainId.targetCodeChange.domId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/
return OperationEvent.Train.editTrainId.targetCodeChange.domId;
}
}
},
domIdConfirm() {
if (this.dialogShow) {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 添加列车识别号*/
return OperationEvent.Train.addTrainId.menu.domId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/
return OperationEvent.Train.editTrainId.menu.domId;
}
}
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
title() {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
return '添加列车识别号';
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
return '修改列车识别号';
}
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
})
},
methods: {
loadInitData(map) {
if (map) {
getPublishTrainList(map.skinCode).then(resp => {
this.trainList = resp.data;
}).catch(error => {
this.$messageBox(`获取列车车组号失败`);
});
}
},
doShow(operate, selected) {
//
if (!this.dialogShow) {
this.operation = operate.operation;
}
rules: {
trainNumber: [
{ required: true, message: '请选择车组号', trigger: 'change' }
],
trainType: [
{ required: true, message: '请选择一个列车类型', trigger: 'change' }
],
serverNo: [
{ required: true, message: '请输入表号', trigger: 'blur' }
],
trainNo: [
{ required: true, message: '请输入车次号', trigger: 'blur' }
],
targetCode: [
{ required: true, message: '请输入目的地号', trigger: 'blur' }
]
},
operation: null,
dialogShow: false,
loading: false,
direction: 0
};
},
computed: {
...mapGetters('map', [
'map'
]),
trainNoIsDisabled() {
return false;
},
serverNoIsDisabled() {
return false;
},
targetCodeIsDisabled() {
return false;
},
trainNumberIsDisabled() {
if (this.operation != OperationEvent.Train.addTrainId.menu.operation) {
return true;
}
return false;
},
trainTypeIsDisabled() {
if (this.operation != OperationEvent.Train.addTrainId.menu.operation) {
return true;
}
return false;
},
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdTrainNumber() {
if (this.dialogShow) {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 添加列车识别号*/
return OperationEvent.Train.addTrainId.trainNumberChange.domId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/
return OperationEvent.Train.editTrainId.trainNumberChange.domId;
}
}
return null;
},
domIdTrainNo() {
if (this.dialogShow) {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 添加列车识别号*/
return OperationEvent.Train.addTrainId.trainNoChange.domId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/
return OperationEvent.Train.editTrainId.trainNoChange.domId;
}
}
return null;
},
domIdTrainType() {
if (this.dialogShow) {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 添加列车识别号*/
return OperationEvent.Train.addTrainId.trainTypeChange.domId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/
return OperationEvent.Train.editTrainId.trainTypeChange.domId;
}
}
return null;
},
domIdServerNo() {
if (this.dialogShow) {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 添加列车识别号*/
return OperationEvent.Train.addTrainId.serverNoChange.domId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/
return OperationEvent.Train.editTrainId.serverNoChange.domId;
}
}
return null;
},
domIdTargetCode() {
if (this.dialogShow) {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 添加列车识别号*/
return OperationEvent.Train.addTrainId.targetCodeChange.domId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/
return OperationEvent.Train.editTrainId.targetCodeChange.domId;
}
}
return null;
},
domIdConfirm() {
if (this.dialogShow) {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 添加列车识别号*/
return OperationEvent.Train.addTrainId.menu.domId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/
return OperationEvent.Train.editTrainId.menu.domId;
}
}
return null;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
title() {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
return '添加列车识别号';
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
return '修改列车识别号';
}
return '';
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
});
},
methods: {
loadInitData(map) {
if (map) {
getPublishTrainList(map.skinCode).then(resp => {
this.trainList = resp.data;
}).catch(() => {
this.$messageBox(`获取列车车组号失败`);
});
}
},
doShow(operate, selected) {
//
if (!this.dialogShow) {
this.operation = operate.operation;
}
this.formModel = {
trainNumber: selected.trainNumber,
trainNo: selected.trainNo,
trainType: '01',
serverNo: selected.serverNo,
targetCode: selected.targetCode,
};
this.formModel = {
trainNumber: selected.trainNumber,
trainNo: selected.trainNo,
trainType: '01',
serverNo: selected.serverNo,
targetCode: selected.targetCode
};
/** 加载列车数据*/
this.loadInitData(this.map);
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('map/setTrainWindowShow', false);
},
trainNumberChange(trainNumber) {
let operate = {
type: MapDeviceType.Train.type,
val: `${trainNumber}`,
operation: ''
}
/** 加载列车数据*/
this.loadInitData(this.map);
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('map/setTrainWindowShow', false);
},
trainNumberChange(trainNumber) {
const operate = {
type: MapDeviceType.Train.type,
val: `${trainNumber}`,
operation: ''
};
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.trainNumberChange.operation;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
operate.operation = OperationEvent.Train.editTrainId.trainNumberChange.operation;
}
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.trainNumberChange.operation;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
operate.operation = OperationEvent.Train.editTrainId.trainNumberChange.operation;
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
})
},
trainTypeChange(trainType) {
let operate = {
type: MapDeviceType.Train.type,
val: `${trainType}`,
operation: ''
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
});
},
trainTypeChange(trainType) {
const operate = {
type: MapDeviceType.Train.type,
val: `${trainType}`,
operation: ''
};
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.trainTypeChange.operation;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
operate.operation = OperationEvent.Train.editTrainId.trainTypeChange.operation;
}
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.trainTypeChange.operation;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
operate.operation = OperationEvent.Train.editTrainId.trainTypeChange.operation;
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
})
},
serverNoChange(serverNo) {
let operate = {
type: MapDeviceType.Train.type,
val: `${serverNo}`,
operation: ''
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
});
},
serverNoChange(serverNo) {
const operate = {
type: MapDeviceType.Train.type,
val: `${serverNo}`,
operation: ''
};
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.serverNoChange.operation;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
operate.operation = OperationEvent.Train.editTrainId.serverNoChange.operation;
}
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.serverNoChange.operation;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
operate.operation = OperationEvent.Train.editTrainId.serverNoChange.operation;
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
})
},
trainNoChange(trainNo) {
let operate = {
type: MapDeviceType.Train.type,
val: `${trainNo}`,
operation: ''
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
});
},
trainNoChange(trainNo) {
const operate = {
type: MapDeviceType.Train.type,
val: `${trainNo}`,
operation: ''
};
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.trainNoChange.operation;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
operate.operation = OperationEvent.Train.editTrainId.trainNoChange.operation;
}
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.trainNoChange.operation;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
operate.operation = OperationEvent.Train.editTrainId.trainNoChange.operation;
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
})
},
targetCodeChange(targetCode) {
let operate = {
type: MapDeviceType.Train.type,
val: `${targetCode}`,
operation: ''
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
});
},
targetCodeChange(targetCode) {
const operate = {
type: MapDeviceType.Train.type,
val: `${targetCode}`,
operation: ''
};
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.targetCodeChange.operation;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
operate.operation = OperationEvent.Train.editTrainId.targetCodeChange.operation;
}
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.targetCodeChange.operation;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
operate.operation = OperationEvent.Train.editTrainId.targetCodeChange.operation;
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
})
},
commit() {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 增加列车识别号*/
this.addTrainId();
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/
this.editTrainId();
}
},
//
addTrainId() {
this.$refs['form'].validate((valid) => {
if (valid) {
let model = this.formModel;
let operate = {
send: true,
type: MapDeviceType.Train.type,
operation: OperationEvent.Train.addTrainId.menu.operation,
messages: [`添加列车识别号:成功`],
val: `${model.trainNumber}::${model.trainType}::${model.serverNo}::${model.trainNo}::${model.targetCode}`,
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
});
},
commit() {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 增加列车识别号*/
this.addTrainId();
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/
this.editTrainId();
}
},
//
addTrainId() {
this.$refs['form'].validate((valid) => {
if (valid) {
const model = this.formModel;
const operate = {
send: true,
type: MapDeviceType.Train.type,
operation: OperationEvent.Train.addTrainId.menu.operation,
messages: [`添加列车识别号:成功`],
val: `${model.trainNumber}::${model.trainType}::${model.serverNo}::${model.trainNo}::${model.targetCode}`
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.confirmTrain.doShow(operate);
}
}).catch(error => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
})
} else {
return false;
}
});
},
//
editTrainId() {
this.$refs['form'].validate((valid) => {
if (valid) {
let operate = {
send: true,
type: MapDeviceType.Train.type,
operation: OperationEvent.Train.editTrainId.menu.operation,
messages: [`修改列车识别号:成功`],
val: this.formModel.trainNo,
}
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.confirmTrain.doShow(operate);
}
}).catch(() => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
} else {
return false;
}
});
},
//
editTrainId() {
this.$refs['form'].validate((valid) => {
if (valid) {
const operate = {
send: true,
type: MapDeviceType.Train.type,
operation: OperationEvent.Train.editTrainId.menu.operation,
messages: [`修改列车识别号:成功`],
val: this.formModel.trainNo
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.confirmTrain.doShow(operate);
}
}).catch(error => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
})
} else {
return false;
}
});
},
cancel() {
let operate = {
type: MapDeviceType.Train.type,
operation: OperationEvent.Command.cancel.menu.operation,
}
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.confirmTrain.doShow(operate);
}
}).catch(() => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
} else {
return false;
}
});
},
cancel() {
const operate = {
type: MapDeviceType.Train.type,
operation: OperationEvent.Command.cancel.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(error => {
this.doClose();
});
}
}
}
</script>
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(() => {
this.doClose();
});
}
}
};
</script>

View File

@ -1,156 +1,165 @@
<template>
<el-dialog class="fuzhou_01 stand-stop-time" :title="title" :visible.sync="show" width="320px"
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag>
<el-form size="small" label-width="90px" :model="formModel" :rules="rules" ref="form">
<el-form-item label="车 组 号:" prop="trainNumber">
<el-input :id="domIdTrainNumber" v-model="formModel.trainNumber" @change="trainNumberChange"></el-input>
</el-form-item>
</el-form>
<el-row justify="center" class="button-group">
<el-col :span="10" :offset="2">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button>
</el-col>
<el-col :span="8" :offset="4">
<el-button :id="domIdCancel" @click="cancel"> </el-button>
</el-col>
</el-row>
<confirm-control ref="confirmControl"></confirm-control>
<notice-info ref="noticeInfo"></notice-info>
</el-dialog>
<el-dialog
v-dialogDrag
class="fuzhou_01 stand-stop-time"
:title="title"
:visible.sync="show"
width="320px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-form ref="form" size="small" label-width="90px" :model="formModel" :rules="rules">
<el-form-item label="车 组 号:" prop="trainNumber">
<el-input :id="domIdTrainNumber" v-model="formModel.trainNumber" @change="trainNumberChange" />
</el-form-item>
</el-form>
<el-row justify="center" class="button-group">
<el-col :span="10" :offset="2">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button>
</el-col>
<el-col :span="8" :offset="4">
<el-button :id="domIdCancel" @click="cancel"> </el-button>
</el-col>
</el-row>
<confirm-control ref="confirmControl" />
<notice-info ref="noticeInfo" />
</el-dialog>
</template>
<script>
import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import { getPublishMapTrainNos } from '@/api/runplan';
import ConfirmControl from './childDialog/confirmControl';
import NoticeInfo from './childDialog/childDialog/noticeInfo'
import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
// import { getPublishMapTrainNos } from '@/api/runplan';
import ConfirmControl from './childDialog/confirmControl';
import NoticeInfo from './childDialog/childDialog/noticeInfo';
export default {
name: 'TrainDelete',
components: {
ConfirmControl,
NoticeInfo
},
data() {
return {
trainNoList: [],
formModel: {
trainNumber: '',
},
export default {
name: 'TrainDelete',
components: {
ConfirmControl,
NoticeInfo
},
data() {
return {
trainNoList: [],
formModel: {
trainNumber: ''
},
rules: {
trainNumber: [
{ required: true, message: '请输入车组号', trigger: 'blur' }
],
},
operation: null,
dialogShow: false,
loading: false,
}
},
computed: {
...mapGetters('map', [
'map'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return this.dialogShow ? OperationEvent.Train.delTrainId.menu.domId : '';
},
domIdTrainNumber() {
return this.dialogShow ? OperationEvent.Train.delTrainId.trainNumberChange.domId : '';
},
title() {
return '删除列车识别号'
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
})
},
methods: {
loadInitData(map) {
if (map) {
getPublishMapTrainNos(map.skinCode).then(response => {
this.trainNoList = response.data;
}).catch(error => {
this.$messageBox(`获取列车车组号失败`);
});
}
},
doShow(operate, selected) {
//
if (!this.dialogShow) {
this.operation = operate.operation;
}
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('map/setTrainWindowShow', false);
},
trainNumberChange() {
let operate = {
type: MapDeviceType.Train.type,
val: `${trainNumber}`,
operation: OperationEvent.Train.delTrainId.trainNumberChange.operation
}
rules: {
trainNumber: [
{ required: true, message: '请输入车组号', trigger: 'blur' }
]
},
operation: null,
dialogShow: false,
loading: false
};
},
computed: {
...mapGetters('map', [
'map'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return this.dialogShow ? OperationEvent.Train.delTrainId.menu.domId : '';
},
domIdTrainNumber() {
return this.dialogShow ? OperationEvent.Train.delTrainId.trainNumberChange.domId : '';
},
title() {
return '删除列车识别号';
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
});
},
methods: {
loadInitData(map) {
if (map) {
// getPublishMapTrainNos(map.skinCode).then(response => {
// this.trainNoList = response.data;
// }).catch(() => {
// this.$messageBox(``);
// });
}
},
doShow(operate, selected) {
//
if (!this.dialogShow) {
this.operation = operate.operation;
}
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('map/setTrainWindowShow', false);
},
trainNumberChange() {
const operate = {
type: MapDeviceType.Train.type,
val: `${this.formModel.trainNumber}`,
operation: OperationEvent.Train.delTrainId.trainNumberChange.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
})
},
commit() {
this.$refs['form'].validate((valid) => {
if (valid) {
let operate = {
send: true,
type: MapDeviceType.Train.type,
operation: OperationEvent.Train.delTrainId.menu.operation,
val: this.formModel.trainNumber
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
});
},
commit() {
this.$refs['form'].validate((valid) => {
if (valid) {
const operate = {
send: true,
type: MapDeviceType.Train.type,
operation: OperationEvent.Train.delTrainId.menu.operation,
val: this.formModel.trainNumber
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(error => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
})
} else {
return false;
}
});
},
cancel() {
let operate = {
type: MapDeviceType.Train.type,
operation: OperationEvent.Command.cancel.menu.operation,
}
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(() => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
} else {
return false;
}
});
},
cancel() {
const operate = {
type: MapDeviceType.Train.type,
operation: OperationEvent.Command.cancel.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(error => { this.doClose(); });
}
}
}
</script>
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(() => { this.doClose(); });
}
}
};
</script>

View File

@ -1,318 +1,321 @@
<template>
<div>
<pop-menu ref="popMenu" :menu="menu"></pop-menu>
<notice-info ref="noticeInfo"></notice-info>
<train-control ref="trainControl"></train-control>
<train-delete ref="trainDelete"></train-delete>
<train-move ref="trainMove"></train-move>
<train-switch ref="trainSwitch"></train-switch>
<train-edit-number ref="trainEditNumber"></train-edit-number>
</div>
<div>
<pop-menu ref="popMenu" :menu="menu" />
<notice-info ref="noticeInfo" />
<train-control ref="trainControl" />
<train-delete ref="trainDelete" />
<train-move ref="trainMove" />
<train-switch ref="trainSwitch" />
<train-edit-number ref="trainEditNumber" />
</div>
</template>
<script>
import PopMenu from '@/components/PopMenu';
import NoticeInfo from './dialog/childDialog/childDialog/noticeInfo'
import { mapGetters } from 'vuex';
import { TrainingMode, OperateMode } from '@/scripts/ConstDic';
import { MapDeviceType, OperationEvent, DeviceMenu } from '@/scripts/ConstDic';
import { MenuDisabledState, menuConvert, trainMenuFiltration } from './utils/menuItemStatus';
import TrainControl from './dialog/trainControl';
import TrainDelete from './dialog/trainDelete';
import TrainMove from './dialog/trainMove';
import TrainSwitch from './dialog/trainSwitch';
import TrainEditNumber from './dialog/trainEditNumber';
import PopMenu from '@/components/PopMenu';
import NoticeInfo from './dialog/childDialog/childDialog/noticeInfo';
import { mapGetters } from 'vuex';
import { OperateMode } from '@/scripts/ConstDic';
import { MapDeviceType, OperationEvent, DeviceMenu } from '@/scripts/ConstDic';
import { MenuDisabledState, menuConvert, trainMenuFiltration } from './utils/menuItemStatus';
import TrainControl from './dialog/trainControl';
import TrainDelete from './dialog/trainDelete';
import TrainMove from './dialog/trainMove';
import TrainSwitch from './dialog/trainSwitch';
import TrainEditNumber from './dialog/trainEditNumber';
export default {
name: 'menuTrain',
props: {
selected: {
type: Object
}
},
components: {
PopMenu,
NoticeInfo,
TrainControl,
TrainDelete,
TrainMove,
TrainSwitch,
TrainEditNumber
},
data() {
return {
menu: [],
menuNormal: {
local: [],
central: [
{
label: '添加列车识别号',
handler: this.addTrainId,
disabledCallback: MenuDisabledState.Train.addTrainId,
auth: { station: true, center: true }
},
{
label: '删除列车识别号',
handler: this.delTrainId,
disabledCallback: MenuDisabledState.Train.delTrainId,
auth: { station: true, center: true }
},
{
label: '修改列车识别号',
handler: this.editTrainId,
disabledCallback: MenuDisabledState.Train.editTrainId,
auth: { station: true, center: true }
},
{
label: '修改车组号',
handler: this.editTrainNo,
disabledCallback: MenuDisabledState.Train.editTrainNo,
auth: { station: true, center: true }
},
{
label: '移动列车识别号',
handler: this.moveTrainId,
disabledCallback: MenuDisabledState.Train.moveTrainId,
auth: { station: true, center: true }
},
{
label: '交换列车识别号',
handler: this.switchTrainId,
disabledCallback: MenuDisabledState.Train.switchTrainId,
auth: { station: true, center: true }
}
]
},
menuForce: [
{
label: '设置通信故障',
handler: this.setStoppage,
disabledCallback: MenuDisabledState.Train.setStoppage
},
{
label: '取消通信故障',
handler: this.cancelStoppage,
disabledCallback: MenuDisabledState.Train.cancelStoppage
}
],
menuSpeed: [
{
label: '确认运行至前方站',
handler: this.limitSpeed,
disabledCallback: MenuDisabledState.Train.limitSpeed
}
]
}
},
watch: {
'$store.state.menuOperation.menuCount': function () {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Train) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
computed: {
...mapGetters('training', [
'mode',
'operatemode'
]),
...mapGetters('menuOperation', [
'buttonOperation'
])
},
methods: {
clickEvent() {
let self = this;
window.onclick = function (e) {
self.doClose();
}
},
initMenu() {
//
this.menu = trainMenuFiltration(this.menuNormal);
if (this.operatemode === OperateMode.ADMIN) {
this.menu = [...this.menu, ...this.menuForce, ...this.menuSpeed]
}
export default {
name: 'MenuTrain',
components: {
PopMenu,
NoticeInfo,
TrainControl,
TrainDelete,
TrainMove,
TrainSwitch,
TrainEditNumber
},
props: {
selected: {
type: Object,
default() {
return null;
}
}
},
data() {
return {
menu: [],
menuNormal: {
local: [],
central: [
{
label: '添加列车识别号',
handler: this.addTrainId,
disabledCallback: MenuDisabledState.Train.addTrainId,
auth: { station: true, center: true }
},
{
label: '删除列车识别号',
handler: this.delTrainId,
disabledCallback: MenuDisabledState.Train.delTrainId,
auth: { station: true, center: true }
},
{
label: '修改列车识别号',
handler: this.editTrainId,
disabledCallback: MenuDisabledState.Train.editTrainId,
auth: { station: true, center: true }
},
{
label: '修改车组号',
handler: this.editTrainNo,
disabledCallback: MenuDisabledState.Train.editTrainNo,
auth: { station: true, center: true }
},
{
label: '移动列车识别号',
handler: this.moveTrainId,
disabledCallback: MenuDisabledState.Train.moveTrainId,
auth: { station: true, center: true }
},
{
label: '交换列车识别号',
handler: this.switchTrainId,
disabledCallback: MenuDisabledState.Train.switchTrainId,
auth: { station: true, center: true }
}
]
},
menuForce: [
{
label: '设置通信故障',
handler: this.setStoppage,
disabledCallback: MenuDisabledState.Train.setStoppage
},
{
label: '取消通信故障',
handler: this.cancelStoppage,
disabledCallback: MenuDisabledState.Train.cancelStoppage
}
],
menuSpeed: [
{
label: '确认运行至前方站',
handler: this.limitSpeed,
disabledCallback: MenuDisabledState.Train.limitSpeed
}
]
};
},
computed: {
...mapGetters('training', [
'mode',
'operatemode'
]),
...mapGetters('menuOperation', [
'buttonOperation'
])
},
watch: {
'$store.state.menuOperation.menuCount': function () {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Train) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
methods: {
clickEvent() {
const self = this;
window.onclick = function (e) {
self.doClose();
};
},
initMenu() {
//
this.menu = trainMenuFiltration(this.menuNormal);
if (this.operatemode === OperateMode.ADMIN) {
this.menu = [...this.menu, ...this.menuForce, ...this.menuSpeed];
}
//
if (this.operatemode === OperateMode.FAULT) {
this.menu = [...this.menuForce, ...this.menuSpeed]
}
//
if (this.operatemode === OperateMode.FAULT) {
this.menu = [...this.menuForce, ...this.menuSpeed];
}
this.menu = menuConvert(this.menu);
},
doShow(point) {
this.clickEvent();
this.initMenu();
this.menu = menuConvert(this.menu);
},
doShow(point) {
this.clickEvent();
this.initMenu();
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
this.$refs.popMenu.resetShowPosition(point);
}
},
doClose() {
if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.close();
// this.$store.dispatch('map/setTrainWindowShow', false);
}
},
//
setStoppage() {
let operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.stoppage.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(error => {
this.$refs.noticeInfo.doShow(operate);
})
},
//
cancelStoppage() {
let operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.cancelStoppage.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(error => {
this.$refs.noticeInfo.doShow(operate);
})
},
//
limitSpeed() {
let operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.limitSpeed.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(error => {
this.$refs.noticeInfo.doShow(operate);
})
},
//
addTrainId() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.addTrainId.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainControl.doShow(operate, this.selected);
}
});
},
//
delTrainId() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.delTrainId.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainDelete.doShow(operate, this.selected);
}
});
},
//
editTrainId() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.editTrainId.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainControl.doShow(operate, this.selected);
}
});
},
//
editTrainNo() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.editTrainNo.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainEditNumber.doShow(operate, this.selected);
}
});
},
//
moveTrainId() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.moveTrainId.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainMove.doShow(operate, this.selected);
}
});
},
//
switchTrainId() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.switchTrainId.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainSwitch.doShow(operate, this.selected);
}
});
}
}
}
</script>
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
this.$refs.popMenu.resetShowPosition(point);
}
},
doClose() {
if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.close();
// this.$store.dispatch('map/setTrainWindowShow', false);
}
},
//
setStoppage() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.stoppage.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
//
cancelStoppage() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.cancelStoppage.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
//
limitSpeed() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.limitSpeed.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
//
addTrainId() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.addTrainId.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainControl.doShow(operate, this.selected);
}
});
},
//
delTrainId() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.delTrainId.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainDelete.doShow(operate, this.selected);
}
});
},
//
editTrainId() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.editTrainId.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainControl.doShow(operate, this.selected);
}
});
},
//
editTrainNo() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.editTrainNo.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainEditNumber.doShow(operate, this.selected);
}
});
},
//
moveTrainId() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.moveTrainId.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainMove.doShow(operate, this.selected);
}
});
},
//
switchTrainId() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.switchTrainId.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainSwitch.doShow(operate, this.selected);
}
});
}
}
};
</script>

View File

@ -1,160 +1,169 @@
<template>
<el-dialog class="beijing-01__systerm stand-stop-time" :title="title" :visible.sync="show" width="320px"
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag>
<el-form size="small" label-width="90px" :model="addModel" :rules="rules" ref="form">
<el-form-item label="车 组 号:" prop="groupNumber">
<el-input v-model="addModel.groupNumber" @change="inputGroupNumber" :id="domIdInput"></el-input>
</el-form-item>
</el-form>
<el-row justify="center" class="button-group">
<el-col :span="10" :offset="2">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button>
</el-col>
<el-col :span="8" :offset="4">
<el-button :id="domIdCancel" @click="cancel"> </el-button>
</el-col>
</el-row>
<confirm-control ref="confirmControl"></confirm-control>
<notice-info ref="noticeInfo"></notice-info>
</el-dialog>
<el-dialog
v-dialogDrag
class="beijing-01__systerm stand-stop-time"
:title="title"
:visible.sync="show"
width="320px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-form ref="form" size="small" label-width="90px" :model="addModel" :rules="rules">
<el-form-item label="车 组 号:" prop="groupNumber">
<el-input :id="domIdInput" v-model="addModel.groupNumber" @change="inputGroupNumber" />
</el-form-item>
</el-form>
<el-row justify="center" class="button-group">
<el-col :span="10" :offset="2">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button>
</el-col>
<el-col :span="8" :offset="4">
<el-button :id="domIdCancel" @click="cancel"> </el-button>
</el-col>
</el-row>
<confirm-control ref="confirmControl" />
<notice-info ref="noticeInfo" />
</el-dialog>
</template>
<script>
import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import { getPublishMapTrainNos } from '@/api/runplan';
import { mouseCancelState } from '../utils/menuItemStatus';
import ConfirmControl from './childDialog/confirmControl';
import NoticeInfo from './childDialog/childDialog/noticeInfo'
import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
// import { getPublishMapTrainNos } from '@/api/runplan';
import { mouseCancelState } from '../utils/menuItemStatus';
import ConfirmControl from './childDialog/confirmControl';
import NoticeInfo from './childDialog/childDialog/noticeInfo';
export default {
name: 'TrainDelete',
components: {
ConfirmControl,
NoticeInfo
},
data() {
return {
trainNoList: [],
selected: null,
addModel: {
groupNumber: '',
},
export default {
name: 'TrainDelete',
components: {
ConfirmControl,
NoticeInfo
},
data() {
return {
trainNoList: [],
selected: null,
addModel: {
groupNumber: ''
},
rules: {
groupNumber: [
{ required: true, message: '请输入车组号', trigger: 'blur' }
],
},
operation: null,
dialogShow: false,
loading: false,
}
},
computed: {
...mapGetters('map', [
'map'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdInput() {
return this.dialogShow ? OperationEvent.Train.delTrainId.input.domId : '';
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return this.dialogShow ? OperationEvent.Train.delTrainId.menu.domId : '';
},
title() {
return '删除车组号'
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
})
},
methods: {
loadInitData(map) {
if (map) {
getPublishMapTrainNos(map.skinCode).then(response => {
this.trainNoList = response.data;
}).catch(error => {
this.$messageBox(`获取列车车组号失败`);
});
}
},
doShow(operate, selected) {
this.selected = selected;
//
if (!this.dialogShow) {
this.operation = operate.operation;
}
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('map/setTrainWindowShow', false);
mouseCancelState(this.selected);
},
inputGroupNumber() {
let operate = {
type: MapDeviceType.Train.type,
operation: OperationEvent.Train.delTrainId.input.operation,
val: this.addModel.groupNumber
}
rules: {
groupNumber: [
{ required: true, message: '请输入车组号', trigger: 'blur' }
]
},
operation: null,
dialogShow: false,
loading: false
};
},
computed: {
...mapGetters('map', [
'map'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdInput() {
return this.dialogShow ? OperationEvent.Train.delTrainId.input.domId : '';
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return this.dialogShow ? OperationEvent.Train.delTrainId.menu.domId : '';
},
title() {
return '删除车组号';
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
});
},
methods: {
loadInitData(map) {
if (map) {
// getPublishMapTrainNos(map.skinCode).then(response => {
// this.trainNoList = response.data;
// }).catch(() => {
// this.$messageBox(``);
// });
}
},
doShow(operate, selected) {
this.selected = selected;
//
if (!this.dialogShow) {
this.operation = operate.operation;
}
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('map/setTrainWindowShow', false);
mouseCancelState(this.selected);
},
inputGroupNumber() {
const operate = {
type: MapDeviceType.Train.type,
operation: OperationEvent.Train.delTrainId.input.operation,
val: this.addModel.groupNumber
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
})
},
commit() {
this.$refs['form'].validate((valid) => {
if (valid) {
let operate = {
send: true,
type: MapDeviceType.Train.type,
operation: OperationEvent.Train.delTrainId.menu.operation,
val: this.addModel.groupNumber
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
});
},
commit() {
this.$refs['form'].validate((valid) => {
if (valid) {
const operate = {
send: true,
type: MapDeviceType.Train.type,
operation: OperationEvent.Train.delTrainId.menu.operation,
val: this.addModel.groupNumber
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(error => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
})
} else {
return false;
}
});
},
cancel() {
let operate = {
type: MapDeviceType.Train.type,
operation: OperationEvent.Command.cancel.menu.operation,
}
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(() => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
} else {
return false;
}
});
},
cancel() {
const operate = {
type: MapDeviceType.Train.type,
operation: OperationEvent.Command.cancel.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(error => { this.doClose(); });
}
}
}
</script>
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(() => { this.doClose(); });
}
}
};
</script>

View File

@ -279,15 +279,6 @@ export default {
]
};
},
watch: {
'$store.state.menuOperation.menuCount': function () {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Train) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
computed: {
...mapGetters('training', [
'mode',
@ -297,6 +288,15 @@ export default {
'buttonOperation'
])
},
watch: {
'$store.state.menuOperation.menuCount': function () {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Train) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
methods: {
clickEvent() {
const self = this;

View File

@ -1,150 +1,162 @@
<template>
<el-dialog class="beijing-01__schedule add-task" :title="title" :visible.sync="dialogShow" width="800px"
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag>
<div style="margin: 10px">
<el-row>
<el-col :span="3">
<el-radio v-model="model.type" label="1">加在最前</el-radio>
</el-col>
<el-col :span="2" :offset="1">
<span>车次号</span>
</el-col>
<el-col :span="5">
<el-select v-model="model.tripNumber" placeholder="请选择">
<el-option v-for="item in tripNumberList" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-col>
<el-col :span="3" :offset="1">
<span>开始时间</span>
</el-col>
<el-col :span="5">
<el-select v-model="model.startTime" placeholder="请选择">
<el-option v-for="item in tripNumberList" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-col>
</el-row>
<el-row>
<el-col :span="3">
<el-radio v-model="model.type" label="2">加在最后</el-radio>
</el-col>
<el-col :span="2" :offset="1">
<span>车次号</span>
</el-col>
<el-col :span="5">
<el-select v-model="model.tripNumber" placeholder="请选择">
<el-option v-for="item in tripNumberList" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-col>
<el-col :span="3" :offset="1">
<span>开始时间</span>
</el-col>
<el-col :span="5">
<el-select v-model="model.startTime" placeholder="请选择">
<el-option v-for="item in tripNumberList" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-col>
<el-dialog
v-dialogDrag
class="beijing-01__schedule add-task"
:title="title"
:visible.sync="dialogShow"
width="800px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<div style="margin: 10px">
<el-row>
<el-col :span="3">
<el-radio v-model="model.type" label="1">加在最前</el-radio>
</el-col>
<el-col :span="2" :offset="1">
<span>车次号</span>
</el-col>
<el-col :span="5">
<el-select v-model="model.tripNumber" placeholder="请选择">
<el-option
v-for="item in tripNumberList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-col>
<el-col :span="3" :offset="1">
<span>开始时间</span>
</el-col>
<el-col :span="5">
<el-select v-model="model.startTime" placeholder="请选择">
<el-option
v-for="item in tripNumberList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-col>
</el-row>
<el-row>
<el-col :span="3">
<el-radio v-model="model.type" label="2">加在最后</el-radio>
</el-col>
<el-col :span="2" :offset="1">
<span>车次号</span>
</el-col>
<el-col :span="5">
<el-select v-model="model.tripNumber" placeholder="请选择">
<el-option
v-for="item in tripNumberList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-col>
<el-col :span="3" :offset="1">
<span>开始时间</span>
</el-col>
<el-col :span="5">
<el-select v-model="model.startTime" placeholder="请选择">
<el-option
v-for="item in tripNumberList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-col>
</el-row>
<el-row style="margin-bottom: 5px;">
交路
</el-row>
<el-row>
<el-table :data="model.route" border :height="180">
<el-table-column prop="date" label="日期" width="180">
</el-table-column>
<el-table-column prop="name" label="姓名" width="180">
</el-table-column>
<el-table-column prop="address" label="地址">
</el-table-column>
<el-table-column width="20">
</el-table-column>
</el-table>
</el-row>
<el-row style=" margin-bottom: 5px;margin-top: 10px;">
详情
</el-row>
<el-row>
<el-table :data="model.detail" border :height="180">
<el-table-column prop="date" label="日期" width="180">
</el-table-column>
<el-table-column prop="name" label="姓名" width="180">
</el-table-column>
<el-table-column prop="address" label="地址">
</el-table-column>
<el-table-column width="20">
</el-table-column>
</el-table>
</el-row>
<el-row>
<el-col :offset="16">
<el-checkbox v-model="model.default">显示默认停站时间和运行等级</el-checkbox>
</el-col>
</el-row>
</div>
<el-row type="flex" justify="center" class="button-group">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
</el-dialog>
</el-row>
<el-row style="margin-bottom: 5px;">
交路
</el-row>
<el-row>
<el-table :data="model.route" border :height="180">
<el-table-column prop="date" label="日期" width="180" />
<el-table-column prop="name" label="姓名" width="180" />
<el-table-column prop="address" label="地址" />
<el-table-column width="20" />
</el-table>
</el-row>
<el-row style=" margin-bottom: 5px;margin-top: 10px;">
详情
</el-row>
<el-row>
<el-table :data="model.detail" border :height="180">
<el-table-column prop="date" label="日期" width="180" />
<el-table-column prop="name" label="姓名" width="180" />
<el-table-column prop="address" label="地址" />
<el-table-column width="20" />
</el-table>
</el-row>
<el-row>
<el-col :offset="16">
<el-checkbox v-model="model.default">显示默认停站时间和运行等级</el-checkbox>
</el-col>
</el-row>
</div>
<el-row type="flex" justify="center" class="button-group">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
</el-dialog>
</template>
<script>
export default {
name: 'AddTask',
components: {
},
data() {
return {
dialogShow: false,
loading: false,
model: {
type: '1',
serviceNumber: '',
tripNumber: '',
startTime: '',
default: false,
route: [],
detail: []
},
tripNumberList: [],
}
},
computed: {
title() {
return '添加任务'
}
},
mounted() {
},
methods: {
doShow(params) {
this.model.serviceNumber = params.serviceNumber;
this.model.tripNumber = params.tripNumber;
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleCommit() {
this.doClose();
}
}
}
export default {
name: 'AddTask',
components: {
},
data() {
return {
dialogShow: false,
loading: false,
model: {
type: '1',
serviceNumber: '',
tripNumber: '',
startTime: '',
default: false,
route: [],
detail: []
},
tripNumberList: []
};
},
computed: {
title() {
return '添加任务';
}
},
mounted() {
},
methods: {
doShow(params) {
this.model.serviceNumber = params.serviceNumber;
this.model.tripNumber = params.tripNumber;
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleCommit() {
this.doClose();
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
/deep/ {
.el-button {
margin-left: 40px !important;
@ -160,4 +172,4 @@
line-height: 20px !important;
}
}
</style>
</style>

View File

@ -18,9 +18,9 @@
</template>
<script>
import { runPlanTemplateList, generateUserRunPlanEveryDay } from '@/api/runplan';
import { runPlanTemplateList } from '@/api/runplan';
import { getStationListBySkinCode } from '@/api/runplan';
import { getEveryDayRunPlanData } from '@/api/simulation';
import { getEveryDayRunPlanData, generateDayRunPlan } from '@/api/simulation';
import { getSkinCodeList } from '@/api/management/mapskin';
export default {
@ -100,7 +100,7 @@ export default {
const choose = this.$refs.pageRules.currentChoose();
if (choose && choose.id) {
this.loading = true;
generateUserRunPlanEveryDay(choose.id, this.$route.query.group).then(response => {
generateDayRunPlan(choose.id, this.$route.query.group).then(response => {
this.loading = false;
this.reloadTable();
this.loadRunData();

View File

@ -1,116 +1,126 @@
<template>
<el-dialog class="beijing-01__schedule create-week-plan" :title="title" :visible.sync="dialogShow" width="800px"
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag>
<el-row>
<el-form ref="form" :model="model" :rules="rules" label-width="140px" size="small">
<el-form-item label="运行图名称:" prop="planId">
<el-row>
<el-col :span="19">
<el-input v-model="model.planName" :readonly="true"></el-input>
</el-col>
<el-col :span="4" :offset="1">
<el-button @click="handleChoose">选择 </el-button>
</el-col>
</el-row>
</el-form-item>
<el-form-item label="计划日期范围:" prop="dateList">
<el-row>
<el-date-picker type="dates" v-model="model.dateList" :clearable="false" placeholder="选择一个或多个日期"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-row>
</el-form-item>
</el-form>
</el-row>
<el-row type="flex" justify="center" class="button-group">
<el-button @click="create"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
<choose-template-plan ref="choose" @chooseConfirm="chooseConfirm"></choose-template-plan>
</el-dialog>
<el-dialog
v-dialogDrag
class="beijing-01__schedule create-week-plan"
:title="title"
:visible.sync="dialogShow"
width="800px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-row>
<el-form ref="form" :model="model" :rules="rules" label-width="140px" size="small">
<el-form-item label="运行图名称:" prop="planId">
<el-row>
<el-col :span="19">
<el-input v-model="model.planName" :readonly="true" />
</el-col>
<el-col :span="4" :offset="1">
<el-button @click="handleChoose">选择 </el-button>
</el-col>
</el-row>
</el-form-item>
<el-form-item label="计划日期范围:" prop="dateList">
<el-row>
<el-date-picker
v-model="model.dateList"
type="dates"
:clearable="false"
placeholder="选择一个或多个日期"
value-format="yyyy-MM-dd"
/>
</el-row>
</el-form-item>
</el-form>
</el-row>
<el-row type="flex" justify="center" class="button-group">
<el-button @click="create"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
<choose-template-plan ref="choose" @chooseConfirm="chooseConfirm" />
</el-dialog>
</template>
<script>
import { createRunPlanLoad } from '@/api/runplan';
import ChooseTemplatePlan from './chooseTemplatePlan';
import { createRunPlanLoad } from '@/api/runplan';
import ChooseTemplatePlan from './chooseTemplatePlan';
export default {
name: 'CreateWeekPlan',
components: {
ChooseTemplatePlan
},
data() {
return {
dialogShow: false,
loading: false,
model: {
planId: '',
planName: '',
dateList: [],
}
}
},
computed: {
title() {
return '创建一周计划'
},
rules() {
let rules = {
planId: [
{ required: true, message: '请选择模板运行图', trigger: 'blur' }
],
dateList: [
{ required: true, message: '请选择计划日期范围', trigger: 'change' }
]
}
export default {
name: 'CreateWeekPlan',
components: {
ChooseTemplatePlan
},
data() {
return {
dialogShow: false,
loading: false,
model: {
planId: '',
planName: '',
dateList: []
}
};
},
computed: {
title() {
return '创建一周计划';
},
rules() {
const rules = {
planId: [
{ required: true, message: '请选择模板运行图', trigger: 'blur' }
],
dateList: [
{ required: true, message: '请选择计划日期范围', trigger: 'change' }
]
};
return rules;
}
},
mounted() {
},
methods: {
doShow(params) {
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleChoose() {
this.$refs.choose.doShow();
},
chooseConfirm(choose) {
if (choose) {
this.model.planId = choose.id;
this.model.planName = choose.name;
}
},
buildModel() {
return this.model.dateList.map(date => {
return {
loadTime: date,
mapId: this.$route.query.mapId,
templatePlanId: this.model.planId
}
});
},
create() {
this.$refs['form'].validate((valid) => {
if (valid) {
createRunPlanLoad(this.buildModel()).then(response => {
this.$message.success('创建运行图计划成功');
this.$emit('reloadTable', { name: 'managePlanList' });
this.doClose();
}).catch(error => {
this.doClose();
this.$messageBox('创建运行图计划失败');
})
}
});
}
}
}
return rules;
}
},
mounted() {
},
methods: {
doShow(params) {
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleChoose() {
this.$refs.choose.doShow();
},
chooseConfirm(choose) {
if (choose) {
this.model.planId = choose.id;
this.model.planName = choose.name;
}
},
buildModel() {
return {
planDateList: this.model.dateList,
mapId: this.$route.query.mapId,
templatePlanId: this.model.planId
};
},
create() {
this.$refs['form'].validate((valid) => {
if (valid) {
createRunPlanLoad(this.buildModel()).then(response => {
this.$message.success('创建运行图计划成功');
this.doClose();
}).catch(() => {
this.doClose();
this.$messageBox('创建运行图计划失败');
});
}
});
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
@ -124,4 +134,4 @@
margin: 10px;
}
}
</style>
</style>

View File

@ -1,57 +1,66 @@
<template>
<el-dialog class="beijing-01__schedule delete-task" :title="title" :visible.sync="dialogShow" width="400px"
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag>
<el-row>
<el-radio v-model="type" :label="1">删除以前所有任务包含本任务</el-radio>
</el-row>
<el-row>
<el-radio v-model="type" :label="2">删除以后所有任务包含本任务</el-radio>
</el-row>
<el-row type="flex" justify="center" class="button-group">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
</el-dialog>
<el-dialog
v-dialogDrag
class="beijing-01__schedule delete-task"
:title="title"
:visible.sync="dialogShow"
width="400px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-row>
<el-radio v-model="type" :label="1">删除以前所有任务包含本任务</el-radio>
</el-row>
<el-row>
<el-radio v-model="type" :label="2">删除以后所有任务包含本任务</el-radio>
</el-row>
<el-row type="flex" justify="center" class="button-group">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
</el-dialog>
</template>
<script>
export default {
name: 'DeleteTask',
components: {
},
data() {
return {
dialogShow: false,
loading: false,
tripNumber: '',
serviceNumber: '',
type: '1',
}
},
computed: {
title() {
return '删除任务'
}
},
mounted() {
},
methods: {
doShow(params) {
this.tripNumber = params.tripNumber;
this.serviceNumber = params.serviceNumber;
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleCommit() {
// this.tripNumber
this.doClose();
}
}
}
export default {
name: 'DeleteTask',
components: {
},
data() {
return {
dialogShow: false,
loading: false,
tripNumber: '',
serviceNumber: '',
type: '1'
};
},
computed: {
title() {
return '删除任务';
}
},
mounted() {
},
methods: {
doShow(params) {
this.tripNumber = params.tripNumber;
this.serviceNumber = params.serviceNumber;
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleCommit() {
// this.tripNumber
this.doClose();
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
@ -61,4 +70,4 @@
margin: 10px;
}
}
</style>
</style>

View File

@ -1,46 +1,55 @@
<template>
<el-dialog class="beijing-01__schedule create-week-plan" :title="title" :visible.sync="dialogShow" width="400px"
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag>
<el-row type="flex" justify="center" class="button-group">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
</el-dialog>
<el-dialog
v-dialogDrag
class="beijing-01__schedule create-week-plan"
:title="title"
:visible.sync="dialogShow"
width="400px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-row type="flex" justify="center" class="button-group">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
</el-dialog>
</template>
<script>
export default {
name: 'DeleteTodayPlan',
components: {
},
data() {
return {
dialogShow: false,
loading: false
}
},
computed: {
title() {
return '删除当天计划'
}
},
mounted() {
},
methods: {
doShow(params) {
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleCommit() {
// this.tripNumber
this.doClose();
}
}
}
export default {
name: 'DeleteTodayPlan',
components: {
},
data() {
return {
dialogShow: false,
loading: false
};
},
computed: {
title() {
return '删除当天计划';
}
},
mounted() {
},
methods: {
doShow(params) {
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleCommit() {
// this.tripNumber
this.doClose();
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
@ -50,4 +59,4 @@
margin: 10px;
}
}
</style>
</style>

View File

@ -1,122 +1,143 @@
<template>
<el-dialog class="beijing-01__schedule manage-plan-list" :title="title" :visible.sync="dialogShow" width="80%"
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList">
</QueryListPage>
</el-dialog>
<el-dialog
v-dialogDrag
class="beijing-01__schedule manage-plan-list"
:title="title"
:visible.sync="dialogShow"
width="80%"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</el-dialog>
</template>
<script>
import { getRunPlanLoadList, deleteRunPlanLoad } from '@/api/runplan';
import { getRunPlanLoadList, deleteRunPlanLoad, listAllTempLateRunPlan } from '@/api/runplan';
import { listPublishMap } from '@/api/jmap/map';
export default {
name: 'ManagePlanList',
data() {
return {
dialogShow: false,
loading: false,
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '140px',
reset: true,
queryObject: {
runPlanName: {
type: 'text',
label: '运行图名称'
}
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '地图名称',
prop: 'mapName'
},
{
title: '运行图名称',
prop: 'runPlanName',
},
{
title: '加载日期',
prop: 'loadTime'
},
{
type: 'button',
title: '操作',
width: '100',
buttons: [
{
name: '删除',
handleClick: this.handleDelete,
type: 'danger'
}
]
}
],
actions: [
{ text: '创建', btnCode: 'employee_insert', handler: this.handleCreateRunPlan },
]
},
export default {
name: 'ManagePlanList',
data() {
return {
dialogShow: false,
loading: false,
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '140px',
reset: true
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('publish.mapName'),
prop: 'mapId',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.mapId, this.mapList, ['id', 'name']); },
tagType: (row) => { return ''; }
},
{
title: this.$t('publish.runPlanName'),
prop: 'templatePlanId',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.templatePlanId, this.templatePlanList, ['id', 'name']); },
tagType: (row) => { return 'success'; }
},
{
title: '加载日期',
prop: 'loadTime'
},
{
type: 'button',
title: '操作',
width: '100',
buttons: [
{
name: '删除',
handleClick: this.handleDelete,
type: 'danger'
}
]
}
],
actions: [
{ text: '创建', btnCode: 'employee_insert', handler: this.handleCreateRunPlan }
]
},
currentModel: {}
}
},
computed: {
title() {
return '运行图计划表'
}
},
created() {
},
methods: {
queryFunction(params) {
if (this.$route.query.mapId) {
params['mapId'] = this.$route.query.mapId;
}
currentModel: {}
};
},
computed: {
title() {
return '运行图计划表';
}
},
mounted() {
this.loadPageData();
},
methods: {
loadPageData() {
this.mapList = [];
listPublishMap().then(resp => {
this.mapList = resp.data;
});
this.templatePlanList = [];
listAllTempLateRunPlan().then(resp => {
this.templatePlanList = resp.data;
});
},
queryFunction(params) {
if (this.$route.query.mapId) {
params['mapId'] = this.$route.query.mapId;
}
if (this.$store.state.user.id) {
params['userId'] = this.$store.state.user.id;
}
if (this.$store.state.user.id) {
params['userId'] = this.$store.state.user.id;
}
return getRunPlanLoadList(params);
},
handleDelete(index, row) {
this.$confirm('此操作将删除次日加载的运行图, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteRunPlanLoad(row.id).then(response => {
this.$message.success('删除成功')
this.reloadTable()
}).catch(error => {
this.reloadTable()
this.$messageBox('删除失败')
})
}).catch(() => { })
},
handleCreateRunPlan() {
this.$emit('dispatchDialog', { name: 'createWeekPlan' });
},
doShow() {
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
reloadTable() {
this.queryList.reload()
}
}
}
return getRunPlanLoadList(params);
},
handleDelete(index, row) {
this.$confirm('此操作将删除次日加载的运行图, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteRunPlanLoad(row.id).then(response => {
this.$message.success('删除成功');
this.reloadTable();
}).catch(() => {
this.reloadTable();
this.$messageBox('删除失败');
});
}).catch(() => { });
},
handleCreateRunPlan() {
this.$emit('dispatchDialog', { name: 'createWeekPlan' });
},
doShow() {
this.dialogShow = true;
this.$nextTick(()=> { this.reloadTable(); });
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
reloadTable() {
this.queryList.reload();
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
</style>
</style>

View File

@ -27,7 +27,6 @@ import ModifyingPlan from '../menusPlan/modifyingPlan';
import AddTask from '../menusPlan/addTask';
import DeleteTask from '../menusPlan/deleteTask';
import ModifyingTask from '../menusPlan/modifyingTask';
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
export default {
name: 'Menus',
@ -44,9 +43,6 @@ export default {
DeleteTask,
ModifyingTask
},
mixins: [
WindowResizeHandler
],
props: {
group: {
type: String,
@ -55,20 +51,20 @@ export default {
},
data() {
return {
width: 0,
height: 0
};
},
computed: {
skinCode() {
return this.$route.query.skinCode || '02';
},
width() {
return this.$store.state.app.width;
},
height() {
return this.$store.state.app.height;
}
},
methods: {
resizeHandler() {
this.width = this._clientWidth;
this.height = this._clientHeight;
},
setPosition() {
this.$nextTick(() => {
this.$refs.schedule.setPosition();

View File

@ -1,143 +1,152 @@
<template>
<el-dialog class="chengdou-03__systerm stand-stop-time" :title="title" :visible.sync="show" width="320px"
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag>
<el-form size="small" label-width="90px" :model="addModel" :rules="rules" ref="form">
<el-form-item label="车 组 号:" prop="groupNumber">
<el-input v-model="addModel.groupNumber"></el-input>
</el-form-item>
</el-form>
<el-row justify="center" class="button-group">
<el-col :span="10" :offset="2">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button>
</el-col>
<el-col :span="8" :offset="4">
<el-button :id="domIdCancel" @click="cancel"> </el-button>
</el-col>
</el-row>
<confirm-control ref="confirmControl"></confirm-control>
<notice-info ref="noticeInfo"></notice-info>
</el-dialog>
<el-dialog
v-dialogDrag
class="chengdou-03__systerm stand-stop-time"
:title="title"
:visible.sync="show"
width="320px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-form ref="form" size="small" label-width="90px" :model="addModel" :rules="rules">
<el-form-item label="车 组 号:" prop="groupNumber">
<el-input v-model="addModel.groupNumber" />
</el-form-item>
</el-form>
<el-row justify="center" class="button-group">
<el-col :span="10" :offset="2">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button>
</el-col>
<el-col :span="8" :offset="4">
<el-button :id="domIdCancel" @click="cancel"> </el-button>
</el-col>
</el-row>
<confirm-control ref="confirmControl" />
<notice-info ref="noticeInfo" />
</el-dialog>
</template>
<script>
import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import { getPublishMapTrainNos } from '@/api/runplan';
import { mouseCancelState } from '../utils/menuItemStatus';
import ConfirmControl from './childDialog/confirmControl';
import NoticeInfo from './childDialog/childDialog/noticeInfo'
import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
// import { getPublishMapTrainNos } from '@/api/runplan';
import { mouseCancelState } from '../utils/menuItemStatus';
import ConfirmControl from './childDialog/confirmControl';
import NoticeInfo from './childDialog/childDialog/noticeInfo';
export default {
name: 'TrainDelete',
components: {
ConfirmControl,
NoticeInfo
},
data() {
return {
trainNoList: [],
selected: null,
addModel: {
groupNumber: '',
},
export default {
name: 'TrainDelete',
components: {
ConfirmControl,
NoticeInfo
},
data() {
return {
trainNoList: [],
selected: null,
addModel: {
groupNumber: ''
},
rules: {
groupNumber: [
{ required: true, message: '请输入车组号', trigger: 'blur' }
],
},
operation: null,
dialogShow: false,
loading: false,
}
},
computed: {
...mapGetters('map', [
'map'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return this.dialogShow ? OperationEvent.Train.delTrainId.menu.domId : '';
},
title() {
return '删除列车识别号'
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
})
},
methods: {
loadInitData(map) {
if (map) {
getPublishMapTrainNos(map.skinCode).then(response => {
this.trainNoList = response.data;
}).catch(error => {
this.$messageBox(`获取列车车组号失败`);
});
}
},
doShow(operate, selected) {
this.selected = selected;
//
if (!this.dialogShow) {
this.operation = operate.operation;
}
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('map/setTrainWindowShow', false);
mouseCancelState(this.selected);
},
commit() {
this.$refs['form'].validate((valid) => {
if (valid) {
let operate = {
send: true,
type: MapDeviceType.Train.type,
operation: OperationEvent.Train.delTrainId.menu.operation,
}
rules: {
groupNumber: [
{ required: true, message: '请输入车组号', trigger: 'blur' }
]
},
operation: null,
dialogShow: false,
loading: false
};
},
computed: {
...mapGetters('map', [
'map'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return this.dialogShow ? OperationEvent.Train.delTrainId.menu.domId : '';
},
title() {
return '删除列车识别号';
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
});
},
methods: {
loadInitData(map) {
if (map) {
// getPublishMapTrainNos(map.skinCode).then(response => {
// this.trainNoList = response.data;
// }).catch(() => {
// this.$messageBox(``);
// });
}
},
doShow(operate, selected) {
this.selected = selected;
//
if (!this.dialogShow) {
this.operation = operate.operation;
}
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('map/setTrainWindowShow', false);
mouseCancelState(this.selected);
},
commit() {
this.$refs['form'].validate((valid) => {
if (valid) {
const operate = {
send: true,
type: MapDeviceType.Train.type,
operation: OperationEvent.Train.delTrainId.menu.operation
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(error => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
})
} else {
return false;
}
});
},
cancel() {
let operate = {
type: MapDeviceType.Train.type,
operation: OperationEvent.Command.cancel.menu.operation,
}
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(() => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
} else {
return false;
}
});
},
cancel() {
const operate = {
type: MapDeviceType.Train.type,
operation: OperationEvent.Command.cancel.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(error => { this.doClose(); });
}
}
}
</script>
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(() => { this.doClose(); });
}
}
};
</script>

View File

@ -755,9 +755,11 @@ export default {
},
initMenu(menu) {
this.menu = menuBarConvert(this.menuNormal[SystemType[this.$store.state.training.prdType]], this.$store.state.training.operatemode);
this.menu[2].children = this.initStationList();
this.clickEvent();
this.closeMenu(true);
if (this.menu.length) {
this.menu[2].children = this.initStationList();
this.clickEvent();
this.closeMenu(true);
}
},
clickEvent() {
const self = this;

View File

@ -1,488 +1,491 @@
<template>
<div>
<pop-menu ref="popMenu" :menu="menu"></pop-menu>
<notice-info ref="noticeInfo"></notice-info>
<train-control ref="trainControl"></train-control>
<train-delete ref="trainDelete"></train-delete>
<train-move ref="trainMove"></train-move>
<train-switch ref="trainSwitch"></train-switch>
<train-edit-number ref="trainEditNumber"></train-edit-number>
<train-create-number ref="trainCreateNumber"></train-create-number>
<train-move-number ref="trainMoveNumber"></train-move-number>
<train-delete-number ref="trainDeleteNumber"></train-delete-number>
<train-detail-info ref="trainDetailInfo"></train-detail-info>
</div>
<div>
<pop-menu ref="popMenu" :menu="menu" />
<notice-info ref="noticeInfo" />
<train-control ref="trainControl" />
<train-delete ref="trainDelete" />
<train-move ref="trainMove" />
<train-switch ref="trainSwitch" />
<train-edit-number ref="trainEditNumber" />
<train-create-number ref="trainCreateNumber" />
<train-move-number ref="trainMoveNumber" />
<train-delete-number ref="trainDeleteNumber" />
<train-detail-info ref="trainDetailInfo" />
</div>
</template>
<script>
import PopMenu from '@/components/PopMenu';
import NoticeInfo from './dialog/childDialog/childDialog/noticeInfo'
import { mapGetters } from 'vuex';
import { TrainingMode, OperateMode } from '@/scripts/ConstDic';
import { MapDeviceType, OperationEvent, DeviceMenu } from '@/scripts/ConstDic';
import { MenuDisabledState, menuConvert, trainMenuFiltration } from './utils/menuItemStatus';
import TrainControl from './dialog/trainControl';
import TrainDelete from './dialog/trainDelete';
import TrainMove from './dialog/trainMove';
import TrainSwitch from './dialog/trainSwitch';
import TrainEditNumber from './dialog/trainEditNumber';
import TrainMoveNumber from './dialog/trainMoveNumber';
import TrainCreateNumber from './dialog/trainCreateNumber';
import TrainDeleteNumber from './dialog/trainDeleteNumber';
import TrainDetailInfo from './dialog/trainDetailInfo';
import { mouseCancelState } from './utils/menuItemStatus';
import PopMenu from '@/components/PopMenu';
import NoticeInfo from './dialog/childDialog/childDialog/noticeInfo';
import { mapGetters } from 'vuex';
import { OperateMode } from '@/scripts/ConstDic';
import { MapDeviceType, OperationEvent, DeviceMenu } from '@/scripts/ConstDic';
import { MenuDisabledState, menuConvert, trainMenuFiltration } from './utils/menuItemStatus';
import TrainControl from './dialog/trainControl';
import TrainDelete from './dialog/trainDelete';
import TrainMove from './dialog/trainMove';
import TrainSwitch from './dialog/trainSwitch';
import TrainEditNumber from './dialog/trainEditNumber';
import TrainMoveNumber from './dialog/trainMoveNumber';
import TrainCreateNumber from './dialog/trainCreateNumber';
import TrainDeleteNumber from './dialog/trainDeleteNumber';
import TrainDetailInfo from './dialog/trainDetailInfo';
import { mouseCancelState } from './utils/menuItemStatus';
export default {
name: 'menuTrain',
props: {
selected: {
type: Object
}
},
components: {
PopMenu,
NoticeInfo,
TrainControl,
TrainDelete,
TrainMove,
TrainSwitch,
TrainEditNumber,
TrainMoveNumber,
TrainCreateNumber,
TrainDeleteNumber,
TrainDetailInfo,
},
data() {
return {
menu: [],
menuNormal: {
local: [],
central: [
{
label: '新建车组号',
handler: this.createTrainNo,
disabledCallback: MenuDisabledState.Train.createTrainNo,
auth: { station: true, center: true }
},
{
label: '移动车组号',
handler: this.moveTrainNo,
disabledCallback: MenuDisabledState.Train.moveTrainNo,
auth: { station: true, center: true }
},
{
label: '删除车组号',
handler: this.deleteTrainNo,
disabledCallback: MenuDisabledState.Train.deleteTrainNo,
auth: { station: true, center: true }
},
{
label: '修改车组号',
handler: this.editTrainNo,
disabledCallback: MenuDisabledState.Train.editTrainNo,
auth: { station: true, center: true }
},
{
label: '设计划车',
handler: this.setPlanTrainId,
disabledCallback: MenuDisabledState.Train.setPlanTrainId,
auth: { station: true, center: true }
},
{
label: '设目的地',
handler: this.destinationTrainId,
disabledCallback: MenuDisabledState.Train.destinationTrainId,
auth: { station: true, center: true }
},
{
label: '设人工车',
handler: this.artificialTrainId,
disabledCallback: MenuDisabledState.Train.artificialTrainId,
auth: { station: true, center: true }
},
{
label: '设特殊人工车',
handler: this.undeveloped,
disabledCallback: MenuDisabledState.Train.moveTrainId,
auth: { station: true, center: true}
},
{
label: '详细列车信息',
handler: this.detailTrainInfo,
disabledCallback: MenuDisabledState.Train.detailTrainInfo,
auth: { station: true, center: true}
},
{
label: '属性',
handler: this.undeveloped,
disabledCallback: MenuDisabledState.Train.moveTrainId,
auth: { station: true, center: true}
}
export default {
name: 'MenuTrain',
components: {
PopMenu,
NoticeInfo,
TrainControl,
TrainDelete,
TrainMove,
TrainSwitch,
TrainEditNumber,
TrainMoveNumber,
TrainCreateNumber,
TrainDeleteNumber,
TrainDetailInfo
},
props: {
selected: {
type: Object,
default() {
return null;
}
}
},
data() {
return {
menu: [],
menuNormal: {
local: [],
central: [
{
label: '新建车组号',
handler: this.createTrainNo,
disabledCallback: MenuDisabledState.Train.createTrainNo,
auth: { station: true, center: true }
},
{
label: '移动车组号',
handler: this.moveTrainNo,
disabledCallback: MenuDisabledState.Train.moveTrainNo,
auth: { station: true, center: true }
},
{
label: '删除车组号',
handler: this.deleteTrainNo,
disabledCallback: MenuDisabledState.Train.deleteTrainNo,
auth: { station: true, center: true }
},
{
label: '修改车组号',
handler: this.editTrainNo,
disabledCallback: MenuDisabledState.Train.editTrainNo,
auth: { station: true, center: true }
},
{
label: '设计划车',
handler: this.setPlanTrainId,
disabledCallback: MenuDisabledState.Train.setPlanTrainId,
auth: { station: true, center: true }
},
{
label: '设目的地',
handler: this.destinationTrainId,
disabledCallback: MenuDisabledState.Train.destinationTrainId,
auth: { station: true, center: true }
},
{
label: '设人工车',
handler: this.artificialTrainId,
disabledCallback: MenuDisabledState.Train.artificialTrainId,
auth: { station: true, center: true }
},
{
label: '设特殊人工车',
handler: this.undeveloped,
disabledCallback: MenuDisabledState.Train.moveTrainId,
auth: { station: true, center: true}
},
{
label: '详细列车信息',
handler: this.detailTrainInfo,
disabledCallback: MenuDisabledState.Train.detailTrainInfo,
auth: { station: true, center: true}
},
{
label: '属性',
handler: this.undeveloped,
disabledCallback: MenuDisabledState.Train.moveTrainId,
auth: { station: true, center: true}
}
]
},
menuForce: [
{
label: '设置通信故障',
handler: this.setStoppage,
disabledCallback: MenuDisabledState.Train.setStoppage
},
{
label: '取消通信故障',
handler: this.cancelStoppage,
disabledCallback: MenuDisabledState.Train.cancelStoppage
}
],
menuSpeed: [
{
label: '确认运行至前方站',
handler: this.limitSpeed,
disabledCallback: MenuDisabledState.Train.limitSpeed
}
]
}
},
watch: {
'$store.state.menuOperation.menuCount': function () {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Train) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
computed: {
...mapGetters('training', [
'mode',
'operatemode'
]),
...mapGetters('menuOperation', [
'buttonOperation'
])
},
methods: {
clickEvent() {
let self = this;
window.onclick = function (e) {
self.doClose();
}
},
initMenu() {
//
this.menu = trainMenuFiltration(this.menuNormal);
if (this.operatemode === OperateMode.ADMIN) {
this.menu = [...this.menu, ...this.menuForce, ...this.menuSpeed]
}
]
},
menuForce: [
{
label: '设置通信故障',
handler: this.setStoppage,
disabledCallback: MenuDisabledState.Train.setStoppage
},
{
label: '取消通信故障',
handler: this.cancelStoppage,
disabledCallback: MenuDisabledState.Train.cancelStoppage
}
],
menuSpeed: [
{
label: '确认运行至前方站',
handler: this.limitSpeed,
disabledCallback: MenuDisabledState.Train.limitSpeed
}
]
};
},
computed: {
...mapGetters('training', [
'mode',
'operatemode'
]),
...mapGetters('menuOperation', [
'buttonOperation'
])
},
watch: {
'$store.state.menuOperation.menuCount': function () {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Train) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
methods: {
clickEvent() {
const self = this;
window.onclick = function (e) {
self.doClose();
};
},
initMenu() {
//
this.menu = trainMenuFiltration(this.menuNormal);
if (this.operatemode === OperateMode.ADMIN) {
this.menu = [...this.menu, ...this.menuForce, ...this.menuSpeed];
}
//
if (this.operatemode === OperateMode.FAULT) {
this.menu = [...this.menuForce, ...this.menuSpeed]
}
//
if (this.operatemode === OperateMode.FAULT) {
this.menu = [...this.menuForce, ...this.menuSpeed];
}
this.menu = menuConvert(this.menu);
},
doShow(point) {
this.clickEvent();
this.initMenu();
this.menu = menuConvert(this.menu);
},
doShow(point) {
this.clickEvent();
this.initMenu();
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
this.$refs.popMenu.resetShowPosition(point);
}
},
doClose() {
if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.close();
// this.$store.dispatch('map/setTrainWindowShow', false);
}
},
//
setStoppage() {
let operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.stoppage.menu.operation
};
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
this.$refs.popMenu.resetShowPosition(point);
}
},
doClose() {
if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.close();
// this.$store.dispatch('map/setTrainWindowShow', false);
}
},
//
setStoppage() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.stoppage.menu.operation
};
mouseCancelState(this.selected);
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(error => {
this.$refs.noticeInfo.doShow(operate);
})
},
//
cancelStoppage() {
let operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.cancelStoppage.menu.operation
};
mouseCancelState(this.selected);
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
//
cancelStoppage() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.cancelStoppage.menu.operation
};
mouseCancelState(this.selected);
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(error => {
this.$refs.noticeInfo.doShow(operate);
})
},
//
limitSpeed() {
let operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.limitSpeed.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(error => {
this.$refs.noticeInfo.doShow(operate);
})
},
//
setPlanTrainId() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.setPlanTrainId.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainControl.doShow(operate, this.selected);
} else {
this.$refs.noticeInfo.doShow(operate);
}
})
},
//
destinationTrainId() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.destinationTrainId.menu.operation
};
this.$store.dispatch('training/next',operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainControl.doShow(operate, this.selected);
} else {
this.$refs.noticeInfo.doShow(operate);
}
})
},
//
artificialTrainId() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.artificialTrainId.menu.operation
};
this.$store.dispatch('training/next',operate).then(({ valid }) => {
if(valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainControl.doShow(operate, this.selected);
} else {
this.$refs.noticeInfo.doShow(operate);
}
})
},
//
detailTrainInfo() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.detailTrainInfo.menu.operation
};
this.$store.dispatch('training/next',operate).then(({ valid }) => {
if (valid){
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainDetailInfo.doShow(operate, this.selected);
} else {
this.$refs.noticeInfo.doShow(operate);
}
})
},
undeveloped() {
this.doClose();
this.$alert('实现中......', '提示', {
confirmButtonText: '确定',
callback: action => {
}
});
},
//
addTrainId() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.addTrainId.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainControl.doShow(operate, this.selected);
}
});
},
//
createTrainNo() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.createTrainNo.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainCreateNumber.doShow(operate, this.selected);
}
});
},
//
delTrainId() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.delTrainId.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainDelete.doShow(operate, this.selected);
}
});
},
//
deleteTrainNo() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.deleteTrainNo.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainDeleteNumber.doShow(operate, this.selected);
}
});
},
//
editTrainId() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.editTrainId.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainControl.doShow(operate, this.selected);
}
});
},
//
editTrainNo() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.editTrainNo.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainEditNumber.doShow(operate, this.selected);
}
});
},
//
moveTrainNo() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.moveTrainNo.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainMoveNumber.doShow(operate, this.selected);
}
});
},
//
moveTrainId() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.moveTrainId.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainMove.doShow(operate, this.selected);
}
});
},
//
switchTrainId() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.switchTrainId.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainSwitch.doShow(operate, this.selected);
}
});
}
}
}
mouseCancelState(this.selected);
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
//
limitSpeed() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.limitSpeed.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
//
setPlanTrainId() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.setPlanTrainId.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainControl.doShow(operate, this.selected);
} else {
this.$refs.noticeInfo.doShow(operate);
}
});
},
//
destinationTrainId() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.destinationTrainId.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainControl.doShow(operate, this.selected);
} else {
this.$refs.noticeInfo.doShow(operate);
}
});
},
//
artificialTrainId() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.artificialTrainId.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainControl.doShow(operate, this.selected);
} else {
this.$refs.noticeInfo.doShow(operate);
}
});
},
//
detailTrainInfo() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.detailTrainInfo.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainDetailInfo.doShow(operate, this.selected);
} else {
this.$refs.noticeInfo.doShow(operate);
}
});
},
undeveloped() {
this.doClose();
this.$alert('实现中......', '提示', {
confirmButtonText: '确定',
callback: action => {
}
});
},
//
addTrainId() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.addTrainId.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainControl.doShow(operate, this.selected);
}
});
},
//
createTrainNo() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.createTrainNo.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainCreateNumber.doShow(operate, this.selected);
}
});
},
//
delTrainId() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.delTrainId.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainDelete.doShow(operate, this.selected);
}
});
},
//
deleteTrainNo() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.deleteTrainNo.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainDeleteNumber.doShow(operate, this.selected);
}
});
},
//
editTrainId() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.editTrainId.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainControl.doShow(operate, this.selected);
}
});
},
//
editTrainNo() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.editTrainNo.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainEditNumber.doShow(operate, this.selected);
}
});
},
//
moveTrainNo() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.moveTrainNo.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainMoveNumber.doShow(operate, this.selected);
}
});
},
//
moveTrainId() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.moveTrainId.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainMove.doShow(operate, this.selected);
}
});
},
//
switchTrainId() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.switchTrainId.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainSwitch.doShow(operate, this.selected);
}
});
}
}
};
</script>

View File

@ -1,150 +1,162 @@
<template>
<el-dialog class="beijing-01__schedule add-task" :title="title" :visible.sync="dialogShow" width="800px"
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag>
<div style="margin: 10px">
<el-row>
<el-col :span="3">
<el-radio v-model="model.type" label="1">加在最前</el-radio>
</el-col>
<el-col :span="2" :offset="1">
<span>车次号</span>
</el-col>
<el-col :span="5">
<el-select v-model="model.tripNumber" placeholder="请选择">
<el-option v-for="item in tripNumberList" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-col>
<el-col :span="3" :offset="1">
<span>开始时间</span>
</el-col>
<el-col :span="5">
<el-select v-model="model.startTime" placeholder="请选择">
<el-option v-for="item in tripNumberList" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-col>
</el-row>
<el-row>
<el-col :span="3">
<el-radio v-model="model.type" label="2">加在最后</el-radio>
</el-col>
<el-col :span="2" :offset="1">
<span>车次号</span>
</el-col>
<el-col :span="5">
<el-select v-model="model.tripNumber" placeholder="请选择">
<el-option v-for="item in tripNumberList" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-col>
<el-col :span="3" :offset="1">
<span>开始时间</span>
</el-col>
<el-col :span="5">
<el-select v-model="model.startTime" placeholder="请选择">
<el-option v-for="item in tripNumberList" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-col>
<el-dialog
v-dialogDrag
class="beijing-01__schedule add-task"
:title="title"
:visible.sync="dialogShow"
width="800px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<div style="margin: 10px">
<el-row>
<el-col :span="3">
<el-radio v-model="model.type" label="1">加在最前</el-radio>
</el-col>
<el-col :span="2" :offset="1">
<span>车次号</span>
</el-col>
<el-col :span="5">
<el-select v-model="model.tripNumber" placeholder="请选择">
<el-option
v-for="item in tripNumberList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-col>
<el-col :span="3" :offset="1">
<span>开始时间</span>
</el-col>
<el-col :span="5">
<el-select v-model="model.startTime" placeholder="请选择">
<el-option
v-for="item in tripNumberList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-col>
</el-row>
<el-row>
<el-col :span="3">
<el-radio v-model="model.type" label="2">加在最后</el-radio>
</el-col>
<el-col :span="2" :offset="1">
<span>车次号</span>
</el-col>
<el-col :span="5">
<el-select v-model="model.tripNumber" placeholder="请选择">
<el-option
v-for="item in tripNumberList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-col>
<el-col :span="3" :offset="1">
<span>开始时间</span>
</el-col>
<el-col :span="5">
<el-select v-model="model.startTime" placeholder="请选择">
<el-option
v-for="item in tripNumberList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-col>
</el-row>
<el-row style="margin-bottom: 5px;">
交路
</el-row>
<el-row>
<el-table :data="model.route" border :height="180">
<el-table-column prop="date" label="日期" width="180">
</el-table-column>
<el-table-column prop="name" label="姓名" width="180">
</el-table-column>
<el-table-column prop="address" label="地址">
</el-table-column>
<el-table-column width="20">
</el-table-column>
</el-table>
</el-row>
<el-row style=" margin-bottom: 5px;margin-top: 10px;">
详情
</el-row>
<el-row>
<el-table :data="model.detail" border :height="180">
<el-table-column prop="date" label="日期" width="180">
</el-table-column>
<el-table-column prop="name" label="姓名" width="180">
</el-table-column>
<el-table-column prop="address" label="地址">
</el-table-column>
<el-table-column width="20">
</el-table-column>
</el-table>
</el-row>
<el-row>
<el-col :offset="16">
<el-checkbox v-model="model.default">显示默认停站时间和运行等级</el-checkbox>
</el-col>
</el-row>
</div>
<el-row type="flex" justify="center" class="button-group">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
</el-dialog>
</el-row>
<el-row style="margin-bottom: 5px;">
交路
</el-row>
<el-row>
<el-table :data="model.route" border :height="180">
<el-table-column prop="date" label="日期" width="180" />
<el-table-column prop="name" label="姓名" width="180" />
<el-table-column prop="address" label="地址" />
<el-table-column width="20" />
</el-table>
</el-row>
<el-row style=" margin-bottom: 5px;margin-top: 10px;">
详情
</el-row>
<el-row>
<el-table :data="model.detail" border :height="180">
<el-table-column prop="date" label="日期" width="180" />
<el-table-column prop="name" label="姓名" width="180" />
<el-table-column prop="address" label="地址" />
<el-table-column width="20" />
</el-table>
</el-row>
<el-row>
<el-col :offset="16">
<el-checkbox v-model="model.default">显示默认停站时间和运行等级</el-checkbox>
</el-col>
</el-row>
</div>
<el-row type="flex" justify="center" class="button-group">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
</el-dialog>
</template>
<script>
export default {
name: 'AddTask',
components: {
},
data() {
return {
dialogShow: false,
loading: false,
model: {
type: '1',
serviceNumber: '',
tripNumber: '',
startTime: '',
default: false,
route: [],
detail: []
},
tripNumberList: [],
}
},
computed: {
title() {
return '添加任务'
}
},
mounted() {
},
methods: {
doShow(params) {
this.model.serviceNumber = params.serviceNumber;
this.model.tripNumber = params.tripNumber;
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleCommit() {
this.doClose();
}
}
}
export default {
name: 'AddTask',
components: {
},
data() {
return {
dialogShow: false,
loading: false,
model: {
type: '1',
serviceNumber: '',
tripNumber: '',
startTime: '',
default: false,
route: [],
detail: []
},
tripNumberList: []
};
},
computed: {
title() {
return '添加任务';
}
},
mounted() {
},
methods: {
doShow(params) {
this.model.serviceNumber = params.serviceNumber;
this.model.tripNumber = params.tripNumber;
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleCommit() {
this.doClose();
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
/deep/ {
.el-button {
margin-left: 40px !important;
@ -160,4 +172,4 @@
line-height: 20px !important;
}
}
</style>
</style>

View File

@ -1,10 +1,10 @@
<template>
<el-dialog
:title="title"
v-dialogDrag
:title="title"
class="beijing-01__schedule choose-plan-template"
:visible.sync="dialogShow"
width="80%"
width="70%"
:before-close="doClose"
:modal="false"
:close-on-click-modal="false"

View File

@ -18,10 +18,9 @@
</template>
<script>
// import { listPublishMap } from '@/api/jmap/mapdraft';
import { runPlanTemplateList, generateUserRunPlanEveryDay } from '@/api/runplan';
import { runPlanTemplateList } from '@/api/runplan';
import { getStationListBySkinCode } from '@/api/runplan';
import { getEveryDayRunPlanData } from '@/api/simulation';
import { getEveryDayRunPlanData, generateDayRunPlan } from '@/api/simulation';
import { getSkinCodeList } from '@/api/management/mapskin';
export default {
@ -101,7 +100,7 @@ export default {
const choose = this.$refs.pageRules.currentChoose();
if (choose && choose.id) {
this.loading = true;
generateUserRunPlanEveryDay(choose.id, this.$route.query.group).then(response => {
generateDayRunPlan(choose.id, this.$route.query.group).then(response => {
this.loading = false;
this.reloadTable();
this.loadRunData();

View File

@ -1,116 +1,126 @@
<template>
<el-dialog class="beijing-01__schedule create-week-plan" :title="title" :visible.sync="dialogShow" width="800px"
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag>
<el-row>
<el-form ref="form" :model="model" :rules="rules" label-width="140px" size="small">
<el-form-item label="运行图名称:" prop="planId">
<el-row>
<el-col :span="19">
<el-input v-model="model.planName" :readonly="true"></el-input>
</el-col>
<el-col :span="4" :offset="1">
<el-button @click="handleChoose">选择 </el-button>
</el-col>
</el-row>
</el-form-item>
<el-form-item label="计划日期范围:" prop="dateList">
<el-row>
<el-date-picker type="dates" v-model="model.dateList" :clearable="false" placeholder="选择一个或多个日期"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-row>
</el-form-item>
</el-form>
</el-row>
<el-row type="flex" justify="center" class="button-group">
<el-button @click="create"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
<choose-template-plan ref="choose" @chooseConfirm="chooseConfirm"></choose-template-plan>
</el-dialog>
<el-dialog
v-dialogDrag
class="beijing-01__schedule create-week-plan"
:title="title"
:visible.sync="dialogShow"
width="800px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-row>
<el-form ref="form" :model="model" :rules="rules" label-width="140px" size="small">
<el-form-item label="运行图名称:" prop="planId">
<el-row>
<el-col :span="19">
<el-input v-model="model.planName" :readonly="true" />
</el-col>
<el-col :span="4" :offset="1">
<el-button @click="handleChoose">选择 </el-button>
</el-col>
</el-row>
</el-form-item>
<el-form-item label="计划日期范围:" prop="dateList">
<el-row>
<el-date-picker
v-model="model.dateList"
type="dates"
:clearable="false"
placeholder="选择一个或多个日期"
value-format="yyyy-MM-dd"
/>
</el-row>
</el-form-item>
</el-form>
</el-row>
<el-row type="flex" justify="center" class="button-group">
<el-button @click="create"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
<choose-template-plan ref="choose" @chooseConfirm="chooseConfirm" />
</el-dialog>
</template>
<script>
import { createRunPlanLoad } from '@/api/runplan';
import ChooseTemplatePlan from './chooseTemplatePlan';
import { createRunPlanLoad } from '@/api/runplan';
import ChooseTemplatePlan from './chooseTemplatePlan';
export default {
name: 'CreateWeekPlan',
components: {
ChooseTemplatePlan
},
data() {
return {
dialogShow: false,
loading: false,
model: {
planId: '',
planName: '',
dateList: [],
}
}
},
computed: {
title() {
return '创建一周计划'
},
rules() {
let rules = {
planId: [
{ required: true, message: '请选择模板运行图', trigger: 'blur' }
],
dateList: [
{ required: true, message: '请选择计划日期范围', trigger: 'change' }
]
}
export default {
name: 'CreateWeekPlan',
components: {
ChooseTemplatePlan
},
data() {
return {
dialogShow: false,
loading: false,
model: {
planId: '',
planName: '',
dateList: []
}
};
},
computed: {
title() {
return '创建一周计划';
},
rules() {
const rules = {
planId: [
{ required: true, message: '请选择模板运行图', trigger: 'blur' }
],
dateList: [
{ required: true, message: '请选择计划日期范围', trigger: 'change' }
]
};
return rules;
}
},
mounted() {
},
methods: {
doShow(params) {
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleChoose() {
this.$refs.choose.doShow();
},
chooseConfirm(choose) {
if (choose) {
this.model.planId = choose.id;
this.model.planName = choose.name;
}
},
buildModel() {
return this.model.dateList.map(date => {
return {
loadTime: date,
mapId: this.$route.query.mapId,
templatePlanId: this.model.planId
}
});
},
create() {
this.$refs['form'].validate((valid) => {
if (valid) {
createRunPlanLoad(this.buildModel()).then(response => {
this.$message.success('创建运行图计划成功');
this.$emit('reloadTable', { name: 'managePlanList' });
this.doClose();
}).catch(error => {
this.doClose();
this.$messageBox('创建运行图计划失败');
})
}
});
}
}
}
return rules;
}
},
mounted() {
},
methods: {
doShow(params) {
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleChoose() {
this.$refs.choose.doShow();
},
chooseConfirm(choose) {
if (choose) {
this.model.planId = choose.id;
this.model.planName = choose.name;
}
},
buildModel() {
return {
planDateList: this.model.dateList,
mapId: this.$route.query.mapId,
templatePlanId: this.model.planId
};
},
create() {
this.$refs['form'].validate((valid) => {
if (valid) {
createRunPlanLoad(this.buildModel()).then(response => {
this.$message.success('创建运行图计划成功');
this.doClose();
}).catch(() => {
this.doClose();
this.$messageBox('创建运行图计划失败');
});
}
});
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
@ -124,4 +134,4 @@
margin: 10px;
}
}
</style>
</style>

View File

@ -1,57 +1,66 @@
<template>
<el-dialog class="beijing-01__schedule delete-task" :title="title" :visible.sync="dialogShow" width="400px"
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag>
<el-row>
<el-radio v-model="type" :label="1">删除以前所有任务包含本任务</el-radio>
</el-row>
<el-row>
<el-radio v-model="type" :label="2">删除以后所有任务包含本任务</el-radio>
</el-row>
<el-row type="flex" justify="center" class="button-group">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
</el-dialog>
<el-dialog
v-dialogDrag
class="beijing-01__schedule delete-task"
:title="title"
:visible.sync="dialogShow"
width="400px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-row>
<el-radio v-model="type" :label="1">删除以前所有任务包含本任务</el-radio>
</el-row>
<el-row>
<el-radio v-model="type" :label="2">删除以后所有任务包含本任务</el-radio>
</el-row>
<el-row type="flex" justify="center" class="button-group">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
</el-dialog>
</template>
<script>
export default {
name: 'DeleteTask',
components: {
},
data() {
return {
dialogShow: false,
loading: false,
tripNumber: '',
serviceNumber: '',
type: '1',
}
},
computed: {
title() {
return '删除任务'
}
},
mounted() {
},
methods: {
doShow(params) {
this.tripNumber = params.tripNumber;
this.serviceNumber = params.serviceNumber;
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleCommit() {
// this.tripNumber
this.doClose();
}
}
}
export default {
name: 'DeleteTask',
components: {
},
data() {
return {
dialogShow: false,
loading: false,
tripNumber: '',
serviceNumber: '',
type: '1'
};
},
computed: {
title() {
return '删除任务';
}
},
mounted() {
},
methods: {
doShow(params) {
this.tripNumber = params.tripNumber;
this.serviceNumber = params.serviceNumber;
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleCommit() {
// this.tripNumber
this.doClose();
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
@ -61,4 +70,4 @@
margin: 10px;
}
}
</style>
</style>

View File

@ -1,46 +1,55 @@
<template>
<el-dialog class="beijing-01__schedule create-week-plan" :title="title" :visible.sync="dialogShow" width="400px"
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag>
<el-row type="flex" justify="center" class="button-group">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
</el-dialog>
<el-dialog
v-dialogDrag
class="beijing-01__schedule create-week-plan"
:title="title"
:visible.sync="dialogShow"
width="400px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-row type="flex" justify="center" class="button-group">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
</el-dialog>
</template>
<script>
export default {
name: 'DeleteTodayPlan',
components: {
},
data() {
return {
dialogShow: false,
loading: false
}
},
computed: {
title() {
return '删除当天计划'
}
},
mounted() {
},
methods: {
doShow(params) {
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleCommit() {
// this.tripNumber
this.doClose();
}
}
}
export default {
name: 'DeleteTodayPlan',
components: {
},
data() {
return {
dialogShow: false,
loading: false
};
},
computed: {
title() {
return '删除当天计划';
}
},
mounted() {
},
methods: {
doShow(params) {
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleCommit() {
// this.tripNumber
this.doClose();
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
@ -50,4 +59,4 @@
margin: 10px;
}
}
</style>
</style>

View File

@ -1,122 +1,143 @@
<template>
<el-dialog class="beijing-01__schedule manage-plan-list" :title="title" :visible.sync="dialogShow" width="80%"
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList">
</QueryListPage>
</el-dialog>
<el-dialog
v-dialogDrag
class="beijing-01__schedule manage-plan-list"
:title="title"
:visible.sync="dialogShow"
width="80%"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</el-dialog>
</template>
<script>
import { getRunPlanLoadList, deleteRunPlanLoad } from '@/api/runplan';
import { getRunPlanLoadList, deleteRunPlanLoad, listAllTempLateRunPlan } from '@/api/runplan';
import { listPublishMap } from '@/api/jmap/map';
export default {
name: 'ManagePlanList',
data() {
return {
dialogShow: false,
loading: false,
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '140px',
reset: true,
queryObject: {
runPlanName: {
type: 'text',
label: '运行图名称'
}
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '地图名称',
prop: 'mapName'
},
{
title: '运行图名称',
prop: 'runPlanName',
},
{
title: '加载日期',
prop: 'loadTime'
},
{
type: 'button',
title: '操作',
width: '100',
buttons: [
{
name: '删除',
handleClick: this.handleDelete,
type: 'danger'
}
]
}
],
actions: [
{ text: '创建', btnCode: 'employee_insert', handler: this.handleCreateRunPlan },
]
},
export default {
name: 'ManagePlanList',
data() {
return {
dialogShow: false,
loading: false,
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '140px',
reset: true
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('publish.mapName'),
prop: 'mapId',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.mapId, this.mapList, ['id', 'name']); },
tagType: (row) => { return ''; }
},
{
title: this.$t('publish.runPlanName'),
prop: 'templatePlanId',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.templatePlanId, this.templatePlanList, ['id', 'name']); },
tagType: (row) => { return 'success'; }
},
{
title: '加载日期',
prop: 'loadTime'
},
{
type: 'button',
title: '操作',
width: '100',
buttons: [
{
name: '删除',
handleClick: this.handleDelete,
type: 'danger'
}
]
}
],
actions: [
{ text: '创建', btnCode: 'employee_insert', handler: this.handleCreateRunPlan }
]
},
currentModel: {}
}
},
computed: {
title() {
return '运行图计划表'
}
},
created() {
},
methods: {
queryFunction(params) {
if (this.$route.query.mapId) {
params['mapId'] = this.$route.query.mapId;
}
currentModel: {}
};
},
computed: {
title() {
return '运行图计划表';
}
},
mounted() {
this.loadPageData();
},
methods: {
loadPageData() {
this.mapList = [];
listPublishMap().then(resp => {
this.mapList = resp.data;
});
this.templatePlanList = [];
listAllTempLateRunPlan().then(resp => {
this.templatePlanList = resp.data;
});
},
queryFunction(params) {
if (this.$route.query.mapId) {
params['mapId'] = this.$route.query.mapId;
}
if (this.$store.state.user.id) {
params['userId'] = this.$store.state.user.id;
}
if (this.$store.state.user.id) {
params['userId'] = this.$store.state.user.id;
}
return getRunPlanLoadList(params);
},
handleDelete(index, row) {
this.$confirm('此操作将删除次日加载的运行图, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteRunPlanLoad(row.id).then(response => {
this.$message.success('删除成功')
this.reloadTable()
}).catch(error => {
this.reloadTable()
this.$messageBox('删除失败')
})
}).catch(() => { })
},
handleCreateRunPlan() {
this.$emit('dispatchDialog', { name: 'createWeekPlan' });
},
doShow() {
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
reloadTable() {
this.queryList.reload()
}
}
}
return getRunPlanLoadList(params);
},
handleDelete(index, row) {
this.$confirm('此操作将删除次日加载的运行图, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteRunPlanLoad(row.id).then(response => {
this.$message.success('删除成功');
this.reloadTable();
}).catch(() => {
this.reloadTable();
this.$messageBox('删除失败');
});
}).catch(() => { });
},
handleCreateRunPlan() {
this.$emit('dispatchDialog', { name: 'createWeekPlan' });
},
doShow() {
this.dialogShow = true;
this.$nextTick(()=> { this.reloadTable(); });
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
reloadTable() {
this.queryList.reload();
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
</style>
</style>

View File

@ -1,152 +1,152 @@
<template>
<el-dialog class="beijing-01__schedule edit-planning-train" :title="title" :visible.sync="dialogShow" width="800px"
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag>
<el-row>
<el-col :offset="10">列车线路</el-col>
</el-row>
<el-row>
<el-col :span="17">
<el-table :data="serviceData" border style="width: 100%" height="160">
<el-table-column prop="startStationCode" label="起点站">
</el-table-column>
<el-table-column prop="startStationStandCode" label="起点站台">
</el-table-column>
<el-table-column prop="endStationCode" label="终点站">
</el-table-column>
<el-table-column prop="endStationStandCode" label="终点站台">
</el-table-column>
</el-table>
</el-col>
<el-col :span="6" :offset="1">
<el-row type="flex" justify="center">
<el-button class="view-button" @click="handleAddTask">加任务</el-button>
</el-row>
<el-row type="flex" justify="center">
<el-button class="view-button" @click="handleReplace">&ensp;&ensp;</el-button>
</el-row>
<el-row type="flex" justify="center">
<el-button class="view-button" @click="handleDeleteTask">删任务</el-button>
</el-row>
<div class="view-box">
<el-row type="flex" justify="center">
<el-radio-group v-model="storeInOut">
<el-radio :label="1">进库</el-radio>
<el-radio :label="2">出库</el-radio>
</el-radio-group>
</el-row>
</div>
</el-col>
</el-row>
<el-row class="view-box">
<el-col :span="9" style="padding-left: 10px">
<el-input v-model="oldServiceNumber" size="small" :disabled="true"></el-input>
</el-col>
<el-col :span="9" style="padding-left: 20px">
<el-input v-model="newServiceNumber" size="small"></el-input>
</el-col>
<el-col :span="5" style="padding-left: 20px">
<el-button @click="handleModifyingTripNumber" style="width: 150px;">改车次号</el-button>
</el-col>
</el-row>
<el-row style="margin-top: 10px">
<el-col :span="4"><span class="view-label">线路开始时间</span></el-col>
<el-col :span="8">
<el-time-select v-model="serviceStartTime" size="small"></el-time-select>
</el-col>
<el-col :span="4"><span class="view-label">线路结束时间</span></el-col>
<el-col :span="8">
<el-time-select v-model="serviceEndTime" size="small"></el-time-select>
</el-col>
</el-row>
<el-row style="margin-top: 20px">
<el-col :offset="10">线路详细信息</el-col>
</el-row>
<el-row>
<el-table :data="tripData" border style="width: 100%" height="200">
<el-table-column prop="arriveTime" label="到站时间">
</el-table-column>
<el-table-column prop="stationCode" label="车站">
</el-table-column>
<el-table-column prop="stationStandCode" label="站台">
</el-table-column>
<el-table-column prop="stopTime" label="停站时间">
</el-table-column>
<el-table-column prop="level" label="运行等级">
</el-table-column>
</el-table>
</el-row>
<el-row style="margin-top: 20px">
<el-checkbox v-model="effect">影响后续任务</el-checkbox>
<el-dialog
v-dialogDrag
class="beijing-01__schedule edit-planning-train"
:title="title"
:visible.sync="dialogShow"
width="800px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-row>
<el-col :offset="10">列车线路</el-col>
</el-row>
<el-row>
<el-col :span="17">
<el-table :data="serviceData" border style="width: 100%" height="160">
<el-table-column prop="startStationCode" label="起点站" />
<el-table-column prop="startStationStandCode" label="起点站台" />
<el-table-column prop="endStationCode" label="终点站" />
<el-table-column prop="endStationStandCode" label="终点站台" />
</el-table>
</el-col>
<el-col :span="6" :offset="1">
<el-row type="flex" justify="center">
<el-button class="view-button" @click="handleAddTask">加任务</el-button>
</el-row>
<el-row type="flex" justify="center">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
<el-button class="view-button" @click="handleReplace">&ensp;&ensp;</el-button>
</el-row>
</el-dialog>
<el-row type="flex" justify="center">
<el-button class="view-button" @click="handleDeleteTask">删任务</el-button>
</el-row>
<div class="view-box">
<el-row type="flex" justify="center">
<el-radio-group v-model="storeInOut">
<el-radio :label="1">进库</el-radio>
<el-radio :label="2">出库</el-radio>
</el-radio-group>
</el-row>
</div>
</el-col>
</el-row>
<el-row class="view-box">
<el-col :span="9" style="padding-left: 10px">
<el-input v-model="oldServiceNumber" size="small" :disabled="true" />
</el-col>
<el-col :span="9" style="padding-left: 20px">
<el-input v-model="newServiceNumber" size="small" />
</el-col>
<el-col :span="5" style="padding-left: 20px">
<el-button style="width: 150px;" @click="handleModifyingTripNumber">改车次号</el-button>
</el-col>
</el-row>
<el-row style="margin-top: 10px">
<el-col :span="4"><span class="view-label">线路开始时间</span></el-col>
<el-col :span="8">
<el-time-select v-model="serviceStartTime" size="small" />
</el-col>
<el-col :span="4"><span class="view-label">线路结束时间</span></el-col>
<el-col :span="8">
<el-time-select v-model="serviceEndTime" size="small" />
</el-col>
</el-row>
<el-row style="margin-top: 20px">
<el-col :offset="10">线路详细信息</el-col>
</el-row>
<el-row>
<el-table :data="tripData" border style="width: 100%" height="200">
<el-table-column prop="arriveTime" label="到站时间" />
<el-table-column prop="stationCode" label="车站" />
<el-table-column prop="stationStandCode" label="站台" />
<el-table-column prop="stopTime" label="停站时间" />
<el-table-column prop="level" label="运行等级" />
</el-table>
</el-row>
<el-row style="margin-top: 20px">
<el-checkbox v-model="effect">影响后续任务</el-checkbox>
</el-row>
<el-row type="flex" justify="center">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
</el-dialog>
</template>
<script>
import { formatTime, formatName } from '@/utils/runPlan';
import { formatTime, formatName } from '@/utils/runPlan';
export default {
name: 'modifyingPlan',
data() {
return {
dialogShow: false,
loading: false,
effect: false,
storeInOut: '1',
oldServiceNumber: '',
newServiceNumber: '',
serviceStartTime: '',
serviceEndTime: '',
serviceData: [],
tripData: [],
}
},
computed: {
title() {
return '修改'
}
},
mounted() {
},
methods: {
formatTime(time) {
return formatTime(time);
},
formatName(code) {
return formatName(code);
},
doShow() {
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
//
handleAddTask() {
this.$emit('dispatchDialog', { name: 'addTask', params: {} })
},
//
handleReplace() {
this.$emit('dispatchDialog', { name: 'modifyingTask', params: {} })
},
//
handleDeleteTask() {
this.$emit('dispatchDialog', { name: 'deleteTask', params: {} })
},
//
handleModifyingTripNumber() {
this.$emit('dispatchDialog', { name: 'modifyingTripNumber', params: {} })
},
//
handleCommit() {
this.doClose();
}
}
}
export default {
name: 'ModifyingPlan',
data() {
return {
dialogShow: false,
loading: false,
effect: false,
storeInOut: '1',
oldServiceNumber: '',
newServiceNumber: '',
serviceStartTime: '',
serviceEndTime: '',
serviceData: [],
tripData: []
};
},
computed: {
title() {
return '修改';
}
},
mounted() {
},
methods: {
formatTime(time) {
return formatTime(time);
},
formatName(code) {
return formatName(code);
},
doShow() {
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
//
handleAddTask() {
this.$emit('dispatchDialog', { name: 'addTask', params: {} });
},
//
handleReplace() {
this.$emit('dispatchDialog', { name: 'modifyingTask', params: {} });
},
//
handleDeleteTask() {
this.$emit('dispatchDialog', { name: 'deleteTask', params: {} });
},
//
handleModifyingTripNumber() {
this.$emit('dispatchDialog', { name: 'modifyingTripNumber', params: {} });
},
//
handleCommit() {
this.doClose();
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
@ -157,13 +157,11 @@
margin-left: 0px;
}
.view-label {
height: 32px;
line-height: 32px;
}
.view-box {
padding: 10px 0px;
border: 1px inset gray;
@ -176,4 +174,4 @@
margin: 5px 20px;
}
}
</style>
</style>

View File

@ -1,298 +1,309 @@
<template>
<el-dialog class="beijing-01__schedule add-task" :title="title" :visible.sync="dialogShow" width="1000px"
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag>
<div style="margin: 10px">
<el-row>
<el-col :span="4">
<el-row>
<el-col :span="9">
<span>车次号</span>
</el-col>
<el-col :span="15">
<el-select style="display: inline-black" v-model="model.tripNumber" placeholder="请选择">
<el-option v-for="item in tripNumberList" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-col>
</el-row>
</el-col>
<el-col :span="2">
<el-row>
<el-col :offset="4">
<el-checkbox v-model="model.trainManual">手工</el-checkbox>
</el-col>
</el-row>
</el-col>
<el-col :span="5">
<el-row>
<el-col :span="12">
<span>缺省停站时间</span>
</el-col>
<el-col :span="12">
<el-select style="display: inline-black" v-model="model.time" placeholder="请选择">
<el-option v-for="item in timeList" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-col>
</el-row>
</el-col>
<el-col :span="5">
<el-row>
<el-col :span="9" :offset="2">
<span>表号</span>
</el-col>
<el-col :span="13">
<el-input v-model="model.serviceNumber"></el-input>
</el-col>
</el-row>
<el-dialog
v-dialogDrag
class="beijing-01__schedule add-task"
:title="title"
:visible.sync="dialogShow"
width="1000px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<div style="margin: 10px">
<el-row>
<el-col :span="4">
<el-row>
<el-col :span="9">
<span>车次号</span>
</el-col>
<el-col :span="15">
<el-select v-model="model.tripNumber" style="display: inline-black" placeholder="请选择">
<el-option
v-for="item in tripNumberList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-col>
</el-row>
</el-col>
<el-col :span="2">
<el-row>
<el-col :offset="4">
<el-checkbox v-model="model.trainManual">手工</el-checkbox>
</el-col>
</el-row>
</el-col>
<el-col :span="5">
<el-row>
<el-col :span="12">
<span>缺省停站时间</span>
</el-col>
<el-col :span="12">
<el-select v-model="model.time" style="display: inline-black" placeholder="请选择">
<el-option
v-for="item in timeList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-col>
</el-row>
</el-col>
<el-col :span="5">
<el-row>
<el-col :span="9" :offset="2">
<span>表号</span>
</el-col>
<el-col :span="13">
<el-input v-model="model.serviceNumber" />
</el-col>
</el-row>
</el-col>
<el-col :span="8">
<el-row>
<el-col :span="22" :offset="2">
<el-row>
<el-col :span="6">
<el-checkbox v-model="model.clearGuest">清客</el-checkbox>
</el-col>
<el-col :span="8">
<el-row>
<el-col :span="22" :offset="2">
<el-row>
<el-col :span="6">
<el-checkbox v-model="model.clearGuest">清客</el-checkbox>
</el-col>
<el-col :span="8">
<el-checkbox v-model="model.continuationPlan">延续计划</el-checkbox>
</el-col>
<el-col :span="6">
<el-checkbox v-model="model.firstTrain">首班车</el-checkbox>
</el-col>
</el-row>
</el-col>
</el-row>
<el-checkbox v-model="model.continuationPlan">延续计划</el-checkbox>
</el-col>
</el-row>
<el-row>
<el-col :span="4">
<el-row>
<el-col :span="9">
<span>序列号</span>
</el-col>
<el-col :span="15">
<el-select style="display: inline-black" v-model="model.serialNumber" placeholder="请选择">
<el-option v-for="item in serialNumberList" :key="item.value" :label="item.label"
:value="model.value">
</el-option>
</el-select>
</el-col>
</el-row>
<el-col :span="6">
<el-checkbox v-model="model.firstTrain">首班车</el-checkbox>
</el-col>
<el-col :span="2">
<el-row>
<el-col :offset="4">
<el-checkbox v-model="model.serialManual">手工</el-checkbox>
</el-col>
</el-row>
</el-col>
<el-col :span="5">
<el-row>
<el-col :span="12">
<span>缺省运行等级</span>
</el-col>
<el-col :span="12">
<el-select style="display: inline-black" v-model="model.level" placeholder="请选择">
<el-option v-for="item in levelList" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-col>
</el-row>
</el-col>
<el-col :span="5">
<el-row>
<el-col :span="9" :offset="2">
<span>开始时间</span>
</el-col>
<el-col :span="13">
<el-time-select v-model="model.startTime" placeholder="选择时间" :clearable="false">
</el-time-select>
</el-col>
</el-row>
</el-row>
</el-col>
</el-row>
</el-col>
</el-row>
<el-row>
<el-col :span="4">
<el-row>
<el-col :span="9">
<span>序列号</span>
</el-col>
<el-col :span="15">
<el-select v-model="model.serialNumber" style="display: inline-black" placeholder="请选择">
<el-option
v-for="item in serialNumberList"
:key="item.value"
:label="item.label"
:value="model.value"
/>
</el-select>
</el-col>
</el-row>
</el-col>
<el-col :span="2">
<el-row>
<el-col :offset="4">
<el-checkbox v-model="model.serialManual">手工</el-checkbox>
</el-col>
</el-row>
</el-col>
<el-col :span="5">
<el-row>
<el-col :span="12">
<span>缺省运行等级</span>
</el-col>
<el-col :span="12">
<el-select v-model="model.level" style="display: inline-black" placeholder="请选择">
<el-option
v-for="item in levelList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-col>
</el-row>
</el-col>
<el-col :span="5">
<el-row>
<el-col :span="9" :offset="2">
<span>开始时间</span>
</el-col>
<el-col :span="13">
<el-time-select v-model="model.startTime" placeholder="选择时间" :clearable="false" />
</el-col>
</el-row>
</el-col>
<el-col :span="8">
<el-row>
<el-col :span="22" :offset="2">
<el-row>
<el-col :span="6">
<el-checkbox v-model="model.inStock">入库</el-checkbox>
</el-col>
<el-col :span="8">
<el-row>
<el-col :span="22" :offset="2">
<el-row>
<el-col :span="6">
<el-checkbox v-model="model.inStock">入库</el-checkbox>
</el-col>
<el-col :span="8">
<el-checkbox v-model="model.outStock">出库</el-checkbox>
</el-col>
<el-col :span="6">
<el-checkbox v-model="model.lastTrain">末班车</el-checkbox>
</el-col>
</el-row>
</el-col>
</el-row>
<el-checkbox v-model="model.outStock">出库</el-checkbox>
</el-col>
</el-row>
<el-row style="margin-bottom: 5px;">
交路
</el-row>
<el-row>
<el-table :data="model.route" border :height="140">
<el-table-column prop="beginStationCode" label="起始站">
<template slot-scope="scope">
{{ formatName(scope.row.beginStationCode) }}
</template>
</el-table-column>
<el-table-column prop="beginStationStandCode" label="起始站台">
</el-table-column>
<el-table-column prop="endStationCode" label="终到站">
<template slot-scope="scope">
{{ formatName(scope.row.endStationCode) }}
</template>
</el-table-column>
<el-table-column prop="endStationStandCode" label="终到站台">
</el-table-column>
<el-table-column prop="describe" label="描述" :width="280">
</el-table-column>
<el-table-column :width="40">
</el-table-column>
</el-table>
</el-row>
<el-row style=" margin-bottom: 5px;margin-top: 10px;">
详情
</el-row>
<el-row>
<el-table :data="model.detail" border :height="140">
<el-table-column prop="stationCode" label="站台" :width="160">
<template slot-scope="scope">
{{ formatName(scope.row.stationCode) }}
</template>
</el-table-column>
<el-table-column prop="startTime" label="到点">
<template slot-scope="scope">
{{ formatTime(scope.row.startTime) }}
</template>
</el-table-column>
<el-table-column prop="stopTime" label="停站时间">
<template slot-scope="scope">
{{ formatTime(scope.row.stopTime) }}
</template>
</el-table-column>
<el-table-column prop="endTime" label="发点">
<template slot-scope="scope">
{{ formatTime(scope.row.endTime) }}
</template>
</el-table-column>
<el-table-column prop="level" label="运行等级">
</el-table-column>
<el-table-column width="280">
</el-table-column>
</el-table>
</el-row>
<el-row>
<el-col :offset="16">
<el-checkbox v-model="model.default">显示默认停站时间和运行等级</el-checkbox>
<el-col :span="6">
<el-checkbox v-model="model.lastTrain">末班车</el-checkbox>
</el-col>
</el-row>
</div>
<el-row type="flex" justify="center" class="button-group">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
</el-dialog>
</el-row>
</el-col>
</el-row>
</el-col>
</el-row>
<el-row style="margin-bottom: 5px;">
交路
</el-row>
<el-row>
<el-table :data="model.route" border :height="140">
<el-table-column prop="beginStationCode" label="起始站">
<template slot-scope="scope">
{{ formatName(scope.row.beginStationCode) }}
</template>
</el-table-column>
<el-table-column prop="beginStationStandCode" label="起始站台" />
<el-table-column prop="endStationCode" label="终到站">
<template slot-scope="scope">
{{ formatName(scope.row.endStationCode) }}
</template>
</el-table-column>
<el-table-column prop="endStationStandCode" label="终到站台" />
<el-table-column prop="describe" label="描述" :width="280" />
<el-table-column :width="40" />
</el-table>
</el-row>
<el-row style=" margin-bottom: 5px;margin-top: 10px;">
详情
</el-row>
<el-row>
<el-table :data="model.detail" border :height="140">
<el-table-column prop="stationCode" label="站台" :width="160">
<template slot-scope="scope">
{{ formatName(scope.row.stationCode) }}
</template>
</el-table-column>
<el-table-column prop="startTime" label="到点">
<template slot-scope="scope">
{{ formatTime(scope.row.startTime) }}
</template>
</el-table-column>
<el-table-column prop="stopTime" label="停站时间">
<template slot-scope="scope">
{{ formatTime(scope.row.stopTime) }}
</template>
</el-table-column>
<el-table-column prop="endTime" label="发点">
<template slot-scope="scope">
{{ formatTime(scope.row.endTime) }}
</template>
</el-table-column>
<el-table-column prop="level" label="运行等级" />
<el-table-column width="280" />
</el-table>
</el-row>
<el-row>
<el-col :offset="16">
<el-checkbox v-model="model.default">显示默认停站时间和运行等级</el-checkbox>
</el-col>
</el-row>
</div>
<el-row type="flex" justify="center" class="button-group">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
</el-dialog>
</template>
<script>
import { formatTime, formatName } from '@/utils/runPlan';
import { formatTime, formatName } from '@/utils/runPlan';
export default {
name: 'ModifyingTask',
components: {
},
data() {
return {
dialogShow: false,
loading: false,
model: {
tripNumber: '',
serialNumber: '',
trainManual: false,
serialManual: false,
clearGuest: false,
continuationPlan: false,
firstTrain: false,
lastTrain: false,
inStock: false,
outStock: false,
startTime: '',
route: [],
detail: []
},
timeList: [],
levelList: [],
tripNumberList: [],
serialNumberList: [],
}
},
computed: {
title() {
return '修改任务'
}
},
mounted() {
},
methods: {
formatTime(time) {
return formatTime(time);
},
formatName(code) {
return formatName(code);
},
loadInitData(params) {
this.model.tripNumber = params.tripNumber;
this.model.serviceNumber = params.serviceNumber;
let editData = this.$store.state.runPlan.editData[params.serviceNumber]
if (editData) {
let tripNumberList = Object.keys(editData.trainMap).sort((a, b) => { return editData.trainMap[a].oldIndex - editData.trainMap[b].oldIndex });
let trainInfo = editData.trainMap[params.tripNumber];
let lastIndex = trainInfo.stationTimeList.length - 1;
let taskObj = {
tripNumber: params.tripNumber,
beginStationCode: trainInfo.stationTimeList[0].stationCode,
beginStationStandCode: '',
endStationCode: trainInfo.stationTimeList[lastIndex].stationCode,
endStationStandCode: ''
}
this.model.route.push(taskObj);
export default {
name: 'ModifyingTask',
components: {
},
data() {
return {
dialogShow: false,
loading: false,
model: {
tripNumber: '',
serialNumber: '',
trainManual: false,
serialManual: false,
clearGuest: false,
continuationPlan: false,
firstTrain: false,
lastTrain: false,
inStock: false,
outStock: false,
startTime: '',
route: [],
detail: []
},
timeList: [],
levelList: [],
tripNumberList: [],
serialNumberList: []
};
},
computed: {
title() {
return '修改任务';
}
},
mounted() {
},
methods: {
formatTime(time) {
return formatTime(time);
},
formatName(code) {
return formatName(code);
},
loadInitData(params) {
this.model.tripNumber = params.tripNumber;
this.model.serviceNumber = params.serviceNumber;
const editData = this.$store.state.runPlan.editData[params.serviceNumber];
if (editData) {
const trainInfo = editData.trainMap[params.tripNumber];
const lastIndex = trainInfo.stationTimeList.length - 1;
const taskObj = {
tripNumber: params.tripNumber,
beginStationCode: trainInfo.stationTimeList[0].stationCode,
beginStationStandCode: '',
endStationCode: trainInfo.stationTimeList[lastIndex].stationCode,
endStationStandCode: ''
};
this.model.route.push(taskObj);
trainInfo.stationTimeList.forEach((elem, index) => {
let stationObj = {
stationCode: elem.stationCode,
startTime: index == 0 ? null : trainInfo.stationTimeList[index - 1].secondTime,
stopTime: index == 0 ? null : elem.secondTime - trainInfo.stationTimeList[index - 1].secondTime,
endTime: elem.secondTime,
level: '',
}
this.model.detail.push(stationObj);
})
}
},
doShow(params) {
this.loadInitData(params);
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleCommit() {
}
}
}
trainInfo.stationTimeList.forEach((elem, index) => {
const stationObj = {
stationCode: elem.stationCode,
startTime: index == 0 ? null : trainInfo.stationTimeList[index - 1].secondTime,
stopTime: index == 0 ? null : elem.secondTime - trainInfo.stationTimeList[index - 1].secondTime,
endTime: elem.secondTime,
level: ''
};
this.model.detail.push(stationObj);
});
}
},
doShow(params) {
this.loadInitData(params);
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleCommit() {
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
/deep/ {
.el-button {
margin-left: 40px !important;
@ -312,4 +323,4 @@
width: 110px !important;
}
}
</style>
</style>

View File

@ -2,7 +2,6 @@
<div class="plan-schedule" style="width: 100%">
<title-bar ref="titleBar" @back="back" />
<menu-bar ref="menuBar" :skin-code="skinCode" @dispatchDialog="dispatchDialog" />
<!-- <menu-tool ref="menuTool" :skinCode="skinCode"></menu-tool> -->
<schedule ref="schedule" :group="group" :skin-code="skinCode" :max-height="height" :max-width="width" />
<status-bar ref="statusBar" :max-top="height" @setPosition="setPosition" />
@ -17,10 +16,8 @@
</template>
<script>
// import { mapGetters } from 'vuex';
import TitleBar from './titleBar';
import MenuBar from './menuBar';
// import MenuTool from './menuTool';
import StatusBar from './statusBar';
import Schedule from './schedule';
import ManagePlanList from '../menusPlan/managePlanList';
@ -30,14 +27,12 @@ import ModifyingPlan from '../menusPlan/modifyingPlan';
import AddTask from '../menusPlan/addTask';
import DeleteTask from '../menusPlan/deleteTask';
import ModifyingTask from '../menusPlan/modifyingTask';
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
export default {
name: 'Menus',
components: {
TitleBar,
MenuBar,
// MenuTool,
StatusBar,
Schedule,
ManagePlanList,
@ -48,9 +43,6 @@ export default {
DeleteTask,
ModifyingTask
},
mixins: [
WindowResizeHandler
],
props: {
group: {
type: String,
@ -59,20 +51,20 @@ export default {
},
data() {
return {
width: 0,
height: 0
};
},
computed: {
skinCode() {
return this.$route.query.skinCode || '02';
},
width() {
return this.$store.state.app.width;
},
height() {
return this.$store.state.app.height;
}
},
methods: {
resizeHandler() {
this.width = this._clientWidth;
this.height = this._clientHeight;
},
setPosition() {
this.$nextTick(() => {
this.$refs.schedule.setPosition();

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