From 7feea79e448ce18f5e8696b462d1857823a4db72 Mon Sep 17 00:00:00 2001 From: ival <610568032@qq.com> Date: Wed, 7 Aug 2019 15:32:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=90=E9=83=BD=E4=B8=89=E5=8F=B7=E7=BA=BF?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E5=9B=BE=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmap/config/deviceStyle.js | 4 +- src/jmap/shape/Switch/index.js | 20 +++--- src/jmap/theme/chengdou_03/planConvert.js | 72 +++++++------------ src/jmap/theme/factory.js | 4 +- .../menus/menuDialog/viewTrainId.vue | 1 + 5 files changed, 42 insertions(+), 59 deletions(-) diff --git a/src/jmap/config/deviceStyle.js b/src/jmap/config/deviceStyle.js index 93bc1b125..b5babe4f6 100644 --- a/src/jmap/config/deviceStyle.js +++ b/src/jmap/config/deviceStyle.js @@ -1,8 +1,8 @@ const mapDeviceStyle = { // '01': 'chengdu_04', '02': 'fuzhou_01', - '03': 'bejing_01', - '04': 'chengdu_03', + // '03': 'bejing_01', + '03': 'chengdu_03', '05': 'batong_01' // 暂时没有画北京八通线 }; diff --git a/src/jmap/shape/Switch/index.js b/src/jmap/shape/Switch/index.js index c54510341..64c5c5a4e 100644 --- a/src/jmap/shape/Switch/index.js +++ b/src/jmap/shape/Switch/index.js @@ -83,7 +83,7 @@ export default class Switch extends Group { const rpoint3 = [rpoint2[0], rpoint2[1] + directy * switchWidth]; const rpoint4 = [rpoint1[0] + this.triangle.getCos(slen), rpoint1[1] + this.triangle.getSin(slen)]; - const switchWidth1 = style.Section.line.width / 2; + const switchWidth1 = style.Section.line.width / 2 + 0.1; const width1 = switchWidth1 * this.triangle.getSinRate(); const height1 = switchWidth1 * this.triangle.getCosRate(); const width2 = (height1 + switchWidth1) / this.triangle.getTanRate(); @@ -213,10 +213,8 @@ export default class Switch extends Group { this.setSwitchCoreColor(this.style.backgroundColor); this.name.getNameText().stopAnimation(false); this.swCore.stopAnimation(false); - if (!this.model.cutOff) { - this.relocShelter.stopAnimation(false); - this.relocShelter.hide(); - } + this.relocShelter.stopAnimation(false); + this.relocShelter.hide(); this.releaseBackground.hide(); this.setHasTextBorder(0); } @@ -234,9 +232,9 @@ export default class Switch extends Group { setInversionAction() { this.recover(); this.setSwitchCoreInvisible(true); + this.setTextColor(this.style.Switch.text.inversionColor); this.locShelter.hide(); this.relocShelter.show(); - this.setTextColor(this.style.Switch.text.inversionColor); this.setSectionState(this.relocShelter.getSection(), 'fill', this.model); } @@ -324,7 +322,7 @@ export default class Switch extends Group { } setSectionState(section, style, state) { - if (section) { + if (section && !section.animators.length) { switch (state.sectionAstatus) { case '00': break; case '01': /** 空闲*/ @@ -359,11 +357,12 @@ export default class Switch extends Group { section.setStyle(style, this.style.Section.line.protectiveLockColor); break; } + + if (state.cutOff) { + this.sectionCutOff(section); + } } - if (state.cutOff && !section.animators.length ) { - this.sectionCutOff(section); - } } setLocateType(model) { @@ -387,6 +386,7 @@ export default class Switch extends Group { setState(model) { this.setLocateType(model); + switch (model.status) { case '01': this.spare(); /** 空闲*/ diff --git a/src/jmap/theme/chengdou_03/planConvert.js b/src/jmap/theme/chengdou_03/planConvert.js index 6e1f69e35..bd0cb85dd 100644 --- a/src/jmap/theme/chengdou_03/planConvert.js +++ b/src/jmap/theme/chengdou_03/planConvert.js @@ -14,10 +14,10 @@ export default { ExcelConfig: { beginRow: 1, beginCol: 0, - fieldNum: 10, + fieldNum: 8, sepField: '车次', columns: { - '车站名': { key: 'stationName', formatter: (val) => { return val; } }, + '车站名称': { key: 'stationName', formatter: (val) => { return val; } }, '到点': { key: 'arriveTime', formatter: (val) => { return val; } }, '发点': { key: 'departureTime', formatter: (val) => { return val; } } } @@ -25,64 +25,46 @@ export default { /** 解析exal数据转换为Json后台数据*/ importData(Sheet, JsonData) { - var dataList = convertSheetToList(Sheet, true); + var dataList = convertSheetToList(Sheet, false); 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; - + for (var rowIndex = this.ExcelConfig.beginRow; rowIndex < dataList.length; rowIndex += 1) { + for (var colIndex = this.ExcelConfig.beginCol; colIndex < dataList[this.ExcelConfig.beginCol].length; colIndex += this.ExcelConfig.fieldNum + 1) { + var tripNew, tripObj; var stationObj = {}; + + tripNew = tripObj = { code: '', arrivalList: [] }; 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]; + var title = dataList[0][colIndex + index]; + var value = dataList[rowIndex][colIndex + index]; - if (title && value) { - // 数据列解析 - isContinue = true; - var titleStr = `${title}`.trim(); - var valueStr = `${value}`.trim(); + if (title && value) { + 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 (titleStr.includes(this.ExcelConfig.sepField)) { + tripObj.code = valueStr; + JsonData.forEach(elem => { + if (elem.code == valueStr) { + tripObj = elem; + return; } - } + }); + } - // 取需要的字段 - if (needList.findIndex(elem => { return elem == titleStr; }) >= 0) { - stationObj[this.ExcelConfig.columns[titleStr].key] = this.ExcelConfig.columns[titleStr].formatter(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); + tripObj.arrivalList.push(stationObj); + if (tripObj == tripNew) { + JsonData.push(tripObj); } } - - // 添加最后那条没有车次的记录 - if (tripObj.code) { - const length = tripObj.arrivalList.length; - if (length) { - tripObj.arrivalList[length - 1]['flag'] = true; - } - JsonData.push(tripObj); - } } } diff --git a/src/jmap/theme/factory.js b/src/jmap/theme/factory.js index ba9e24a9c..a8aead864 100644 --- a/src/jmap/theme/factory.js +++ b/src/jmap/theme/factory.js @@ -3,8 +3,8 @@ class Theme { this._code = '02'; this._mapMenu = { '02': 'fuzhou_01', - '03': 'beijing_01', - '04': 'chengdou_03', + // '03': 'beijing_01', + '03': 'chengdou_03', '05': 'batong_01' }; } diff --git a/src/jmap/theme/fuzhou_01/menus/menuDialog/viewTrainId.vue b/src/jmap/theme/fuzhou_01/menus/menuDialog/viewTrainId.vue index 29a60083b..a6ca97299 100644 --- a/src/jmap/theme/fuzhou_01/menus/menuDialog/viewTrainId.vue +++ b/src/jmap/theme/fuzhou_01/menus/menuDialog/viewTrainId.vue @@ -177,6 +177,7 @@ case '5': return 'targetCode:serviceNumber:tripNumber'; //目的地号+表号+车次号 case '6': return 'targetCode:serviceNumber:groupNumber'; //目的地号+表号+车组号 } + return ''; //无格式类型 } }