diff --git a/src/api/management/author.js b/src/api/management/author.js index c844787d1..f1ab5456f 100644 --- a/src/api/management/author.js +++ b/src/api/management/author.js @@ -10,14 +10,6 @@ export function getLessonPermissonPageList(params) { }); } -// 根据ID获取权限数据 -// export function getLessonPermissonDetail(id) { -// return request({ -// url: `/api/permission/${id}`, -// method: 'get' -// }); -// } - /** 创建课程权限*/ export function createLessonPermisson(data) { return request({ @@ -26,10 +18,19 @@ export function createLessonPermisson(data) { data: data }); } + +/** 获取权限详情*/ +export function getPermissonDetail(id) { + return request({ + url: `/api/permission/${id}/package`, + method: 'get' + }); +} + /** 获取用户某课程某段时间内可用的权限数量*/ export function getTotalRemains(params) { return request({ - url: '/api/permission/totalRemains', + url: '/api/userPermission/totalRemains', method: 'get', params: params }); @@ -37,7 +38,7 @@ export function getTotalRemains(params) { /** 设置权限失效或有效*/ export function setLessonPermisson(data) { return request({ - url: `/api/permission/${data.id}/status`, + url: `/api/userPermission/${data.id}/status`, method: 'put', data: data }); @@ -48,7 +49,7 @@ export function setLessonPermisson(data) { */ export function queryPermissionSimulation(data) { return request({ - url: `/api/permission/${data.mapId}/${data.prdCode}/simulation`, + url: `/api/userPermission/${data.mapId}/${data.prdCode}/simulation`, method: 'get' }); } @@ -56,38 +57,28 @@ export function queryPermissionSimulation(data) { /** 获取大屏权限列表*/ export function queryPermissionScreen() { return request({ - url: `/api/permission/bigScreen`, + url: `/api/userPermission/bigScreen`, method: 'get' }); } -/** 更新课程权限*/ -/* -export function updateLessonPermisson(data) { - return request({ - url: '/api/permission', - method: 'put', - data: data - }); -} -*/ - -/** 删除课程权限*/ -/* -export function deleteLessonPermisson(id) { - return request({ - url: '/api/permission/' + id, - method: 'delete' - }); -} -*/ - /** * 用户权限列表 */ +export function listPermision(params) { + return request({ + url: `/api/userPermission`, + method: 'get', + params: params + }); +} + +/** + * 个人权限列表 + */ export function listUserPermision(params) { return request({ - url: `/api/permission/my`, + url: `/api/userPermission/my`, method: 'get', params: params }); @@ -101,10 +92,10 @@ export function getDistribute(id) { }); } -/** 用户权限列表 */ +/** 设置权限所有者 */ export function putPermissionOwner(data) { return request({ - url: `/api/permission/${data.id}/owner`, + url: `/api/userPermission/${data.id}/owner`, method: 'put', data: data.owner }); diff --git a/src/api/management/distribute.js b/src/api/management/distribute.js index f7424bbbc..5d68f8bbc 100644 --- a/src/api/management/distribute.js +++ b/src/api/management/distribute.js @@ -1,6 +1,6 @@ import request from '@/utils/request'; -/** 上课权限获取*/ +/** 权限转增*/ export function getLessons(data) { return request({ url: '/api/distribute/getLessons', @@ -9,15 +9,41 @@ export function getLessons(data) { }); } -/** 上课权限分发*/ +/** 权限分发*/ export function giveLessons(data) { return request({ - url: '/api/distribute/givePermission', + url: '/api/distribute/distribute', method: 'post', data: data }); } +/** 权限转增*/ +export function permissionTurnAdd(data) { + return request({ + url: '/api/distribute/transfer', + method: 'post', + data: data + }); +} + +/** 从订单分发权限(获取二维码)*/ +export function postDistribute(data) { + return request({ + url: `/api/distribute/${data.code}/distribute`, + method: 'post', + data: data + }); +} + +/** 权限获取*/ +export function getPermission(state) { + return request({ + url: `/api/distribute/getPermission?state=${state}`, + method: 'get' + }); +} + /** 接收课程权限*/ export function receiveLessons(data) { return request({ diff --git a/src/api/management/goods.js b/src/api/management/goods.js index 5e9b6fd59..7c87f2e5a 100644 --- a/src/api/management/goods.js +++ b/src/api/management/goods.js @@ -66,7 +66,7 @@ export function getCommodityDetailById(id) { */ export function updataCommodityList(data) { return request({ - url: `/api/goods`, + url: `/api/goods/${data.id}`, method: 'put', data: data }); diff --git a/src/api/runplan.js b/src/api/runplan.js index 229c57b1d..8876c8220 100644 --- a/src/api/runplan.js +++ b/src/api/runplan.js @@ -277,20 +277,14 @@ export function deleteRunPlanTemplate(planId) { } /** 生成通用每日运行图*/ -export function generateCommonRunPlanEveryDay(planId) { +export function generateCommonRunPlanEveryDay(planId, params) { return request({ url: `/api/runPlan/template/generate/${planId}`, - method: 'post' + method: 'post', + params }); } -/** 生成用户每日运行图*/ -export function generateUserRunPlanEveryDay(planId, group) { - return request({ - url: `/api/runPlan/daily/privilege/${planId}?group=${group}`, - method: 'post' - }); -} /** 获取运行计划每日列表*/ export function runPlanEveryDayList(params) { return request({ @@ -309,20 +303,12 @@ export function deleteRunPlanEveryDay(planId) { } /** 获取地图运行图的车次号*/ -export function getPublishMapTrainNos(skinCode) { - return request({ - url: `/api/runPlan/daily/${skinCode}/trainNos`, - method: 'get' - }); -} - -/** 获取服务号、车组号*/ -export function getPublishMapTrainServerNos(skinCode) { - return request({ - url: `/api/runPlan/daily/${skinCode}/serverNos`, - method: 'get' - }); -} +// export function getPublishMapTrainNos(skinCode) { +// return request({ +// url: `/api/runPlan/daily/${skinCode}/trainNos`, +// method: 'get' +// }); +// } /** 分页查询加载计划*/ export function getRunPlanLoadList(params) { @@ -374,3 +360,11 @@ export function queryRunPlanDaily(planId) { method: 'get' }); } + +/** 获取模板运行图列表*/ +export function listAllTempLateRunPlan() { + return request({ + url: `/api/runPlan/template/all`, + method: 'get' + }); +} diff --git a/src/api/scheduling.js b/src/api/scheduling.js new file mode 100644 index 000000000..253dd304c --- /dev/null +++ b/src/api/scheduling.js @@ -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' + }); +} diff --git a/src/api/simulation.js b/src/api/simulation.js index 60e1053b1..b8161a02d 100644 --- a/src/api/simulation.js +++ b/src/api/simulation.js @@ -160,14 +160,6 @@ export function getEveryDayRunPlanData(group) { }); } -/** 生成手机同步仿真二维码*/ -// export function getSimulationQrCodeUrl(group) { -// return request({ -// url: `/api/simulation/${group}/qrCode`, -// method: 'post' -// }); -// } - /** 录制脚本仿真*/ export function scriptRecordNotify(scriptId) { return request({ @@ -239,7 +231,7 @@ export function selectScriptMembers(group, data) { export function modifyScriptMemberSex(group, playerId, data) { return request({ url: `/api/simulation/${group}/scriptWrite/player/${playerId}?gender=${data.gender}`, - method: 'put', + method: 'put' }); } @@ -293,85 +285,6 @@ export function modifyScriptAction(group, actionId, data) { }); } -// /** 根据成员角色查询设备列表*/ -// export function getDevicesByRole(group, params) { -// return request({ -// url: `/api/simulation/${group}/role/devices`, -// method: 'get', -// params -// }); -// } -// /** 获取任务录制的成员角色列表 */ -// export function getMembersByGroup(group) { -// return request({ -// url: `/api/simulation/${group}/questRecord/members`, -// method: 'get' -// }); -// } - -// /** 添加任务角色成员 */ -// export function postQuestMember(group, data) { -// return request({ -// url: `/api/simulation/${group}/questRecord/member`, -// method: 'post', -// data -// }); -// } - -// /** 删除任务角色成员 */ -// export function deleteQuestMember(group, memberId) { -// return request({ -// url: `/api/simulation/${group}/questRecord/member/${memberId}`, -// method: 'delete' -// }); -// } - -// // /** 添加/修改任务角色行为 */ -// export function postMemberBehavior(group, memberId, data) { -// return request({ -// url: `/api/simulation/${group}/questRecord/${memberId}/behavior`, -// method: 'post', -// data -// }); -// } -// /** 删除任务角色行为 */ -// export function deleteMemberBehavior(group, memberId, behaviorId) { -// return request({ -// url: `/api/simulation/${group}/questRecord/${memberId}/behavior/${behaviorId}`, -// method: 'delete' -// }); -// } -// /** 删除任务角色行为动作 */ -// export function deleteMemberBehaviorAction(group, memberId, behaviorId, actionId) { -// return request({ -// url: `/api/simulation/${group}/questRecord/${memberId}/behavior/${behaviorId}/action/${actionId}`, -// method: 'delete' -// }); -// } -// /** 添加/修改任务角色行为动作 */ -// export function postMemberBehaviorAction(group, memberId, behaviorId, data) { -// return request({ -// url: `/api/simulation/${group}/questRecord/${memberId}/behavior/${behaviorId}/action`, -// method: 'post', -// data -// }); -// } -// /** 添加/修改任务目标条件*/ -// export function postTargetConditionAction(group, data) { -// return request({ -// url: `/api/simulation/${group}/questRecord/targetCondition`, -// method: 'post', -// data -// }); -// } -// /** 删除任务目标条件*/ -// export function deleteTargetConditionAction(group, tcId) { -// return request({ -// url: `/api/simulation/${group}/questRecord/targetCondition/${tcId}`, -// method: 'delete' -// }); -// } - /** 分页查询存在的仿真 */ export function getExistingSimulation(params) { return request({ @@ -396,14 +309,6 @@ export function getDeviceCodeByDeviceType(group, params) { params }); } -// /** 根据设备类型获取设备条件列表 */ -// export function getDeviceCoditionByDeviceType(params) { -// return request({ -// url: `/api/simulation/deviceType/conditions`, -// method: 'get', -// params -// }); -// } /** 获取任务录制的数据 */ export function getScriptRecord(group) { @@ -486,3 +391,20 @@ export function executeScript(group) { method: 'post' }); } + +/** 生成用户自己的当日运行图*/ +export function generateDayRunPlan(planId, group) { + return request({ + url: `/api/simulation/${group}/loadRunPlan/${planId}`, + method: 'post' + }); +} + +/** 创建排班计划仿真*/ +export function schedulingNotify(params) { + return request({ + url: `/api/scheduling/simulation`, + method: 'post', + params + }); +} diff --git a/src/assets/ibp_images/appendage_box.png b/src/assets/ibp_images/appendage_box.png new file mode 100644 index 000000000..5d26ada38 Binary files /dev/null and b/src/assets/ibp_images/appendage_box.png differ diff --git a/src/assets/ibp_images/ibp_bg.png b/src/assets/ibp_images/ibp_bg.png index ba2d03cbf..47bb6eb6a 100644 Binary files a/src/assets/ibp_images/ibp_bg.png and b/src/assets/ibp_images/ibp_bg.png differ diff --git a/src/assets/ibp_images/key.png b/src/assets/ibp_images/key.png new file mode 100644 index 000000000..ce2edd5ca Binary files /dev/null and b/src/assets/ibp_images/key.png differ diff --git a/src/assets/ibp_images/key_on.png b/src/assets/ibp_images/key_on.png new file mode 100644 index 000000000..7ab133914 Binary files /dev/null and b/src/assets/ibp_images/key_on.png differ diff --git a/src/assets/ibp_images/keyhole.png b/src/assets/ibp_images/keyhole.png new file mode 100644 index 000000000..b31e041f2 Binary files /dev/null and b/src/assets/ibp_images/keyhole.png differ diff --git a/src/assets/ibp_images/telephone_terminal.png b/src/assets/ibp_images/telephone_terminal.png index 0f9462ca8..2916add46 100644 Binary files a/src/assets/ibp_images/telephone_terminal.png and b/src/assets/ibp_images/telephone_terminal.png differ diff --git a/src/components/QueryListPage/QueryListPage.vue b/src/components/QueryListPage/QueryListPage.vue index ea6077051..05f0fbf74 100644 --- a/src/components/QueryListPage/QueryListPage.vue +++ b/src/components/QueryListPage/QueryListPage.vue @@ -63,8 +63,7 @@ :sortable="column.sortable" > { const code = elem.code; const type = elem._type; + updateIbpData(elem); const oDevice = this.ibpDevice[code] || {instance: null, event: null, model: modelFactory(type, elem)}; - const nDevice = Object.assign(oDevice.model || {}, elem); + const nDevice = {instance: null, event: null, model: Object.assign(oDevice.model || {}, elem)}; this.$painter.delete(oDevice); if (!elem._dispose) { this.ibpDevice[code] = nDevice; + console.log('--3', nDevice); this.$painter.add(nDevice); } }); @@ -221,6 +223,7 @@ class IbpPan { } resize(opt) { + console.log('----------',this.$ibpZr); this.$ibpZr.resize(opt); this.$painter.updateZrSize(opt); } diff --git a/src/ibp/painter.js b/src/ibp/painter.js index edcb09bf0..6522894b9 100644 --- a/src/ibp/painter.js +++ b/src/ibp/painter.js @@ -61,8 +61,10 @@ class Painter { add(device) { device = Object.assign(device, { event: this.$ibp.$mouseController }); const instance = shapefactory(device, this.$ibp); + console.log('--4', instance); if (instance) { device.instance = instance; + instance.setDraggable(); this.$transformHandle.transformView(instance); this.ibpInstanceLevel[device.model._type].add(instance); } diff --git a/src/ibp/shape/alarm.js b/src/ibp/shape/alarm.js index 00a1a3cf2..824204dc4 100644 --- a/src/ibp/shape/alarm.js +++ b/src/ibp/shape/alarm.js @@ -1,13 +1,18 @@ import Group from 'zrender/src/container/Group'; import Image from 'zrender/src/graphic/Image'; import alarmpic from '@/assets/ibp_images/alarm.png'; +import store from '@/store'; export default class alarm extends Group { constructor(device) { super(); this.model = device.model; + this.event = device.event; this.zlevel = device.model.zlevel; + this.offsetX = 0; + this.offsetY = 0; + this.dragging = false; this.create(); } @@ -20,14 +25,13 @@ export default class alarm extends Group { image: alarmpic, x: model.point.x, y: model.point.y, - width: 71, - height: 74 + width: model.width, + height: model.width/71*74 } }); this.add(this.imageBg); this.transformScale(); } - /** 缩放按钮 */ transformScale() { this.imageBg.origin = [this.model.point.x, this.model.point.y]; @@ -36,7 +40,7 @@ export default class alarm extends Group { } setDraggable() { - this.arrow.attr('draggable', true); + this.imageBg.attr('draggable', true); this.createMouseEvent(); } createMouseEvent() { @@ -47,6 +51,12 @@ export default class alarm extends Group { mousedown(e) { this.event.disable(); + if (e.which == 3) { + store.dispatch('ibp/setUpdateDeviceData', this.model); + } + this.offsetX = e.offsetX; + this.offsetY = e.offsetY; + this.dragging = true; } mousemove(e) { @@ -54,7 +64,11 @@ export default class alarm extends Group { mouseup(e) { this.event.enable(); - this.model.point.x = this.model.point.x + e.offsetX; - this.model.point.y = this.model.point.y + e.offsetY; + if (this.dragging) { + this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX); + this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY); + this.draggable = false; + } + } } diff --git a/src/ibp/shape/appendageBox.js b/src/ibp/shape/appendageBox.js new file mode 100644 index 000000000..12a4fac61 --- /dev/null +++ b/src/ibp/shape/appendageBox.js @@ -0,0 +1,63 @@ +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); + } + 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); + } + + } +} diff --git a/src/ibp/shape/arrow.js b/src/ibp/shape/arrow.js index 166bc364b..98ddb42f7 100644 --- a/src/ibp/shape/arrow.js +++ b/src/ibp/shape/arrow.js @@ -2,12 +2,16 @@ import Polygon from 'zrender/src/graphic/shape/Polygon'; import Group from 'zrender/src/container/Group'; import {arrow} from '@/jmap/shape/utils/ShapePoints'; // import { updateIbpData } from '@/ibp/utils/parser'; +import store from '@/store'; class Arrow extends Group { constructor(device) { super(); this.event = device.event; this.model = device.model; + this.offsetX = 0; + this.offsetY = 0; + this.dragging = false; this.create(); } @@ -16,13 +20,12 @@ class Arrow extends Group { this.arrow = new Polygon({ zlevel: model.zlevel, z: model.z, - draggable: model.draggable || false, + draggable: false, shape: { - points: arrow(this.model.point.x, this.model.point.y, this.model.length, 10) + points: arrow(this.model.point.x, this.model.point.y, this.model.length, this.model.width) }, style: { stroke: model.stroke, - lineWidth: model.lineWidth, fill: model.fill } }); @@ -36,6 +39,14 @@ class Arrow extends Group { this.transformRotation(0); break; } + case 'top': { + this.transformRotation(90); + break; + } + case 'bottom': { + this.transformRotation(270); + break; + } case 'right': { this.transformRotation(180); break; @@ -63,18 +74,23 @@ class Arrow extends Group { this.on('mousemove', this.mousemove, this); this.on('mouseup', this.mouseup, this); } - mousedown() { + mousedown(e) { this.event.disable(); - console.log('鼠标按下'); + if (e.which == 3) { + store.dispatch('ibp/setUpdateDeviceData', this.model); + } + this.offsetX = e.offsetX; + this.offsetY = e.offsetY; + this.dragging = true; } mousemove() { - console.log('鼠标移动'); } mouseup(e) { this.event.enable(); - this.model.point.x = this.model.point.x + e.offsetX; - this.model.point.y = this.model.point.y + e.offsetY; - console.log('鼠标抬起', this.model); + if (this.dragging) { + this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX); + this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY); + } } } diff --git a/src/ibp/shape/background.js b/src/ibp/shape/background.js index 3e2708ad3..312c42a4e 100644 --- a/src/ibp/shape/background.js +++ b/src/ibp/shape/background.js @@ -12,7 +12,7 @@ export default class background extends Group { this.create(); } create() { - this.imageBg = new Image({ + this.imageBg1 = new Image({ zlevel: this.zlevel, z: this.z, style: { @@ -23,6 +23,17 @@ export default class background extends Group { height: 1024 } }); + this.imageBg2 = new Image({ + zlevel: this.zlevel, + z: this.z, + style: { + x: 2048, + y: 0, + image: ibpBg, + width: 2048, + height: 1024 + } + }); this.tailorRect = new Rect({ zlevel: this.zlevel, z: this.z, @@ -37,15 +48,8 @@ export default class background extends Group { } tailorBgImage() { // this.imageBg.setClipPath(this.tailorRect); - this.add(this.imageBg); - } - setInitialPosition(opt) { - const x = this.imageBg.style.x; - const y = this.imageBg.style.y; - this.imageBg.setStyle('x', x-opt.offsetX); - this.imageBg.setStyle('y', y-opt.offsetY); - this.tailorRect.setShape('x', x-opt.offsetX); - this.tailorRect.setShape('y', y-opt.offsetY); + this.add(this.imageBg1); + this.add(this.imageBg2); } setDraggable() { } diff --git a/src/ibp/shape/button.js b/src/ibp/shape/button.js index 58be97077..a6dbd31e4 100644 --- a/src/ibp/shape/button.js +++ b/src/ibp/shape/button.js @@ -10,6 +10,7 @@ import yellowButtonPic from '@/assets/ibp_images/yellow_button.png'; import yellowButtonPicOn from '@/assets/ibp_images/yellow_button_on.png'; import grayButtonPic from '@/assets/ibp_images/gray_button.png'; import grayButtonPicOn from '@/assets/ibp_images/gray_button_on.png'; +import store from '@/store'; export default class button extends Group { static colors = new Map([ @@ -29,6 +30,10 @@ export default class button extends Group { this.event = device.event; this.model = device.model; this.zlevel = device.model.zlevel; + this.event = device.event; + this.offsetX = 0; + this.offsetY = 0; + this.dragging = false; this.create(); } create() { @@ -74,17 +79,17 @@ export default class button extends Group { setState(model) { switch (model.status) { case 'on': { - // 关闭 - this.close(); + // 开放 + this.open(); this.model.status='on'; break; } case 'off': { - // 开放 - this.open(); + // 关闭 + this.close(); this.model.status='off'; break; - } + } } } @@ -105,17 +110,24 @@ export default class button extends Group { } } - mousedown() { + mousedown(e) { this.event.disable(); - console.log('鼠标按下'); + if (e.which == 3) { + store.dispatch('ibp/setUpdateDeviceData', this.model); + } + this.offsetX = e.offsetX; + this.offsetY = e.offsetY; + this.dragging = true; } mousemove() { } mouseup(e) { this.event.enable(); - this.model.point.x = this.model.point.x + e.offsetX; - this.model.point.y = this.model.point.y + e.offsetY; - console.log('鼠标抬起', this.model); + if (this.dragging) { + this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX); + this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY); + } + } // 关闭 close() { diff --git a/src/ibp/shape/circularLamp.js b/src/ibp/shape/circularLamp.js index de3f8e6c0..0d2bcdc46 100644 --- a/src/ibp/shape/circularLamp.js +++ b/src/ibp/shape/circularLamp.js @@ -1,5 +1,6 @@ import Group from 'zrender/src/container/Group'; import Circle from 'zrender/src/graphic/shape/Circle'; +import store from '@/store'; export default class CircularLamp extends Group { constructor(device) { @@ -8,6 +9,9 @@ export default class CircularLamp extends Group { this.event = device.event; this.zlevel = device.model.zlevel; this.z = device.model.z; + this.offsetX = 0; + this.offsetY = 0; + this.dragging = false; this.create(); } @@ -15,7 +19,7 @@ export default class CircularLamp extends Group { this.lamp = new Circle({ zlevel: this.zlevel, z: this.z, - draggable: this.model.draggable||false, + draggable: false, shape: { cx: this.model.point.x, cy: this.model.point.y, @@ -40,15 +44,22 @@ export default class CircularLamp extends Group { this.on('mousemove', this.mousemove, this); this.on('mouseup', this.mouseup, this); } - mousedown() { + mousedown(e) { this.event.disable(); - console.log('鼠标按下'); + if (e.which == 3) { + store.dispatch('ibp/setUpdateDeviceData', this.model); + } + this.offsetX = e.offsetX; + this.offsetY = e.offsetY; + this.dragging = true; } mousemove() { - console.log('鼠标移动'); } - mouseup() { + mouseup(e) { this.event.enable(); - console.log('鼠标抬起'); + if (this.dragging) { + this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX); + this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY); + } } } diff --git a/src/ibp/shape/elevator.js b/src/ibp/shape/elevator.js new file mode 100644 index 000000000..27c590b5e --- /dev/null +++ b/src/ibp/shape/elevator.js @@ -0,0 +1,128 @@ +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: model.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); + } + 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; + } +} diff --git a/src/ibp/shape/elevatorArrow.js b/src/ibp/shape/elevatorArrow.js index 5c9c9ad2b..acdcedb69 100644 --- a/src/ibp/shape/elevatorArrow.js +++ b/src/ibp/shape/elevatorArrow.js @@ -16,7 +16,8 @@ export default class elevatorArrow extends Group { const model = this.model; this.imageBg = new Image({ zlevel: this.zlevel, - draggable: model.draggable || false, + z: model.z, + draggable: false, style: { image: this.getStatus(), x: model.point.x, @@ -25,10 +26,12 @@ export default class elevatorArrow extends Group { height: 60 } }); + // debugger; this.add(this.imageBg); this.getOrientate(); + this.transformScale(); } - + getOrientate() { switch (this.model.orientation) { case 'top': { @@ -49,13 +52,13 @@ export default class elevatorArrow extends Group { this.imageBg.dirty(); } - // /** 缩放按钮 */ - // 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(); - // } - + /** 缩放按钮 */ + 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) { @@ -71,26 +74,41 @@ export default class elevatorArrow extends Group { } } - 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); + setStatus(data) { + let imageBack; + switch (data) { + case 'on': { + imageBack=elevatorArrowPicOn; + break; + } + case 'off': { + imageBack=elevatorArrowPic; + break; + } + } + this.imageBg.setStyle({image: imageBack}); } - mousedown(e) { - this.event.disable(); - } + // 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); + // } - mousemove(e) { - } + // mousedown(e) { + // this.event.disable(); + // } - 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; - } + // 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; + // } } diff --git a/src/ibp/shape/elevatorBack.js b/src/ibp/shape/elevatorBack.js index 18c439881..3b7bd3bd0 100644 --- a/src/ibp/shape/elevatorBack.js +++ b/src/ibp/shape/elevatorBack.js @@ -1,5 +1,4 @@ -import Circle from 'zrender/src/graphic/shape/Circle'; -import Polygon from 'zrender/src/graphic/shape/Polygon'; +import * as toolpath from 'zrender/src/tool/path'; import Group from 'zrender/src/container/Group'; export default class elevatorBack extends Group { @@ -12,58 +11,24 @@ export default class elevatorBack extends Group { } create() { + // debugger; const model = this.model; - this.arrowCircle = new Circle({ + 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, - // path: 'M 0 0 Q -70 -50 0 -100 0 -100 L 150 -400 L 200 -400 Q 270 -350 200 -300 200 -300 L 50 0', - // draggable: model.draggable || false, - shape: { - cx: model.point.x + model.width/6*5, - cy: model.point.y + model.height/8, - r: model.width/6 - }, + draggable: false, style: { - fill: this.model.fillColor || '#adadad' + x: model.point.x, + y: model.point.y, + brushType: 'fill', + fill: this.model.fillColor || '#313131', + lineWidth: 0 } }); - - this.arrowPoly = new Polygon({ - zlevel: model.zlevel, - z: model.z, - // draggable: model.draggable || false, - shape: { - points: [ [model.point.x+model.width/6, model.point.y + model.height], [model.point.x+model.width/6*2, model.point.y + model.height], - [model.point.x+model.width/6*5, model.point.y + model.height/8*2], - [model.point.x+model.width/6*5, model.point.y], - [model.point.x+model.width/6*4, model.point.y], - [model.point.x+model.width/6, model.point.y + model.height/8*6] - ] - }, - style: { - stroke: model.stroke || '#adadad', - lineWidth: model.lineWidth, - fill: model.fill || '#adadad' - } - }); - - this.arrowCircleRight = new Circle({ - zlevel: model.zlevel, - z: model.z, - // path: 'M 0 0 Q -70 -50 0 -100 0 -100 L 150 -400 L 200 -400 Q 270 -350 200 -300 200 -300 L 50 0', - // draggable: model.draggable || false, - shape: { - cx: model.point.x + model.width/6, - cy: model.point.y + model.height/8*7, - r: model.width/6 - }, - style: { - fill: this.model.fillColor || '#adadad' - } - }); - - this.add(this.arrowPoly); - this.add(this.arrowCircle); - this.add(this.arrowCircleRight); + this.add(this.elevatorBack); } -} \ No newline at end of file +} diff --git a/src/ibp/shape/factory.js b/src/ibp/shape/factory.js index ad469c01f..1ac62b449 100644 --- a/src/ibp/shape/factory.js +++ b/src/ibp/shape/factory.js @@ -3,12 +3,30 @@ import deviceType from '../constant/deviceType'; import Background from './background'; import CircularLamp from './circularLamp'; import IbpText from './ibpText'; +import Alarm from './alarm'; +import IbpLine from './ibpLine'; +import Button from './button'; +import TipBox from './ibpTipBox'; +import AppendageBox from './appendageBox'; +import RotatingButton from './rotatingButton'; +import Elevator from './elevator'; +import Key from './key'; +import TeleTerminal from './teleTerminal'; const ibpShape = {}; ibpShape[deviceType.Arrow] = Arrow; ibpShape[deviceType.Background] = Background; ibpShape[deviceType.CircularLamp] = CircularLamp; ibpShape[deviceType.IbpText] = IbpText; +ibpShape[deviceType.Alarm] = Alarm; +ibpShape[deviceType.IbpLine] = IbpLine; +ibpShape[deviceType.SquareButton] = Button; +ibpShape[deviceType.TipBox] = TipBox; +ibpShape[deviceType.AppendageBox] = AppendageBox; +ibpShape[deviceType.RotatingButton] = RotatingButton; +ibpShape[deviceType.Elevator] = Elevator; +ibpShape[deviceType.Key] = Key; +ibpShape[deviceType.TeleTerminal] = TeleTerminal; function shapefactory(device, ibp) { const type = device.model._type; diff --git a/src/ibp/shape/ibpLine.js b/src/ibp/shape/ibpLine.js new file mode 100644 index 000000000..9e8d92782 --- /dev/null +++ b/src/ibp/shape/ibpLine.js @@ -0,0 +1,65 @@ +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); + } + 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; + } + } +} diff --git a/src/ibp/shape/ibpText.js b/src/ibp/shape/ibpText.js index 3322bce34..7ac8091da 100644 --- a/src/ibp/shape/ibpText.js +++ b/src/ibp/shape/ibpText.js @@ -1,14 +1,17 @@ import Group from 'zrender/src/container/Group'; import Text from 'zrender/src/graphic/Text'; -import { updateIbpData } from '@/ibp/utils/parser'; +import store from '@/store'; -export default class button extends Group { +export default class ibpText extends Group { constructor(device) { super(); this.model = device.model; this.event = device.event; this.zlevel = device.model.zlevel; this.z = device.model.z; + this.offsetX = 0; + this.offsetY = 0; + this.dragging = false; this.create(); } create() { @@ -19,8 +22,8 @@ export default class button extends Group { silent: model.silent || false, draggable: model.draggable || false, style: { - x: model.x, - y: model.y, + x: model.point.x, + y: model.point.y, fontWeight: model.fontWeight, fontSize: model.fontSize, fontFamily: model.fontFamily, @@ -29,7 +32,8 @@ export default class button extends Group { textFill: model.textFill, textAlign: model.textAlign, textPosition: model.textPosition || 'inside', - textVerticalAlign: model.textVerticalAlign || null + textVerticalAlign: model.textVerticalAlign || null, + textLineHeight: model.fontSize } }); this.add(this.textName); @@ -43,18 +47,22 @@ export default class button extends Group { this.on('mousemove', this.mousemove, this); this.on('mouseup', this.mouseup, this); } - mousedown() { + mousedown(e) { this.event.disable(); - console.log('鼠标按下'); + if (e.which == 3) { + store.dispatch('ibp/setUpdateDeviceData', this.model); + } + this.offsetX = e.offsetX; + this.offsetY = e.offsetY; + this.dragging = true; } mousemove() { - console.log('鼠标移动'); } mouseup(e) { this.event.enable(); - this.model.x = this.model.x + e.offsetX; - this.model.y = this.model.y + e.offsetY; - console.log('鼠标抬起', this.model); - updateIbpData(this.model, 'update'); + if (this.dragging) { + this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX); + this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY); + } } } diff --git a/src/ibp/shape/ibpTipBox.js b/src/ibp/shape/ibpTipBox.js new file mode 100644 index 000000000..eb8f12098 --- /dev/null +++ b/src/ibp/shape/ibpTipBox.js @@ -0,0 +1,62 @@ +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); + } + 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); + } + } +} diff --git a/src/ibp/shape/key.js b/src/ibp/shape/key.js new file mode 100644 index 000000000..cb329be7c --- /dev/null +++ b/src/ibp/shape/key.js @@ -0,0 +1,103 @@ +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: model.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); + } + 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); + } +} diff --git a/src/ibp/shape/rotateTip.js b/src/ibp/shape/rotateTip.js index 5855fece6..736bab9a8 100644 --- a/src/ibp/shape/rotateTip.js +++ b/src/ibp/shape/rotateTip.js @@ -2,6 +2,7 @@ import Group from 'zrender/src/container/Group'; import Image from 'zrender/src/graphic/Image'; import rotateBlack from '@/assets/ibp_images/rotate_black.png'; import rotateRed from '@/assets/ibp_images/rotate_red.png'; +import store from '@/store'; export default class rotateTip extends Group { @@ -9,6 +10,10 @@ export default class rotateTip extends Group { super(); this.model = device.model; this.zlevel = device.model.zlevel; + this.event = device.event; + this.offsetX = 0; + this.offsetY = 0; + this.dragging = false; this.create(); } @@ -35,7 +40,7 @@ export default class rotateTip extends Group { this.imageBg.scale =[this.model.width/68, this.model.width/68]; this.imageBg.dirty(); } - + getRotateColor() { if (this.model.color) { switch (this.model.color) { @@ -63,6 +68,12 @@ export default class rotateTip extends Group { mousedown(e) { this.event.disable(); + if (e.which == 3) { + store.dispatch('ibp/setUpdateDeviceData', this.model); + } + this.offsetX = e.offsetX; + this.offsetY = e.offsetY; + this.dragging = true; } mousemove(e) { @@ -70,7 +81,9 @@ export default class rotateTip extends Group { mouseup(e) { this.event.enable(); - this.model.point.x = this.model.point.x + e.offsetX; - this.model.point.y = this.model.point.y + e.offsetY; + if (this.dragging) { + this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX); + this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY); + } } } diff --git a/src/ibp/shape/rotatingButton.js b/src/ibp/shape/rotatingButton.js new file mode 100644 index 000000000..f7667dccb --- /dev/null +++ b/src/ibp/shape/rotatingButton.js @@ -0,0 +1,62 @@ +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); + } + 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); + } + } +} diff --git a/src/ibp/shape/teleTerminal.js b/src/ibp/shape/teleTerminal.js index c4626aa91..2dc109bf7 100644 --- a/src/ibp/shape/teleTerminal.js +++ b/src/ibp/shape/teleTerminal.js @@ -1,13 +1,18 @@ 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(); } @@ -20,8 +25,8 @@ export default class alarm extends Group { image: teleTerminalPic, x: model.point.x, y: model.point.y, - width: 64, - height: 56 + width: 150, + height: 150 } }); this.add(this.imageBg); @@ -31,12 +36,12 @@ export default class alarm extends Group { /** 缩放按钮 */ transformScale() { this.imageBg.origin = [this.model.point.x, this.model.point.y]; - this.imageBg.scale =[this.model.width/64, this.model.width/64]; + this.imageBg.scale =[this.model.width/150, this.model.width/150]; this.imageBg.dirty(); } setDraggable() { - this.arrow.attr('draggable', true); + this.imageBg.attr('draggable', true); this.createMouseEvent(); } createMouseEvent() { @@ -47,6 +52,12 @@ export default class alarm extends Group { mousedown(e) { this.event.disable(); + if (e.which == 3) { + store.dispatch('ibp/setUpdateDeviceData', this.model); + } + this.offsetX = e.offsetX; + this.offsetY = e.offsetY; + this.dragging = true; } mousemove(e) { @@ -54,7 +65,9 @@ export default class alarm extends Group { mouseup(e) { this.event.enable(); - this.model.point.x = this.model.point.x + e.offsetX; - this.model.point.y = this.model.point.y + e.offsetY; + if (this.dragging) { + this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX); + this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY); + } } } diff --git a/src/ibp/utils/parser.js b/src/ibp/utils/parser.js index 7f3aa3ee4..29a173ead 100644 --- a/src/ibp/utils/parser.js +++ b/src/ibp/utils/parser.js @@ -2,6 +2,7 @@ import * as zrUtil from 'zrender/src/core/util'; import * as matrix from 'zrender/src/core/matrix'; import deviceType from '../constant/deviceType'; import deviceRender from '../constant/deviceRender'; +import store from '@/store'; export function createTransform(opts) { let transform = matrix.create(); @@ -57,8 +58,8 @@ export function parser(data, config) { ibpDevice[elem.code] = createModel(deviceType.CircularLamp, elem, propConvert); }, this); - zrUtil.each(data.warnButtonList || [], elem => { - ibpDevice[elem.code] = createModel(deviceType.WarnButton, elem, propConvert); + zrUtil.each(data.alarmList || [], elem => { + ibpDevice[elem.code] = createModel(deviceType.Alarm, elem, propConvert); }, this); zrUtil.each(data.arrowList || [], elem => { @@ -69,10 +70,246 @@ export function parser(data, config) { ibpDevice[elem.code] = createModel(deviceType.RotatingButton, elem, propConvert); }, this); - zrUtil.each(data.tipList || [], elem => { - ibpDevice[elem.code] = createModel(deviceType.Tip, elem, propConvert); + zrUtil.each(data.tipBoxList || [], elem => { + ibpDevice[elem.code] = createModel(deviceType.TipBox, elem, propConvert); }, this); + + zrUtil.each(data.ibpLineList || [], elem => { + ibpDevice[elem.code] = createModel(deviceType.IbpLine, elem, propConvert); + }, this); + + zrUtil.each(data.appendageBoxList || [], elem => { + ibpDevice[elem.code] = createModel(deviceType.AppendageBox, elem, propConvert); + }, this); + + zrUtil.each(data.elevatorList || [], elem => { + ibpDevice[elem.code] = createModel(deviceType.Elevator, elem, propConvert); + }, this); + + zrUtil.each(data.keyList || [], elem => { + ibpDevice[elem.code] = createModel(deviceType.Key, elem, propConvert); + }, this); + + zrUtil.each(data.teleTerminalList || [], elem => { + ibpDevice[elem.code] = createModel(deviceType.TeleTerminal, elem, propConvert); + }, this); + } 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 0) { + let newDevice = true; + for (let i=0; i 0) { + let newDevice = true; + for (let i=0; i 0) { + let newDevice = true; + for (let i=0; i 0) { + let newDevice = true; + for (let i=0; i 0) { + let newDevice = true; + for (let i=0; i 0) { + let newDevice = true; + for (let i=0; i 0) { + let newDevice = true; + for (let i=0; i 0) { + let newDevice = true; + for (let i=0; i 0) { + let newDevice = true; + for (let i=0; i 0) { + let newDevice = true; + for (let i=0; i 0) { + let newDevice = true; + for (let i=0; i>>>>>> 327bf6f32b24ee9862ae9627615dc63ceccd3c9f // 定义场景(渲染容器) const scene = SetScene(); - const speed = 0; let drivingcode = null; @@ -104,8 +107,13 @@ export function JLmapDriving(dom, data, skinCode) { controls3.enabled = true; scene.add(controls3.getObject()); +<<<<<<< HEAD let cameracctv = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 150); cameracctv.position.set( 5, -3,27 ); +======= + const cameracctv = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 150); + cameracctv.position.set( 5, -3, 27 ); +>>>>>>> 327bf6f32b24ee9862ae9627615dc63ceccd3c9f cameracctv.rotation.y = Math.PI/5*3; camera.add(cameracctv); @@ -136,7 +144,11 @@ export function JLmapDriving(dom, data, skinCode) { if (scope.animateswitch == true) { // 根据相机渲染场景 renderer.render(scene, camera); +<<<<<<< HEAD renderercctv.render(scene,cameracctv); +======= + renderercctv.render(scene, cameracctv); +>>>>>>> 327bf6f32b24ee9862ae9627615dc63ceccd3c9f // updatcontrols(); // renderercctv controls3.update(); @@ -192,7 +204,7 @@ export function JLmapDriving(dom, data, skinCode) { this.updatestoptime = function(stime) { scope.stime = stime; }; - this.updatedrivedata = function(drivedata){ + this.updatedrivedata = function(drivedata) { scope.drivecount += 1; scope.drivedata = drivedata; }; diff --git a/src/jlmap3d/main/loaders/AssetLoader.js b/src/jlmap3d/main/loaders/AssetLoader.js index b7a674d38..d952e6d79 100644 --- a/src/jlmap3d/main/loaders/AssetLoader.js +++ b/src/jlmap3d/main/loaders/AssetLoader.js @@ -18,7 +18,7 @@ let defaulttrain = { deviceType:"train", type:"num4", picUrl:"", - assetUrl:"https://test.joylink.club/oss/models/train/train.FBX" + assetUrl:"https://joylink.club/oss/models/train/train.FBX" } @@ -56,7 +56,7 @@ let defaultsuidao = { deviceType:"suidao", type:"suidao", picUrl:"", - assetUrl:"https://test.joylink.club/oss/models/suidao/suidao.FBX" + assetUrl:"https://joylink.club/oss/models/suidao/suidao.FBX" }//https://joylink.club/oss/models/suidao/suidao.FBX //../../static/model/ diff --git a/src/jlmap3d/main/loaders/FBXLoader.js b/src/jlmap3d/main/loaders/FBXLoader.js index a376e99a1..256198c3a 100644 --- a/src/jlmap3d/main/loaders/FBXLoader.js +++ b/src/jlmap3d/main/loaders/FBXLoader.js @@ -551,7 +551,15 @@ THREE.FBXLoader = ( function () { if ( materialNode.EmissiveFactor ) { - parameters.emissiveIntensity = parseFloat( materialNode.EmissiveFactor.value ); + if(materialNode.Opacity.value<1 && materialNode.Opacity.value>0.9){ + parameters.side = THREE.DoubleSide; + parameters.transparent = true; + parameters.alphaTest = 0.7; + parameters.opacity = 1; + + }else{ + parameters.opacity = parseFloat( materialNode.Opacity.value ); + } } diff --git a/src/jmap/config/skinCode/bejing_01.js b/src/jmap/config/skinCode/bejing_01.js index 2777d73a8..bf0e09d05 100644 --- a/src/jmap/config/skinCode/bejing_01.js +++ b/src/jmap/config/skinCode/bejing_01.js @@ -304,9 +304,9 @@ class SkinCode extends defaultStyle { }; this[deviceType.Station] = { - text: { - show: true // 公里标名称显示 - }, + // text: { + // show: true // 公里标名称显示 + // }, kmPostShow: true, // 公里标显示 kilometerPosition: 'down', // 公里标位置 fontWeight: 'bold' // 文字错细 diff --git a/src/jmap/config/skinCode/chengdu_03.js b/src/jmap/config/skinCode/chengdu_03.js index 3c1474c90..caecf92b4 100644 --- a/src/jmap/config/skinCode/chengdu_03.js +++ b/src/jmap/config/skinCode/chengdu_03.js @@ -300,9 +300,9 @@ class SkinCode extends defaultStyle { }; this[deviceType.Station] = { - text: { - show: true // 公里标名称显示 - }, + // text: { + // show: true // 公里标名称显示 + // }, kmPostShow: false, // 公里标显示 kilometerPosition: 'up' // 公里标朝向 }; diff --git a/src/jmap/config/skinCode/chengdu_04.js b/src/jmap/config/skinCode/chengdu_04.js index 4705e4417..7fad28b82 100644 --- a/src/jmap/config/skinCode/chengdu_04.js +++ b/src/jmap/config/skinCode/chengdu_04.js @@ -297,9 +297,9 @@ class SkinCode extends defaultStyle { }; this[deviceType.Station] = { - text: { - show: true // 公里标名称显示 - }, + // text: { + // show: true // 公里标名称显示 + // }, kmPostShow: false, // 公里标显示 kilometerPosition: 'up' // 公里标朝向 }; diff --git a/src/jmap/config/skinCode/fuzhou_01.js b/src/jmap/config/skinCode/fuzhou_01.js index acae1a23b..e96d5cc30 100644 --- a/src/jmap/config/skinCode/fuzhou_01.js +++ b/src/jmap/config/skinCode/fuzhou_01.js @@ -279,9 +279,9 @@ class SkinCode extends defaultStyle { }; this[deviceType.Station] = { - text: { - show: true // 公里标名称显示 - }, + // text: { + // show: true // 公里标名称显示 + // }, kmPostShow: true, // 公里标显示 kilometerPosition: 'up' // 公里标朝向 }; diff --git a/src/jmap/map.js b/src/jmap/map.js index 966b7771a..47d7e3833 100644 --- a/src/jmap/map.js +++ b/src/jmap/map.js @@ -20,9 +20,6 @@ class Jlmap { // 鼠标事件 this.events = { __Pan: 'pan', __Zoom: 'zoom', Selected: 'selected', Contextmenu: 'contextmenu', DataZoom: 'dataZoom'}; - // 原始数据 - this.data = {}; - // 皮肤参数 this.skinCode = ''; @@ -83,12 +80,10 @@ class Jlmap { this.$options.scaleRate = map.skinVO.scaling || 1; this.$options.offsetX = map.skinVO.origin ? map.skinVO.origin.x : 0; this.$options.offsetY = map.skinVO.origin ? map.skinVO.origin.y : 0; + // 更新视图大小 this.$painter.updateTransform({ scaleRate: this.$options.scaleRate, offsetX: this.$options.offsetX, offsetY: this.$options.offsetY }); } - // 保存原始数据 - this.data = map; - // 解析地图数据 this.mapDevice = mapDevice; @@ -103,7 +98,6 @@ class Jlmap { // 视图加载完成 回调 if (this.methods.viewLoaded instanceof Function) { this.methods.viewLoaded(this.mapDevice); } - } setDefaultState() { @@ -158,7 +152,6 @@ class Jlmap { const type = elem._type; const oDevice = this.mapDevice[code] || deviceFactory(type, elem); const nDevice = Object.assign(oDevice || {}, elem); - this.dataSync(nDevice); this.$painter.delete(oDevice); if (!elem._dispose) { this.mapDevice[code] = nDevice; @@ -275,52 +268,6 @@ class Jlmap { return payload || {}; } - dataSync(model) { - var prop = null; - var type = model._type; - var code = model.code; - - switch (type) { - case deviceType.Link: prop = 'linkList'; break; - case deviceType.Section: prop = 'sectionList'; break; - case deviceType.Switch: prop = 'switchList'; break; - case deviceType.Signal: prop = 'signalList'; break; - case deviceType.Station: prop = 'stationList'; break; - case deviceType.StationStand: prop = 'stationStandList'; break; - case deviceType.StationControl: prop = 'stationControlList'; break; - case deviceType.StationCounter: prop = 'stationCounterList'; break; - case deviceType.ZcControl: prop = 'zcControlList'; break; - case deviceType.StationDelayUnlock: prop = 'stationDelayUnlockList'; break; - case deviceType.LcControl: prop = 'lcControlList'; break; - case deviceType.ButtonControl: prop = 'buttonList'; break; - case deviceType.LimitControl: prop = 'tempSpeedLimitList'; break; - case deviceType.ImageControl: prop = 'imageControl'; break; - case deviceType.Train: prop = 'trainList'; break; - case deviceType.TrainWindow: prop = 'trainWindowList'; break; - case deviceType.Line: prop = 'lineList'; break; - case deviceType.Text: prop = 'textList'; break; - } - - const list = this.data[prop] || []; - const idex = list.findIndex(elem => { return elem.code == code; }); - if (list) { - if (model._dispose) { - idex >= 0 && list.splice(idex, 1); - } else { - const elem = list[idex]; - if (elem) { - Object.keys(model).forEach(key => { - if (key != 'instance') { - elem[key] = model[key]; - } - }); - } else { - list.push(Object.assign({}, model)); - } - } - } - } - getZr() { return this.$zr; } diff --git a/src/jmap/shape/Section/EMouse.js b/src/jmap/shape/Section/EMouse.js index d97f5eb11..40e2166ec 100644 --- a/src/jmap/shape/Section/EMouse.js +++ b/src/jmap/shape/Section/EMouse.js @@ -99,8 +99,8 @@ class EMouse extends Group { this.sectionTextBorder && this.sectionTextBorder.show(); this.lineBorder && this.lineBorder.show(); const instance = this.getInstanceByCode(this.device.model.trainWindowCode); - if (instance && instance.mouseEnter) { - instance.mouseEnter(e); + if (instance && instance.mouseEvent && instance.mouseEvent.mouseEnter) { + instance.mouseEvent.mouseEnter(e); } } } @@ -118,8 +118,8 @@ class EMouse extends Group { this.sectionTextBorder && this.sectionTextBorder.hide(); this.lineBorder && this.lineBorder.hide(); const instance = this.getInstanceByCode(this.device.model.trainWindowCode); - if (instance && instance.mouseLeave) { - instance.mouseLeave(e); + if (instance && instance.mouseEvent && instance.mouseEvent.mouseLeave) { + instance.mouseEvent.mouseLeave(e); } } } diff --git a/src/jmap/shape/Station/index.js b/src/jmap/shape/Station/index.js index 642962ef8..152d34e4d 100644 --- a/src/jmap/shape/Station/index.js +++ b/src/jmap/shape/Station/index.js @@ -21,7 +21,7 @@ export default class Station extends Group { const model = this.model; const style = this.style; - if (style.Station.text.show) { + if (model.visible) { // 公里标名称是否显示 this.stationText = new ETextName({ zlevel: this.zlevel, @@ -38,29 +38,29 @@ export default class Station extends Group { textFill: model.nameFontColor }); this.add(this.stationText); - } - - if (style.Station.kmPostShow) { + const path = window.location.href; + if (style.Station.kmPostShow || path.includes('/map/draw')) { // 公里标是否显示 - let direction = 1; - if (this.style.Station.kilometerPosition == 'up') { - direction = -1; + let direction = 1; + if (this.style.Station.kilometerPosition == 'up') { + direction = -1; + } + this.mileageText = new ETextName({ + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + x: model.position.x, + y: model.position.y + ((parseInt(model.nameFont) + 2) * direction), + fontWeight: model.fontWeight, + fontSize: model.kmPostFont || 18, + fontFamily: style.fontFamily, + text: model.kmPost, + textAlign: 'middle', + textVerticalAlign: 'top', + textFill: model.kmPostFontColor + }); + this.add(this.mileageText); } - this.mileageText = new ETextName({ - zlevel: this.zlevel, - z: this.z, - position: [0, 0], - x: model.position.x, - y: model.position.y + ((parseInt(model.nameFont) + 2) * direction), - fontWeight: model.fontWeight, - fontSize: model.kmPostFont || 18, - fontFamily: style.fontFamily, - text: model.kmPost, - textAlign: 'middle', - textVerticalAlign: 'top', - textFill: model.kmPostFontColor - }); - this.add(this.mileageText); } } diff --git a/src/jmap/shape/Switch/EMouse.js b/src/jmap/shape/Switch/EMouse.js index 89b6e57fa..5ae837984 100644 --- a/src/jmap/shape/Switch/EMouse.js +++ b/src/jmap/shape/Switch/EMouse.js @@ -42,9 +42,9 @@ class EMouse extends Group { // 创建道岔边框 craeteSwitchBorder() { - const sectionA = this.device.model.sectionAInstance.instance; - const sectionB = this.device.model.sectionBInstance.instance; - const sectionC = this.device.model.sectionCInstance.instance; + const sectionA = this.getInstanceByCode(this.device.model.sectionACode); + const sectionB = this.getInstanceByCode(this.device.model.sectionBCode); + const sectionC = this.getInstanceByCode(this.device.model.sectionCCode); const rect = this.device.getBoundingRect(); sectionA && rect.union(sectionA.getBoundingRect()); @@ -83,8 +83,8 @@ class EMouse extends Group { const section = store.getters['map/getDeviceByCode'](this.device.model.sectionACode) || {}; const parentSection = store.getters['map/getDeviceByCode'](section.parentCode) || {}; const instance = this.getInstanceByCode(parentSection.trainWindowCode); - if (instance && instance.mouseLeave) { - instance.mouseLeave(e); + if (instance && instance.mouseEvent && instance.mouseEvent.mouseLeave) { + instance.mouseEvent.mouseLeave(e); } } } @@ -101,8 +101,8 @@ class EMouse extends Group { const section = store.getters['map/getDeviceByCode'](this.device.model.sectionACode) || {}; const parentSection = store.getters['map/getDeviceByCode'](section.parentCode) || {}; const instance = this.getInstanceByCode(parentSection.trainWindowCode); - if (instance && instance.mouseEnter) { - instance.mouseEnter(e); + if (instance && instance.mouseEvent && instance.mouseEvent.mouseEnter) { + instance.mouseEvent.mouseEnter(e); } } diff --git a/src/jmap/shape/TrainWindow/EMouse.js b/src/jmap/shape/TrainWindow/EMouse.js new file mode 100644 index 000000000..d059089c0 --- /dev/null +++ b/src/jmap/shape/TrainWindow/EMouse.js @@ -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); + } + } +} diff --git a/src/jmap/shape/TrainWindow/index.js b/src/jmap/shape/TrainWindow/index.js index 1315f9c9a..e0ec9d383 100644 --- a/src/jmap/shape/TrainWindow/index.js +++ b/src/jmap/shape/TrainWindow/index.js @@ -1,6 +1,7 @@ /* 车次窗*/ import Polygon from 'zrender/src/graphic/shape/Polygon'; import Group from 'zrender/src/container/Group'; +import EMouse from './EMouse'; import store from '@/store'; class TrainWindow extends Group { @@ -14,6 +15,7 @@ class TrainWindow extends Group { this.z = 9; this.prdType = store.state.training.prdType; this.create(model); + this.createMouseEvent(); this.setState(model); } create(model) { @@ -22,6 +24,12 @@ class TrainWindow extends Group { } } + createMouseEvent() { + this.mouseEvent = new EMouse(this); + this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); }); + this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); }); + } + /** 创建车次窗*/ createTrainWindow() { const model = this.model; @@ -44,9 +52,7 @@ class TrainWindow extends Group { lineWidth: this.style.TrainWindow.lineWidth, stroke: this.style.TrainWindow.lineColor, fill: this.style.transparentColor - }, - onmouseover: (e) => { this.mouseover(e); }, - onmouseout: (e) => { this.mouseout(e); } + } }); this.add(this.trainRect); } @@ -72,38 +78,6 @@ class TrainWindow extends Group { getInstanceByCode(code) { return (store.getters['map/getDeviceByCode'](code) || {}).instance; } - - mouseout(e) { - if (this.prdType) { - this.setVisible(false); - const instance = this.getInstanceByCode(this.model.sectionCode); - if (instance && instance.mouseEvent && instance.mouseEvent.mouseout) { - instance.mouseEvent.mouseLeave(e); - } - } - } - - mouseover(e) { - if (this.prdType) { - this.setVisible(true); - const instance = this.getInstanceByCode(this.model.sectionCode); - if (instance && instance.mouseEvent && instance.mouseEvent.mouseover) { - instance.mouseEvent.mouseEnter(e); - } - } - } - - mouseEnter(e) { - if (this.prdType) { - this.setVisible(true); - } - } - - mouseLeave(e) { - if (this.prdType ) { - this.setVisible(false); - } - } } export default TrainWindow; diff --git a/src/jmap/theme/batong_01/menus/dialog/trainControl.vue b/src/jmap/theme/batong_01/menus/dialog/trainControl.vue index ab8584424..14842059e 100644 --- a/src/jmap/theme/batong_01/menus/dialog/trainControl.vue +++ b/src/jmap/theme/batong_01/menus/dialog/trainControl.vue @@ -1,423 +1,464 @@ \ No newline at end of file + this.$store.dispatch('training/next', operate).then(({ valid }) => { + if (valid) { + this.doClose(); + } + }).catch(() => { + this.doClose(); + }); + } + } +}; + diff --git a/src/jmap/theme/batong_01/menus/dialog/trainDelete.vue b/src/jmap/theme/batong_01/menus/dialog/trainDelete.vue index 003ce2e1f..643df3baa 100644 --- a/src/jmap/theme/batong_01/menus/dialog/trainDelete.vue +++ b/src/jmap/theme/batong_01/menus/dialog/trainDelete.vue @@ -1,156 +1,165 @@ \ No newline at end of file + this.$store.dispatch('training/next', operate).then(({ valid }) => { + if (valid) { + this.doClose(); + } + }).catch(() => { this.doClose(); }); + } + } +}; + diff --git a/src/jmap/theme/batong_01/menus/menuTrain.vue b/src/jmap/theme/batong_01/menus/menuTrain.vue index eadcd4d12..05a582a36 100644 --- a/src/jmap/theme/batong_01/menus/menuTrain.vue +++ b/src/jmap/theme/batong_01/menus/menuTrain.vue @@ -1,318 +1,321 @@  \ No newline at end of file + if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) { + this.$refs.popMenu.resetShowPosition(point); + } + }, + doClose() { + if (this.$refs && this.$refs.popMenu) { + this.$refs.popMenu.close(); + // this.$store.dispatch('map/setTrainWindowShow', false); + } + }, + // 设置故障 + setStoppage() { + const operate = { + start: true, + send: true, + code: this.selected.code, + type: MapDeviceType.Train.type, + label: MapDeviceType.Train.label, + operation: OperationEvent.Train.stoppage.menu.operation + }; + this.$store.dispatch('training/next', operate).then(({ valid }) => { + if (valid) { + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + } else { + this.$refs.noticeInfo.doShow(operate); + } + }).catch(() => { + this.$refs.noticeInfo.doShow(operate); + }); + }, + // 取消故障 + cancelStoppage() { + const operate = { + start: true, + send: true, + code: this.selected.code, + type: MapDeviceType.Train.type, + label: MapDeviceType.Train.label, + operation: OperationEvent.Train.cancelStoppage.menu.operation + }; + this.$store.dispatch('training/next', operate).then(({ valid }) => { + if (valid) { + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + } else { + this.$refs.noticeInfo.doShow(operate); + } + }).catch(() => { + this.$refs.noticeInfo.doShow(operate); + }); + }, + // 限速行驶 + limitSpeed() { + const operate = { + start: true, + send: true, + code: this.selected.code, + type: MapDeviceType.Train.type, + label: MapDeviceType.Train.label, + operation: OperationEvent.Train.limitSpeed.menu.operation + }; + this.$store.dispatch('training/next', operate).then(({ valid }) => { + if (valid) { + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + } else { + this.$refs.noticeInfo.doShow(operate); + } + }).catch(() => { + this.$refs.noticeInfo.doShow(operate); + }); + }, + // 添加列车识别号 + addTrainId() { + const operate = { + start: true, + code: this.selected.code, + type: MapDeviceType.Train.type, + label: MapDeviceType.Train.label, + operation: OperationEvent.Train.addTrainId.menu.operation + }; + this.$store.dispatch('training/next', operate).then(({ valid }) => { + if (valid) { + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + this.$refs.trainControl.doShow(operate, this.selected); + } + }); + }, + // 删除列车识别号 + delTrainId() { + const operate = { + start: true, + code: this.selected.code, + type: MapDeviceType.Train.type, + label: MapDeviceType.Train.label, + operation: OperationEvent.Train.delTrainId.menu.operation + }; + this.$store.dispatch('training/next', operate).then(({ valid }) => { + if (valid) { + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + this.$refs.trainDelete.doShow(operate, this.selected); + } + }); + }, + // 修改列车识别号 + editTrainId() { + const operate = { + start: true, + code: this.selected.code, + type: MapDeviceType.Train.type, + label: MapDeviceType.Train.label, + operation: OperationEvent.Train.editTrainId.menu.operation + }; + this.$store.dispatch('training/next', operate).then(({ valid }) => { + if (valid) { + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + this.$refs.trainControl.doShow(operate, this.selected); + } + }); + }, + // 修改车组号 + editTrainNo() { + const operate = { + start: true, + code: this.selected.code, + type: MapDeviceType.Train.type, + label: MapDeviceType.Train.label, + operation: OperationEvent.Train.editTrainNo.menu.operation + }; + this.$store.dispatch('training/next', operate).then(({ valid }) => { + if (valid) { + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + this.$refs.trainEditNumber.doShow(operate, this.selected); + } + }); + }, + // 移动列车识别号 + moveTrainId() { + const operate = { + start: true, + code: this.selected.code, + type: MapDeviceType.Train.type, + label: MapDeviceType.Train.label, + operation: OperationEvent.Train.moveTrainId.menu.operation + }; + this.$store.dispatch('training/next', operate).then(({ valid }) => { + if (valid) { + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + this.$refs.trainMove.doShow(operate, this.selected); + } + }); + }, + // 交换列车识别号 + switchTrainId() { + const operate = { + start: true, + code: this.selected.code, + type: MapDeviceType.Train.type, + label: MapDeviceType.Train.label, + operation: OperationEvent.Train.switchTrainId.menu.operation + }; + this.$store.dispatch('training/next', operate).then(({ valid }) => { + if (valid) { + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + this.$refs.trainSwitch.doShow(operate, this.selected); + } + }); + } + } +}; + diff --git a/src/jmap/theme/beijing_01/menus/dialog/trainDelete.vue b/src/jmap/theme/beijing_01/menus/dialog/trainDelete.vue index 70225067f..155e29ee3 100644 --- a/src/jmap/theme/beijing_01/menus/dialog/trainDelete.vue +++ b/src/jmap/theme/beijing_01/menus/dialog/trainDelete.vue @@ -1,160 +1,169 @@ \ No newline at end of file + this.$store.dispatch('training/next', operate).then(({ valid }) => { + if (valid) { + this.doClose(); + } + }).catch(() => { this.doClose(); }); + } + } +}; + diff --git a/src/jmap/theme/beijing_01/menus/menuTrain.vue b/src/jmap/theme/beijing_01/menus/menuTrain.vue index 03cd655b6..a37eb1d68 100644 --- a/src/jmap/theme/beijing_01/menus/menuTrain.vue +++ b/src/jmap/theme/beijing_01/menus/menuTrain.vue @@ -279,15 +279,6 @@ export default { ] }; }, - watch: { - '$store.state.menuOperation.menuCount': function () { - if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Train) && !this.buttonOperation) { - this.doShow(this.$store.state.menuOperation.menuPosition); - } else { - this.doClose(); - } - } - }, computed: { ...mapGetters('training', [ 'mode', @@ -297,6 +288,15 @@ export default { 'buttonOperation' ]) }, + watch: { + '$store.state.menuOperation.menuCount': function () { + if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Train) && !this.buttonOperation) { + this.doShow(this.$store.state.menuOperation.menuPosition); + } else { + this.doClose(); + } + } + }, methods: { clickEvent() { const self = this; diff --git a/src/jmap/theme/beijing_01/menusPlan/addTask.vue b/src/jmap/theme/beijing_01/menusPlan/addTask.vue index 10a8fd228..009c19f02 100644 --- a/src/jmap/theme/beijing_01/menusPlan/addTask.vue +++ b/src/jmap/theme/beijing_01/menusPlan/addTask.vue @@ -1,150 +1,162 @@ \ No newline at end of file + diff --git a/src/jmap/theme/beijing_01/menusPlan/createTodayPlan.vue b/src/jmap/theme/beijing_01/menusPlan/createTodayPlan.vue index af08e8157..f9b4ff067 100644 --- a/src/jmap/theme/beijing_01/menusPlan/createTodayPlan.vue +++ b/src/jmap/theme/beijing_01/menusPlan/createTodayPlan.vue @@ -18,9 +18,9 @@ \ No newline at end of file + diff --git a/src/jmap/theme/beijing_01/menusPlan/deleteTask.vue b/src/jmap/theme/beijing_01/menusPlan/deleteTask.vue index b661ed20e..cd79c305f 100644 --- a/src/jmap/theme/beijing_01/menusPlan/deleteTask.vue +++ b/src/jmap/theme/beijing_01/menusPlan/deleteTask.vue @@ -1,57 +1,66 @@ \ No newline at end of file + diff --git a/src/jmap/theme/beijing_01/menusPlan/deleteTodayPlan.vue b/src/jmap/theme/beijing_01/menusPlan/deleteTodayPlan.vue index 284028f97..2e22a7c64 100644 --- a/src/jmap/theme/beijing_01/menusPlan/deleteTodayPlan.vue +++ b/src/jmap/theme/beijing_01/menusPlan/deleteTodayPlan.vue @@ -1,46 +1,55 @@ \ No newline at end of file + diff --git a/src/jmap/theme/beijing_01/menusPlan/managePlanList.vue b/src/jmap/theme/beijing_01/menusPlan/managePlanList.vue index b4ae47a4b..288ad3381 100644 --- a/src/jmap/theme/beijing_01/menusPlan/managePlanList.vue +++ b/src/jmap/theme/beijing_01/menusPlan/managePlanList.vue @@ -1,122 +1,143 @@ \ No newline at end of file + diff --git a/src/jmap/theme/chengdu_03/menus/dialog/trainDelete.vue b/src/jmap/theme/chengdu_03/menus/dialog/trainDelete.vue index ca1df1743..109e1c918 100644 --- a/src/jmap/theme/chengdu_03/menus/dialog/trainDelete.vue +++ b/src/jmap/theme/chengdu_03/menus/dialog/trainDelete.vue @@ -1,143 +1,152 @@ \ No newline at end of file + this.$store.dispatch('training/next', operate).then(({ valid }) => { + if (valid) { + this.doClose(); + } + }).catch(() => { this.doClose(); }); + } + } +}; + diff --git a/src/jmap/theme/chengdu_03/menus/menuBar.vue b/src/jmap/theme/chengdu_03/menus/menuBar.vue index eb025a093..c6631e746 100644 --- a/src/jmap/theme/chengdu_03/menus/menuBar.vue +++ b/src/jmap/theme/chengdu_03/menus/menuBar.vue @@ -755,9 +755,11 @@ export default { }, initMenu(menu) { this.menu = menuBarConvert(this.menuNormal[SystemType[this.$store.state.training.prdType]], this.$store.state.training.operatemode); - this.menu[2].children = this.initStationList(); - this.clickEvent(); - this.closeMenu(true); + if (this.menu.length) { + this.menu[2].children = this.initStationList(); + this.clickEvent(); + this.closeMenu(true); + } }, clickEvent() { const self = this; diff --git a/src/jmap/theme/chengdu_03/menus/menuTrain.vue b/src/jmap/theme/chengdu_03/menus/menuTrain.vue index 4f5e7d38b..29d2509ce 100644 --- a/src/jmap/theme/chengdu_03/menus/menuTrain.vue +++ b/src/jmap/theme/chengdu_03/menus/menuTrain.vue @@ -1,488 +1,491 @@  diff --git a/src/jmap/theme/chengdu_03/menusPlan/addTask.vue b/src/jmap/theme/chengdu_03/menusPlan/addTask.vue index 10a8fd228..009c19f02 100644 --- a/src/jmap/theme/chengdu_03/menusPlan/addTask.vue +++ b/src/jmap/theme/chengdu_03/menusPlan/addTask.vue @@ -1,150 +1,162 @@ \ No newline at end of file + diff --git a/src/jmap/theme/chengdu_03/menusPlan/chooseTemplatePlan.vue b/src/jmap/theme/chengdu_03/menusPlan/chooseTemplatePlan.vue index 747a38d6b..591ed34cc 100644 --- a/src/jmap/theme/chengdu_03/menusPlan/chooseTemplatePlan.vue +++ b/src/jmap/theme/chengdu_03/menusPlan/chooseTemplatePlan.vue @@ -1,10 +1,10 @@ @@ -71,6 +73,7 @@ import MenuPlan from '@/views/display/menuPlan'; import MenuScript from '@/views/display/menuScript'; import WindowResizeHandler from '@/mixin/WindowResizeHandler'; import AddQuest from './demon/addQuest'; +import Scheduling from './demon/scheduling'; import { mapGetters } from 'vuex'; import { getTrainingDetail, getTrainingStepsDetail } from '@/api/jmap/training'; import { setGoodsTryUse } from '@/api/management/goods'; @@ -78,16 +81,14 @@ import { getProductDetail } from '@/api/management/mapprd'; import { runDiagramQuit, loadScript, getSimulationInfo } from '@/api/simulation'; import { OperateMode, TrainingMode } from '@/scripts/ConstDic'; import { checkLoginLine } from '@/api/login'; -// import { isFullscreen } from '@/utils/screen'; import { loadMapData, loadMapDataById } from '@/utils/loaddata'; -// import { handleToken } from '@/utils/auth'; import { EventBus } from '@/scripts/event-bus'; import Vue from 'vue'; // 三维 import Jl3dSimulation from '@/views/jlmap3d/simulation/jl3dsimulation'; import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive'; -import IbpPlate from '@/views/ibp/index' +import IbpPlate from '@/views/ibp/index'; export default { name: 'DisplayDraft', @@ -108,7 +109,8 @@ export default { MenuSystemTime, Jl3dSimulation, Jl3dDrive, - IbpPlate + IbpPlate, + Scheduling }, mixins: [WindowResizeHandler], props: { @@ -135,14 +137,15 @@ export default { panelShow: true, simulationShow: false, drivingShow: false, - questId: 0, // 加载任务的Id + questId: 0, // 加载任务的Id group: '', prdTypeMap: { - '01': '01', // 现地 => 现地 - '02': '02', // 行调 => 行调 - '04': '02' // 司机加实 => 行调 + '01': '01', // 现地 => 现地 + '02': '02', // 行调 => 行调 + '04': '02', // 司机 => 行调 + '05': '' // 派班 => null }, - ibpShow: false + ibpShow: false }; }, computed: { @@ -558,11 +561,14 @@ export default { this.$refs.Jl3dSimulation.show(this.skinCode); } }, - showIbp() { - this.panelShow = false; - this.ibpShow = true; - this.$refs.ibpPlate.show(); - }, + showIbp() { + this.panelShow = false; + this.ibpShow = true; + this.$refs.ibpPlate.show(); + }, + showScheduling() { + this.$refs.scheduling.doShow(); + }, showpanel() { this.panelShow = true; this.simulationShow = false; @@ -571,10 +577,10 @@ export default { this.panelShow = true; this.drivingShow = false; }, - hideIbp() { - this.panelShow = true; - this.ibpShow = false; - }, + hideIbp() { + this.panelShow = true; + this.ibpShow = false; + }, runPlanViewShow() { this.$refs.runPlanView.doShow(); }, diff --git a/src/views/display/menuDemon.vue b/src/views/display/menuDemon.vue index 5c1e3d1d6..acba7ee8f 100644 --- a/src/views/display/menuDemon.vue +++ b/src/views/display/menuDemon.vue @@ -7,9 +7,10 @@
- + IBP盘 + 排班计划 {{ jl3dname }} -