Commit e39f46bb1e2b3638557a3d9927ffab3b20ac4ee9

Authored by 徐烜
1 parent 61207941

其他公交公司用的公交电子站牌页面组件

1、修正gps数据显示bug,添加方向数据到moodel中并添加到d3的自定义数据key中,具体查看models/下的代码
front-end/h5/src/components/core/plugins/bsth/othergj/linechart/chart/models/eBusStopGpsData.js
... ... @@ -82,17 +82,19 @@ class EBusStopGpsData {
82 82 * @param lineName 线路名称
83 83 * @param lineCode 线路编码
84 84 * @param endStopName 终点站站名
  85 + * @param direction 方向
85 86 * @param startTime 首班车时间
86 87 * @param endTime 末班车时间
87 88 * @param arrivalInfo 到站信息(如:2站,等待发车,即将进站)
88 89 * @param gpsDataList gps数据列表
89 90 */
90   - constructor (lineName, lineCode, endStopName,
  91 + constructor (lineName, lineCode, endStopName, direction = '0',
91 92 startTime = '00:00', endTime = '23:59',
92 93 arrivalInfo = '等待发车', gpsDataList = [] ) {
93 94 this._lineName = lineName
94 95 this._lineCode = lineCode
95 96 this._endStopName = endStopName
  97 + this._direction = direction
96 98 this._startTime = startTime
97 99 this._endTime = endTime
98 100 this._arrivalInfo = arrivalInfo
... ... @@ -102,6 +104,7 @@ class EBusStopGpsData {
102 104 get lineName () { return this._lineName }
103 105 get lineCode () { return this._lineCode }
104 106 get endStopName () { return this._endStopName }
  107 + get direction () {return this._direction}
105 108 get startTime () { return this._startTime }
106 109 get endTime () { return this._endTime }
107 110 get arrivalInfo () { return this._arrivalInfo }
... ... @@ -111,7 +114,7 @@ class EBusStopGpsData {
111 114 let dataList = []
112 115 if (this._lineName) {
113 116 dataList.push({
114   - d3DataKey: this._lineName + '_' + this._lineCode,
  117 + d3DataKey: this._lineName + '_' + this._lineCode + "_" + this._direction,
115 118 lineName: this._lineName,
116 119 stopName: this._endStopName,
117 120 startTime: this._startTime,
... ... @@ -197,7 +200,7 @@ class EBusStopGpsData {
197 200 let gpsDataList = [gps1, gps2, gps3, gps4, gps5, gps6, gps7]
198 201 // 2、发车信息
199 202 return new EBusStopGpsData(
200   - '线路1', '1', '站点6',
  203 + '线路1', '1', '站点6', '0',
201 204 '6:00', '23:00',
202 205 '2站', gpsDataList)
203 206  
... ...
front-end/h5/src/components/core/plugins/bsth/othergj/linechart/list/models/othergj-eBusStop-line-chart-list-scrollPage-innerData.js
... ... @@ -203,23 +203,26 @@ class ScrollPageInnerData {
203 203 */
204 204 refreshDataWithRemoteData (remoteDataList) {
205 205 // 远程数据格式参考 http://36.134.151.106:19102/General_Interface/getArriveVO?deviceId=66MH0001
  206 + // console.log(remoteDataList)
206 207 if (!remoteDataList || !remoteDataList.length) {
207 208 return
208 209 }
  210 + // console.log(this._innerDataItemList)
209 211  
210 212 // 1、按照线路名字_线路编码分组数据
211 213 let dataGroupByLineNameCode = Utils.listGroupBy(remoteDataList, function (d) {
212   - return d.lineName + '_' + d.lineCode
  214 + return d.lineName + '_' + d.lineCode + '_' + d.direction
213 215 })
214 216 // 2、处理数据,循环计算每条线路的数据 TODO:
215 217 for (let internalData of this._innerDataItemList) {
216   - let key = internalData._eBusStopData.lineName + '_' + internalData._eBusStopData.lineCode
  218 + let key = internalData._eBusStopGpsData.lineName + '_' +
  219 + internalData._eBusStopGpsData.lineCode + '_' + internalData._eBusStopGpsData.direction
217 220 if (dataGroupByLineNameCode[key]) {
218 221 let remoteInfo = dataGroupByLineNameCode[key][0]
219 222 // 刷新gps数据
220 223 internalData._eBusStopGpsData.setFromRemoteInfo(remoteInfo)
221 224  
222   - // console.log(`${key}刷新remoteGps数据`)
  225 + console.log(`${key}刷新remoteGps数据`)
223 226 }
224 227 }
225 228  
... ... @@ -302,7 +305,7 @@ class ScrollPageInnerData {
302 305 })
303 306 }
304 307 let eBusStopGpsData = new EBusStopGpsData(
305   - lineName, lineCode, routeData.lastStationName,
  308 + lineName, lineCode, routeData.lastStationName, lineDir,
306 309 startTime, endTime, '等待发车', gpsDataList)
307 310  
308 311 // 添加scroll数据
... ...
front-end/h5/src/components/core/plugins/bsth/othergj/linechart/list/othergj-eBusStop-line-chart-list-scrollPage.js
... ... @@ -115,6 +115,7 @@ export default {
115 115 }, this.scroll_seconds * 1000)
116 116 },
117 117 'remoteDataTimer.count' () {
  118 + // console.log('remoteDataTimer.count')
118 119 let timer = this.remoteDataTimer.timer
119 120 if (timer) {
120 121 try {
... ...