Commit 1eee9ca962cca1fb13b552acaa7e25bd45d7c548
1 parent
8dcd7f64
api 接口封装 地图
Showing
4 changed files
with
96 additions
and
78 deletions
src/api/api.js
| @@ -17,3 +17,15 @@ export const deviceAddress = p => post('urban/intelligence/device/queryDeviceSta | @@ -17,3 +17,15 @@ export const deviceAddress = p => post('urban/intelligence/device/queryDeviceSta | ||
| 17 | 17 | ||
| 18 | //....消息 | 18 | //....消息 |
| 19 | export const msgAddress = p => post('urban/intelligence/orderPark/queryLastOrderPark',p) | 19 | export const msgAddress = p => post('urban/intelligence/orderPark/queryLastOrderPark',p) |
| 20 | + | ||
| 21 | +//....今日车流量 | ||
| 22 | +export const dayAddress = p => post('urban/intelligence/orderPark/queryOrderParkNumForToday',p) | ||
| 23 | + | ||
| 24 | +//....周出场 | ||
| 25 | +export const weekAddress = p => post('urban/intelligence/orderPark/queryOrderParkNumForLastWeek',p) | ||
| 26 | + | ||
| 27 | +//....停车场总数 | ||
| 28 | +export const parkAddress = p => post('urban/intelligence/park/queryParkNumStatisticByOrgIds',p) | ||
| 29 | + | ||
| 30 | +//....地图 | ||
| 31 | +export const baiduMapAddress = p => post('urban/intelligence/berth/queryBerthStatisticForOrgId',p) |
src/components/chinaMap/index.vue
| @@ -33,6 +33,8 @@ | @@ -33,6 +33,8 @@ | ||
| 33 | import echarts from 'echarts' | 33 | import echarts from 'echarts' |
| 34 | import countTo from 'vue-count-to';//通过设置:endVall 和 :startVall 会自动判断计数和倒数,:duration='3000'是指完成动画的时间。 | 34 | import countTo from 'vue-count-to';//通过设置:endVall 和 :startVall 会自动判断计数和倒数,:duration='3000'是指完成动画的时间。 |
| 35 | import {mapGetters} from 'vuex' //use commit | 35 | import {mapGetters} from 'vuex' //use commit |
| 36 | + import { parkAddress, baiduMapAddress } from '../../api/api' | ||
| 37 | + | ||
| 36 | export default { | 38 | export default { |
| 37 | name: "chinaMap", | 39 | name: "chinaMap", |
| 38 | components: { countTo }, | 40 | components: { countTo }, |
| @@ -45,11 +47,11 @@ | @@ -45,11 +47,11 @@ | ||
| 45 | }, | 47 | }, |
| 46 | memberParams:{//memberTotal:738,//会员总数 | 48 | memberParams:{//memberTotal:738,//会员总数 |
| 47 | startVal:0, | 49 | startVal:0, |
| 48 | - endVal: 7200 | 50 | + endVal: 0 |
| 49 | }, | 51 | }, |
| 50 | dayParams:{//dayTotal:10000,//今日订单数 | 52 | dayParams:{//dayTotal:10000,//今日订单数 |
| 51 | startVal:0, | 53 | startVal:0, |
| 52 | - endVal: 1000 | 54 | + endVal: 0 |
| 53 | }, | 55 | }, |
| 54 | mapChart: {}, | 56 | mapChart: {}, |
| 55 | mapData:[], | 57 | mapData:[], |
| @@ -60,44 +62,43 @@ | @@ -60,44 +62,43 @@ | ||
| 60 | ...mapGetters(['getParkingTotal','getOrderTotal']) | 62 | ...mapGetters(['getParkingTotal','getOrderTotal']) |
| 61 | }, | 63 | }, |
| 62 | mounted() { | 64 | mounted() { |
| 63 | - this.axios.post('urban/intelligence/park/queryParkNumStatisticByOrgIds',{ | ||
| 64 | - orgIds: this.GLOBAL.paramsvariables | ||
| 65 | - }).then((response)=>{ | ||
| 66 | - let data = response.data.data | ||
| 67 | - this.parkParams.endVal=data | ||
| 68 | - }).catch((response)=>{ | ||
| 69 | - console.log(response); | ||
| 70 | - }) | ||
| 71 | - this.axios.post('urban/intelligence/berth/queryBerthStatisticForOrgId',{ | ||
| 72 | - orgIds: [10003,10005] | ||
| 73 | - }).then((response)=>{ | ||
| 74 | - let data = response.data.data | ||
| 75 | - console.log(data) | ||
| 76 | - //let mapData = []; | ||
| 77 | - for (let i=0;i<data.length;i++){ | ||
| 78 | - this.mapData.push({ | ||
| 79 | - name:data[i].orgName, | ||
| 80 | - value:data[i].allBerthNum | ||
| 81 | - }) | ||
| 82 | - //this.coordinateData.data[i].orgName = [data[i].lonId,data[i].orgId] | ||
| 83 | - // this.coordinateData.push({ | ||
| 84 | - // key: data[i].orgName,value:[data[i].lonId,data[i].latId] | ||
| 85 | - // }) | ||
| 86 | - this.coordinateData[data[i].orgName] = [data[i].lonId,data[i].latId] | ||
| 87 | - } | ||
| 88 | - //'双流': [103.912493, 30.586969] | ||
| 89 | - console.log(this.coordinateData) | ||
| 90 | - this.mapChart= this.createPie(); | ||
| 91 | - window.addEventListener('resize', function() { | ||
| 92 | - this.mapChart.resize() | ||
| 93 | - }.bind(this)); | ||
| 94 | - }).catch((response)=>{ | ||
| 95 | - console.log(response); | ||
| 96 | - }) | ||
| 97 | - | ||
| 98 | - | 65 | + this.parkInit() |
| 66 | + this.baiduMapInit() | ||
| 99 | }, | 67 | }, |
| 100 | methods: { | 68 | methods: { |
| 69 | + parkInit() { | ||
| 70 | + parkAddress({ | ||
| 71 | + orgIds: this.GLOBAL.paramsvariables | ||
| 72 | + }).then((response)=>{ | ||
| 73 | + let data = response.data.data | ||
| 74 | + this.parkParams.endVal=data | ||
| 75 | + }).catch((response)=>{ | ||
| 76 | + console.log(response); | ||
| 77 | + }) | ||
| 78 | + }, | ||
| 79 | + baiduMapInit() { | ||
| 80 | + baiduMapAddress({ | ||
| 81 | + orgIds: this.GLOBAL.paramsvariables | ||
| 82 | + }).then((response)=>{ | ||
| 83 | + let data = response.data.data | ||
| 84 | + console.log(data) | ||
| 85 | + //let mapData = []; | ||
| 86 | + for (let i=0;i<data.length;i++){ | ||
| 87 | + this.mapData.push({ | ||
| 88 | + name:data[i].orgName, | ||
| 89 | + value:data[i].allBerthNum | ||
| 90 | + }) | ||
| 91 | + this.coordinateData[data[i].orgName] = [data[i].lonId,data[i].latId] | ||
| 92 | + } | ||
| 93 | + //'双流': [103.912493, 30.586969] | ||
| 94 | + this.mapChart= this.createPie(); | ||
| 95 | + window.addEventListener('resize', function() { | ||
| 96 | + this.mapChart.resize() | ||
| 97 | + }.bind(this)); | ||
| 98 | + }).catch((response)=>{ | ||
| 99 | + console.log(response); | ||
| 100 | + }) | ||
| 101 | + }, | ||
| 101 | /* | 102 | /* |
| 102 | * china地图 | 103 | * china地图 |
| 103 | * */ | 104 | * */ |
src/components/weekAndDay/uDay.vue
| @@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
| 13 | 13 | ||
| 14 | <script> | 14 | <script> |
| 15 | import echarts from 'echarts' | 15 | import echarts from 'echarts' |
| 16 | - | 16 | + import { dayAddress } from '../../api/api' |
| 17 | export default { | 17 | export default { |
| 18 | name: "uDay", | 18 | name: "uDay", |
| 19 | data() { | 19 | data() { |
| @@ -26,26 +26,29 @@ | @@ -26,26 +26,29 @@ | ||
| 26 | * 进出场折线图 | 26 | * 进出场折线图 |
| 27 | * */ | 27 | * */ |
| 28 | mounted() { | 28 | mounted() { |
| 29 | - this.axios.post('urban/intelligence/orderPark/queryOrderParkNumForToday',{ | ||
| 30 | - orgIds: this.GLOBAL.paramsvariables | ||
| 31 | - }).then((response)=>{ | ||
| 32 | - let data = response.data.data | ||
| 33 | - let xData=[],inNum=[],outNum=[] | ||
| 34 | - for(let i=0;i<data.length;i++){ | ||
| 35 | - xData.push(data[i].queryDate) | ||
| 36 | - inNum.push(data[i].inNum) | ||
| 37 | - outNum.push(data[i].outNum) | ||
| 38 | - } | ||
| 39 | - | ||
| 40 | - this.lineChart=this.createLine(xData,inNum,outNum); | ||
| 41 | - window.addEventListener('resize', function() { | ||
| 42 | - this.lineChart.resize() | ||
| 43 | - }.bind(this)); | ||
| 44 | - }).catch((response)=>{ | ||
| 45 | - console.log(response); | ||
| 46 | - }) | 29 | + this.onLoad() |
| 47 | }, | 30 | }, |
| 48 | methods: { | 31 | methods: { |
| 32 | + onLoad() { | ||
| 33 | + dayAddress({ | ||
| 34 | + orgIds: this.GLOBAL.paramsvariables | ||
| 35 | + }).then((response)=>{ | ||
| 36 | + let data = response.data.data | ||
| 37 | + let xData=[],inNum=[],outNum=[] | ||
| 38 | + for(let i=0;i<data.length;i++){ | ||
| 39 | + xData.push(data[i].queryDate) | ||
| 40 | + inNum.push(data[i].inNum) | ||
| 41 | + outNum.push(data[i].outNum) | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + this.lineChart=this.createLine(xData,inNum,outNum); | ||
| 45 | + window.addEventListener('resize', function() { | ||
| 46 | + this.lineChart.resize() | ||
| 47 | + }.bind(this)); | ||
| 48 | + }).catch((response)=>{ | ||
| 49 | + console.log(response); | ||
| 50 | + }) | ||
| 51 | + }, | ||
| 49 | createLine(xAxis_data,series_in,series_out){ | 52 | createLine(xAxis_data,series_in,series_out){ |
| 50 | // 基于准备好的dom,初始化echarts实例 | 53 | // 基于准备好的dom,初始化echarts实例 |
| 51 | let lineChart = echarts.init(document.querySelector('.lineChart')); | 54 | let lineChart = echarts.init(document.querySelector('.lineChart')); |
src/components/weekAndDay/uWeek.vue
| @@ -14,7 +14,7 @@ | @@ -14,7 +14,7 @@ | ||
| 14 | 14 | ||
| 15 | <script> | 15 | <script> |
| 16 | import echarts from 'echarts' | 16 | import echarts from 'echarts' |
| 17 | - import {mapActions} from 'vuex' | 17 | + import { weekAddress } from '../../api/api' |
| 18 | export default { | 18 | export default { |
| 19 | name: "uWeek", | 19 | name: "uWeek", |
| 20 | data() { | 20 | data() { |
| @@ -24,28 +24,30 @@ | @@ -24,28 +24,30 @@ | ||
| 24 | } | 24 | } |
| 25 | }, | 25 | }, |
| 26 | mounted() { | 26 | mounted() { |
| 27 | - this.axios.post('urban/intelligence/orderPark/queryOrderParkNumForLastWeek',{ | ||
| 28 | - orgIds: this.GLOBAL.paramsvariables | ||
| 29 | - }).then((response)=>{ | ||
| 30 | - let data = response.data.data | ||
| 31 | - let xData=[],inNum=[],outNum=[],lastInNum | ||
| 32 | - for(let i=0;i<data.length;i++){ | ||
| 33 | - xData.push(data[i].queryDate) | ||
| 34 | - inNum.push(data[i].inNum) | ||
| 35 | - outNum.push(data[i].outNum) | ||
| 36 | - lastInNum = data[data.length-1].inNum | ||
| 37 | - } | ||
| 38 | - this.$store.dispatch('transferOrderTotal',lastInNum) | ||
| 39 | - this.weekChart=this.createLine(xData,inNum,outNum); | ||
| 40 | - window.addEventListener('resize', function() { | ||
| 41 | - this.weekChart.resize() | ||
| 42 | - }.bind(this)); | ||
| 43 | - }).catch((response)=>{ | ||
| 44 | - console.log(response); | ||
| 45 | - }) | ||
| 46 | - | 27 | + this.onLoad() |
| 47 | }, | 28 | }, |
| 48 | methods: { | 29 | methods: { |
| 30 | + onLoad() { | ||
| 31 | + weekAddress({ | ||
| 32 | + orgIds: this.GLOBAL.paramsvariables | ||
| 33 | + }).then((response)=>{ | ||
| 34 | + let data = response.data.data | ||
| 35 | + let xData=[],inNum=[],outNum=[],lastInNum | ||
| 36 | + for(let i=0;i<data.length;i++){ | ||
| 37 | + xData.push(data[i].queryDate) | ||
| 38 | + inNum.push(data[i].inNum) | ||
| 39 | + outNum.push(data[i].outNum) | ||
| 40 | + lastInNum = data[data.length-1].inNum | ||
| 41 | + } | ||
| 42 | + this.$store.dispatch('transferOrderTotal',lastInNum) | ||
| 43 | + this.weekChart=this.createLine(xData,inNum,outNum); | ||
| 44 | + window.addEventListener('resize', function() { | ||
| 45 | + this.weekChart.resize() | ||
| 46 | + }.bind(this)); | ||
| 47 | + }).catch((response)=>{ | ||
| 48 | + console.log(response); | ||
| 49 | + }) | ||
| 50 | + }, | ||
| 49 | createLine(xAxis_data,series_in,series_out){ | 51 | createLine(xAxis_data,series_in,series_out){ |
| 50 | // 基于准备好的dom,初始化echarts实例 | 52 | // 基于准备好的dom,初始化echarts实例 |
| 51 | let lineChart = echarts.init(document.querySelector('.weekChart')); | 53 | let lineChart = echarts.init(document.querySelector('.weekChart')); |