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/utils/api.js b/src/utils/api.js index 4cf0785..86f9d12 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -18,3 +18,6 @@ export const equipmentAddress = p => post('urban/intelligence/device/queryDevice //....地图 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 921c2be..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, mapAddress } from '../utils/api' +import { parkAddress, tollAddress, incomeAddress, berthAddress, equipmentAddress, mapAddress, inoutAddress } from '../utils/api' export default { name: 'VHome', @@ -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,7 +169,6 @@ export default { this.bertotal = data.allBerthNum this.pieChartData = { yData: [data.freeBerthNum,data.isOccupyBertnNum], - } }).catch((response)=>{ @@ -160,14 +179,10 @@ export default { orgIds: this.GLOBAL.orignId }).then((response)=>{ let data = response.data.data - console.log(data) var tempData = []; for(var index in data){ - var item = data[index]; var tempItem = - - { Name: item.parkInfo.plName, lonId: item.parkInfo.lonId, @@ -180,9 +195,7 @@ export default { income:(item.realTimeInfoDTO.allIncome/100).toFixed(2), arreageincome:(item.realTimeInfoDTO.escapeFee).toFixed(2) } - tempData.push(tempItem); - } this.ditudata = tempData; @@ -192,8 +205,6 @@ export default { // {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'} // ] - - //console.log(this.ditudata) }).catch((response)=>{ console.log(response); }) @@ -266,11 +277,11 @@ export default { setmethod(){ setInterval(()=>{ - this.parkingTotal++ - this.rodeside++ - },1000) + this.initView() + },10000) } - } + }, + }