diff --git a/src/api/jmap/map.js b/src/api/jmap/map.js index 742c53659..3ddda2021 100644 --- a/src/api/jmap/map.js +++ b/src/api/jmap/map.js @@ -40,7 +40,7 @@ export function getPublishMapDetailById(id) { }); } -/** 获取发布地图列表*/ +/** 获取发布地图列表(不包含项目线路)*/ export function listPublishMap(params) { return request({ url: `/api/map/list`, diff --git a/src/api/jmap/training.js b/src/api/jmap/training.js index ee086c10c..5104ceede 100644 --- a/src/api/jmap/training.js +++ b/src/api/jmap/training.js @@ -44,14 +44,6 @@ export function sendTrainingNextStep(data, group) { }); } -/** 获取实训树*/ -export function getTrainingTree() { - return request({ - url: `/api/training/tree`, - method: 'get' - }); -} - /** 获取章节基本信息*/ export function getTrainingDetail(trainingId) { return request({ diff --git a/src/components/PopMenu/index.vue b/src/components/PopMenu/index.vue index 5b504f164..8ad4795a5 100644 --- a/src/components/PopMenu/index.vue +++ b/src/components/PopMenu/index.vue @@ -87,132 +87,133 @@ diff --git a/src/i18n/langs/en/map.js b/src/i18n/langs/en/map.js index 32e750989..51c6b360a 100644 --- a/src/i18n/langs/en/map.js +++ b/src/i18n/langs/en/map.js @@ -376,6 +376,7 @@ export default { pointSystem2: 'TwoPointSystem', pointSystem5: 'FivePointSystem', skinType: 'SkinType', + lineCode:'Line Type', turnoverTime: 'TurnoverTime', productList: 'ProductList', belongsToMapName: 'BelongsToMapName', diff --git a/src/i18n/langs/zh/map.js b/src/i18n/langs/zh/map.js index 441f92de1..1b3c5a610 100644 --- a/src/i18n/langs/zh/map.js +++ b/src/i18n/langs/zh/map.js @@ -488,6 +488,7 @@ export default { pointSystem2: '2分制', pointSystem5: '5分制', skinType: '皮肤风格', + lineCode:'线路类型', turnoverTime: '更新时间', productList: '产品列表', belongsToMapName: '所属地图名称', diff --git a/src/jmap/config/skinCode/fuzhou_01.js b/src/jmap/config/skinCode/fuzhou_01.js index fcbb3639e..5a640b4e3 100644 --- a/src/jmap/config/skinCode/fuzhou_01.js +++ b/src/jmap/config/skinCode/fuzhou_01.js @@ -262,9 +262,9 @@ class SkinCode extends defaultStyle { show: true // 控制模式箭头显隐 }, mouseOverStyle: { // 鼠标悬浮样式 - fontSize: 10, + fontSize: null, fontFormat: 'consolas', - fontColor: '#FFF000', + fontColor: '#000', fontWeight: 'normal', textAlign: 'middle', textVerticalAlign: 'top' @@ -302,7 +302,7 @@ class SkinCode extends defaultStyle { offset: {x: 0, y: 8}, // 道岔名称与区段距离 fontSize: 11, // 字体大小 fontColor: '#C0C0C0', // 道岔名称颜色 - fontWeight: 'normal', // 字体粗细 + fontWeight: 'bold', // 字体粗细 borderColor: '#FE0000', // 道岔边框颜色 lossColor: '#FFFFFF', // 道岔失去颜色 locateColor: '#00FF00', // 道岔定位颜色 diff --git a/src/jmap/constant/deviceRender.js b/src/jmap/constant/deviceRender.js index 6f017258c..b13a4fb94 100644 --- a/src/jmap/constant/deviceRender.js +++ b/src/jmap/constant/deviceRender.js @@ -126,5 +126,10 @@ deviceRender[deviceType.TRain] = { zlevel: 1 // progressive: 4 }; +/** CheckBox渲染配置*/ +deviceRender[deviceType.CheckBox] = { + _type: deviceType.CheckBox, + zlevel: 1 +}; export default deviceRender; diff --git a/src/jmap/constant/deviceType.js b/src/jmap/constant/deviceType.js index d824501ae..9ecbe5129 100644 --- a/src/jmap/constant/deviceType.js +++ b/src/jmap/constant/deviceType.js @@ -16,7 +16,8 @@ const deviceType = { Train: 'Train', TrainWindow: 'TrainWindow', Line: 'Line', - Text: 'Text' + Text: 'Text', + CheckBox: 'CheckBox' }; export default deviceType; diff --git a/src/jmap/map.js b/src/jmap/map.js index ff78f4c41..1c65d4655 100644 --- a/src/jmap/map.js +++ b/src/jmap/map.js @@ -371,6 +371,26 @@ class Jlmap { } } } + + renderCheckBox(model) { + const type = model._type; + const code = model.code; + const oDevice = this.mapDevice[code] || deviceFactory(type, model); + const nDevice = deviceFactory(type, Object.assign(oDevice.model || {}, model)); + delete this.mapDevice[code]; + this.$painter.delete(oDevice); + if (!model._dispose) { + this.mapDevice[code] = nDevice; + this.$painter.add(nDevice); + } + } + deleteCheckBox(code) { + const oDevice = this.mapDevice[code]; + if (oDevice) { + delete this.mapDevice[code]; + this.$painter.delete(oDevice); + } + } } export default Jlmap; diff --git a/src/jmap/mouseController.js b/src/jmap/mouseController.js index ca873294d..b22250fe1 100644 --- a/src/jmap/mouseController.js +++ b/src/jmap/mouseController.js @@ -13,6 +13,7 @@ class EventModel { if (Object.values(deviceType).includes(view._type)) { this.deviceCode = view._code; this.deviceType = view._type; + this.eventTarget = view; break; } @@ -32,6 +33,11 @@ class MouseController extends Eventful { constructor(jmap) { super(); this.$jmap = jmap; + this.deviceList = []; + this.rightClickPoint = { + x: 0, + y: 0 + }; // 右键点击坐标 this.$zr = jmap.getZr(); this.events = jmap.getEvents(); this.initHandler(this.$zr); @@ -76,25 +82,31 @@ class MouseController extends Eventful { } mousedown(e) { - if (eventTool.notLeftMouse(e)) { - return; + // if (eventTool.notLeftMouse(e)) { + // return; + // } + if (e.which == 1 || e.which == 3) { + var x = e.offsetX; + var y = e.offsetY; + + this._x = x; + this._y = y; + this._dragging = true; + if (e.which == 3 && this._zoomOnMouseWheel) { + this.handleMouseDownRight(e); + } else if (e.which == 1 && this._zoomOnMouseWheel) { + this.handleMouseDownLeft(e); + } } - - var x = e.offsetX; - var y = e.offsetY; - - this._x = x; - this._y = y; - this._dragging = true; } mousemove(e) { - if (eventTool.notLeftMouse(e) || - !this._moveOnMouseMove || - !this._dragging - ) { - return; - } + // if (eventTool.notLeftMouse(e) || + // !this._moveOnMouseMove || + // !this._dragging + // ) { + // return; + // } const oldX = this._x; const oldY = this._y; @@ -105,9 +117,13 @@ class MouseController extends Eventful { this._x = e.offsetX; this._y = e.offsetY; - this._preventDefaultMouseMove && eventTool.stop(e.event); + if (e.which == 1) { + this._preventDefaultMouseMove && eventTool.stop(e.event); - this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y }); + this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y }); + } else if (e.which === 3 && this._zoomOnMouseWheel) { + this.handleMouseMoveRight({x: e.offsetX, y: e.offsetY}); + } } mouseup(e) { @@ -192,6 +208,66 @@ class MouseController extends Eventful { return newEm; } + + // 处理鼠标右键按下事件 + handleMouseDownRight(e) { + this.rightClickPoint.x = e.offsetX; + this.rightClickPoint.y = e.offsetY; + } + // 处理鼠标左键按下事件 + handleMouseDownLeft(e) { + const em = new EventModel(e); + this.eventTarget = em.eventTarget; + if (this.eventTarget && this.eventTarget._type === deviceType.CheckBox) { + // this.handleBoundingRect(this.eventTarget); + } else { + this.$jmap.deleteCheckBox('check_box'); + this.eventTarget = ''; + } + } + // 通过包围盒筛选选中区域的元素 + handleBoundingRect(eventTarget) { + console.log(eventTarget, '包围盒'); + this.deviceList = []; + // let boundingRect = eventTarget.grouper.getBoundingRect(); + const boundingRect = this.createFakeBoundingRect(eventTarget); + const deviceList = Object.values(this.$jmap.mapDevice); + const includeDeviceList = []; + deviceList.forEach( item =>{ + if (item.instance._type !== deviceType.Background) { + let deviceBoundingRect = item.instance.grouper.getBoundingRect(); + deviceBoundingRect = this.createFakeBoundingRect(item.instance, deviceBoundingRect); + if (this.whetherInclude(boundingRect, deviceBoundingRect )) { + includeDeviceList.push(item.instance); + } + } + }); + this.deviceList = includeDeviceList; + } + // 创建假包围盒对象 + createFakeBoundingRect(instance) { + return { + x1: instance.model.point.x, + y1: instance.model.point.y, + x2: instance.model.point.x + instance.model.width, + y2: instance.model.point.y + instance.model.height + }; + } + + // 判断元素包围盒是否在选中区域 + whetherInclude(boundingRect1, boundingRect2) { + return boundingRect1.x1 <= boundingRect2.x1 && boundingRect1.y1 <= boundingRect2.y1 && boundingRect1.x2 >= boundingRect2.x2 && boundingRect1.y2 >= boundingRect2.y2; + } + + // 右键拖动区域大小 + handleMouseMoveRight(point2) { + const point1 = this.rightClickPoint; + const x = Math.min(point1.x, point2.x) + this.$jmap.$options.offsetX; + const y = Math.min(point1.y, point2.y) + this.$jmap.$options.offsetY; + const width = Math.abs(point1.x - point2.x); + const height = Math.abs(point1.y - point2.y); + this.$jmap.renderCheckBox({code: 'check_box', _type: 'CheckBox', point: {x: x, y: y}, width: width, height: height }); + } } export default MouseController; diff --git a/src/jmap/shape/StationControl/EMouse.js b/src/jmap/shape/StationControl/EMouse.js index 8850a1e30..a26e61025 100644 --- a/src/jmap/shape/StationControl/EMouse.js +++ b/src/jmap/shape/StationControl/EMouse.js @@ -2,61 +2,61 @@ import Group from 'zrender/src/container/Group'; import Text from 'zrender/src/graphic/Text'; export default class EMouse extends Group { - constructor(device) { - super(); - this.device = device; - this.create(); - } - create() { - this.text = new Text({ - _subType: 'Text', - zlevel: this.device.zlevel, - z: this.device.z+1, - position: [0, 0], - style: { - x: this.device.model.position.x - this.device.style.StationControl.lamp.distance / 2 + this.device.style.StationControl.lamp.offset.x, - y: this.device.model.position.y + this.device.style.StationControl.lamp.offset.y + this.device.style.StationControl.lamp.radiusR + this.device.style.StationControl.text.distance-40, - fontWeight: this.device.style.StationControl.mouseOverStyle.fontWeight, - fontSize: this.device.style.StationControl.mouseOverStyle.fontSize, - fontFamily: this.device.style.StationControl.mouseOverStyle.fontFormat, - text: '填充', - textFill: this.device.style.StationControl.mouseOverStyle.fontColor, - textAlign: this.device.style.StationControl.mouseOverStyle.textAlign, - textVerticalAlign: this.device.style.StationControl.mouseOverStyle.textVerticalAlign - } - }); + constructor(device) { + super(); + this.device = device; + this.create(); + } + create() { + this.text = new Text({ + _subType: 'Text', + zlevel: this.device.zlevel, + z: this.device.z + 1, + position: [0, 0], + style: { + x: this.device.model.position.x - this.device.style.StationControl.lamp.distance / 2 + this.device.style.StationControl.lamp.offset.x, + y: this.device.model.position.y + this.device.style.StationControl.lamp.offset.y + this.device.style.StationControl.lamp.radiusR + this.device.style.StationControl.text.distance - 40, + fontWeight: this.device.style.StationControl.mouseOverStyle.fontWeight, + fontSize: this.device.style.StationControl.mouseOverStyle.fontSize, + fontFamily: this.device.style.StationControl.mouseOverStyle.fontFormat, + text: '', + textFill: this.device.style.StationControl.mouseOverStyle.fontColor, + textAlign: this.device.style.StationControl.mouseOverStyle.textAlign, + textVerticalAlign: this.device.style.StationControl.mouseOverStyle.textVerticalAlign + } + }); - this.add(this.text); - this.text.hide(); - } - setTextContext(text) { - if (text) { - this.text.setStyle('text', text); - } - } - mouseover(e) { - if (e.target) { - let name = ''; - switch (e.target.parent._subType) { - case 'emergency': - name = '紧急站控'; - break; - case 'center': - name = '中控'; - break; - case 'substation': - name = '站控'; - break; - } - // debugger; - this.setTextContext(name); - this.text.show(); - } - } + this.add(this.text); + this.text.hide(); + } + setTextContext(text) { + if (text) { + this.text.setStyle('text', text); + } + } + mouseover(e) { + if (e.target) { + let name = ''; + switch (e.target.parent._subType) { + case 'emergency': + name = '紧急站控'; + break; + case 'center': + name = '中控'; + break; + case 'substation': + name = '站控'; + break; + } + // debugger; + this.setTextContext(name); + this.text.show(); + } + } - mouseout(e) { - if (!this.device.model.down) { - this.text.hide(); - } - } + mouseout(e) { + if (!this.device.model.down) { + this.text.hide(); + } + } } diff --git a/src/jmap/shape/checkBox/checkBox.js b/src/jmap/shape/checkBox/checkBox.js new file mode 100644 index 000000000..55ad94de6 --- /dev/null +++ b/src/jmap/shape/checkBox/checkBox.js @@ -0,0 +1,46 @@ +import Group from 'zrender/src/container/Group'; +import Rect from 'zrender/src/graphic/shape/Rect'; + +export default class checkBox extends Group { + constructor(model, style) { + super(); + this.model = model; + this._type = model._type; + this._code = model.code; + this.zlevel = model.zlevel; + this.z = model.z; + this.create(); + } + + create() { + const model = this.model; + this.grouper = new Group({ + id: model.code, + position: [model.point.x, model.point.y] + }); + this.box = new Rect({ + zlevel: model.zlevel, + z: model.z, + draggable: false, + shape: { + x: 0, + y: 0, + width: this.model.width, + height: this.model.height + }, + style: { + fill: 'rgb(135,206,250,0.2)' + } + }); + this.grouper.add(this.box); + this.add(this.grouper); + } + setModel(dx, dy) { + this.model.point.x += dx; + this.model.point.y += dy; + } + setSize(width, height) { + this.model.width = width; + this.model.height = height; + } +} diff --git a/src/jmap/shape/factory.js b/src/jmap/shape/factory.js index f68e047fb..a19e73986 100644 --- a/src/jmap/shape/factory.js +++ b/src/jmap/shape/factory.js @@ -17,6 +17,7 @@ import TrainWindow from './TrainWindow/index.js'; import Train from './Train/index.js'; import Line from './Line/index.js'; import Text2 from './Text/index.js'; +import CheckBox from './checkBox/checkBox.js'; /** 图库*/ const mapShape = {}; @@ -38,6 +39,7 @@ mapShape[deviceType.TrainWindow] = TrainWindow; mapShape[deviceType.Train] = Train; mapShape[deviceType.Line] = Line; mapShape[deviceType.Text] = Text2; +mapShape[deviceType.CheckBox] = CheckBox; function shapefactory(device, jmap) { const type = device._type; diff --git a/src/jmap/theme/beijing_01/menusPlan/chooseTemplatePlan.vue b/src/jmap/theme/beijing_01/menusPlan/chooseTemplatePlan.vue index 03e8ca29c..ecacd95cb 100644 --- a/src/jmap/theme/beijing_01/menusPlan/chooseTemplatePlan.vue +++ b/src/jmap/theme/beijing_01/menusPlan/chooseTemplatePlan.vue @@ -52,7 +52,7 @@ export default { prop: 'name' }, { - title: '皮肤类型', + title: '线路类型', prop: 'skinCode', type: 'tag', columnValue: (row) => { diff --git a/src/jmap/theme/beijing_01/menusPlan/createTodayPlan.vue b/src/jmap/theme/beijing_01/menusPlan/createTodayPlan.vue index df37dd77f..2ac39113d 100644 --- a/src/jmap/theme/beijing_01/menusPlan/createTodayPlan.vue +++ b/src/jmap/theme/beijing_01/menusPlan/createTodayPlan.vue @@ -54,7 +54,7 @@ export default { prop: 'name' }, { - title: '皮肤类型', + title: '线路类型', prop: 'skinCode', type: 'tag', columnValue: (row) => { diff --git a/src/jmap/theme/beijing_01/menusPlan/managePlanList.vue b/src/jmap/theme/beijing_01/menusPlan/managePlanList.vue index 288ad3381..7fcd45639 100644 --- a/src/jmap/theme/beijing_01/menusPlan/managePlanList.vue +++ b/src/jmap/theme/beijing_01/menusPlan/managePlanList.vue @@ -16,126 +16,126 @@ diff --git a/src/views/publish/productStatus/index.vue b/src/views/publish/productStatus/index.vue index 394200d4d..aaaeb14d6 100644 --- a/src/views/publish/productStatus/index.vue +++ b/src/views/publish/productStatus/index.vue @@ -6,7 +6,7 @@ diff --git a/src/views/system/userControl/index.vue b/src/views/system/userControl/index.vue index cb4010e4d..d05ba2bd6 100644 --- a/src/views/system/userControl/index.vue +++ b/src/views/system/userControl/index.vue @@ -12,118 +12,118 @@ import DictionaryEdit from './edit'; import CorrelationMap from './correlationMap'; export default { - name: 'UserControl', - components: { - DictionaryEdit, - CorrelationMap - }, - data() { - return { - pagerConfig: { - pageSize: 'pageSize', - pageIndex: 'pageNum' - }, - queryForm: { - labelWidth: '80px', - reset: true, - queryObject: { - name: { - type: 'text', - label: this.$t('system.name') - }, - roles: { - type: 'select', - label: this.$t('system.roles'), - config: { - data: this.$ConstSelect.roleList - } - } - } + name: 'UserControl', + components: { + DictionaryEdit, + CorrelationMap + }, + data() { + return { + pagerConfig: { + pageSize: 'pageSize', + pageIndex: 'pageNum' + }, + queryForm: { + labelWidth: '80px', + reset: true, + queryObject: { + name: { + type: 'text', + label: this.$t('system.name') + }, + roles: { + type: 'select', + label: this.$t('system.roles'), + config: { + data: this.$ConstSelect.roleList + } + } + } - }, - queryList: { - query: getUserList, - selectCheckShow: false, - indexShow: true, - columns: [ - { - title: this.$t('system.name'), - prop: 'name' - }, - { - title: this.$t('system.nickname'), - prop: 'nickname' - }, - { - title: this.$t('global.mobile'), - prop: 'mobile' - }, - { - title: this.$t('global.email'), - prop: 'email' - }, - { - title: this.$t('system.roles'), - prop: 'roles', - type: 'tagMore', - columnValue: (row) => { return this.$convertField(row.roles, this.$ConstSelect.roleList, ['value', 'label'], true); }, - tagType: (row) => { return 'success'; } - }, - { - type: 'button', - title: this.$t('global.operate'), - width: '250', - buttons: [ - { - name: this.$t('global.edit'), - handleClick: this.handleUserEdit - }, - { - name: this.$t('system.subscribeMap'), - handleClick: this.handleMapCorrelation, - type: 'danger' - } - ] - } - ] - }, - currentModel: {} - }; - }, - created() { - }, - methods: { - // 编辑 - handleUserEdit(index, row) { - this.$refs.edit.doShow(row); - }, + }, + queryList: { + query: getUserList, + selectCheckShow: false, + indexShow: true, + columns: [ + { + title: this.$t('system.name'), + prop: 'name' + }, + { + title: this.$t('system.nickname'), + prop: 'nickname' + }, + { + title: this.$t('global.mobile'), + prop: 'mobile' + }, + { + title: this.$t('global.email'), + prop: 'email' + }, + { + title: this.$t('system.roles'), + prop: 'roles', + type: 'tagMore', + columnValue: (row) => { return this.$convertField(row.roles, this.$ConstSelect.roleList, ['value', 'label'], true); }, + tagType: (row) => { return 'success'; } + }, + { + type: 'button', + title: this.$t('global.operate'), + width: '250', + buttons: [ + { + name: this.$t('global.edit'), + handleClick: this.handleUserEdit + }, + { + name: this.$t('system.subscribeMap'), + handleClick: this.handleMapCorrelation, + type: 'danger' + } + ] + } + ] + }, + currentModel: {} + }; + }, + created() { + }, + methods: { + // 编辑 + handleUserEdit(index, row) { + this.$refs.edit.doShow(row); + }, - // 删除 - handleUserDelete(index, row) { - this.$confirm(this.$t('system.wellDelType'), this.$t('global.tips'), { - confirmButtonText: this.$t('global.confirm'), - cancelButtonText: this.$t('global.cancel'), - type: 'warning' - }).then(() => { - // delPublishMap(row.id).then(response => { - // this.$message.success('删除成功') - // this.reloadTable() - // localStore.remove('mapId') - // }).catch(error => { - // this.reloadTable() - // this.$messageBox('删除失败') - // }) - }); - }, + // 删除 + handleUserDelete(index, row) { + this.$confirm(this.$t('system.wellDelType'), this.$t('global.tips'), { + confirmButtonText: this.$t('global.confirm'), + cancelButtonText: this.$t('global.cancel'), + type: 'warning' + }).then(() => { + // delPublishMap(row.id).then(response => { + // this.$message.success('删除成功') + // this.reloadTable() + // localStore.remove('mapId') + // }).catch(error => { + // this.reloadTable() + // this.$messageBox('删除失败') + // }) + }); + }, - // 关联地图 - handleMapCorrelation(index, row) { - this.$refs.correlationMap.doShow(row); - }, + // 关联地图 + handleMapCorrelation(index, row) { + this.$refs.correlationMap.doShow(row); + }, - reloadTable() { - this.queryList.reload(); - } - } + reloadTable() { + this.queryList.reload(); + } + } }; diff --git a/src/views/system/userSimulation/index.vue b/src/views/system/userSimulation/index.vue index 5fa6c2c50..5da75cc2a 100644 --- a/src/views/system/userSimulation/index.vue +++ b/src/views/system/userSimulation/index.vue @@ -8,7 +8,6 @@