From 30c672026f0241bdf85fde42831cfb8a115b634e Mon Sep 17 00:00:00 2001 From: zyy <1787816799@qq.com> Date: Thu, 5 Mar 2020 15:48:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=9F=A9=E5=BD=A2=E5=8C=85?= =?UTF-8?q?=E5=9B=B4=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmapNew/config/skinCode/ningbo_01.js | 5 +- src/jmapNew/constant/deviceRender.js | 9 +- src/jmapNew/constant/deviceType.js | 3 +- src/jmapNew/constant/stateTransition.js | 5 +- src/jmapNew/shape/Automactic/index.js | 24 +- src/jmapNew/shape/OutFrame/index.js | 41 +++ src/jmapNew/shape/factory.js | 6 +- src/jmapNew/utils/parser.js | 11 +- src/store/modules/map.js | 11 +- .../mapoperate/automaticControl.vue | 30 +- .../newMap/newMapdraft/mapoperate/index.vue | 14 +- .../mapoperate/outFrameControl.vue | 319 ++++++++++++++++++ 12 files changed, 437 insertions(+), 41 deletions(-) create mode 100644 src/jmapNew/shape/OutFrame/index.js create mode 100644 src/views/newMap/newMapdraft/mapoperate/outFrameControl.vue diff --git a/src/jmapNew/config/skinCode/ningbo_01.js b/src/jmapNew/config/skinCode/ningbo_01.js index 2cdf784ab..d06ce0e0f 100644 --- a/src/jmapNew/config/skinCode/ningbo_01.js +++ b/src/jmapNew/config/skinCode/ningbo_01.js @@ -203,7 +203,7 @@ class SkinCode extends defaultStyle { } }; - this[deviceType.Automactic] = { + this[deviceType.MapCycleButtonVO] = { // 是否显示 visible: true, text: { @@ -222,6 +222,9 @@ class SkinCode extends defaultStyle { fill: 'rgba(0,0,0,0)', // 填充色 radiusR: 6, // 控制灯大小 controlColor: '#b5b3b3' // 控制灯颜色 (灰色) + }, + OutFrame: { + } }; diff --git a/src/jmapNew/constant/deviceRender.js b/src/jmapNew/constant/deviceRender.js index 15fd2dccf..90a90f970 100644 --- a/src/jmapNew/constant/deviceRender.js +++ b/src/jmapNew/constant/deviceRender.js @@ -117,10 +117,15 @@ deviceRender[deviceType.CheckBox] = { }; /** Automactic渲染配置 自动折返*/ -deviceRender[deviceType.Automactic] = { - _type: deviceType.Automactic, +deviceRender[deviceType.MapCycleButtonVO] = { + _type: deviceType.MapCycleButtonVO, zlevel: 1 }; +/** OutFrame渲染配置 自动折返包围矩形*/ +deviceRender[deviceType.OutFrame] = { + _type: deviceType.OutFrame, + zlevel: 1 +}; export default deviceRender; diff --git a/src/jmapNew/constant/deviceType.js b/src/jmapNew/constant/deviceType.js index 6407bfeb4..f1af16ab7 100644 --- a/src/jmapNew/constant/deviceType.js +++ b/src/jmapNew/constant/deviceType.js @@ -10,7 +10,8 @@ const deviceType = { StationStand: 'StationStand', Esp: 'Esp', Psd: 'Psd', - Automactic: 'Automactic', + MapCycleButtonVO: 'MapCycleButtonVO', + OutFrame: 'OutFrame', StationControl: 'StationControl', StationCounter: 'StationCounter', StationDelayUnlock: 'StationDelayUnlock', diff --git a/src/jmapNew/constant/stateTransition.js b/src/jmapNew/constant/stateTransition.js index 1bff1aac5..f993764e1 100644 --- a/src/jmapNew/constant/stateTransition.js +++ b/src/jmapNew/constant/stateTransition.js @@ -109,7 +109,10 @@ class Status { handleLimitControl(device) { this.statusObj = { }; } - handleAutomactic(device) { + handleMapCycleButtonVO(device) { + this.statusObj = { }; + } + handleOutFrame(device) { this.statusObj = { }; } getStatus() { diff --git a/src/jmapNew/shape/Automactic/index.js b/src/jmapNew/shape/Automactic/index.js index 03a10015e..f1bfbde4e 100644 --- a/src/jmapNew/shape/Automactic/index.js +++ b/src/jmapNew/shape/Automactic/index.js @@ -7,7 +7,7 @@ import Text from 'zrender/src/graphic/Text'; import Rect from 'zrender/src/graphic/shape/Rect'; import EMouse from './EMouse'; -export default class LcControl extends Group { +export default class Automactic extends Group { constructor(model, style) { super(); this.z = 20; @@ -30,11 +30,11 @@ export default class LcControl extends Group { shape: { cx: model.position.x, cy: model.position.y, - r: this.style.Automactic.lamp.radiusR + r: this.style.MapCycleButtonVO.lamp.radiusR }, style: { lineWidth: 0, - fill: this.style.Automactic.lamp.controlColor + fill: this.style.MapCycleButtonVO.lamp.controlColor } }); @@ -45,9 +45,9 @@ export default class LcControl extends Group { position: [0, 0], style: { x: model.position.x, - y: model.position.y + this.style.Automactic.lamp.radiusR + this.style.Automactic.text.distance, - fontWeight: this.style.Automactic.text.fontWeight, - fontSize: this.style.Automactic.text.fontSize, + y: model.position.y + this.style.MapCycleButtonVO.lamp.radiusR + this.style.MapCycleButtonVO.text.distance, + fontWeight: this.style.MapCycleButtonVO.text.fontWeight, + fontSize: this.style.MapCycleButtonVO.text.fontSize, fontFamily: this.style.fontFamily, text: model.name, textFill: '#fff', @@ -64,9 +64,9 @@ export default class LcControl extends Group { position: [0, 0], style: { x: model.position.x, - y: model.position.y + this.style.Automactic.lamp.radiusR + this.style.Automactic.subtitleText.distance, - fontWeight: this.style.Automactic.subtitleText.fontWeight, - fontSize: this.style.Automactic.subtitleText.fontSize, + y: model.position.y + this.style.MapCycleButtonVO.lamp.radiusR + this.style.MapCycleButtonVO.subtitleText.distance, + fontWeight: this.style.MapCycleButtonVO.subtitleText.fontWeight, + fontSize: this.style.MapCycleButtonVO.subtitleText.fontSize, fontFamily: this.style.fontFamily, text: model.subtitleName, textFill: '#fff', @@ -83,9 +83,9 @@ export default class LcControl extends Group { silent: true, shape: arcRect, style: { - lineDash: this.style.Automactic.lamp.lineDash, - stroke: this.style.Automactic.lamp.stroke, - fill: this.style.Automactic.lamp.fill + lineDash: this.style.MapCycleButtonVO.lamp.lineDash, + stroke: this.style.MapCycleButtonVO.lamp.stroke, + fill: this.style.MapCycleButtonVO.lamp.fill } }); this.add(this.control); diff --git a/src/jmapNew/shape/OutFrame/index.js b/src/jmapNew/shape/OutFrame/index.js new file mode 100644 index 000000000..af6376aa6 --- /dev/null +++ b/src/jmapNew/shape/OutFrame/index.js @@ -0,0 +1,41 @@ +import Group from 'zrender/src/container/Group'; +import Rect from 'zrender/src/graphic/shape/Rect'; + +export default class OutFrame extends Group { + constructor(model, style) { + super(); + this.model = model; + this._type = model._type; + this._code = model.code; + this.style = style; + this.zlevel = model.zlevel; + this.z = 0; + this.create(); + this.setState(model); + } + + create() { + const model = this.model; + this.box = new Rect({ + zlevel: this.zlevel, + z: this.z, + shape: { + x: model.position.x - model.width / 2, + y: model.position.y - model.height / 2, + width: model.width, + height: model.height + }, + style: { + lineDash: null, + stroke: '#fff', + lineWidth: 1, + fill: 'rgb(135,206,250,0)' + } + }); + this.add(this.box); + } + + // 设置状态 + setState(model) { + } +} diff --git a/src/jmapNew/shape/factory.js b/src/jmapNew/shape/factory.js index b003bf2e4..36a7ce029 100644 --- a/src/jmapNew/shape/factory.js +++ b/src/jmapNew/shape/factory.js @@ -15,7 +15,8 @@ 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 Automactic from './Automactic/index.js'; +import MapCycleButtonVO from './Automactic/index.js'; +import OutFrame from './OutFrame/index.js'; import CheckBox from './checkBox/checkBox.js'; /** 图库*/ @@ -36,7 +37,8 @@ mapShape[deviceType.TrainWindow] = TrainWindow; mapShape[deviceType.Train] = Train; mapShape[deviceType.Line] = Line; mapShape[deviceType.Text] = Text2; -mapShape[deviceType.Automactic] = Automactic; +mapShape[deviceType.MapCycleButtonVO] = MapCycleButtonVO; +mapShape[deviceType.OutFrame] = OutFrame; mapShape[deviceType.CheckBox] = CheckBox; function shapefactory(device, jmap) { diff --git a/src/jmapNew/utils/parser.js b/src/jmapNew/utils/parser.js index b54e7cdce..0b0567b91 100644 --- a/src/jmapNew/utils/parser.js +++ b/src/jmapNew/utils/parser.js @@ -115,8 +115,12 @@ export function parser(data, skinCode) { mapDevice[elem.code] = createDevice(deviceType.Text, elem, propConvert); }, this); - zrUtil.each(data.Automactic || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.Automactic, elem, propConvert); + zrUtil.each(data.cycleButtonList || [], elem => { + mapDevice[elem.code] = createDevice(deviceType.MapCycleButtonVO, elem, propConvert); + }, this); + + zrUtil.each(data.outFrameList || [], elem => { + mapDevice[elem.code] = createDevice(deviceType.OutFrame, elem, propConvert); }, this); zrUtil.each(data.trainWindowList || [], elem => { @@ -209,7 +213,8 @@ export function updateMapData(state, model) { case deviceType.Text: updateForList(model, state, 'textList'); break; case deviceType.Psd: updateForList(model, state, 'psdList'); break; case deviceType.Esp: updateForList(model, state, 'espList'); break; - case deviceType.Automactic: updateForList(model, state, 'automaticList'); break; + case deviceType.MapCycleButtonVO: updateForList(model, state, 'cycleButtonList'); break; + case deviceType.OutFrame: updateForList(model, state, 'outFrameList'); break; } } } diff --git a/src/store/modules/map.js b/src/store/modules/map.js index 7d6ce651e..2b8cd2ae2 100644 --- a/src/store/modules/map.js +++ b/src/store/modules/map.js @@ -316,9 +316,16 @@ const map = { return []; } }, - automaticList: (state) => { + cycleButtonList: (state) => { if (state.map) { - return state.map.automaticList || []; + return state.map.cycleButtonList || []; + } else { + return []; + } + }, + outFrameList: (state) => { + if (state.map) { + return state.map.outFrameList || []; } else { return []; } diff --git a/src/views/newMap/newMapdraft/mapoperate/automaticControl.vue b/src/views/newMap/newMapdraft/mapoperate/automaticControl.vue index ec07c28e6..33968a55c 100644 --- a/src/views/newMap/newMapdraft/mapoperate/automaticControl.vue +++ b/src/views/newMap/newMapdraft/mapoperate/automaticControl.vue @@ -37,7 +37,7 @@ import { deepAssign } from '@/utils/index'; import { getAutoReentryList} from '@/api/jmap/mapdraft'; export default { - name: 'ZcControlDraft', + name: 'MapCycleButtonVO', components: { ConfigList, ConfigData @@ -58,7 +58,7 @@ export default { code: '', name: '', subtitleName: '', //副标题 - automaticCode: '', // 关联自动折返code + cycleCode: '', // 关联自动折返code position: { x: 0, y: 0 @@ -68,7 +68,7 @@ export default { code: '', name: '', subtitleName: '', // 副标题 - automaticCode: '', // 关联自动折返code + cycleCode: '', // 关联自动折返code position: { x: 0, y: 0 @@ -81,7 +81,7 @@ export default { name: [ { required: true, message: this.$t('rules.pleaseEnterStatusSignal'), trigger: 'blur' } ], - automaticCode:[ + cycleCode:[ { required: true, message: this.$t('rules.selectConcentrateStation'), trigger: 'change' } ], 'position.x': [ @@ -95,7 +95,7 @@ export default { }, computed: { ...mapGetters('map', [ - 'automaticList' + 'cycleButtonList' ]), form() { const form = { @@ -108,14 +108,14 @@ export default { draw: { name: this.$t('map.drawData'), item: [ - { prop: 'code', label: `${this.$t('map.code')}`, type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.automaticList, change: true, deviceChange: this.deviceChange }, + { prop: 'code', label: `${this.$t('map.code')}`, type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.cycleButtonList, change: true, deviceChange: this.deviceChange }, { prop: 'name', label: '标题名称:', type: 'input' }, { prop: 'subtitleName', label: '副标题名称:', type: 'input' }, { prop: 'position', label: '坐标:', type: 'coordinate', width: '140px', children: [ { prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px' }, { prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px' } ] }, - { prop:'automaticCode', label: '自动折返进路code:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.autoList }, + { prop:'cycleCode', label: '自动折返进路code:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.autoList }, ] } } @@ -126,7 +126,7 @@ export default { const form = { labelWidth: '150px', items: [ - { prop:'automaticCode', label: '自动折返进路:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.autoList }, + { prop:'cycleCode', label: '自动折返进路:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.autoList }, { prop: 'name', label: '自动折返名称:', type: 'input' }, { prop: 'subtitleName', label: '副标题名称:', type: 'input' }, { prop: 'position', label: '坐标:', type: 'coordinate', width: '140px', children: [ @@ -140,7 +140,7 @@ export default { }, createRules: function () { return { - automaticCode: [ + cycleCode: [ { required: true, message: '请选择自动折返进路', trigger: 'change' } ], name: [ @@ -174,7 +174,7 @@ export default { deviceSelect(selected) { this.$refs.dataform.resetFields(); this.$refs.make.resetFields(); - if (selected && selected._type.toUpperCase() === 'Automactic'.toUpperCase()) { + if (selected && selected._type.toUpperCase() === 'MapCycleButtonVO'.toUpperCase()) { this.activeName = 'first'; this.editModel = deepAssign(this.editModel, selected); } @@ -191,10 +191,10 @@ export default { create() { this.$refs.make.validate((valid) => { if (valid) { - const uid = getUID('Automactic', this.automaticList); + const uid = getUID('MapCycleButtonVO', this.cycleButtonList); let models = []; const model = { - _type: 'Automactic', + _type: 'MapCycleButtonVO', code: uid, name: this.addModel.name, subtitleName: this.addModel.subtitleName, @@ -202,7 +202,7 @@ export default { x: this.addModel.position.x, y: this.addModel.position.y }, - automaticCode:this.addModel.automaticCode + cycleCode:this.addModel.cycleCode }; models.push(model); this.$emit('updateMapModel', models); @@ -214,7 +214,7 @@ export default { edit() { this.$refs['dataform'].validate((valid) => { if (valid) { - const data = Object.assign({_type: 'Automactic'}, this.editModel); + const data = Object.assign({_type: 'MapCycleButtonVO'}, this.editModel); let models = [data]; this.$emit('updateMapModel', models); } @@ -223,7 +223,7 @@ export default { // 删除对象 deleteObj() { const selected = this.$store.getters['map/getDeviceByCode'](this.editModel.code); - if (selected && selected._type.toUpperCase() === 'Automactic'.toUpperCase()) { + if (selected && selected._type.toUpperCase() === 'MapCycleButtonVO'.toUpperCase()) { const _that = this; this.$confirm(this.$t('tip.confirmDeletion'), this.$t('tip.hint'), { confirmButtonText: this.$t('tip.confirm'), diff --git a/src/views/newMap/newMapdraft/mapoperate/index.vue b/src/views/newMap/newMapdraft/mapoperate/index.vue index c2b3ef8de..0cf5c53cc 100644 --- a/src/views/newMap/newMapdraft/mapoperate/index.vue +++ b/src/views/newMap/newMapdraft/mapoperate/index.vue @@ -92,9 +92,9 @@ @setCenter="setCenter" /> - + + + + + + +
+ + + +
+ + {{ $t('map.updateObj') }} + {{ $t('map.deleteObj') }} + +
+ +
+ + + + +
+ + {{ $t('map.create') }} + +
+
+ + + +