diff --git a/src/components/VEquipment.vue b/src/components/VEquipment.vue index 92cb023..cd4a55f 100644 --- a/src/components/VEquipment.vue +++ b/src/components/VEquipment.vue @@ -66,8 +66,7 @@ export default { watch:{ equipment:{//深度监听,可监听到对象、数组的变化 handler(val){ - this.equipvalue = val - console.log(val.PDA) + }, deep:true } diff --git a/src/components/VInout.vue b/src/components/VInout.vue index c3c2332..ec2ef62 100644 --- a/src/components/VInout.vue +++ b/src/components/VInout.vue @@ -3,7 +3,7 @@ 进出场消息
-

{{inoutmsg}} 进场 {{inouttime}}

+

{{inoutmsg}} {{inouttime|formatDate}}

@@ -13,6 +13,8 @@ diff --git a/src/components/VMap.vue b/src/components/VMap.vue index 768c16e..7f217c1 100644 --- a/src/components/VMap.vue +++ b/src/components/VMap.vue @@ -17,7 +17,18 @@ export default { } }, mounted(){ - this.drawMap() + + + }, + watch:{ + // mapdata:function (newVal) { + // console.log(newVal) + // } + mapdata: function () { + this.$nextTick(()=>{ + this.drawMap() + }) + } }, methods:{ initMap(){ @@ -35,7 +46,7 @@ export default { // let data = this.data map = new BMap.Map('map', {enableMapClick: false}) var point = new BMap.Point(mapData[0].lonId, mapData[0].latId) - map.centerAndZoom(point, 15) + map.centerAndZoom(point, 22) var mapStyle={ style : "midnight" } map.enableScrollWheelZoom(false); map.setMapStyle(mapStyle); @@ -94,8 +105,8 @@ export default {
  • ${mapData[item].plBerthNum}
    总数
  • - - + + `, { offset: new BMap.Size(-225, -55), //label的偏移量,为了让label的中心显示在点上 diff --git a/src/utils/api.js b/src/utils/api.js index 1043109..86f9d12 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -15,3 +15,9 @@ export const berthAddress = p => post('urban/intelligence/berth/queryBerthStatis //....设备 export const equipmentAddress = p => post('urban/intelligence/device/queryDeviceStatistic',p) + +//....地图 +export const mapAddress = p => post('urban/intelligence/park/queryParkDetailInfoByOrgIds',p) + +//....进出场 +export const inoutAddress = p => post('urban/intelligence/orderPark/queryLastOrderPark',p) diff --git a/src/utils/date.js b/src/utils/date.js new file mode 100644 index 0000000..7f20e6c --- /dev/null +++ b/src/utils/date.js @@ -0,0 +1,22 @@ +export function formatDate (date, fmt) { + if (/(y+)/.test(fmt)) { + fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length)); + } + let o = { + 'M+': date.getMonth() + 1, + 'd+': date.getDate(), + 'h+': date.getHours(), + 'm+': date.getMinutes(), + 's+': date.getSeconds() + }; + for (let k in o) { + if (new RegExp(`(${k})`).test(fmt)) { + let str = o[k] + ''; + fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? str : padLeftZero(str)); + } + } + return fmt; +}; +function padLeftZero (str) { + return ('00' + str).substr(str.length); +}; diff --git a/src/view/VHome.vue b/src/view/VHome.vue index a6a7d10..b64dd45 100644 --- a/src/view/VHome.vue +++ b/src/view/VHome.vue @@ -41,7 +41,7 @@ import VIncome from '../components/VIncome' import VBerth from '../components/VBerth' import VEquipment from '../components/VEquipment' -import { parkAddress, tollAddress, incomeAddress, berthAddress, equipmentAddress } from '../utils/api' +import { parkAddress, tollAddress, incomeAddress, berthAddress, equipmentAddress, mapAddress, inoutAddress } from '../utils/api' export default { name: 'VHome', @@ -91,9 +91,9 @@ export default { ydpper:100 }, ditudata:[ - {Name:'万达停车场1',lonId:'111.742579',latId:'40.818675',status:0,freeBrethNum:0,plBerthNum:1000,plName:'万达广场停车场1',plAddress:'北京万达广场1'}, - {Name:'万达停车场2',lonId:'111.622579',latId:'40.878675',status:1,freeBrethNum:100,plBerthNum:800,plName:'万达广场停车场2',plAddress:'北京万达广场2'}, - {Name:'万达停车场333333',lonId:'111.782579',latId:'40.778675',status:2,freeBrethNum:300,plBerthNum:500,plName:'万达广场停车场3',plAddress:'北京万达广场3'} + {Name:'万达停车场1',lonId:'111.742579',latId:'40.818675',status:0,freeBrethNum:0,plBerthNum:1000,plName:'万达广场停车场1',plAddress:'北京万达广场1',income:123,arreageincome:100}, + {Name:'万达停车场2',lonId:'111.622579',latId:'40.878675',status:1,freeBrethNum:100,plBerthNum:800,plName:'万达广场停车场2',plAddress:'北京万达广场2',income:123,arreageincome:100}, + {Name:'万达停车场333333',lonId:'111.782579',latId:'40.778675',status:2,freeBrethNum:300,plBerthNum:500,plName:'万达广场停车场3',plAddress:'北京万达广场3',income:123,arreageincome:100} ] } @@ -101,7 +101,7 @@ export default { mounted(){ //this.setmethod() this.initView(); - //this.setmethod() + this.setmethod() }, @@ -128,6 +128,27 @@ export default { console.log(response); }) + inoutAddress({//进出场 + orgIds: ['10078','10003'] + }).then((response)=>{ + let data = response.data.data + console.log(response) + let inoutdata = data[0] + if(inoutdata.parkState == 10){ + inoutdata.parkState = "进场" + this.inouttime = inoutdata.parkInTime + this.imgUrl = inoutdata.inCarUrl + }else{ + inoutdata.parkState = "出场" + this.inouttime = inoutdata.parkOutTime + this.imgUrl = inoutdata.outCarUrl + } + this.inoutmsg = inoutdata.plName+' '+inoutdata.carNumber +' '+inoutdata.parkState + + }).catch((response)=>{ + console.log(response); + }) + incomeAddress({//收入 orgIds: this.GLOBAL.orignId }).then((response)=>{ @@ -137,7 +158,6 @@ export default { seriesData:[data.aliPay,data.wxPay,data.otherPay], total:1 } - }).catch((response)=>{ console.log(response); }) @@ -149,18 +169,52 @@ export default { this.bertotal = data.allBerthNum this.pieChartData = { yData: [data.freeBerthNum,data.isOccupyBertnNum], + } + }).catch((response)=>{ + console.log(response); + }) + + mapAddress({//地图 + orgIds: this.GLOBAL.orignId + }).then((response)=>{ + let data = response.data.data + var tempData = []; + for(var index in data){ + var item = data[index]; + var tempItem = + { + Name: item.parkInfo.plName, + lonId: item.parkInfo.lonId, + latId:item.parkInfo.latId, + status: 0, + freeBrethNum: item.realTimeInfoDTO.berthFreeNum, + plBerthNum: item.realTimeInfoDTO.berthNum, + plName: item.parkInfo.plName, + plAddress: item.parkInfo.plAddress, + income:(item.realTimeInfoDTO.allIncome/100).toFixed(2), + arreageincome:(item.realTimeInfoDTO.escapeFee).toFixed(2) + } + tempData.push(tempItem); } + this.ditudata = tempData; + console.log(this.ditudata) + // ditudata:[ + // {Name:'万达停车场1',lonId:'111.742579',latId:'40.818675',status:0,freeBrethNum:0,plBerthNum:1000,plName:'万达广场停车场1',plAddress:'北京万达广场1'}, + // {Name:'万达停车场2',lonId:'111.622579',latId:'40.878675',status:1,freeBrethNum:100,plBerthNum:800,plName:'万达广场停车场2',plAddress:'北京万达广场2'}, + // {Name:'万达停车场333333',lonId:'111.782579',latId:'40.778675',status:2,freeBrethNum:300,plBerthNum:500,plName:'万达广场停车场3',plAddress:'北京万达广场3'} + // ] }).catch((response)=>{ console.log(response); }) + + equipmentAddress({//设备 orgIds: this.GLOBAL.orignId }).then((response)=>{ let data = response.data.data - console.log(data) if(data[0].onNum == 0){ var PDAper = 0 }else{ @@ -211,7 +265,6 @@ export default { // ydp:150, // ydpTotal:300 // } - console.log(this.equipment) }).catch((response)=>{ console.log(response); @@ -224,11 +277,11 @@ export default { setmethod(){ setInterval(()=>{ - this.parkingTotal++ - this.rodeside++ - },1000) + this.initView() + },10000) } - } + }, + }