diff --git a/src/jmap/map.js b/src/jmap/map.js index 52b696bea..26eb46060 100644 --- a/src/jmap/map.js +++ b/src/jmap/map.js @@ -5,9 +5,10 @@ import Painter from './painter'; import Options from './options'; import MouseController from './mouseController'; import deviceState from './constant/deviceState'; -import { selectSkinStyle } from './config/deviceStyle'; import deviceType from './constant/deviceType'; +import { selectSkinStyle } from './config/deviceStyle'; import { parser, deviceFactory, createBoundingRect, calculateDCenter } from './utils/parser'; +import Theme from './theme/factory'; const renderer = 'canvas'; const devicePixelRatio = 1; @@ -27,7 +28,10 @@ class Jlmap { this.skinStyle = ''; // 皮肤风格 - this.styleDict = {}; + this.style = this.loadStyle(); + + // 地图主题 + this.theme = this.loadTheme(); // 设备数据 this.mapDevice = {}; @@ -63,6 +67,10 @@ class Jlmap { return selectSkinStyle(skinStyle); } + loadTheme(skinStyle) { + return new Theme(skinStyle); + } + loadDefaultState() { const defaultStateDict = {}; @@ -86,10 +94,13 @@ class Jlmap { this.data = map; // 加载对应皮肤 - this.styleDict = this.loadStyle(this.skinStyle); + this.style = this.loadStyle(this.skinStyle); + + // 主题模块 + this.theme = this.loadTheme(this.skinStyle); // 解析地图数据 - this.mapDevice = parser(map); + this.mapDevice = parser(map, this); // 数据加载完成 回调 if (this.methods.dataLoaded instanceof Function) { this.methods.dataLoaded(this.mapDevice); } @@ -306,18 +317,6 @@ class Jlmap { return this.events; } - getSkinStyle() { - return this.skinStyle; - } - - getStyleDict() { - return this.styleDict; - } - - getDefaultStateDict() { - return this.defaultStateDict; - } - getDeviceByCode(code) { return this.mapDevice[code]; } @@ -333,11 +332,16 @@ class Jlmap { clearTrainView() { this.$painter.clearLevel(deviceType.Train); + zrUtil.each(Object.values(this.mapDevice), device => { + if (device._type == deviceType.Train) { + device.instance = null; + } + }); } clear() { this.skinStyle = ''; - this.styleDict = {}; + this.style = {}; this.mapDevice = {}; this.$painter.clear(); } diff --git a/src/jmap/painter.js b/src/jmap/painter.js index 34f671464..33264570a 100644 --- a/src/jmap/painter.js +++ b/src/jmap/painter.js @@ -125,7 +125,7 @@ class Painter { device.trainWindowModel = oldTrainWindowModel; } - this.mapInstanceLevel[deviceType.Train].remove(instance); + instance && this.mapInstanceLevel[deviceType.Train].remove(instance); this.add(device); } diff --git a/src/jmap/shape/Signal/index.js b/src/jmap/shape/Signal/index.js index a8b10dfe5..aa9d8e448 100644 --- a/src/jmap/shape/Signal/index.js +++ b/src/jmap/shape/Signal/index.js @@ -146,7 +146,7 @@ class Signal extends Group { this.add(this.sigPost); this.lamps.forEach(lamp => { this.add(lamp); }); - this.add(this.sigName); + this.model.nameShow ? this.add(this.sigName) : null; this.add(this.sigAuto); this.add(this.sigRoute); this.add(this.sigDelay); diff --git a/src/jmap/shape/factory.js b/src/jmap/shape/factory.js index 7cac0d575..d592ca368 100644 --- a/src/jmap/shape/factory.js +++ b/src/jmap/shape/factory.js @@ -39,11 +39,10 @@ mapShape[deviceType.Text] = Text2; function shapefactory(device, jmap) { const type = device._type; - const style = jmap.getStyleDict(); const shape = mapShape[type]; if (shape instanceof Function) { // eslint-disable-next-line - return new shape(device, style); + return new shape(device, jmap.style); } } diff --git a/src/jmap/theme/batong_01/menus/menuDialog/viewDevice.vue b/src/jmap/theme/batong_01/menus/menuDialog/viewDevice.vue index 726e3cbc8..839281353 100644 --- a/src/jmap/theme/batong_01/menus/menuDialog/viewDevice.vue +++ b/src/jmap/theme/batong_01/menus/menuDialog/viewDevice.vue @@ -113,48 +113,48 @@ }) }, setDeviceDisplay() { - // let show = false; - // let deviceList = []; + let show = false; + let deviceList = []; - // //区段边界设置 - // let sectionList = this.$store.getters['map/sectionList']; - // if (sectionList && sectionList.length > 0) { - // sectionList.forEach(elem => { - // //区段边界 - // show = this.deviceLevels.indexOf(2) !== -1 ? true : false; - // elem.borderBorderShow = show; - // elem.type = deviceType.Section; - // deviceList.push(elem); - // }); - // } + //区段边界设置 + let sectionList = this.$store.getters['map/sectionList']; + if (sectionList && sectionList.length > 0) { + sectionList.forEach(elem => { + //区段边界 + show = this.deviceLevels.indexOf(2) !== -1 ? true : false; + elem.borderBorderShow = show; + elem.type = deviceType.Section; + deviceList.push(elem); + }); + } - // //车次窗设置 - // let trainWindowList = this.$store.getters['map/trainWindowList']; - // if (trainWindowList && trainWindowList.length > 0) { - // trainWindowList.forEach(elem => { - // //车次窗 - // show = this.deviceLevels.indexOf(1) !== -1 ? true : false; - // elem.type = deviceType.Section; - // elem.trainWindowShow = show; - // deviceList.push(elem); - // }); - // } + //车次窗设置 + let trainWindowList = this.$store.getters['map/trainWindowList']; + if (trainWindowList && trainWindowList.length > 0) { + trainWindowList.forEach(elem => { + //车次窗 + show = this.deviceLevels.indexOf(1) !== -1 ? true : false; + elem.type = deviceType.Section; + elem.trainWindowShow = show; + deviceList.push(elem); + }); + } - // //联锁自动进路表示灯和ATS自动触发表示灯设置 - // let signalList = this.$store.getters['map/signalList']; - // if (signalList && signalList.length > 0) { - // signalList.forEach(elem => { - // //联锁自动进路表示灯 - // show = this.deviceLevels.indexOf(3) !== -1 ? true : false; - // elem.linkageAutoRouteShow = show; - // //ATS自动触发表示灯 - // show = this.deviceLevels.indexOf(4) !== -1 ? true : false; - // elem.atsAutoTriggerShow = show; - // deviceList.push(elem); - // }) - // } + //联锁自动进路表示灯和ATS自动触发表示灯设置 + let signalList = this.$store.getters['map/signalList']; + if (signalList && signalList.length > 0) { + signalList.forEach(elem => { + //联锁自动进路表示灯 + show = this.deviceLevels.indexOf(3) !== -1 ? true : false; + elem.linkageAutoRouteShow = show; + //ATS自动触发表示灯 + show = this.deviceLevels.indexOf(4) !== -1 ? true : false; + elem.atsAutoTriggerShow = show; + deviceList.push(elem); + }) + } - // this.$store.dispatch('map/updateMapDevices', deviceList); + this.$store.dispatch('map/updateMapDevices', deviceList); } } } diff --git a/src/jmap/theme/batong_01/menus/menuDialog/viewName.vue b/src/jmap/theme/batong_01/menus/menuDialog/viewName.vue index 4286f97d0..ee32f9dc6 100644 --- a/src/jmap/theme/batong_01/menus/menuDialog/viewName.vue +++ b/src/jmap/theme/batong_01/menus/menuDialog/viewName.vue @@ -147,115 +147,115 @@ }) }, setNameDisplay() { - // let show = false; - // let deviceList = []; + let show = false; + let deviceList = []; - // //信号机 - // show = this.nameLevels.indexOf(1) !== -1 ? true : false; - // let signalList = this.$store.getters['map/signalList']; - // if (signalList && signalList.length > 0) { - // signalList.forEach(elem => { - // elem.nameShow = show; - // deviceList.push(elem); - // }) - // } + //信号机 + show = this.nameLevels.indexOf(1) !== -1 ? true : false; + let signalList = this.$store.getters['map/signalList']; + if (signalList && signalList.length > 0) { + signalList.forEach(elem => { + elem.nameShow = show; + deviceList.push(elem); + }) + } - // //按钮名称 - // show = this.nameLevels.indexOf(3) !== -1 ? true : false; + //按钮名称 + show = this.nameLevels.indexOf(3) !== -1 ? true : false; - // //道岔 - // let switchList = this.$store.getters['map/switchList']; - // if (switchList && switchList.length > 0) { - // switchList.forEach(elem => { - // //道岔名称 - // show = this.nameLevels.indexOf(7) !== -1 ? true : false; - // elem.nameShow = show; - // //道岔轨名称 - // show = this.nameLevels.indexOf(9) !== -1 ? true : false; - // elem.switchSectionNameShow = show; - // deviceList.push(elem); - // }) - // } + //道岔 + let switchList = this.$store.getters['map/switchList']; + if (switchList && switchList.length > 0) { + switchList.forEach(elem => { + //道岔名称 + show = this.nameLevels.indexOf(7) !== -1 ? true : false; + elem.nameShow = show; + //道岔轨名称 + show = this.nameLevels.indexOf(9) !== -1 ? true : false; + elem.switchSectionNameShow = show; + deviceList.push(elem); + }) + } - // //控制模式 - // show = this.nameLevels.indexOf(8) !== -1 ? true : false; - // let control = this.$store.getters['map/stationControlList']; - // if (control && control.length > 0) { - // control.forEach(elem => { - // //标识灯名称 - // elem.indicatorShow = show; - // deviceList.push(elem); - // }) - // } + //控制模式 + show = this.nameLevels.indexOf(8) !== -1 ? true : false; + let control = this.$store.getters['map/stationControlList']; + if (control && control.length > 0) { + control.forEach(elem => { + //标识灯名称 + elem.indicatorShow = show; + deviceList.push(elem); + }) + } - // //区段 - // let sectionList = this.$store.getters['map/sectionList']; - // if (sectionList && sectionList.length > 0) { - // sectionList.forEach(elem => { - // if (elem.isSwitchSection && elem.parentCode) { - // //道岔轨的区段名称默认不显示 - // elem.nameShow = false; - // } else { - // if (elem.type === '01') { - // show = this.nameLevels.indexOf(11) !== -1 ? true : false; - // elem.nameShow = show; - // } else if (elem.type === '02') { - // //股道轨名称 - // show = this.nameLevels.indexOf(5) !== -1 ? true : false; - // elem.nameShow = show; - // } else if (elem.type === '03') { - // //道岔区段名称 - // show = this.nameLevels.indexOf(9) !== -1 ? true : false; - // elem.nameShow = show; - // } - // } + //区段 + let sectionList = this.$store.getters['map/sectionList']; + if (sectionList && sectionList.length > 0) { + sectionList.forEach(elem => { + if (elem.isSwitchSection && elem.parentCode) { + //道岔轨的区段名称默认不显示 + elem.nameShow = false; + } else { + if (elem.type === '01') { + show = this.nameLevels.indexOf(11) !== -1 ? true : false; + elem.nameShow = show; + } else if (elem.type === '02') { + //股道轨名称 + show = this.nameLevels.indexOf(5) !== -1 ? true : false; + elem.nameShow = show; + } else if (elem.type === '03') { + //道岔区段名称 + show = this.nameLevels.indexOf(9) !== -1 ? true : false; + elem.nameShow = show; + } + } - // //站台轨名称 - // if (elem.isStandTrack) { - // show = this.nameLevels.indexOf(2) !== -1 ? true : false; - // elem.standTrackNameShow = show; - // } + //站台轨名称 + if (elem.isStandTrack) { + show = this.nameLevels.indexOf(2) !== -1 ? true : false; + elem.standTrackNameShow = show; + } - // //折返轨名称 - // if (elem.isReentryTrack) { - // show = this.nameLevels.indexOf(4) !== -1 ? true : false; - // elem.reentryTrackNameShow = show; - // } + //折返轨名称 + if (elem.isReentryTrack) { + show = this.nameLevels.indexOf(4) !== -1 ? true : false; + elem.reentryTrackNameShow = show; + } - // //转换轨名称 - // if (elem.isTransferTrack) { - // show = this.nameLevels.indexOf(6) !== -1 ? true : false; - // elem.transferTrackNameShow = show; - // } + //转换轨名称 + if (elem.isTransferTrack) { + show = this.nameLevels.indexOf(6) !== -1 ? true : false; + elem.transferTrackNameShow = show; + } - // deviceList.push(elem); - // }) - // } + deviceList.push(elem); + }) + } - // //停车点 - // show = this.nameLevels.indexOf(10) !== -1 ? true : false; - // let stopPointList = this.$store.getters['map/stopPointList']; - // if (stopPointList && stopPointList.length > 0) { - // stopPointList.forEach(elem => { - // //目的地名称 - // elem.destCodeShow = show; - // deviceList.push(elem); - // }) - // } + //停车点 + show = this.nameLevels.indexOf(10) !== -1 ? true : false; + let stopPointList = this.$store.getters['map/stopPointList']; + if (stopPointList && stopPointList.length > 0) { + stopPointList.forEach(elem => { + //目的地名称 + elem.destCodeShow = show; + deviceList.push(elem); + }) + } - // //车站 - // show = this.nameLevels.indexOf(12) !== -1 ? true : false; - // let stationList = this.$store.getters['map/stationList']; - // if (stationList && stationList.length > 0) { - // stationList.forEach(elem => { - // //公里标 - // elem.kmPostShow = show; - // deviceList.push(elem); - // }) - // } + //车站 + show = this.nameLevels.indexOf(12) !== -1 ? true : false; + let stationList = this.$store.getters['map/stationList']; + if (stationList && stationList.length > 0) { + stationList.forEach(elem => { + //公里标 + elem.kmPostShow = show; + deviceList.push(elem); + }) + } - // this.$store.dispatch('map/updateMapDevices', deviceList); + this.$store.dispatch('map/updateMapDevices', deviceList); } } } diff --git a/src/jmap/theme/batong_01/menus/menuDialog/viewTrainId.vue b/src/jmap/theme/batong_01/menus/menuDialog/viewTrainId.vue index 3f82afaf6..40d56e47b 100644 --- a/src/jmap/theme/batong_01/menus/menuDialog/viewTrainId.vue +++ b/src/jmap/theme/batong_01/menus/menuDialog/viewTrainId.vue @@ -155,17 +155,17 @@ }) }, setTrainDispaly() { - // let trainList = this.$store.getters['training/viewTrainList']; - // if (trainList && trainList.length > 0) { - // let planFormat = this.trainNameFormatBy(this.planMode); - // let nameFontSize = this.fontSize; - // trainList.forEach(elem => { - // elem.nameFormat = planFormat; - // elem.nameFontSize = nameFontSize; - // }); + let trainList = this.$store.getters['training/viewTrainList']; + if (trainList && trainList.length > 0) { + let planFormat = this.trainNameFormatBy(this.planMode); + let nameFontSize = this.fontSize; + trainList.forEach(elem => { + elem.nameFormat = planFormat; + elem.nameFontSize = nameFontSize; + }); - // this.$store.dispatch('map/updateMapDevices', trainList); - // } + this.$store.dispatch('map/updateMapDevices', trainList); + } }, trainNameFormatBy(mode) { switch (mode.toString()) { diff --git a/src/jmap/theme/batong_01/model.js b/src/jmap/theme/batong_01/model.js index 61732df51..cf408a81f 100644 --- a/src/jmap/theme/batong_01/model.js +++ b/src/jmap/theme/batong_01/model.js @@ -1,71 +1,63 @@ -/** - * 公共字段部分默认初始值 - */ -const modelPublicInitialValue = { - Signal: { - lampPositionType: '02', - lampPostType: '02' - } -}; +import deviceType from '../../constant/deviceType'; -/** - * 在绘图创建Model数据时,根据皮肤类型修改公共属性默认值 - * @param {Object} model - */ -export function InitPublicProperties(model) { - if (model) { - var modelInitial = modelPublicInitialValue[model._type]; - if (modelInitial) { - for (var prop in modelInitial) { - model[prop] = modelInitial[prop]; +class Model { + constructor() { + // 公共字段部分默认初始值 + this['public'] = {}; + this['public'][deviceType.Signal] = { + lampPositionType: '02', + lampPostType: '02' + }; + + // 私有字段部分默认初始值 + this['private'] = {}; + this['private'][deviceType.StationControl] = { + indicatorShow: true // 标识灯名称显示 + }; + this['private'][deviceType.Section] = { + borderBorderShow: true, // 区段边界显示 + standTrackNameShow: true, // 站台轨名称显示 + reentryTrackNameShow: true, // 折返轨名称显示 + transferTrackNameShow: true // 转换轨名称显示 + }; + this['private'][deviceType.Signal] = { + linkageAutoRouteShow: true, // 联锁自动进路表示灯显示 + atsAutoTriggerShow: true // ATS自动触发表示灯显示 + }; + this['private'][deviceType.Train] = { + nameFormat: 'targetCode:serviceNumber:tripNumber', // 字体格式 + nameFontSize: 10 // 字体大小 + }; + this['private'][deviceType.TrainWindow] = { + trainWindowShow: true + }; + } + + initPublicProps(model) { + if (model) { + var modelInitial = this.public[model._type]; + if (modelInitial) { + for (var prop in modelInitial) { + model[prop] = modelInitial[prop]; + } } } + + return model; } - return model; -} - -/** - * 私有字段部分默认初始值 - */ -const modelPrivateInitialValue = { - StationControl: { - indicatorShow: true // 标识灯名称显示 - }, - Section: { - borderBorderShow: true, // 区段边界显示 - standTrackNameShow: true, // 站台轨名称显示 - reentryTrackNameShow: true, // 折返轨名称显示 - transferTrackNameShow: true // 转换轨名称显示 - - }, - Signal: { - linkageAutoRouteShow: true, // 联锁自动进路表示灯显示 - atsAutoTriggerShow: true // ATS自动触发表示灯显示 - }, - Train: { - nameFormat: 'targetCode:serverNo:trainNo', // 字体格式 - nameFontSize: 10 // 字体大小 - }, - TrainWindow: { - // trainWindowShow: true, // 是否显示 - trainWindowShow: false - } -}; - -/** - * 加载Model数据时,根据皮肤类型修改前端私有属性默认值 - * @param {Object} model - */ -export function InitPrivateProperties(model) { - if (model) { - var modelInitial = modelPrivateInitialValue[model._type]; - if (modelInitial) { - for (var prop in modelInitial) { - model[prop] = modelInitial[prop]; + initPrivateProps(model) { + if (model) { + var modelInitial = this.private[model._type]; + if (modelInitial) { + for (var prop in modelInitial) { + model[prop] = modelInitial[prop]; + } } } - } - return model; + return model; + } } + +export default new Model(); diff --git a/src/jmap/theme/beijing_01/menus/menuDialog/viewDevice.vue b/src/jmap/theme/beijing_01/menus/menuDialog/viewDevice.vue index 0f9ee4b72..5d4364e7c 100644 --- a/src/jmap/theme/beijing_01/menus/menuDialog/viewDevice.vue +++ b/src/jmap/theme/beijing_01/menus/menuDialog/viewDevice.vue @@ -114,46 +114,46 @@ }) }, setDeviceDisplay() { - // let show = false; - // let deviceList = []; + let show = false; + let deviceList = []; - // //区段边界设置 - // let sectionList = this.$store.getters['map/sectionList']; - // if (sectionList && sectionList.length > 0) { - // sectionList.forEach(elem => { - // //区段边界 - // show = this.deviceLevels.indexOf(2) !== -1 ? true : false; - // elem.borderBorderShow = show; - // deviceList.push(elem); - // }); - // } + //区段边界设置 + let sectionList = this.$store.getters['map/sectionList']; + if (sectionList && sectionList.length > 0) { + sectionList.forEach(elem => { + //区段边界 + show = this.deviceLevels.indexOf(2) !== -1 ? true : false; + elem.borderBorderShow = show; + deviceList.push(elem); + }); + } - // //车次窗设置 - // let trainWindowList = this.$store.getters['map/trainWindowList']; - // if (trainWindowList && trainWindowList.length > 0) { - // trainWindowList.forEach(elem => { - // //车次窗 - // show = this.deviceLevels.indexOf(1) !== -1 ? true : false; - // elem.trainWindowShow = show; - // deviceList.push(elem); - // }); - // } + //车次窗设置 + let trainWindowList = this.$store.getters['map/trainWindowList']; + if (trainWindowList && trainWindowList.length > 0) { + trainWindowList.forEach(elem => { + //车次窗 + show = this.deviceLevels.indexOf(1) !== -1 ? true : false; + elem.trainWindowShow = show; + deviceList.push(elem); + }); + } - // //联锁自动进路表示灯和ATS自动触发表示灯设置 - // let signalList = this.$store.getters['map/signalList']; - // if (signalList && signalList.length > 0) { - // signalList.forEach(elem => { - // //联锁自动进路表示灯 - // show = this.deviceLevels.indexOf(3) !== -1 ? true : false; - // elem.linkageAutoRouteShow = show; - // //ATS自动触发表示灯 - // show = this.deviceLevels.indexOf(4) !== -1 ? true : false; - // elem.atsAutoTriggerShow = show; - // deviceList.push(elem); - // }) - // } + //联锁自动进路表示灯和ATS自动触发表示灯设置 + let signalList = this.$store.getters['map/signalList']; + if (signalList && signalList.length > 0) { + signalList.forEach(elem => { + //联锁自动进路表示灯 + show = this.deviceLevels.indexOf(3) !== -1 ? true : false; + elem.linkageAutoRouteShow = show; + //ATS自动触发表示灯 + show = this.deviceLevels.indexOf(4) !== -1 ? true : false; + elem.atsAutoTriggerShow = show; + deviceList.push(elem); + }) + } - // this.$store.dispatch('map/updateMapDevices', deviceList); + this.$store.dispatch('map/updateMapDevices', deviceList); } } } diff --git a/src/jmap/theme/beijing_01/menus/menuDialog/viewName.vue b/src/jmap/theme/beijing_01/menus/menuDialog/viewName.vue index 39ae6bb83..d52460b2f 100644 --- a/src/jmap/theme/beijing_01/menus/menuDialog/viewName.vue +++ b/src/jmap/theme/beijing_01/menus/menuDialog/viewName.vue @@ -147,116 +147,116 @@ }) }, setNameDisplay() { - // let show = false; - // let deviceList = []; + let show = false; + let deviceList = []; - // //信号机 - // show = this.nameLevels.indexOf(1) !== -1 ? true : false; - // let signalList = this.$store.getters['map/signalList']; - // if (signalList && signalList.length > 0) { - // signalList.forEach(elem => { - // elem.nameShow = show; - // deviceList.push(elem); - // }) - // } + //信号机 + show = this.nameLevels.indexOf(1) !== -1 ? true : false; + let signalList = this.$store.getters['map/signalList']; + if (signalList && signalList.length > 0) { + signalList.forEach(elem => { + elem.nameShow = show; + deviceList.push(elem); + }) + } - // //按钮名称 - // show = this.nameLevels.indexOf(3) !== -1 ? true : false; + //按钮名称 + show = this.nameLevels.indexOf(3) !== -1 ? true : false; - // //道岔 - // let switchList = this.$store.getters['map/switchList']; - // if (switchList && switchList.length > 0) { - // switchList.forEach(elem => { - // //道岔名称 - // show = this.nameLevels.indexOf(7) !== -1 ? true : false; - // elem.nameShow = show; - // //道岔轨名称 - // show = this.nameLevels.indexOf(9) !== -1 ? true : false; - // elem.switchSectionNameShow = show; - // deviceList.push(elem); - // }) - // } + //道岔 + let switchList = this.$store.getters['map/switchList']; + if (switchList && switchList.length > 0) { + switchList.forEach(elem => { + //道岔名称 + show = this.nameLevels.indexOf(7) !== -1 ? true : false; + elem.nameShow = show; + //道岔轨名称 + show = this.nameLevels.indexOf(9) !== -1 ? true : false; + elem.switchSectionNameShow = show; + deviceList.push(elem); + }) + } - // //控制模式 - // show = this.nameLevels.indexOf(8) !== -1 ? true : false; - // let control = this.$store.getters['map/stationControlList']; - // if (control && control.length > 0) { - // control.forEach(elem => { - // //标识灯名称 - // elem.indicatorShow = show; - // deviceList.push(elem); - // }) - // } + //控制模式 + show = this.nameLevels.indexOf(8) !== -1 ? true : false; + let control = this.$store.getters['map/stationControlList']; + if (control && control.length > 0) { + control.forEach(elem => { + //标识灯名称 + elem.indicatorShow = show; + deviceList.push(elem); + }) + } - // //区段 - // let sectionList = this.$store.getters['map/sectionList']; - // if (sectionList && sectionList.length > 0) { - // sectionList.forEach(elem => { - // if (elem.isSwitchSection && elem.parentCode) { - // //道岔轨的区段名称默认不显示 - // elem.nameShow = false; - // } else { - // if (elem.type === '01') { - // show = this.nameLevels.indexOf(11) !== -1 ? true : false; - // elem.nameShow = show; - // } else if (elem.type === '02') { - // //股道轨名称 - // show = this.nameLevels.indexOf(5) !== -1 ? true : false; - // elem.nameShow = show; - // } else if (elem.type === '03') { - // //道岔区段名称 - // show = this.nameLevels.indexOf(9) !== -1 ? true : false; - // elem.nameShow = show; - // } - // } + //区段 + let sectionList = this.$store.getters['map/sectionList']; + if (sectionList && sectionList.length > 0) { + sectionList.forEach(elem => { + if (elem.isSwitchSection && elem.parentCode) { + //道岔轨的区段名称默认不显示 + elem.nameShow = false; + } else { + if (elem.type === '01') { + show = this.nameLevels.indexOf(11) !== -1 ? true : false; + elem.nameShow = show; + } else if (elem.type === '02') { + //股道轨名称 + show = this.nameLevels.indexOf(5) !== -1 ? true : false; + elem.nameShow = show; + } else if (elem.type === '03') { + //道岔区段名称 + show = this.nameLevels.indexOf(9) !== -1 ? true : false; + elem.nameShow = show; + } + } - // //站台轨名称 - // if (elem.isStandTrack) { - // show = this.nameLevels.indexOf(2) !== -1 ? true : false; - // elem.standTrackNameShow = show; - // } + //站台轨名称 + if (elem.isStandTrack) { + show = this.nameLevels.indexOf(2) !== -1 ? true : false; + elem.standTrackNameShow = show; + } - // //折返轨名称 - // if (elem.isReentryTrack) { - // show = this.nameLevels.indexOf(4) !== -1 ? true : false; - // elem.reentryTrackNameShow = show; - // } + //折返轨名称 + if (elem.isReentryTrack) { + show = this.nameLevels.indexOf(4) !== -1 ? true : false; + elem.reentryTrackNameShow = show; + } - // //转换轨名称 - // if (elem.isTransferTrack) { - // show = this.nameLevels.indexOf(6) !== -1 ? true : false; - // elem.transferTrackNameShow = show; - // } + //转换轨名称 + if (elem.isTransferTrack) { + show = this.nameLevels.indexOf(6) !== -1 ? true : false; + elem.transferTrackNameShow = show; + } - // deviceList.push(elem); - // }) - // } + deviceList.push(elem); + }) + } - // //停车点 - // show = this.nameLevels.indexOf(10) !== -1 ? true : false; - // let stopPointList = this.$store.getters['map/stopPointList']; - // if (stopPointList && stopPointList.length > 0) { - // stopPointList.forEach(elem => { - // //目的地名称 - // elem.destCodeShow = show; - // deviceList.push(elem); - // }) - // } + //停车点 + show = this.nameLevels.indexOf(10) !== -1 ? true : false; + let stopPointList = this.$store.getters['map/stopPointList']; + if (stopPointList && stopPointList.length > 0) { + stopPointList.forEach(elem => { + //目的地名称 + elem.destCodeShow = show; + deviceList.push(elem); + }) + } - // //车站 - // show = this.nameLevels.indexOf(12) !== -1 ? true : false; - // let stationList = this.$store.getters['map/stationList']; - // if (stationList && stationList.length > 0) { - // stationList.forEach(elem => { - // //公里标 - // elem.kmPostShow = show; - // deviceList.push(elem); + //车站 + show = this.nameLevels.indexOf(12) !== -1 ? true : false; + let stationList = this.$store.getters['map/stationList']; + if (stationList && stationList.length > 0) { + stationList.forEach(elem => { + //公里标 + elem.kmPostShow = show; + deviceList.push(elem); - // }) - // } + }) + } - // this.$store.dispatch('map/updateMapDevices', deviceList); + this.$store.dispatch('map/updateMapDevices', deviceList); } } } diff --git a/src/jmap/theme/beijing_01/menus/menuDialog/viewTrainId.vue b/src/jmap/theme/beijing_01/menus/menuDialog/viewTrainId.vue index 4b4414847..935e1b017 100644 --- a/src/jmap/theme/beijing_01/menus/menuDialog/viewTrainId.vue +++ b/src/jmap/theme/beijing_01/menus/menuDialog/viewTrainId.vue @@ -155,17 +155,17 @@ }) }, setTrainDispaly() { - // let trainList = this.$store.getters['training/viewTrainList']; - // if (trainList && trainList.length > 0) { - // let planFormat = this.trainNameFormatBy(this.planMode); - // let nameFontSize = this.fontSize; - // trainList.forEach(elem => { - // elem.nameFormat = planFormat; - // elem.nameFontSize = nameFontSize; - // }); + let trainList = this.$store.getters['training/viewTrainList']; + if (trainList && trainList.length > 0) { + let planFormat = this.trainNameFormatBy(this.planMode); + let nameFontSize = this.fontSize; + trainList.forEach(elem => { + elem.nameFormat = planFormat; + elem.nameFontSize = nameFontSize; + }); - // this.$store.dispatch('map/updateMapDevices', trainList); - // } + this.$store.dispatch('map/updateMapDevices', trainList); + } }, trainNameFormatBy(mode) { switch (mode.toString()) { diff --git a/src/jmap/theme/beijing_01/menusPlan/createTodayPlan.vue b/src/jmap/theme/beijing_01/menusPlan/createTodayPlan.vue index 9db58acca..34d738a6d 100644 --- a/src/jmap/theme/beijing_01/menusPlan/createTodayPlan.vue +++ b/src/jmap/theme/beijing_01/menusPlan/createTodayPlan.vue @@ -17,7 +17,6 @@ import { getEveryDayRunPlanData } from '@/api/simulation'; import { getSkinStyleList } from '@/api/management/mapskin' import { UrlConfig } from '@/router/index'; - import ThemeFactory from '@/jmap/theme/factory'; export default { name: 'ReloadTodayPlan', @@ -129,7 +128,7 @@ if (skinStyle) { getStationListBySkinStyle(skinStyle).then(response => { let stations = response.data; - this.PlanConvert = ThemeFactory.loadPlanConvert(skinStyle); + this.PlanConvert = this.$theme.loadPlanConvert(skinStyle); this.$store.dispatch('runPlan/setStations', stations).then(() => { getEveryDayRunPlanData(this.$route.query.group).then(resp => { this.$store.dispatch('runPlan/setPlanData', resp.data); diff --git a/src/jmap/theme/beijing_01/model.js b/src/jmap/theme/beijing_01/model.js index 3068a5264..cf408a81f 100644 --- a/src/jmap/theme/beijing_01/model.js +++ b/src/jmap/theme/beijing_01/model.js @@ -1,70 +1,63 @@ -/** - * 公共字段部分默认初始值 - */ -const modelPublicInitialValue = { - Signal: { - lampPositionType: '02', - lampPostType: '02' - } -}; +import deviceType from '../../constant/deviceType'; -/** - * 在绘图创建Model数据时,根据皮肤类型修改公共属性默认值 - * @param {Object} model - */ -export function InitPublicProperties(model) { - if (model) { - var modelInitial = modelPublicInitialValue[model._type]; - if (modelInitial) { - for (var prop in modelInitial) { - model[prop] = modelInitial[prop]; +class Model { + constructor() { + // 公共字段部分默认初始值 + this['public'] = {}; + this['public'][deviceType.Signal] = { + lampPositionType: '02', + lampPostType: '02' + }; + + // 私有字段部分默认初始值 + this['private'] = {}; + this['private'][deviceType.StationControl] = { + indicatorShow: true // 标识灯名称显示 + }; + this['private'][deviceType.Section] = { + borderBorderShow: true, // 区段边界显示 + standTrackNameShow: true, // 站台轨名称显示 + reentryTrackNameShow: true, // 折返轨名称显示 + transferTrackNameShow: true // 转换轨名称显示 + }; + this['private'][deviceType.Signal] = { + linkageAutoRouteShow: true, // 联锁自动进路表示灯显示 + atsAutoTriggerShow: true // ATS自动触发表示灯显示 + }; + this['private'][deviceType.Train] = { + nameFormat: 'targetCode:serviceNumber:tripNumber', // 字体格式 + nameFontSize: 10 // 字体大小 + }; + this['private'][deviceType.TrainWindow] = { + trainWindowShow: true + }; + } + + initPublicProps(model) { + if (model) { + var modelInitial = this.public[model._type]; + if (modelInitial) { + for (var prop in modelInitial) { + model[prop] = modelInitial[prop]; + } } } + + return model; } - return model; -} - -/** - * 私有字段部分默认初始值 - */ -const modelPrivateInitialValue = { - StationControl: { - indicatorShow: true // 标识灯名称显示 - }, - Section: { - borderBorderShow: true, // 区段边界显示 - standTrackNameShow: true, // 站台轨名称显示 - reentryTrackNameShow: true, // 折返轨名称显示 - transferTrackNameShow: true // 转换轨名称显示 - - }, - Signal: { - linkageAutoRouteShow: true, // 联锁自动进路表示灯显示 - atsAutoTriggerShow: true // ATS自动触发表示灯显示 - }, - Train: { - nameFormat: 'targetCode:serviceNumber:tripNumber', // 字体格式 - nameFontSize: 10 // 字体大小 - }, - TrainWindow: { - trainWindowShow: true - } -}; - -/** - * 加载Model数据时,根据皮肤类型修改前端私有属性默认值 - * @param {Object} model - */ -export function InitPrivateProperties(model) { - if (model) { - var modelInitial = modelPrivateInitialValue[model._type]; - if (modelInitial) { - for (var prop in modelInitial) { - model[prop] = modelInitial[prop]; + initPrivateProps(model) { + if (model) { + var modelInitial = this.private[model._type]; + if (modelInitial) { + for (var prop in modelInitial) { + model[prop] = modelInitial[prop]; + } } } - } - return model; + return model; + } } + +export default new Model(); diff --git a/src/jmap/theme/beijing_01/convert.js b/src/jmap/theme/beijing_01/planConvert.js similarity index 100% rename from src/jmap/theme/beijing_01/convert.js rename to src/jmap/theme/beijing_01/planConvert.js diff --git a/src/jmap/theme/beijing_01/planSchedule/menuBar.vue b/src/jmap/theme/beijing_01/planSchedule/menuBar.vue index 5f2ed5cbe..468199d71 100644 --- a/src/jmap/theme/beijing_01/planSchedule/menuBar.vue +++ b/src/jmap/theme/beijing_01/planSchedule/menuBar.vue @@ -107,7 +107,7 @@ import XLSX from 'xlsx'; import { mapGetters } from 'vuex'; import { importRunPlan } from '@/api/runplan'; - import { importData } from '../convert'; + import { importData } from '../planConvert'; import { launchFullscreen } from '@/utils/screen'; export default { diff --git a/src/jmap/theme/beijing_01/planSchedule/schedule.vue b/src/jmap/theme/beijing_01/planSchedule/schedule.vue index ede46634e..443a57bff 100644 --- a/src/jmap/theme/beijing_01/planSchedule/schedule.vue +++ b/src/jmap/theme/beijing_01/planSchedule/schedule.vue @@ -17,7 +17,6 @@ import { timeFormat } from '@/utils/date'; import { runDiagramGetTime } from '@/api/simulation'; import { getStationListBySkinStyle } from '@/api/runplan'; - import ThemeFactory from '@/jmap/theme/factory'; import DataTable from '../menusPlan/components/dataTable'; export default { @@ -229,7 +228,7 @@ ]) }, mounted() { - this.PlanConvert = ThemeFactory.loadPlanConvert(this.skinStyle); + this.PlanConvert = this.$theme.loadPlanConvert(this.skinStyle); }, beforeDestroy() { this.destroy(); diff --git a/src/jmap/theme/chengdou_03/menus/menuDialog/viewDevice.vue b/src/jmap/theme/chengdou_03/menus/menuDialog/viewDevice.vue index f94f60716..e893b78f7 100644 --- a/src/jmap/theme/chengdou_03/menus/menuDialog/viewDevice.vue +++ b/src/jmap/theme/chengdou_03/menus/menuDialog/viewDevice.vue @@ -114,46 +114,46 @@ }) }, setDeviceDisplay() { - // let show = false; - // let deviceList = []; + let show = false; + let deviceList = []; - // //区段边界设置 - // let sectionList = this.$store.getters['map/sectionList']; - // if (sectionList && sectionList.length > 0) { - // sectionList.forEach(elem => { - // //区段边界 - // show = this.deviceLevels.indexOf(2) !== -1 ? true : false; - // elem.borderBorderShow = show; - // deviceList.push(elem); - // }); - // } + //区段边界设置 + let sectionList = this.$store.getters['map/sectionList']; + if (sectionList && sectionList.length > 0) { + sectionList.forEach(elem => { + //区段边界 + show = this.deviceLevels.indexOf(2) !== -1 ? true : false; + elem.borderBorderShow = show; + deviceList.push(elem); + }); + } - // //车次窗设置 - // let trainWindowList = this.$store.getters['map/trainWindowList']; - // if (trainWindowList && trainWindowList.length > 0) { - // trainWindowList.forEach(elem => { - // //车次窗 - // show = this.deviceLevels.indexOf(1) !== -1 ? true : false; - // elem.trainWindowShow = show; - // deviceList.push(elem); - // }); - // } + //车次窗设置 + let trainWindowList = this.$store.getters['map/trainWindowList']; + if (trainWindowList && trainWindowList.length > 0) { + trainWindowList.forEach(elem => { + //车次窗 + show = this.deviceLevels.indexOf(1) !== -1 ? true : false; + elem.trainWindowShow = show; + deviceList.push(elem); + }); + } - // //联锁自动进路表示灯和ATS自动触发表示灯设置 - // let signalList = this.$store.getters['map/signalList']; - // if (signalList && signalList.length > 0) { - // signalList.forEach(elem => { - // //联锁自动进路表示灯 - // show = this.deviceLevels.indexOf(3) !== -1 ? true : false; - // elem.linkageAutoRouteShow = show; - // //ATS自动触发表示灯 - // show = this.deviceLevels.indexOf(4) !== -1 ? true : false; - // elem.atsAutoTriggerShow = show; - // deviceList.push(elem); - // }) - // } + //联锁自动进路表示灯和ATS自动触发表示灯设置 + let signalList = this.$store.getters['map/signalList']; + if (signalList && signalList.length > 0) { + signalList.forEach(elem => { + //联锁自动进路表示灯 + show = this.deviceLevels.indexOf(3) !== -1 ? true : false; + elem.linkageAutoRouteShow = show; + //ATS自动触发表示灯 + show = this.deviceLevels.indexOf(4) !== -1 ? true : false; + elem.atsAutoTriggerShow = show; + deviceList.push(elem); + }) + } - // this.$store.dispatch('map/updateMapDevices', deviceList); + this.$store.dispatch('map/updateMapDevices', deviceList); } } } diff --git a/src/jmap/theme/chengdou_03/menus/menuDialog/viewName.vue b/src/jmap/theme/chengdou_03/menus/menuDialog/viewName.vue index ffd4a4e2d..db2b5142d 100644 --- a/src/jmap/theme/chengdou_03/menus/menuDialog/viewName.vue +++ b/src/jmap/theme/chengdou_03/menus/menuDialog/viewName.vue @@ -147,116 +147,116 @@ }) }, setNameDisplay() { - // let show = false; - // let deviceList = []; + let show = false; + let deviceList = []; - // //信号机 - // show = this.nameLevels.indexOf(1) !== -1 ? true : false; - // let signalList = this.$store.getters['map/signalList']; - // if (signalList && signalList.length > 0) { - // signalList.forEach(elem => { - // elem.nameShow = show; - // deviceList.push(elem); - // }) - // } + //信号机 + show = this.nameLevels.indexOf(1) !== -1 ? true : false; + let signalList = this.$store.getters['map/signalList']; + if (signalList && signalList.length > 0) { + signalList.forEach(elem => { + elem.nameShow = show; + deviceList.push(elem); + }) + } - // //按钮名称 - // show = this.nameLevels.indexOf(3) !== -1 ? true : false; + //按钮名称 + show = this.nameLevels.indexOf(3) !== -1 ? true : false; - // //道岔 - // let switchList = this.$store.getters['map/switchList']; - // if (switchList && switchList.length > 0) { - // switchList.forEach(elem => { - // //道岔名称 - // show = this.nameLevels.indexOf(7) !== -1 ? true : false; - // elem.nameShow = show; - // //道岔轨名称 - // show = this.nameLevels.indexOf(9) !== -1 ? true : false; - // elem.switchSectionNameShow = show; - // deviceList.push(elem); - // }) - // } + //道岔 + let switchList = this.$store.getters['map/switchList']; + if (switchList && switchList.length > 0) { + switchList.forEach(elem => { + //道岔名称 + show = this.nameLevels.indexOf(7) !== -1 ? true : false; + elem.nameShow = show; + //道岔轨名称 + show = this.nameLevels.indexOf(9) !== -1 ? true : false; + elem.switchSectionNameShow = show; + deviceList.push(elem); + }) + } - // //控制模式 - // show = this.nameLevels.indexOf(8) !== -1 ? true : false; - // let control = this.$store.getters['map/stationControlList']; - // if (control && control.length > 0) { - // control.forEach(elem => { - // //标识灯名称 - // elem.indicatorShow = show; - // deviceList.push(elem); - // }) - // } + //控制模式 + show = this.nameLevels.indexOf(8) !== -1 ? true : false; + let control = this.$store.getters['map/stationControlList']; + if (control && control.length > 0) { + control.forEach(elem => { + //标识灯名称 + elem.indicatorShow = show; + deviceList.push(elem); + }) + } - // //区段 - // let sectionList = this.$store.getters['map/sectionList']; - // if (sectionList && sectionList.length > 0) { - // sectionList.forEach(elem => { - // if (elem.isSwitchSection && elem.parentCode) { - // //道岔轨的区段名称默认不显示 - // elem.nameShow = false; - // } else { - // if (elem.type === '01') { - // show = this.nameLevels.indexOf(11) !== -1 ? true : false; - // elem.nameShow = show; - // } else if (elem.type === '02') { - // //股道轨名称 - // show = this.nameLevels.indexOf(5) !== -1 ? true : false; - // elem.nameShow = show; - // } else if (elem.type === '03') { - // //道岔区段名称 - // show = this.nameLevels.indexOf(9) !== -1 ? true : false; - // elem.nameShow = show; - // } - // } + //区段 + let sectionList = this.$store.getters['map/sectionList']; + if (sectionList && sectionList.length > 0) { + sectionList.forEach(elem => { + if (elem.isSwitchSection && elem.parentCode) { + //道岔轨的区段名称默认不显示 + elem.nameShow = false; + } else { + if (elem.type === '01') { + show = this.nameLevels.indexOf(11) !== -1 ? true : false; + elem.nameShow = show; + } else if (elem.type === '02') { + //股道轨名称 + show = this.nameLevels.indexOf(5) !== -1 ? true : false; + elem.nameShow = show; + } else if (elem.type === '03') { + //道岔区段名称 + show = this.nameLevels.indexOf(9) !== -1 ? true : false; + elem.nameShow = show; + } + } - // //站台轨名称 - // if (elem.isStandTrack) { - // show = this.nameLevels.indexOf(2) !== -1 ? true : false; - // elem.standTrackNameShow = show; - // } + //站台轨名称 + if (elem.isStandTrack) { + show = this.nameLevels.indexOf(2) !== -1 ? true : false; + elem.standTrackNameShow = show; + } - // //折返轨名称 - // if (elem.isReentryTrack) { - // show = this.nameLevels.indexOf(4) !== -1 ? true : false; - // elem.reentryTrackNameShow = show; - // } + //折返轨名称 + if (elem.isReentryTrack) { + show = this.nameLevels.indexOf(4) !== -1 ? true : false; + elem.reentryTrackNameShow = show; + } - // //转换轨名称 - // if (elem.isTransferTrack) { - // show = this.nameLevels.indexOf(6) !== -1 ? true : false; - // elem.transferTrackNameShow = show; - // } + //转换轨名称 + if (elem.isTransferTrack) { + show = this.nameLevels.indexOf(6) !== -1 ? true : false; + elem.transferTrackNameShow = show; + } - // deviceList.push(elem); - // }) - // } + deviceList.push(elem); + }) + } - // //停车点 - // show = this.nameLevels.indexOf(10) !== -1 ? true : false; - // let stopPointList = this.$store.getters['map/stopPointList']; - // if (stopPointList && stopPointList.length > 0) { - // stopPointList.forEach(elem => { - // //目的地名称 - // elem.destCodeShow = show; - // deviceList.push(elem); - // }) - // } + //停车点 + show = this.nameLevels.indexOf(10) !== -1 ? true : false; + let stopPointList = this.$store.getters['map/stopPointList']; + if (stopPointList && stopPointList.length > 0) { + stopPointList.forEach(elem => { + //目的地名称 + elem.destCodeShow = show; + deviceList.push(elem); + }) + } - // //车站 - // show = this.nameLevels.indexOf(12) !== -1 ? true : false; - // let stationList = this.$store.getters['map/stationList']; - // if (stationList && stationList.length > 0) { - // stationList.forEach(elem => { - // //公里标 - // elem.kmPostShow = show; - // deviceList.push(elem); + //车站 + show = this.nameLevels.indexOf(12) !== -1 ? true : false; + let stationList = this.$store.getters['map/stationList']; + if (stationList && stationList.length > 0) { + stationList.forEach(elem => { + //公里标 + elem.kmPostShow = show; + deviceList.push(elem); - // }) - // } + }) + } - // this.$store.dispatch('map/updateMapDevices', deviceList); + this.$store.dispatch('map/updateMapDevices', deviceList); } } } diff --git a/src/jmap/theme/chengdou_03/menus/menuDialog/viewTrainId.vue b/src/jmap/theme/chengdou_03/menus/menuDialog/viewTrainId.vue index 55280864b..d1d4353bc 100644 --- a/src/jmap/theme/chengdou_03/menus/menuDialog/viewTrainId.vue +++ b/src/jmap/theme/chengdou_03/menus/menuDialog/viewTrainId.vue @@ -155,17 +155,17 @@ }) }, setTrainDispaly() { - // let trainList = this.$store.getters['training/viewTrainList']; - // if (trainList && trainList.length > 0) { - // let planFormat = this.trainNameFormatBy(this.planMode); - // let nameFontSize = this.fontSize; - // trainList.forEach(elem => { - // elem.nameFormat = planFormat; - // elem.nameFontSize = nameFontSize; - // }); + let trainList = this.$store.getters['training/viewTrainList']; + if (trainList && trainList.length > 0) { + let planFormat = this.trainNameFormatBy(this.planMode); + let nameFontSize = this.fontSize; + trainList.forEach(elem => { + elem.nameFormat = planFormat; + elem.nameFontSize = nameFontSize; + }); - // this.$store.dispatch('map/updateMapDevices', trainList); - // } + this.$store.dispatch('map/updateMapDevices', trainList); + } }, trainNameFormatBy(mode) { switch (mode.toString()) { diff --git a/src/jmap/theme/chengdou_03/menusPlan/createTodayPlan.vue b/src/jmap/theme/chengdou_03/menusPlan/createTodayPlan.vue index 9db58acca..34d738a6d 100644 --- a/src/jmap/theme/chengdou_03/menusPlan/createTodayPlan.vue +++ b/src/jmap/theme/chengdou_03/menusPlan/createTodayPlan.vue @@ -17,7 +17,6 @@ import { getEveryDayRunPlanData } from '@/api/simulation'; import { getSkinStyleList } from '@/api/management/mapskin' import { UrlConfig } from '@/router/index'; - import ThemeFactory from '@/jmap/theme/factory'; export default { name: 'ReloadTodayPlan', @@ -129,7 +128,7 @@ if (skinStyle) { getStationListBySkinStyle(skinStyle).then(response => { let stations = response.data; - this.PlanConvert = ThemeFactory.loadPlanConvert(skinStyle); + this.PlanConvert = this.$theme.loadPlanConvert(skinStyle); this.$store.dispatch('runPlan/setStations', stations).then(() => { getEveryDayRunPlanData(this.$route.query.group).then(resp => { this.$store.dispatch('runPlan/setPlanData', resp.data); diff --git a/src/jmap/theme/chengdou_03/model.js b/src/jmap/theme/chengdou_03/model.js index 3068a5264..cf408a81f 100644 --- a/src/jmap/theme/chengdou_03/model.js +++ b/src/jmap/theme/chengdou_03/model.js @@ -1,70 +1,63 @@ -/** - * 公共字段部分默认初始值 - */ -const modelPublicInitialValue = { - Signal: { - lampPositionType: '02', - lampPostType: '02' - } -}; +import deviceType from '../../constant/deviceType'; -/** - * 在绘图创建Model数据时,根据皮肤类型修改公共属性默认值 - * @param {Object} model - */ -export function InitPublicProperties(model) { - if (model) { - var modelInitial = modelPublicInitialValue[model._type]; - if (modelInitial) { - for (var prop in modelInitial) { - model[prop] = modelInitial[prop]; +class Model { + constructor() { + // 公共字段部分默认初始值 + this['public'] = {}; + this['public'][deviceType.Signal] = { + lampPositionType: '02', + lampPostType: '02' + }; + + // 私有字段部分默认初始值 + this['private'] = {}; + this['private'][deviceType.StationControl] = { + indicatorShow: true // 标识灯名称显示 + }; + this['private'][deviceType.Section] = { + borderBorderShow: true, // 区段边界显示 + standTrackNameShow: true, // 站台轨名称显示 + reentryTrackNameShow: true, // 折返轨名称显示 + transferTrackNameShow: true // 转换轨名称显示 + }; + this['private'][deviceType.Signal] = { + linkageAutoRouteShow: true, // 联锁自动进路表示灯显示 + atsAutoTriggerShow: true // ATS自动触发表示灯显示 + }; + this['private'][deviceType.Train] = { + nameFormat: 'targetCode:serviceNumber:tripNumber', // 字体格式 + nameFontSize: 10 // 字体大小 + }; + this['private'][deviceType.TrainWindow] = { + trainWindowShow: true + }; + } + + initPublicProps(model) { + if (model) { + var modelInitial = this.public[model._type]; + if (modelInitial) { + for (var prop in modelInitial) { + model[prop] = modelInitial[prop]; + } } } + + return model; } - return model; -} - -/** - * 私有字段部分默认初始值 - */ -const modelPrivateInitialValue = { - StationControl: { - indicatorShow: true // 标识灯名称显示 - }, - Section: { - borderBorderShow: true, // 区段边界显示 - standTrackNameShow: true, // 站台轨名称显示 - reentryTrackNameShow: true, // 折返轨名称显示 - transferTrackNameShow: true // 转换轨名称显示 - - }, - Signal: { - linkageAutoRouteShow: true, // 联锁自动进路表示灯显示 - atsAutoTriggerShow: true // ATS自动触发表示灯显示 - }, - Train: { - nameFormat: 'targetCode:serviceNumber:tripNumber', // 字体格式 - nameFontSize: 10 // 字体大小 - }, - TrainWindow: { - trainWindowShow: true - } -}; - -/** - * 加载Model数据时,根据皮肤类型修改前端私有属性默认值 - * @param {Object} model - */ -export function InitPrivateProperties(model) { - if (model) { - var modelInitial = modelPrivateInitialValue[model._type]; - if (modelInitial) { - for (var prop in modelInitial) { - model[prop] = modelInitial[prop]; + initPrivateProps(model) { + if (model) { + var modelInitial = this.private[model._type]; + if (modelInitial) { + for (var prop in modelInitial) { + model[prop] = modelInitial[prop]; + } } } - } - return model; + return model; + } } + +export default new Model(); diff --git a/src/jmap/theme/chengdou_03/convert.js b/src/jmap/theme/chengdou_03/planConvert.js similarity index 100% rename from src/jmap/theme/chengdou_03/convert.js rename to src/jmap/theme/chengdou_03/planConvert.js diff --git a/src/jmap/theme/chengdou_03/planSchedule/menuBar.vue b/src/jmap/theme/chengdou_03/planSchedule/menuBar.vue index 5f2ed5cbe..468199d71 100644 --- a/src/jmap/theme/chengdou_03/planSchedule/menuBar.vue +++ b/src/jmap/theme/chengdou_03/planSchedule/menuBar.vue @@ -107,7 +107,7 @@ import XLSX from 'xlsx'; import { mapGetters } from 'vuex'; import { importRunPlan } from '@/api/runplan'; - import { importData } from '../convert'; + import { importData } from '../planConvert'; import { launchFullscreen } from '@/utils/screen'; export default { diff --git a/src/jmap/theme/chengdou_03/planSchedule/schedule.vue b/src/jmap/theme/chengdou_03/planSchedule/schedule.vue index ede46634e..e575987ac 100644 --- a/src/jmap/theme/chengdou_03/planSchedule/schedule.vue +++ b/src/jmap/theme/chengdou_03/planSchedule/schedule.vue @@ -17,7 +17,6 @@ import { timeFormat } from '@/utils/date'; import { runDiagramGetTime } from '@/api/simulation'; import { getStationListBySkinStyle } from '@/api/runplan'; - import ThemeFactory from '@/jmap/theme/factory'; import DataTable from '../menusPlan/components/dataTable'; export default { @@ -229,7 +228,7 @@ ]) }, mounted() { - this.PlanConvert = ThemeFactory.loadPlanConvert(this.skinStyle); + this.PlanConvert = this.$theme().loadPlanConvert(this.skinStyle); }, beforeDestroy() { this.destroy(); diff --git a/src/jmap/theme/default/convert.js b/src/jmap/theme/default/convert.js deleted file mode 100644 index efa368367..000000000 --- a/src/jmap/theme/default/convert.js +++ /dev/null @@ -1,308 +0,0 @@ -import { createMartPoint, createSeriesModel, createMarkLineModels, hexColor, convertSheetToList } from '@/utils/runPlan'; - -export default { - /** 边缘高度*/ - EdgeHeight: 600, - - /** 间隔高度*/ - CoordMultiple: 1, - - /** 偏移时间*/ - TranslationTime: 60 * 60 * 2, - - /** excel解析配置*/ - ExcelConfig: { - beginRow: 1, - beginCol: 0, - fieldNum: 10, - sepField: '车次', - columns: { - '车站名': { key: 'stationName', formatter: (val) => { return val; } }, - '到点': { key: 'arriveTime', formatter: (val) => { return val; } }, - '发点': { key: 'departureTime', formatter: (val) => { return val; } } - } - }, - - /** 解析exal数据转换为Json后台数据*/ - importData(Sheet, JsonData) { - var dataList = convertSheetToList(Sheet, true); - var needList = Object.keys(this.ExcelConfig.columns); - - if (dataList && dataList.length) { - for (var colIndex = this.ExcelConfig.beginCol; colIndex < dataList.length; colIndex += this.ExcelConfig.fieldNum + 1) { - var isContinue = true; - var tripObj = { code: '', arrivalList: [] }; - - for (var rowIndex = this.ExcelConfig.beginRow; isContinue; rowIndex += 1) { - isContinue = false; - - var stationObj = {}; - for (var index = 0; index < this.ExcelConfig.fieldNum; index += 1) { - if (dataList[colIndex + index]) { - var title = dataList[colIndex + index][0]; - var value = dataList[colIndex + index][rowIndex]; - - if (title && value) { - // 数据列解析 - isContinue = true; - var titleStr = `${title}`.trim(); - var valueStr = `${value}`.trim(); - - if (titleStr == this.ExcelConfig.sepField) { - if (tripObj.code) { - const length = tripObj.arrivalList.length; - if (length == 1) { - tripObj.arrivalList[0]['flag'] = true; - } - JsonData.push(tripObj); - tripObj = { code: valueStr, arrivalList: [] }; - } else { - tripObj.code = valueStr; - } - } - - // 取需要的字段 - if (needList.findIndex(elem => { return elem == titleStr; }) >= 0) { - stationObj[this.ExcelConfig.columns[titleStr].key] = this.ExcelConfig.columns[titleStr].formatter(valueStr); - } - } - } - } - - // 添加字段值 - if (Object.keys(stationObj).length) { - tripObj.arrivalList.push(stationObj); - } - } - - // 添加最后那条没有车次的记录 - if (tripObj.code) { - const length = tripObj.arrivalList.length; - if (length) { - tripObj.arrivalList[length - 1]['flag'] = true; - } - JsonData.push(tripObj); - } - } - } - - return JsonData; - }, - - /** 将后台数据解析成图表*/ - convertDataToModels(data, stations, kmRangeCoordMap, lineStyle) { - var models = []; - - if (data && data.serviceNumberDataList && data.serviceNumberDataList.length) { - /** 按服务遍历数据*/ - data.serviceNumberDataList.forEach((service) => { - /** 按车次遍历数据*/ - var opt = { name: '', markPointData: [], data: [] }; - if (service.tripNumberDataList && service.tripNumberDataList.length) { - service.tripNumberDataList.forEach((train, j) => { - var pointdata = {}; - var idx = 0; - var num = 0; - var lastPoint = null; - var nextPoint = null; - - /** 如果车次号为空,不显示名称*/ - if (train.tripNumber) { - /** 创建标记点名称和坐标*/ - pointdata.name = `${service.serviceNumber}${train.directionCode}${train.tripNumber}`; - pointdata.color = '#000' || lineStyle.color; - pointdata.directionCode = train.directionCode; - pointdata.coord = [train.stationTimeList[1].secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, train.stationTimeList[1], train.directionCode, false)]; - - /** 给服务对象添加服务名称和标记点*/ - opt.markPointData.push(createMartPoint(pointdata)); - /** 创建服务号名称*/ - opt.name = `${service.serviceNumber}`; - } - - /** 计算非折返点车次点坐标集合*/ - train.stationTimeList.forEach((elem, index) => { - idx = index; - if (index == 0 && train.stationTimeList[index].stationCode != train.stationTimeList[index + 1].stationCode || - index == train.stationTimeList.length - 2 && train.stationTimeList[index].secondTime != train.stationTimeList[index + 1].secondTime || - index > 0 && index < train.stationTimeList.length - 1) { - opt.data.push([elem.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem, elem.directionCode, false), elem.stationCode]); - } - }); - - /** 计算折返点车次坐标点集合*/ - if (!service.backup && train.reentry && service.tripNumberDataList[j + 1] && service.tripNumberDataList[j + 1].stationTimeList) { - lastPoint = train.stationTimeList[idx - 1]; - nextPoint = service.tripNumberDataList[j + 1].stationTimeList[1]; - num = this.computedReentryNumber(train.tripNumber); - opt.data.push([lastPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, lastPoint, train.directionCode, true, num), lastPoint.stationCode]); - opt.data.push([nextPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, nextPoint, train.directionCode, true, num), nextPoint.stationCode]); - } - - /** 如果是备用车,按车次添加线*/ - if (service.backup) { - /** 创建一条完成的服务数据*/ - opt.name += j; - var model = createSeriesModel(opt, Object.assign({ color: hexColor.toCreate() }, lineStyle)); - if (model) { - models.push(model); - opt = { name: '', markPointData: [], data: [] }; - } - } - }); - - // 不是备用车,按服务添加线 - if (!service.backup) { - /** 创建一条完成的服务数据*/ - var model = createSeriesModel(opt, Object.assign({ color: hexColor.toCreate() }, lineStyle)); - if (model) { - models.push(model); - } - } - } - }); - return models; - } else { - return []; - } - }, - - /** 更新数据并解析成图表*/ - updateDataToModels(data, stations, kmRangeCoordMap, runPlanData, series, lineStyle) { - if (data && data.length) { - data.forEach(elem => { - /** 判断此条记录的服务号是否存在*/ - if (!runPlanData[elem.serviceNumber]) { - /** 创建一个新服务号标记*/ - runPlanData[elem.serviceNumber] = {}; - - /** 不存在此服务号,则需要创建一条新的line*/ - series.push(createSeriesModel({ - zlevel: 1, - name: `run${elem.serviceNumber}`, - data: [], - markPointData: [] - }, Object.assign({ color: hexColor.toCreate() }, lineStyle))); - } - - /** 添加数据*/ - series.forEach(serie => { - /** 找到服务号所在图数据的位置*/ - if (serie.name == `run${elem.serviceNumber}`) { - /** 添加车组号记录标记*/ - if (!runPlanData[elem.serviceNumber][elem.tripNumber]) { - runPlanData[elem.serviceNumber][elem.tripNumber] = []; - } - - runPlanData[elem.serviceNumber][elem.tripNumber].push(elem); - runPlanData[elem.serviceNumber][elem.tripNumber].sort((a, b) => { - return parseInt(a.secondTime) - parseInt(b.secondTime); - }); - - /** 如果此记录车组号的数据为第一条时,则打上标签*/ - if (runPlanData[elem.serviceNumber][elem.tripNumber].length <= 1) { - serie.markPoint.data.push(createMartPoint({ - directionCode: elem.directionCode, - coord: [parseInt(elem.secondTime), this.getCoordYByElem(stations, kmRangeCoordMap, elem, false)], - name: `(${elem.groupNumber})${elem.serviceNumber}${elem.directionCode}${elem.tripNumber}` - })); - } - - /** 计算折返点*/ - var nextPoint = [parseInt(elem.secondTime), this.getCoordYByElem(stations, kmRangeCoordMap, elem, false), elem.directionCode]; - if (serie.data.length > 0) { - var lastPoint = serie.data[serie.data.length - 1]; - if (lastPoint[2] !== nextPoint[2]) { - var num = this.computedReentryNumber(elem.tripNumber); - serie.data.push([lastPoint[0], this.getYvalueByDirectionCode(lastPoint[1], lastPoint[2], num), lastPoint[2]]); - serie.data.push([nextPoint[0], this.getYvalueByDirectionCode(nextPoint[1], lastPoint[2], num), lastPoint[2]]); - } - } - - /** 添加车组号数据到对应的服务图数据中*/ - serie.data.push(nextPoint); - - /** 保证原始数据排序*/ - serie.data.sort((a, b) => { - return parseInt(a[0]) - parseInt(b[0]); - }); - } - }); - }); - } - - return series; - }, - - /** 初始化Y轴*/ - initializeYaxis(stations) { - return createMarkLineModels(stations, (elem) => { - return this.EdgeHeight + elem.kmRange * this.CoordMultiple; - }); - }, - - /** 将后台数据转换为试图序列模型*/ - convertStationsToMap(stations) { - var map = {}; - if (stations && stations.length) { - stations.forEach((elem) => { - map[`${elem.kmRange}`] = this.EdgeHeight + elem.kmRange * this.CoordMultiple; - }); - } - - return map; - }, - - /** 计算y轴最小值*/ - computedYaxisMinValue(stations) { - return stations[0].kmRange * this.CoordMultiple; - }, - - /** 计算y轴最大值*/ - computedYaxisMaxValue(stations) { - return stations[stations.length - 1].kmRange * this.CoordMultiple + this.EdgeHeight * 2; - }, - - /** 格式化y轴数据*/ - computedFormatYAxis(stations, params) { - var yText = ''; - - stations.forEach(elem => { - if (elem.kmRange < parseInt(params.value) / this.CoordMultiple - this.EdgeHeight) { - yText = elem.kmRange + 'm'; - } - }); - - return yText; - }, - - /** 根据是否和上一个车次是否相交,计算下一个车次的折返的高度*/ - computedReentryNumber(code) { - return parseInt(code || 1) % 2 ? 1 : 2; - }, - - /** 根据方向计算y折返偏移量*/ - getYvalueByDirectionCode(defaultVlue, directionCode, num) { - if (directionCode === '1') { - defaultVlue -= this.EdgeHeight / 2 * num; - } else if (directionCode === '2') { - defaultVlue += this.EdgeHeight / 2 * num; - } - - return defaultVlue; - }, - - /** 根据elem计算y值*/ - getCoordYByElem(stations, kmRangeCoordMap, elem, directionCode, isSpecial, num) { - var defaultVlue = 0; - var station = stations.find(it => { return it.code == elem.stationCode; }); - if (station) { - defaultVlue = kmRangeCoordMap[`${station.kmRange}`]; - if (isSpecial) { - defaultVlue = this.getYvalueByDirectionCode(defaultVlue, directionCode, num); - } - } - - return defaultVlue; - } -}; diff --git a/src/jmap/theme/default/menus/dialog/routecancel.vue b/src/jmap/theme/default/menus/dialog/routecancel.vue deleted file mode 100644 index 2f1245b34..000000000 --- a/src/jmap/theme/default/menus/dialog/routecancel.vue +++ /dev/null @@ -1,114 +0,0 @@ - - - \ No newline at end of file diff --git a/src/jmap/theme/default/menus/dialog/routerelieve.vue b/src/jmap/theme/default/menus/dialog/routerelieve.vue deleted file mode 100644 index 59767ec8b..000000000 --- a/src/jmap/theme/default/menus/dialog/routerelieve.vue +++ /dev/null @@ -1,91 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/jmap/theme/default/menus/dialog/routesetting.vue b/src/jmap/theme/default/menus/dialog/routesetting.vue deleted file mode 100644 index ed2b35a74..000000000 --- a/src/jmap/theme/default/menus/dialog/routesetting.vue +++ /dev/null @@ -1,171 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/jmap/theme/default/menus/dialog/sectioncontrol.vue b/src/jmap/theme/default/menus/dialog/sectioncontrol.vue deleted file mode 100644 index e6a9de274..000000000 --- a/src/jmap/theme/default/menus/dialog/sectioncontrol.vue +++ /dev/null @@ -1,145 +0,0 @@ - - - \ No newline at end of file diff --git a/src/jmap/theme/default/menus/dialog/sectionfault.vue b/src/jmap/theme/default/menus/dialog/sectionfault.vue deleted file mode 100644 index ea05a0fb7..000000000 --- a/src/jmap/theme/default/menus/dialog/sectionfault.vue +++ /dev/null @@ -1,237 +0,0 @@ - - - \ No newline at end of file diff --git a/src/jmap/theme/default/menus/dialog/signalreopen.vue b/src/jmap/theme/default/menus/dialog/signalreopen.vue deleted file mode 100644 index 8892e3f8a..000000000 --- a/src/jmap/theme/default/menus/dialog/signalreopen.vue +++ /dev/null @@ -1,119 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/jmap/theme/default/menus/dialog/standearlydeparture.vue b/src/jmap/theme/default/menus/dialog/standearlydeparture.vue deleted file mode 100644 index 19f488a54..000000000 --- a/src/jmap/theme/default/menus/dialog/standearlydeparture.vue +++ /dev/null @@ -1,137 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/jmap/theme/default/menus/dialog/standjumpstop.vue b/src/jmap/theme/default/menus/dialog/standjumpstop.vue deleted file mode 100644 index a0a5f2e33..000000000 --- a/src/jmap/theme/default/menus/dialog/standjumpstop.vue +++ /dev/null @@ -1,242 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/jmap/theme/default/menus/dialog/switchcontrol.vue b/src/jmap/theme/default/menus/dialog/switchcontrol.vue deleted file mode 100644 index c1ccee409..000000000 --- a/src/jmap/theme/default/menus/dialog/switchcontrol.vue +++ /dev/null @@ -1,151 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/jmap/theme/default/menus/dialog/traincreate.vue b/src/jmap/theme/default/menus/dialog/traincreate.vue deleted file mode 100644 index d68876cf2..000000000 --- a/src/jmap/theme/default/menus/dialog/traincreate.vue +++ /dev/null @@ -1,135 +0,0 @@ - - - \ No newline at end of file diff --git a/src/jmap/theme/default/menus/index.vue b/src/jmap/theme/default/menus/index.vue deleted file mode 100644 index 69112ae99..000000000 --- a/src/jmap/theme/default/menus/index.vue +++ /dev/null @@ -1,251 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/jmap/theme/default/menus/menuButton.vue b/src/jmap/theme/default/menus/menuButton.vue deleted file mode 100644 index 8cb2a393e..000000000 --- a/src/jmap/theme/default/menus/menuButton.vue +++ /dev/null @@ -1,305 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/jmap/theme/default/menus/menuCancel.vue b/src/jmap/theme/default/menus/menuCancel.vue deleted file mode 100644 index f0e06159f..000000000 --- a/src/jmap/theme/default/menus/menuCancel.vue +++ /dev/null @@ -1,119 +0,0 @@ - - - \ No newline at end of file diff --git a/src/jmap/theme/default/menus/menuSection.vue b/src/jmap/theme/default/menus/menuSection.vue deleted file mode 100644 index 76acd6ebe..000000000 --- a/src/jmap/theme/default/menus/menuSection.vue +++ /dev/null @@ -1,357 +0,0 @@ - - - \ No newline at end of file diff --git a/src/jmap/theme/default/menus/menuSignal.vue b/src/jmap/theme/default/menus/menuSignal.vue deleted file mode 100644 index f61fc7803..000000000 --- a/src/jmap/theme/default/menus/menuSignal.vue +++ /dev/null @@ -1,351 +0,0 @@ - - - \ No newline at end of file diff --git a/src/jmap/theme/default/menus/menuStation.vue b/src/jmap/theme/default/menus/menuStation.vue deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/jmap/theme/default/menus/menuStationControl.vue b/src/jmap/theme/default/menus/menuStationControl.vue deleted file mode 100644 index c703cf45c..000000000 --- a/src/jmap/theme/default/menus/menuStationControl.vue +++ /dev/null @@ -1,206 +0,0 @@ - - - \ No newline at end of file diff --git a/src/jmap/theme/default/menus/menuStationStand.vue b/src/jmap/theme/default/menus/menuStationStand.vue deleted file mode 100644 index 9449427d4..000000000 --- a/src/jmap/theme/default/menus/menuStationStand.vue +++ /dev/null @@ -1,277 +0,0 @@ - - - \ No newline at end of file diff --git a/src/jmap/theme/default/menus/menuSwitch.vue b/src/jmap/theme/default/menus/menuSwitch.vue deleted file mode 100644 index 0b873eec6..000000000 --- a/src/jmap/theme/default/menus/menuSwitch.vue +++ /dev/null @@ -1,277 +0,0 @@ - - - \ No newline at end of file diff --git a/src/jmap/theme/default/menus/menuTrain.vue b/src/jmap/theme/default/menus/menuTrain.vue deleted file mode 100644 index 873a8073d..000000000 --- a/src/jmap/theme/default/menus/menuTrain.vue +++ /dev/null @@ -1,201 +0,0 @@ - - - \ No newline at end of file diff --git a/src/jmap/theme/default/menus/utils/menuItemStatus.js b/src/jmap/theme/default/menus/utils/menuItemStatus.js deleted file mode 100644 index a90a18dc0..000000000 --- a/src/jmap/theme/default/menus/utils/menuItemStatus.js +++ /dev/null @@ -1,302 +0,0 @@ -import store from '@/store'; -import deviceState from '@/jmap/constant/deviceState'; - -export function getCurrentStateObject() { - return store.getters['menuOperation/selected']; -} - -export const MenuDisabledState = { - Section: { - // 封锁 - lock() { - const device = getCurrentStateObject(); - if (device && device.status == deviceState.Section.status.State06) { - return true; - } - }, - // 解禁 - unlock() { - const device = getCurrentStateObject(); - if (device && device.status != deviceState.Section.status.State06) { - return true; - } - }, - // 区故解 - fault() { - const device = getCurrentStateObject(); - if (device && device.status != deviceState.Section.status.State05) { - return true; - } - }, - // 区段跟踪激活 - active() { - - }, - // 区段跟踪切除 - splite() { - - }, - // 确认计轴有效 - sureAxleEffective() { - // 未开发 - }, - // 设置临时限速 - setTemporarySpeedLimit() { - // 未开发 - }, - // 查看设备状态 - viewDeviceState() { - // 未开发 - }, - // 新建列车 - newTrain() { - - }, - // 空闲 - spare() { - // 未开发 - }, - // 故障锁闭 - faultLock() { - // 未开发 - }, - // 设置故障 - setStoppage() { - }, - // 取消故障 - cancelStoppage() { - }, - // 强制开门 - forceOpenDoor() { - }, - // 强制关门 - forceCloseDoor() { - } - }, - Signal: { - // 排列进路 - arrangementRoute() { - - }, - // 取消列车进路 - cancelTrainRoute() { - const device = getCurrentStateObject(); - if (device && device.status == deviceState.Signal.status.State01) { - return true; - } - }, - // 人解列车进路 - humanTrainRoute() { - const device = getCurrentStateObject(); - if (device && device.status == deviceState.Signal.status.State01) { - return true; - } - }, - // 封锁 - lock() { - // 未开发 - }, - // 解锁 - unlock() { - // 未开发 - }, - // 设置自动通过进路 - setUpAutomaticRoute() { - // 未开发 - }, - // 信号重开 - reopenSignal() { - - }, - // 引导 - guide() { - // 未开发 - }, - // 进路交人工控 - routeToIndustrialControl() { - // 未开发 - }, - // 进路交自动控 - routeToAutomaticControl() { - // 未开发 - }, - // 查询进路控制状态 - queryRouteAutomaticState() { - // 未开发 - }, - // 设置故障 - setStoppage() { - }, - // 取消故障 - cancelStoppage() { - } - }, - Station: { - }, - StationControl: { - // 紧急站控 - emergencyStationControl() { - const device = getCurrentStateObject(); - if (device && device.status == deviceState.StationControl.status.State03) { - return true; - } - }, - // 请求站控 - requestStationControl() { - const device = getCurrentStateObject(); - if (device && device.status == deviceState.StationControl.status.State02) { - return true; - } - }, - // 强行站控 - forcedStationControl() { - const device = getCurrentStateObject(); - if (device && device.status == deviceState.StationControl.status.State02) { - return true; - } - }, - // 请求中控 - requestCentralControl() { - const device = getCurrentStateObject(); - if (device && device.status == deviceState.StationControl.status.State01) { - return true; - } - }, - // 设置故障 - setStoppage() { - }, - // 取消故障 - cancelStoppage() { - } - }, - StationStand: { - // 设置扣车 - setDetainTrain() { - // 未开发 - }, - // 取消扣车 - cancelDetainTrain() { - // 未开发 - }, - // 设置跳停 - setJumpStop() { - const device = getCurrentStateObject(); - if (device && device.status == deviceState.StationStand.status.State03 || device && device.status == deviceState.StationStand.status.State04) { - return true; - } - }, - // 取消跳停 - cancelJumpStop() { - }, - // 提前发车 - earlyDeparture() { - }, - // 站台详细信息 - stationStandDetail() { - // 未开发 - }, - // 设置故障 - setStoppage() { - }, - // 取消故障 - cancelStoppage() { - } - }, - Switch: { - // 定操 - normalIndication() { - const device = getCurrentStateObject(); - if (device && device.locateType == deviceState.Switch.locateType.State01) { - return true; - } - }, - // 反操 - reverseIndication() { - const device = getCurrentStateObject(); - if (device && device.locateType == deviceState.Switch.locateType.State02) { - return true; - } - }, - // 单锁 - lock() { - const device = getCurrentStateObject(); - if (device && device.status == deviceState.Switch.status.State10) { - return true; - } - }, - // 解锁 - unlock() { - const device = getCurrentStateObject(); - if (device && device.status != deviceState.Switch.status.State10) { - return true; - } - }, - // 封锁 - block() { - // 未开发 - }, - // 区故解 - fault() { - // 未开发 - }, - // 区段跟踪激活 - active() { - // 未开发 - }, - // 区段跟踪切除 - splite() { - // 未开发 - }, - // 查看设备状态 - viewDeviceState() { - // 未开发 - }, - // 设置故障 - setStoppage() { - }, - // 取消故障 - cancelStoppage() { - } - }, - Train: { - // 删除列车 - remove() { - // 未开发 - }, - // 运行 - run() { - const device = getCurrentStateObject(); - if (device && device.runState == deviceState.Train.runState.State02) { - return true; - } - }, - // 停止 - stop() { - const device = getCurrentStateObject(); - if (device && device.runState == deviceState.Train.runState.State01) { - return true; - } - }, - // 设置故障 - setStoppage() { - }, - // 取消故障 - cancelStoppage() { - } - } -}; - -/** - * 将menu的disabled属性使用disabledCallback计算并返回 - * @param {Array} menu - */ -export function menuConvert(menu) { - if (menu.constructor === Array) { - menu.forEach(elem => { - if (elem.disabledCallback.constructor === Function) { - elem.disabled = elem.disabledCallback(); - } - }); - } - return menu; -} diff --git a/src/jmap/theme/default/menusPlan/components/dataTable.vue b/src/jmap/theme/default/menusPlan/components/dataTable.vue deleted file mode 100644 index 6d0ad3146..000000000 --- a/src/jmap/theme/default/menusPlan/components/dataTable.vue +++ /dev/null @@ -1,203 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/jmap/theme/default/model.js b/src/jmap/theme/default/model.js deleted file mode 100644 index 2c74b67fc..000000000 --- a/src/jmap/theme/default/model.js +++ /dev/null @@ -1,22 +0,0 @@ -export const modelPublicInitialValue = { - -}; - -/** - * 在创建Model数据时,根据皮肤类型修改默认值 - * @param {Object} model - */ -export function InitPublicProperties(model) { - if (model) { - let modelInitial = modelPublicInitialValue[model._type]; - if (modelInitial) { - for (let prop in modelInitial) { - if (prop && modelInitial[prop]) { - model[prop] = modelInitial[prop]; - } - } - } - } - - return model; -} \ No newline at end of file diff --git a/src/jmap/theme/default/planSchedule/index.vue b/src/jmap/theme/default/planSchedule/index.vue deleted file mode 100644 index 4e2f632f8..000000000 --- a/src/jmap/theme/default/planSchedule/index.vue +++ /dev/null @@ -1,391 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/jmap/theme/default/planSchedule/menuBar.vue b/src/jmap/theme/default/planSchedule/menuBar.vue deleted file mode 100644 index 31a4084c1..000000000 --- a/src/jmap/theme/default/planSchedule/menuBar.vue +++ /dev/null @@ -1,472 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/jmap/theme/default/planSchedule/menuTool.vue b/src/jmap/theme/default/planSchedule/menuTool.vue deleted file mode 100644 index d3ecde016..000000000 --- a/src/jmap/theme/default/planSchedule/menuTool.vue +++ /dev/null @@ -1,172 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/jmap/theme/default/planSchedule/schedule.vue b/src/jmap/theme/default/planSchedule/schedule.vue deleted file mode 100644 index 7e3e5024f..000000000 --- a/src/jmap/theme/default/planSchedule/schedule.vue +++ /dev/null @@ -1,491 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/jmap/theme/default/planSchedule/statusBar.vue b/src/jmap/theme/default/planSchedule/statusBar.vue deleted file mode 100644 index f85d6c6ce..000000000 --- a/src/jmap/theme/default/planSchedule/statusBar.vue +++ /dev/null @@ -1,100 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/jmap/theme/default/planSchedule/titleBar.vue b/src/jmap/theme/default/planSchedule/titleBar.vue deleted file mode 100644 index 689c3486a..000000000 --- a/src/jmap/theme/default/planSchedule/titleBar.vue +++ /dev/null @@ -1,75 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/jmap/theme/factory.js b/src/jmap/theme/factory.js index fd522da09..0d707f405 100644 --- a/src/jmap/theme/factory.js +++ b/src/jmap/theme/factory.js @@ -1,8 +1,6 @@ -class ThemeFactory { - constructor() { - this._default = '02'; +class Theme { + constructor(code) { this._mapMenu = { - // '01': 'default', '02': 'fuzhou_01', '03': 'beijing_01', '04': 'chengdou_03', @@ -11,32 +9,33 @@ class ThemeFactory { } // 加载菜单组件 - loadMenusComponent(code) { - return Object.assign({}, require(`./${this._mapMenu[code || this._default]}/menus/index`).default); + loadMenuComponent(code) { + return Object.assign({}, require(`./${this._mapMenu[code]}/menus/index`).default); } // 加载运行图计划表组件 - loadPlanScheduleComponent(code) { - return Object.assign({}, require(`./${this._mapMenu[code || this._default]}/planSchedule/index`).default); + loadPlanComponent(code) { + return Object.assign({}, require(`./${this._mapMenu[code]}/planSchedule/index`).default); } // 加载运行图解析和转化函数 loadPlanConvert(code) { - return require(`./${this._mapMenu[code || this._default]}/convert`).default; + return require(`./${this._mapMenu[code]}/planConvert`).default; } - // model字段转换器 - modelConvert(code) { - const convert = require(`./${this._mapMenu[code || this._default]}/model`) || {}; - if (!convert.hasOwnProperty('InitPublicProperties')) { - convert.InitPublicProperties = (model) => { return model; }; + // 共有字段转换 + loadPropConvert(code) { + var convert = require(`./${this._mapMenu[code]}/model`) || {}; + + if (!convert.hasOwnProperty('initPublicProps')) { + convert.initPublicProps = (model) => { return model; }; } - if (!convert.hasOwnProperty('InitPrivateProperties')) { - convert.InitPrivateProperties = (model) => { return model; }; + if (!convert.hasOwnProperty('initPrivateProps')) { + convert.initPrivateProps = (model) => { return model; }; } return convert; } } -export default new ThemeFactory(); +export default Theme; diff --git a/src/jmap/theme/fuzhou_01/menus/menuDialog/viewDevice.vue b/src/jmap/theme/fuzhou_01/menus/menuDialog/viewDevice.vue index 3f78d68cb..cf5cad110 100644 --- a/src/jmap/theme/fuzhou_01/menus/menuDialog/viewDevice.vue +++ b/src/jmap/theme/fuzhou_01/menus/menuDialog/viewDevice.vue @@ -29,7 +29,8 @@