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