Browse Source

对接路段分析

空白格 3 years ago
parent
commit
b0250ae35b

+ 3 - 1
common/apiurl.js

@@ -23,6 +23,8 @@ export const apiurl = {
 		// 获取收费员业绩排行接口
 		getTollCollectorPerformanceUrl: '/admin/overview/payeetop',
 		// 获取营收趋势统计接口
-		getRevenueTrendsDataUrl: '/admin/statis/roadamt'
+		getRevenueTrendsDataUrl: '/admin/statis/roadamt',
+		// 获取路段分析车流量分析接口
+		getRoadTrafficFlowDataUrl: '/admin/statis/roadvehicle'
 	}
 }

+ 3 - 1
common/http.api.js

@@ -28,7 +28,9 @@ const install = (Vue, vm) => {
 		// 获取收费员业绩排行
 		getTollCollectorPerformanceApi: (params = {}) => vm.$u.http.get(apiurl.operationalAnalysis.getTollCollectorPerformanceUrl, { params }),
 		// 获取营收趋势统计
-		getRevenueTrendsDataApi: (params = {}) => vm.$u.http.get(apiurl.operationalAnalysis.getRevenueTrendsDataUrl, { params })
+		getRevenueTrendsDataApi: (params = {}) => vm.$u.http.get(apiurl.operationalAnalysis.getRevenueTrendsDataUrl, { params }),
+		// 获取路段分析车流量分析
+		getRoadTrafficFlowDataApi: (params = {}) => vm.$u.http.get(apiurl.operationalAnalysis.getRoadTrafficFlowDataUrl, { params })
 	}
 	
 	// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下

+ 22 - 0
pages/dataOverview/operationalAnalysis/components/sectionAnalysis.vue

@@ -99,6 +99,7 @@
 				this.reportType = reportType
 				this.queryDate = queryDate
 				this.getRevenueTrendsData()
+				this.getRoadTrafficFlowData()
 			},
 			getRevenueTrendsData() {
 				uni.$u.api.operationalAnalysisApi.getRevenueTrendsDataApi({
@@ -120,6 +121,27 @@
 						console.log(this.revenueTrendsData)
 					}
 				})
+			},
+			getRoadTrafficFlowData() {
+				uni.$u.api.operationalAnalysisApi.getRoadTrafficFlowDataApi({
+					reportType: this.reportType,
+					queryDate: this.queryDate
+				}).then(res => {
+					if (res.code === 200) {
+						if (res.data.itemList && res.data.itemList.length) {
+							this.trafficFlowData.categories = res.data.itemList.map(item => {
+								return item.roadName
+							})
+							this.trafficFlowData.series[0].data = res.data.itemList.map(item => {
+								return item.vehicleCount
+							})
+						} else {
+							this.trafficFlowData.categories = []
+							this.trafficFlowData.series[0].data = []
+						}
+						console.log(this.trafficFlowData)
+					}
+				})
 			}
 		}
 	}

+ 1 - 1
pages/dataOverview/operationalAnalysis/operationalAnalysis.vue

@@ -232,7 +232,7 @@
 			}
 		},
 		onShow() {
-			this.currentType = this.typeList[0][6]
+			this.currentType = this.typeList[0][0]
 			this.defaultSetVal();
 		},
 		methods: {

+ 21 - 7
pages/index/index.vue

@@ -4,7 +4,7 @@
 			<view class="index-header-box">
 				<view class="index-header-box-1">
 					<view class="left">
-						<text>欢迎你!{{ userInfo.nickname }}</text>
+						<text>欢迎你!{{ vuex_user.operName }}</text>
 					</view>
 					<view class="right">
 						<u-icon size="21" name="../../static/icons/logout-icon.svg" @click="logout"></u-icon>
@@ -72,9 +72,7 @@
 	export default {
 		data() {
 			return {
-				userInfo: {
-					nickname: 'XXX'
-				},
+				todayData: {},
 				analysisMenuList: [{
 						icon: require('@/static/icons/today-overview-icon.svg'),
 						name: '今日概况',
@@ -147,7 +145,8 @@
 			}
 		},
 		onLoad() {
-
+			// 为了验证token是否过期
+			this.getTodayData();
 		},
 		methods: {
 			/**
@@ -160,7 +159,6 @@
 					success: (res) => {
 						if (res.confirm) {
 							uni.$u.api.logoutApi().then(res => {
-								console.log(res)
 								if (res.code === 200) {
 									uni.$u.vuex('vuex_token', '');
 									this.$u.vuex('vuex_user', {});
@@ -176,7 +174,23 @@
 							})
 						}
 					}
-				});
+				})
+			},
+			/**
+			 * 获取今日概况
+			 */
+			getTodayData() {
+				uni.$u.api.todayOverviewApi.getTodayDataApi().then(res => {
+					if (res.code === 200) {
+						this.todayData = res.data
+					} else {
+						this.$refs.uToast.show({
+							loading: true,
+							message: res.msg || '获取今日概况失败!',
+							type: 'error'
+						})
+					}
+				})
 			},
 			/**
 			 * 跳转页面