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* yarn-error.log*
package-lock.json package-lock.json
tests/**/coverage/ tests/**/coverage/
src/utils/baseUrl* /src/utils/baseUrl.js
/src/utils/
# Editor directories and files # Editor directories and files
.idea .idea

View File

@ -1,7 +1,7 @@
<template> <template>
<div id="app"> <div id="app">
<router-view /> <router-view />
<deomon-topic ref="deomonTopic"/> <deomon-topic ref="deomonTopic" />
</div> </div>
</template> </template>
@ -9,12 +9,16 @@
import { handleToken } from '@/utils/auth'; import { handleToken } from '@/utils/auth';
import { creatSubscribe, perpetualTopic } from '@/utils/stomp'; import { creatSubscribe, perpetualTopic } from '@/utils/stomp';
import DeomonTopic from '@/views/demonstration/deomonTopic'; import DeomonTopic from '@/views/demonstration/deomonTopic';
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
export default { export default {
name: 'App', name: 'App',
components: { components: {
DeomonTopic DeomonTopic
// QuickMenu
}, },
mixins: [
WindowResizeHandler
],
watch: { watch: {
'$store.state.socket.roomInvite': function (val) { '$store.state.socket.roomInvite': function (val) {
if (val.creatorId) { if (val.creatorId) {
@ -27,6 +31,9 @@ export default {
this.subscribe(); this.subscribe();
}, },
methods: { methods: {
resizeHandler() {
this.$store.dispatch('app/resize', {width: this._clientWidth, height: this._clientHeight});
},
prohibitSystemContextMenu() { prohibitSystemContextMenu() {
window.document.oncontextmenu = function () { window.document.oncontextmenu = function () {
return false; 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) { export function createLessonPermisson(data) {
return request({ return request({
@ -26,10 +18,36 @@ export function createLessonPermisson(data) {
data: 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) { export function getTotalRemains(params) {
return request({ return request({
url: '/api/permission/totalRemains', url: '/api/userPermission/totalRemains',
method: 'get', method: 'get',
params: params params: params
}); });
@ -37,7 +55,7 @@ export function getTotalRemains(params) {
/** 设置权限失效或有效*/ /** 设置权限失效或有效*/
export function setLessonPermisson(data) { export function setLessonPermisson(data) {
return request({ return request({
url: `/api/permission/${data.id}/status`, url: `/api/userPermission/${data.id}/status`,
method: 'put', method: 'put',
data: data data: data
}); });
@ -48,7 +66,7 @@ export function setLessonPermisson(data) {
*/ */
export function queryPermissionSimulation(data) { export function queryPermissionSimulation(data) {
return request({ return request({
url: `/api/permission/${data.mapId}/${data.prdCode}/simulation`, url: `/api/userPermission/${data.mapId}/${data.prdCode}/simulation`,
method: 'get' method: 'get'
}); });
} }
@ -56,38 +74,28 @@ export function queryPermissionSimulation(data) {
/** 获取大屏权限列表*/ /** 获取大屏权限列表*/
export function queryPermissionScreen() { export function queryPermissionScreen() {
return request({ return request({
url: `/api/permission/bigScreen`, url: `/api/userPermission/bigScreen`,
method: 'get' 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) { export function listUserPermision(params) {
return request({ return request({
url: `/api/permission/my`, url: `/api/userPermission/my`,
method: 'get', method: 'get',
params: params params: params
}); });
@ -101,10 +109,10 @@ export function getDistribute(id) {
}); });
} }
/** 用户权限列表 */ /** 设置权限所有者 */
export function putPermissionOwner(data) { export function putPermissionOwner(data) {
return request({ return request({
url: `/api/permission/${data.id}/owner`, url: `/api/userPermission/${data.id}/owner`,
method: 'put', method: 'put',
data: data.owner data: data.owner
}); });

View File

@ -1,6 +1,6 @@
import request from '@/utils/request'; import request from '@/utils/request';
/** 上课权限获取*/ /** 权限转增*/
export function getLessons(data) { export function getLessons(data) {
return request({ return request({
url: '/api/distribute/getLessons', url: '/api/distribute/getLessons',
@ -9,15 +9,41 @@ export function getLessons(data) {
}); });
} }
/** 上课权限分发*/ /** 权限分发*/
export function giveLessons(data) { export function giveLessons(data) {
return request({ return request({
url: '/api/distribute/givePermission', url: '/api/distribute/distribute',
method: 'post', method: 'post',
data: data 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) { export function receiveLessons(data) {
return request({ return request({

View File

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

View File

@ -277,20 +277,14 @@ export function deleteRunPlanTemplate(planId) {
} }
/** 生成通用每日运行图*/ /** 生成通用每日运行图*/
export function generateCommonRunPlanEveryDay(planId) { export function generateCommonRunPlanEveryDay(planId, params) {
return request({ return request({
url: `/api/runPlan/template/generate/${planId}`, 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) { export function runPlanEveryDayList(params) {
return request({ return request({
@ -309,20 +303,12 @@ export function deleteRunPlanEveryDay(planId) {
} }
/** 获取地图运行图的车次号*/ /** 获取地图运行图的车次号*/
export function getPublishMapTrainNos(skinCode) { // export function getPublishMapTrainNos(skinCode) {
return request({ // return request({
url: `/api/runPlan/daily/${skinCode}/trainNos`, // url: `/api/runPlan/daily/${skinCode}/trainNos`,
method: 'get' // method: 'get'
}); // });
} // }
/** 获取服务号、车组号*/
export function getPublishMapTrainServerNos(skinCode) {
return request({
url: `/api/runPlan/daily/${skinCode}/serverNos`,
method: 'get'
});
}
/** 分页查询加载计划*/ /** 分页查询加载计划*/
export function getRunPlanLoadList(params) { export function getRunPlanLoadList(params) {
@ -374,3 +360,11 @@ export function queryRunPlanDaily(planId) {
method: 'get' 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) { export function scriptRecordNotify(scriptId) {
return request({ return request({
@ -239,7 +231,7 @@ export function selectScriptMembers(group, data) {
export function modifyScriptMemberSex(group, playerId, data) { export function modifyScriptMemberSex(group, playerId, data) {
return request({ return request({
url: `/api/simulation/${group}/scriptWrite/player/${playerId}?gender=${data.gender}`, url: `/api/simulation/${group}/scriptWrite/player/${playerId}?gender=${data.gender}`,
method: 'put', method: 'put'
}); });
} }
@ -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) { export function getExistingSimulation(params) {
return request({ return request({
@ -396,14 +309,6 @@ export function getDeviceCodeByDeviceType(group, params) {
params params
}); });
} }
// /** 根据设备类型获取设备条件列表 */
// export function getDeviceCoditionByDeviceType(params) {
// return request({
// url: `/api/simulation/deviceType/conditions`,
// method: 'get',
// params
// });
// }
/** 获取任务录制的数据 */ /** 获取任务录制的数据 */
export function getScriptRecord(group) { export function getScriptRecord(group) {
@ -486,3 +391,20 @@ export function executeScript(group) {
method: 'post' 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" :sortable="column.sortable"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag :type="column.tagType(scope.row, scope.$index)">{{ column.columnValue(scope.row, <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>
scope.$index) }}</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -118,8 +117,7 @@
:type="button.type ? button.type : 'primary'" :type="button.type ? button.type : 'primary'"
:disabled="isTableBtnDisabled(button, scope.$index, scope.row)" :disabled="isTableBtnDisabled(button, scope.$index, scope.row)"
@click="button.handleClick(scope.$index, scope.row) " @click="button.handleClick(scope.$index, scope.row) "
>{{ getTableBtnName(button.name, >{{ getTableBtnName(button.name, scope.$index, scope.row) }}</el-button>
scope.$index, scope.row) }}</el-button>
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
@ -454,6 +452,9 @@ export default {
}, },
currentChoose() { currentChoose() {
return this.choose; return this.choose;
},
refresh() {
this.queryList.data = [...this.queryList.data];
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -4,32 +4,33 @@ const deviceRender = {};
/** IbpText渲染配置*/ /** IbpText渲染配置*/
deviceRender[deviceType.IbpText] = { deviceRender[deviceType.IbpText] = {
zlevel: 1 zlevel: 3
}; };
/** SquareButton渲染配置*/ /** SquareButton渲染配置*/
deviceRender[deviceType.SquareButton] = { deviceRender[deviceType.SquareButton] = {
zlevel: 1 zlevel: 3
}; };
/** WarnButton渲染配置*/ /** WarnButton渲染配置*/
deviceRender[deviceType.WarnButton] = { deviceRender[deviceType.WarnButton] = {
zlevel: 1 zlevel: 3
}; };
/** Arrow渲染配置*/ /** Arrow渲染配置*/
deviceRender[deviceType.Arrow] = { deviceRender[deviceType.Arrow] = {
zlevel: 1 zlevel: 2
}; };
/** RotatingButton渲染配置*/ /** RotatingButton渲染配置*/
deviceRender[deviceType.RotatingButton] = { deviceRender[deviceType.RotatingButton] = {
zlevel: 1 zlevel: 3
}; };
/** Tip渲染配置*/ /** TipBox渲染配置*/
deviceRender[deviceType.Tip] = { deviceRender[deviceType.TipBox] = {
zlevel: 1 zlevel: 2,
z: 2
}; };
/** BackGround渲染配置*/ /** BackGround渲染配置*/
@ -39,6 +40,43 @@ deviceRender[deviceType.Background] = {
/** CircularLamp渲染配置 */ /** CircularLamp渲染配置 */
deviceRender[deviceType.CircularLamp] = { deviceRender[deviceType.CircularLamp] = {
zlevel: 3
};
/** AppendageBox渲染配置 */
deviceRender[deviceType.AppendageBox] = {
zlevel: 1 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; export default deviceRender;

View File

@ -1,12 +1,19 @@
const deviceType = { const deviceType = {
IbpText: 'IbpText', IbpText: 'IbpText',
SquareButton: 'SquareButton', SquareButton: 'SquareButton',
WarnButton: 'WarnButton',
Arrow: 'Arrow', Arrow: 'Arrow',
RotatingButton: 'RotatingButton', RotatingButton: 'RotatingButton',
Tip: 'Tip', TipBox: 'TipBox',
Background: 'Background', 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; 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 deviceState from '../jmap/constant/deviceState';
import deviceType from './constant/deviceType'; import deviceType from './constant/deviceType';
import {calculateDCenter, createBoundingRect, modelFactory} from './utils/parser'; import {calculateDCenter, createBoundingRect, modelFactory} from './utils/parser';
import { updateIbpData } from './utils/parser';
const renderer = 'canvas'; const renderer = 'canvas';
const devicePixelRatio = 1; const devicePixelRatio = 1;
@ -24,6 +25,9 @@ class IbpPan {
// 设备数据 // 设备数据
this.ibpDevice = {}; this.ibpDevice = {};
// 展示的画布大小
this.canvasSize = {};
// 默认状态 // 默认状态
this.defaultStateDict = this.loadDefaultState(); this.defaultStateDict = this.loadDefaultState();
@ -39,7 +43,7 @@ class IbpPan {
this.$painter = new Painter(this); this.$painter = new Painter(this);
this.$painter.updateZrSize({width: this.$ibpZr.getWidth(), height: this.$ibpZr.getHeight()}); 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); this.optionsHandler = this.setOptions.bind(this);
@ -60,23 +64,27 @@ class IbpPan {
return defaultStateDict; return defaultStateDict;
} }
setMap(config, ibpDevice) { setMap(config, ibpDevice) {
// 保存皮肤类型 // 保存平移缩放数据
if (config.config) { if (config.config) {
this.$options.scaleRate = config.scaling; this.$options.scaleRate = config.scaling;
this.$options.offsetX = config.origin.x; this.$options.offsetX = config.origin.x;
this.$options.offsetY = config.origin.y; this.$options.offsetY = config.origin.y;
this.$painter.updateTransform({ scaleRate: config.scaling, offsetX: config.origin.x, offsetY: config.origin.y });
} }
// 保存原始数据 // 保存原始数据
this.data = config; this.data = config;
// 保存需展现的画布大小
this.canvasSize = {
x: 0,
y: 0,
width: config.background.width,
height: config.background.height
};
// 解析地图数据 // 解析地图数据
this.ibpDevice = ibpDevice; this.ibpDevice = ibpDevice;
// 加载对应皮肤
// this.style = this.loadStyle(this.skinCode);
// 数据加载完成 回调 // 数据加载完成 回调
if (this.methods.dataLoaded instanceof Function) { this.methods.dataLoaded(this.ibpDevice); } 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); } if (this.methods.viewLoaded instanceof Function) { this.methods.viewLoaded(this.ibpDevice); }
this.$painter.updateTransform(this.$options, this.canvasSize);
} }
setDefaultState() { setDefaultState() {
@ -97,7 +106,7 @@ class IbpPan {
setOptions(opts) { setOptions(opts) {
const options = this.pullBack(opts); const options = this.pullBack(opts);
this.$options.update(options); this.$options.update(options);
this.$painter.updateTransform(this.$options); this.$painter.updateTransform(this.$options, this.canvasSize);
if (this.$options.disabled == true) { if (this.$options.disabled == true) {
this.$mouseController.disable(); this.$mouseController.disable();
@ -122,16 +131,16 @@ class IbpPan {
} }
render(list) { render(list) {
console.log('-*-*-*-*-', list);
(list || []).forEach(elem => { (list || []).forEach(elem => {
const code = elem.code; const code = elem.code;
const type = elem._type; const type = elem._type;
updateIbpData(elem);
const oDevice = this.ibpDevice[code] || {instance: null, event: null, model: modelFactory(type, 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); this.$painter.delete(oDevice);
if (!elem._dispose) { if (!elem._dispose) {
this.ibpDevice[code] = nDevice; this.ibpDevice[code] = nDevice;
this.$painter.add(nDevice); this.$painter.add(nDevice, true);
} }
}); });
@ -234,7 +243,22 @@ class IbpPan {
this.ibpDevice = {}; this.ibpDevice = {};
this.$painter.clear(); 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() { dispose() {
this.off(this.events.Pan, this.optionsHandler); this.off(this.events.Pan, this.optionsHandler);
this.off(this.events.Zoom, 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 Group from 'zrender/src/container/Group';
import Image from 'zrender/src/graphic/Image'; import Image from 'zrender/src/graphic/Image';
import alarmpic from '@/assets/ibp_images/alarm.png'; import alarmpic from '@/assets/ibp_images/alarm.png';
import store from '@/store';
export default class alarm extends Group { export default class alarm extends Group {
constructor(device) { constructor(device) {
super(); super();
this.model = device.model; this.model = device.model;
this.event = device.event;
this.zlevel = device.model.zlevel; this.zlevel = device.model.zlevel;
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.create(); this.create();
} }
@ -15,20 +20,27 @@ export default class alarm extends Group {
const model = this.model; const model = this.model;
this.imageBg = new Image({ this.imageBg = new Image({
zlevel: this.zlevel, zlevel: this.zlevel,
draggable: model.draggable || false, draggable: false,
style: { style: {
image: alarmpic, image: alarmpic,
x: model.point.x, x: model.point.x,
y: model.point.y, y: model.point.y,
width: 70, width: model.width,
height: 74 height: model.width/71*74
} }
}); });
this.add(this.imageBg); 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() { setDraggable() {
this.arrow.attr('draggable', true); this.imageBg.attr('draggable', true);
this.createMouseEvent(); this.createMouseEvent();
} }
createMouseEvent() { createMouseEvent() {
@ -39,6 +51,13 @@ export default class alarm extends Group {
mousedown(e) { mousedown(e) {
this.event.disable(); 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(e) {
@ -46,7 +65,11 @@ export default class alarm extends Group {
mouseup(e) { mouseup(e) {
this.event.enable(); this.event.enable();
this.model.point.x = this.model.point.x + e.offsetX; if (this.dragging) {
this.model.point.y = this.model.point.y + e.offsetY; 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 Group from 'zrender/src/container/Group';
import {arrow} from '@/jmap/shape/utils/ShapePoints'; import {arrow} from '@/jmap/shape/utils/ShapePoints';
// import { updateIbpData } from '@/ibp/utils/parser'; // import { updateIbpData } from '@/ibp/utils/parser';
import store from '@/store';
class Arrow extends Group { class Arrow extends Group {
constructor(device) { constructor(device) {
super(); super();
this.event = device.event; this.event = device.event;
this.model = device.model; this.model = device.model;
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.create(); this.create();
} }
@ -16,13 +20,12 @@ class Arrow extends Group {
this.arrow = new Polygon({ this.arrow = new Polygon({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
draggable: model.draggable || false, draggable: false,
shape: { 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: { style: {
stroke: model.stroke, stroke: model.stroke,
lineWidth: model.lineWidth,
fill: model.fill fill: model.fill
} }
}); });
@ -36,6 +39,14 @@ class Arrow extends Group {
this.transformRotation(0); this.transformRotation(0);
break; break;
} }
case 'top': {
this.transformRotation(90);
break;
}
case 'bottom': {
this.transformRotation(270);
break;
}
case 'right': { case 'right': {
this.transformRotation(180); this.transformRotation(180);
break; break;
@ -63,18 +74,25 @@ class Arrow extends Group {
this.on('mousemove', this.mousemove, this); this.on('mousemove', this.mousemove, this);
this.on('mouseup', this.mouseup, this); this.on('mouseup', this.mouseup, this);
} }
mousedown() { mousedown(e) {
this.event.disable(); 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() { mousemove() {
console.log('鼠标移动');
} }
mouseup(e) { mouseup(e) {
this.event.enable(); this.event.enable();
this.model.point.x = this.model.point.x + e.offsetX; if (this.dragging) {
this.model.point.y = this.model.point.y + e.offsetY; this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX);
console.log('鼠标抬起', this.model); 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.model = device.model;
this.zlevel = device.model.zlevel; this.zlevel = device.model.zlevel;
this.z = 1; this.z = 1;
this.imageBgArray = [];
// this.model.width = 4100;
// this.model.height = 900;
this.create(); this.create();
} }
create() { create() {
this.imageBg = new Image({ const widthNum = Math.ceil(parseInt(this.model.width)/2048);
zlevel: this.zlevel, const heightNum = Math.ceil(parseInt(this.model.height)/1024);
z: this.z, for (let i = 0; i<widthNum; i++) {
style: { for (let j = 0; j<heightNum; j++) {
x: 0, const imageBg = new Image({
y: 0, zlevel: this.zlevel,
image: ibpBg, z: this.z,
width: 2048, style: {
height: 1024 x: i*2048,
y: j*1024,
image: ibpBg,
width: 2048,
height: 1024
}
});
this.imageBgArray.push(imageBg);
} }
}); }
this.tailorRect = new Rect({ this.tailorRect = new Rect({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
@ -36,16 +46,11 @@ export default class background extends Group {
this.tailorBgImage(); this.tailorBgImage();
} }
tailorBgImage() { tailorBgImage() {
// this.imageBg.setClipPath(this.tailorRect); const _this = this;
this.add(this.imageBg); this.imageBgArray.forEach( function(elem) {
} elem.setClipPath(_this.tailorRect);
setInitialPosition(opt) { _this.add(elem);
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);
} }
setDraggable() { 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 yellowButtonPicOn from '@/assets/ibp_images/yellow_button_on.png';
import grayButtonPic from '@/assets/ibp_images/gray_button.png'; import grayButtonPic from '@/assets/ibp_images/gray_button.png';
import grayButtonPicOn from '@/assets/ibp_images/gray_button_on.png'; import grayButtonPicOn from '@/assets/ibp_images/gray_button_on.png';
import store from '@/store';
export default class button extends Group { export default class button extends Group {
static colors = new Map([ static colors = new Map([
@ -26,15 +27,20 @@ export default class button extends Group {
]); ]);
constructor(device) { constructor(device) {
super(); super();
this.event = device.event;
this.model = device.model; this.model = device.model;
this.zlevel = device.model.zlevel; this.zlevel = device.model.zlevel;
this.event = device.event;
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.create(); this.create();
} }
create() { create() {
const model = this.model; const model = this.model;
this.imageBg = new Image({ this.imageBg = new Image({
zlevel: this.zlevel, zlevel: this.zlevel,
draggable: model.draggable || false, draggable: false,
style: { style: {
image: this.getImagePic(), image: this.getImagePic(),
x: model.point.x, x: model.point.x,
@ -44,6 +50,14 @@ export default class button extends Group {
} }
}); });
this.add(this.imageBg); 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() { getImagePic() {
@ -52,7 +66,7 @@ export default class button extends Group {
} }
setDraggable() { setDraggable() {
this.arrow.attr('draggable', true); this.imageBg.attr('draggable', true);
this.createMouseEvent(); this.createMouseEvent();
} }
createMouseEvent() { createMouseEvent() {
@ -65,14 +79,14 @@ export default class button extends Group {
setState(model) { setState(model) {
switch (model.status) { switch (model.status) {
case 'on': { case 'on': {
// 关闭 // 开放
this.close(); this.open();
this.model.status='on'; this.model.status='on';
break; break;
} }
case 'off': { case 'off': {
// 开放 // 关闭
this.open(); this.close();
this.model.status='off'; this.model.status='off';
break; break;
} }
@ -98,13 +112,24 @@ export default class button extends Group {
mousedown(e) { mousedown(e) {
this.event.disable(); 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) { mouseup(e) {
this.event.enable(); this.event.enable();
this.model.point.x = this.model.point.x + e.offsetX; if (this.dragging) {
this.model.point.y = this.model.point.y + e.offsetY; 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() { close() {

View File

@ -1,5 +1,6 @@
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
import Circle from 'zrender/src/graphic/shape/Circle'; import Circle from 'zrender/src/graphic/shape/Circle';
import store from '@/store';
export default class CircularLamp extends Group { export default class CircularLamp extends Group {
constructor(device) { constructor(device) {
@ -8,6 +9,9 @@ export default class CircularLamp extends Group {
this.event = device.event; this.event = device.event;
this.zlevel = device.model.zlevel; this.zlevel = device.model.zlevel;
this.z = device.model.z; this.z = device.model.z;
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.create(); this.create();
} }
@ -15,7 +19,7 @@ export default class CircularLamp extends Group {
this.lamp = new Circle({ this.lamp = new Circle({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
draggable: this.model.draggable||false, draggable: false,
shape: { shape: {
cx: this.model.point.x, cx: this.model.point.x,
cy: this.model.point.y, cy: this.model.point.y,
@ -40,15 +44,24 @@ export default class CircularLamp extends Group {
this.on('mousemove', this.mousemove, this); this.on('mousemove', this.mousemove, this);
this.on('mouseup', this.mouseup, this); this.on('mouseup', this.mouseup, this);
} }
mousedown() { mousedown(e) {
this.event.disable(); 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() { mousemove() {
console.log('鼠标移动');
} }
mouseup() { mouseup(e) {
this.event.enable(); 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 Background from './background';
import CircularLamp from './circularLamp'; import CircularLamp from './circularLamp';
import IbpText from './ibpText'; 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 = {}; const ibpShape = {};
ibpShape[deviceType.Arrow] = Arrow; ibpShape[deviceType.Arrow] = Arrow;
ibpShape[deviceType.Background] = Background; ibpShape[deviceType.Background] = Background;
ibpShape[deviceType.CircularLamp] = CircularLamp; ibpShape[deviceType.CircularLamp] = CircularLamp;
ibpShape[deviceType.IbpText] = IbpText; 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) { function shapefactory(device, ibp) {
const type = device.model._type; 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 Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text'; 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) { constructor(device) {
super(); super();
this.model = device.model; this.model = device.model;
this.event = device.event; this.event = device.event;
this.zlevel = device.model.zlevel; this.zlevel = device.model.zlevel;
this.z = device.model.z; this.z = device.model.z;
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.create(); this.create();
} }
create() { create() {
@ -17,10 +20,10 @@ export default class button extends Group {
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
silent: model.silent || false, silent: model.silent || false,
draggable: model.draggable || false, draggable: false,
style: { style: {
x: model.x, x: model.point.x,
y: model.y, y: model.point.y,
fontWeight: model.fontWeight, fontWeight: model.fontWeight,
fontSize: model.fontSize, fontSize: model.fontSize,
fontFamily: model.fontFamily, fontFamily: model.fontFamily,
@ -29,7 +32,8 @@ export default class button extends Group {
textFill: model.textFill, textFill: model.textFill,
textAlign: model.textAlign, textAlign: model.textAlign,
textPosition: model.textPosition || 'inside', textPosition: model.textPosition || 'inside',
textVerticalAlign: model.textVerticalAlign || null textVerticalAlign: model.textVerticalAlign || null,
textLineHeight: model.fontSize
} }
}); });
this.add(this.textName); this.add(this.textName);
@ -43,18 +47,24 @@ export default class button extends Group {
this.on('mousemove', this.mousemove, this); this.on('mousemove', this.mousemove, this);
this.on('mouseup', this.mouseup, this); this.on('mouseup', this.mouseup, this);
} }
mousedown() { mousedown(e) {
this.event.disable(); 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() { mousemove() {
console.log('鼠标移动');
} }
mouseup(e) { mouseup(e) {
this.event.enable(); this.event.enable();
this.model.x = this.model.x + e.offsetX; if (this.dragging) {
this.model.y = this.model.y + e.offsetY; this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX);
console.log('鼠标抬起', this.model); this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY);
updateIbpData(this.model, 'update'); 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 Image from 'zrender/src/graphic/Image';
import rotateBlack from '@/assets/ibp_images/rotate_black.png'; import rotateBlack from '@/assets/ibp_images/rotate_black.png';
import rotateRed from '@/assets/ibp_images/rotate_red.png'; import rotateRed from '@/assets/ibp_images/rotate_red.png';
import store from '@/store';
export default class rotateTip extends Group { export default class rotateTip extends Group {
@ -9,6 +10,10 @@ export default class rotateTip extends Group {
super(); super();
this.model = device.model; this.model = device.model;
this.zlevel = device.model.zlevel; this.zlevel = device.model.zlevel;
this.event = device.event;
this.offsetX = 0;
this.offsetY = 0;
this.dragging = false;
this.create(); this.create();
} }
@ -16,16 +21,24 @@ export default class rotateTip extends Group {
const model = this.model; const model = this.model;
this.imageBg = new Image({ this.imageBg = new Image({
zlevel: this.zlevel, zlevel: this.zlevel,
draggable: model.draggable || false, draggable: false,
style: { style: {
image: this.getRotateColor(), image: this.getRotateColor(),
x: model.point.x, x: model.point.x,
y: model.point.y, y: model.point.y,
width: 70, width: 68,
height: 74 height: 60
} }
}); });
this.add(this.imageBg); 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() { getRotateColor() {
@ -44,7 +57,7 @@ export default class rotateTip extends Group {
} }
setDraggable() { setDraggable() {
this.arrow.attr('draggable', true); this.imageBg.attr('draggable', true);
this.createMouseEvent(); this.createMouseEvent();
} }
createMouseEvent() { createMouseEvent() {
@ -55,6 +68,13 @@ export default class rotateTip extends Group {
mousedown(e) { mousedown(e) {
this.event.disable(); 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(e) {
@ -62,7 +82,10 @@ export default class rotateTip extends Group {
mouseup(e) { mouseup(e) {
this.event.enable(); this.event.enable();
this.model.point.x = this.model.point.x + e.offsetX; if (this.dragging) {
this.model.point.y = this.model.point.y + e.offsetY; 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(); view.decomposeTransform();
this.revisibleView(view); 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.transform = createTransform(opts);
this.transformAll(); 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 * as matrix from 'zrender/src/core/matrix';
import deviceType from '../constant/deviceType'; import deviceType from '../constant/deviceType';
import deviceRender from '../constant/deviceRender'; import deviceRender from '../constant/deviceRender';
import store from '@/store';
export function createTransform(opts) { export function createTransform(opts) {
let transform = matrix.create(); 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 }; return { instance: null, event: null, model: propConvert ? propConvert.initPrivateProps(tempModel) : tempModel };
} }
export function parser(data, config) { export function parser(data) {
var ibpDevice = {}; var ibpDevice = {};
const propConvert = null; const propConvert = null;
// var propConvert = skinCode ? Vue.prototype.$theme.loadPropConvert(skinCode): null; // var propConvert = skinCode ? Vue.prototype.$theme.loadPropConvert(skinCode): null;
if (data) { if (data) {
Object.assign(data.background);
Object.assign(data.background, config);
ibpDevice[data.background.code] = createModel(deviceType.Background, data.background, propConvert); ibpDevice[data.background.code] = createModel(deviceType.Background, data.background, propConvert);
zrUtil.each(data.textList || [], elem => { zrUtil.each(data.textList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.IbpText, elem, propConvert); 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); ibpDevice[elem.code] = createModel(deviceType.CircularLamp, elem, propConvert);
}, this); }, this);
zrUtil.each(data.warnButtonList || [], elem => { zrUtil.each(data.alarmList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.WarnButton, elem, propConvert); ibpDevice[elem.code] = createModel(deviceType.Alarm, elem, propConvert);
}, this); }, this);
zrUtil.each(data.arrowList || [], elem => { zrUtil.each(data.arrowList || [], elem => {
@ -69,10 +69,284 @@ export function parser(data, config) {
ibpDevice[elem.code] = createModel(deviceType.RotatingButton, elem, propConvert); ibpDevice[elem.code] = createModel(deviceType.RotatingButton, elem, propConvert);
}, this); }, this);
zrUtil.each(data.tipList || [], elem => { zrUtil.each(data.tipBoxList || [], elem => {
ibpDevice[elem.code] = createModel(deviceType.Tip, elem, propConvert); ibpDevice[elem.code] = createModel(deviceType.TipBox, elem, propConvert);
}, this); }, 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; 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'; renderer.domElement.style.top = '0';
var renderercctv = new THREE.WebGLRenderer(); 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.position = 'absolute';
renderercctv.domElement.style.top = '0'; renderercctv.domElement.style.top = '0';
document.getElementById('jlsimulation').appendChild(renderer.domElement); document.getElementById('jlsimulation').appendChild(renderer.domElement);
document.getElementById('jlcctv').appendChild(renderercctv.domElement); document.getElementById('jlcctv').appendChild(renderercctv.domElement);
// 定义相机 // 定义相机
//let camera = SetCamera(dom); // let camera = SetCamera(dom);
// 定义场景(渲染容器) // 定义场景(渲染容器)
const scene = SetScene(); const scene = SetScene();
const speed = 0; const speed = 0;
let drivingcode = null; let drivingcode = null;
@ -104,8 +103,8 @@ export function JLmapDriving(dom, data, skinCode) {
controls3.enabled = true; controls3.enabled = true;
scene.add(controls3.getObject()); scene.add(controls3.getObject());
let cameracctv = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 150); const cameracctv = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 150);
cameracctv.position.set( 5, -3,27 ); cameracctv.position.set( 5, -3, 27 );
cameracctv.rotation.y = Math.PI/5*3; cameracctv.rotation.y = Math.PI/5*3;
camera.add(cameracctv); camera.add(cameracctv);
@ -135,9 +134,8 @@ export function JLmapDriving(dom, data, skinCode) {
// 判断渲染是否开启 // 判断渲染是否开启
if (scope.animateswitch == true) { if (scope.animateswitch == true) {
// 根据相机渲染场景 // 根据相机渲染场景
renderercctv.render(scene,cameracctv);
renderer.render(scene, camera); renderer.render(scene, camera);
renderercctv.render(scene, cameracctv);
// updatcontrols(); // updatcontrols();
// renderercctv // renderercctv
controls3.update(); controls3.update();
@ -193,7 +191,7 @@ export function JLmapDriving(dom, data, skinCode) {
this.updatestoptime = function(stime) { this.updatestoptime = function(stime) {
scope.stime = stime; scope.stime = stime;
}; };
this.updatedrivedata = function(drivedata){ this.updatedrivedata = function(drivedata) {
scope.drivecount += 1; scope.drivecount += 1;
scope.drivedata = drivedata; scope.drivedata = drivedata;
}; };

View File

@ -564,9 +564,14 @@ THREE.FBXLoader = ( function () {
} }
if ( materialNode.Opacity ) { if ( materialNode.Opacity ) {
if(materialNode.Opacity.value<1 && materialNode.Opacity.value>0.9){
parameters.opacity = parseFloat( materialNode.Opacity.value ); 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 ) { if ( parameters.opacity < 1.0 ) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -20,9 +20,6 @@ class Jlmap {
// 鼠标事件 // 鼠标事件
this.events = { __Pan: 'pan', __Zoom: 'zoom', Selected: 'selected', Contextmenu: 'contextmenu', DataZoom: 'dataZoom'}; this.events = { __Pan: 'pan', __Zoom: 'zoom', Selected: 'selected', Contextmenu: 'contextmenu', DataZoom: 'dataZoom'};
// 原始数据
this.data = {};
// 皮肤参数 // 皮肤参数
this.skinCode = ''; this.skinCode = '';
@ -83,12 +80,10 @@ class Jlmap {
this.$options.scaleRate = map.skinVO.scaling || 1; this.$options.scaleRate = map.skinVO.scaling || 1;
this.$options.offsetX = map.skinVO.origin ? map.skinVO.origin.x : 0; this.$options.offsetX = map.skinVO.origin ? map.skinVO.origin.x : 0;
this.$options.offsetY = map.skinVO.origin ? map.skinVO.origin.y : 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.$painter.updateTransform({ scaleRate: this.$options.scaleRate, offsetX: this.$options.offsetX, offsetY: this.$options.offsetY });
} }
// 保存原始数据
this.data = map;
// 解析地图数据 // 解析地图数据
this.mapDevice = mapDevice; this.mapDevice = mapDevice;
@ -103,7 +98,6 @@ class Jlmap {
// 视图加载完成 回调 // 视图加载完成 回调
if (this.methods.viewLoaded instanceof Function) { this.methods.viewLoaded(this.mapDevice); } if (this.methods.viewLoaded instanceof Function) { this.methods.viewLoaded(this.mapDevice); }
} }
setDefaultState() { setDefaultState() {
@ -158,7 +152,6 @@ class Jlmap {
const type = elem._type; const type = elem._type;
const oDevice = this.mapDevice[code] || deviceFactory(type, elem); const oDevice = this.mapDevice[code] || deviceFactory(type, elem);
const nDevice = Object.assign(oDevice || {}, elem); const nDevice = Object.assign(oDevice || {}, elem);
this.dataSync(nDevice);
this.$painter.delete(oDevice); this.$painter.delete(oDevice);
if (!elem._dispose) { if (!elem._dispose) {
this.mapDevice[code] = nDevice; this.mapDevice[code] = nDevice;
@ -275,52 +268,6 @@ class Jlmap {
return payload || {}; 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() { getZr() {
return this.$zr; return this.$zr;
} }

View File

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

View File

@ -21,7 +21,7 @@ export default class Station extends Group {
const model = this.model; const model = this.model;
const style = this.style; const style = this.style;
if (style.Station.text.show) { if (model.visible) {
// 公里标名称是否显示 // 公里标名称是否显示
this.stationText = new ETextName({ this.stationText = new ETextName({
zlevel: this.zlevel, zlevel: this.zlevel,
@ -38,29 +38,29 @@ export default class Station extends Group {
textFill: model.nameFontColor textFill: model.nameFontColor
}); });
this.add(this.stationText); this.add(this.stationText);
} const path = window.location.href;
if (style.Station.kmPostShow || path.includes('/map/draw')) {
if (style.Station.kmPostShow) {
// 公里标是否显示 // 公里标是否显示
let direction = 1; let direction = 1;
if (this.style.Station.kilometerPosition == 'up') { if (this.style.Station.kilometerPosition == 'up') {
direction = -1; 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() { craeteSwitchBorder() {
const sectionA = this.device.model.sectionAInstance.instance; const sectionA = this.getInstanceByCode(this.device.model.sectionACode);
const sectionB = this.device.model.sectionBInstance.instance; const sectionB = this.getInstanceByCode(this.device.model.sectionBCode);
const sectionC = this.device.model.sectionCInstance.instance; const sectionC = this.getInstanceByCode(this.device.model.sectionCCode);
const rect = this.device.getBoundingRect(); const rect = this.device.getBoundingRect();
sectionA && rect.union(sectionA.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 section = store.getters['map/getDeviceByCode'](this.device.model.sectionACode) || {};
const parentSection = store.getters['map/getDeviceByCode'](section.parentCode) || {}; const parentSection = store.getters['map/getDeviceByCode'](section.parentCode) || {};
const instance = this.getInstanceByCode(parentSection.trainWindowCode); const instance = this.getInstanceByCode(parentSection.trainWindowCode);
if (instance && instance.mouseLeave) { if (instance && instance.mouseEvent && instance.mouseEvent.mouseLeave) {
instance.mouseLeave(e); instance.mouseEvent.mouseLeave(e);
} }
} }
} }
@ -101,8 +101,8 @@ class EMouse extends Group {
const section = store.getters['map/getDeviceByCode'](this.device.model.sectionACode) || {}; const section = store.getters['map/getDeviceByCode'](this.device.model.sectionACode) || {};
const parentSection = store.getters['map/getDeviceByCode'](section.parentCode) || {}; const parentSection = store.getters['map/getDeviceByCode'](section.parentCode) || {};
const instance = this.getInstanceByCode(parentSection.trainWindowCode); const instance = this.getInstanceByCode(parentSection.trainWindowCode);
if (instance && instance.mouseEnter) { if (instance && instance.mouseEvent && instance.mouseEvent.mouseEnter) {
instance.mouseEnter(e); 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 Polygon from 'zrender/src/graphic/shape/Polygon';
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
import EMouse from './EMouse';
import store from '@/store'; import store from '@/store';
class TrainWindow extends Group { class TrainWindow extends Group {
@ -14,6 +15,7 @@ class TrainWindow extends Group {
this.z = 9; this.z = 9;
this.prdType = store.state.training.prdType; this.prdType = store.state.training.prdType;
this.create(model); this.create(model);
this.createMouseEvent();
this.setState(model); this.setState(model);
} }
create(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() { createTrainWindow() {
const model = this.model; const model = this.model;
@ -44,9 +52,7 @@ class TrainWindow extends Group {
lineWidth: this.style.TrainWindow.lineWidth, lineWidth: this.style.TrainWindow.lineWidth,
stroke: this.style.TrainWindow.lineColor, stroke: this.style.TrainWindow.lineColor,
fill: this.style.transparentColor fill: this.style.transparentColor
}, }
onmouseover: (e) => { this.mouseover(e); },
onmouseout: (e) => { this.mouseout(e); }
}); });
this.add(this.trainRect); this.add(this.trainRect);
} }
@ -72,38 +78,6 @@ class TrainWindow extends Group {
getInstanceByCode(code) { getInstanceByCode(code) {
return (store.getters['map/getDeviceByCode'](code) || {}).instance; 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; export default TrainWindow;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,152 +1,152 @@
<template> <template>
<el-dialog class="beijing-01__schedule edit-planning-train" :title="title" :visible.sync="dialogShow" width="800px" <el-dialog
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag> v-dialogDrag
<el-row> class="beijing-01__schedule edit-planning-train"
<el-col :offset="10">列车线路</el-col> :title="title"
</el-row> :visible.sync="dialogShow"
<el-row> width="800px"
<el-col :span="17"> :before-close="doClose"
<el-table :data="serviceData" border style="width: 100%" height="160"> :z-index="2000"
<el-table-column prop="startStationCode" label="起点站"> :modal="false"
</el-table-column> :close-on-click-modal="false"
<el-table-column prop="startStationStandCode" label="起点站台"> >
</el-table-column> <el-row>
<el-table-column prop="endStationCode" label="终点站"> <el-col :offset="10">列车线路</el-col>
</el-table-column> </el-row>
<el-table-column prop="endStationStandCode" label="终点站台"> <el-row>
</el-table-column> <el-col :span="17">
</el-table> <el-table :data="serviceData" border style="width: 100%" height="160">
</el-col> <el-table-column prop="startStationCode" label="起点站" />
<el-col :span="6" :offset="1"> <el-table-column prop="startStationStandCode" label="起点站台" />
<el-row type="flex" justify="center"> <el-table-column prop="endStationCode" label="终点站" />
<el-button class="view-button" @click="handleAddTask">加任务</el-button> <el-table-column prop="endStationStandCode" label="终点站台" />
</el-row> </el-table>
<el-row type="flex" justify="center"> </el-col>
<el-button class="view-button" @click="handleReplace">&ensp;&ensp;</el-button> <el-col :span="6" :offset="1">
</el-row> <el-row type="flex" justify="center">
<el-row type="flex" justify="center"> <el-button class="view-button" @click="handleAddTask">加任务</el-button>
<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-row> </el-row>
<el-row type="flex" justify="center"> <el-row type="flex" justify="center">
<el-button @click="handleCommit"> </el-button> <el-button class="view-button" @click="handleReplace">&ensp;&ensp;</el-button>
<el-button @click="doClose"> </el-button>
</el-row> </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> </template>
<script> <script>
import { formatTime, formatName } from '@/utils/runPlan'; import { formatTime, formatName } from '@/utils/runPlan';
export default { export default {
name: 'modifyingPlan', name: 'ModifyingPlan',
data() { data() {
return { return {
dialogShow: false, dialogShow: false,
loading: false, loading: false,
effect: false, effect: false,
storeInOut: '1', storeInOut: '1',
oldServiceNumber: '', oldServiceNumber: '',
newServiceNumber: '', newServiceNumber: '',
serviceStartTime: '', serviceStartTime: '',
serviceEndTime: '', serviceEndTime: '',
serviceData: [], serviceData: [],
tripData: [], tripData: []
} };
}, },
computed: { computed: {
title() { title() {
return '修改' return '修改';
} }
}, },
mounted() { mounted() {
}, },
methods: { methods: {
formatTime(time) { formatTime(time) {
return formatTime(time); return formatTime(time);
}, },
formatName(code) { formatName(code) {
return formatName(code); return formatName(code);
}, },
doShow() { doShow() {
this.dialogShow = true; this.dialogShow = true;
}, },
doClose() { doClose() {
this.loading = false; this.loading = false;
this.dialogShow = false; this.dialogShow = false;
}, },
// //
handleAddTask() { handleAddTask() {
this.$emit('dispatchDialog', { name: 'addTask', params: {} }) this.$emit('dispatchDialog', { name: 'addTask', params: {} });
}, },
// //
handleReplace() { handleReplace() {
this.$emit('dispatchDialog', { name: 'modifyingTask', params: {} }) this.$emit('dispatchDialog', { name: 'modifyingTask', params: {} });
}, },
// //
handleDeleteTask() { handleDeleteTask() {
this.$emit('dispatchDialog', { name: 'deleteTask', params: {} }) this.$emit('dispatchDialog', { name: 'deleteTask', params: {} });
}, },
// //
handleModifyingTripNumber() { handleModifyingTripNumber() {
this.$emit('dispatchDialog', { name: 'modifyingTripNumber', params: {} }) this.$emit('dispatchDialog', { name: 'modifyingTripNumber', params: {} });
}, },
// //
handleCommit() { handleCommit() {
this.doClose(); this.doClose();
} }
} }
} };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss"; @import "src/styles/mixin.scss";
@ -157,13 +157,11 @@
margin-left: 0px; margin-left: 0px;
} }
.view-label { .view-label {
height: 32px; height: 32px;
line-height: 32px; line-height: 32px;
} }
.view-box { .view-box {
padding: 10px 0px; padding: 10px 0px;
border: 1px inset gray; border: 1px inset gray;

View File

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

View File

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

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