|
@@ -4,16 +4,20 @@
|
|
|
</u-navbar>
|
|
|
<view class="parking-panel">
|
|
|
<view class="panel-left">
|
|
|
- <view>
|
|
|
- <text class="left-title">{{parkingSite.parking_name}}</text>
|
|
|
+ <view class="panel-row">
|
|
|
+ <text class="item-title" style="font-size: 32rpx;color:#000;">{{parkingSite.parking_name}}</text>
|
|
|
<u-icon name="edit-pen" size="32" color="#4a4a4a" style="margin-left:100rpx;padding:10rpx;" @tap="editParking"></u-icon>
|
|
|
</view>
|
|
|
|
|
|
- <view class="left-txt">
|
|
|
- <text>总车位数 </text><text class="num-txt">{{parkingSite.total_parking_number}}</text>
|
|
|
-
|
|
|
+
|
|
|
+ <view class="panel-row">
|
|
|
+ <text class="item-title">区域</text>
|
|
|
+ <text class="item-title">车位余数 / 总数</text>
|
|
|
+ </view>
|
|
|
+ <view class="panel-row" v-for="(site,index) in parkingSite.sites" :key="index">
|
|
|
+ <text class="item-title">{{site.areaName}}</text>
|
|
|
+ <text class="num-txt">{{site.surplusParkingNumber}} / {{site.totalParkingNumber}}</text>
|
|
|
</view>
|
|
|
- <view class="left-txt">剩余车位数<text class="num-txt">{{parkingSite.surplus_parking_number}}</text></view>
|
|
|
</view>
|
|
|
<image :src="parkingSite.pic_url" style="width:200rpx;height:160rpx;border-radius: 10rpx;"></image>
|
|
|
</view>
|
|
@@ -55,9 +59,18 @@
|
|
|
</u-modal>
|
|
|
|
|
|
<u-modal v-model="showEditModal" ref="editModal" title="车位数编辑" :show-cancel-button="true" :async-close="true" @confirm="submitSeat">
|
|
|
- <view class="slot-content">
|
|
|
- <u-field type="number" v-model="seatModel.total" label="总车位数" :label-width="150" :field-style="{'border-bottom':'1px solid #55aaff'}"/>
|
|
|
- <u-field type="number" v-model="seatModel.idle" label="剩余车位数" :label-width="150" :field-style="{'border-bottom':'1px solid #55aaff'}"/>
|
|
|
+ <view class="eidt-content">
|
|
|
+ <view class="edit-row" style="font-weight: bold;">
|
|
|
+ <text class="item-title">区域</text>
|
|
|
+ <text class="item-title" style="margin-right:30rpx;">车位余数 / 总数</text>
|
|
|
+ </view>
|
|
|
+ <view class="edit-row" v-for="(site,index) in editSites" :key="index">
|
|
|
+ <text class="item-title">{{site.areaName}}</text>
|
|
|
+ <view style="display: flex;justify-content: flex-end;">
|
|
|
+ <u-field type="number" v-model="site.surplusParkingNumber" label="" :label-width="0" :field-style="{'border-bottom':'1px solid #55aaff','width':'60rpx'}" :clearable="false"/>
|
|
|
+ <u-field type="number" v-model="site.totalParkingNumber" label="" :label-width="0" :field-style="{'border-bottom':'1px solid #55aaff','width':'60rpx'}" :clearable="false"/>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</u-modal>
|
|
|
</view>
|
|
@@ -77,6 +90,7 @@
|
|
|
opening:false,
|
|
|
openingChannel:'',
|
|
|
parkingSite:{},
|
|
|
+ editSites:null,
|
|
|
chargeRule:{},
|
|
|
othChargeRule:[],
|
|
|
devs:[],
|
|
@@ -94,8 +108,6 @@
|
|
|
methods: {
|
|
|
editParking(){
|
|
|
this.showEditModal=true;
|
|
|
- this.seatModel.total=this.parkingSite.total_parking_number;
|
|
|
- this.seatModel.idle=this.parkingSite.surplus_parking_number;
|
|
|
},
|
|
|
closeEditModal(isClose){
|
|
|
if(isClose){
|
|
@@ -105,35 +117,70 @@
|
|
|
this.$refs.editModal.clearLoading();
|
|
|
}
|
|
|
},
|
|
|
+ synSites(){ //编辑车位提交成功后同步模型数据
|
|
|
+ this.parkingSite['sites']=JSON.parse(JSON.stringify(this.editSites))
|
|
|
+ },
|
|
|
submitSeat(){
|
|
|
-
|
|
|
- api.updateParkingSeat(this.parkingSite.id,this.seatModel.total,this.seatModel.idle).then(resp=>{
|
|
|
- if(!resp.success){
|
|
|
+ //this.crtparkId
|
|
|
+ //let arySeat=[{parkId:'11',area:'0',totalParkingNumber:0,surplusParkingNumber:2}]
|
|
|
+ let arySeat=this.editSites.map(area=>{
|
|
|
+ area['parkId']=this.crtparkId
|
|
|
+ return area
|
|
|
+ })
|
|
|
+ if(this.crtparkId=='1'){ //荆鹏停车场
|
|
|
+ api.updateParkingAreaSeat(arySeat).then(resp=>{
|
|
|
+ if(!resp.success){
|
|
|
+ uni.showToast({
|
|
|
+ title:resp.msg||'保存数据失败',
|
|
|
+ icon:'none'
|
|
|
+ })
|
|
|
+ this.closeEditModal()
|
|
|
+ return;
|
|
|
+ }
|
|
|
uni.showToast({
|
|
|
- title:resp.msg||'保存数据失败',
|
|
|
- icon:'none'
|
|
|
+ title:'操作成功',
|
|
|
+ icon:'success'
|
|
|
})
|
|
|
+ this.synSites()
|
|
|
+ this.closeEditModal(true)
|
|
|
+
|
|
|
+ }).catch(err=>{
|
|
|
this.closeEditModal()
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- uni.showToast({
|
|
|
- title:'操作成功',
|
|
|
- icon:'success'
|
|
|
+ uni.showToast({
|
|
|
+ title:'保存数据出错',
|
|
|
+ icon:'none'
|
|
|
+ })
|
|
|
})
|
|
|
- this.closeEditModal(true)
|
|
|
-
|
|
|
- //编辑后的值设置到显示对象中,不用请求后台
|
|
|
- this.parkingSite.total_parking_number=this.seatModel.total;
|
|
|
- this.parkingSite.surplus_parking_number=this.seatModel.idle;
|
|
|
-
|
|
|
- }).catch(err=>{
|
|
|
- uni.showToast({
|
|
|
- title:'保存数据出错',
|
|
|
- icon:'none'
|
|
|
+ }
|
|
|
+
|
|
|
+ else{
|
|
|
+ api.updateParkingSeat(arySeat[0].parkId,arySeat[0].totalParkingNumber,arySeat[0].surplusParkingNumber).then(resp=>{
|
|
|
+ if(!resp.success){
|
|
|
+ uni.showToast({
|
|
|
+ title:resp.msg||'保存数据失败',
|
|
|
+ icon:'none'
|
|
|
+ })
|
|
|
+ this.closeEditModal()
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ uni.showToast({
|
|
|
+ title:'操作成功',
|
|
|
+ icon:'success'
|
|
|
+ })
|
|
|
+ this.synSites()
|
|
|
+ this.closeEditModal(true)
|
|
|
+ }).catch(err=>{
|
|
|
+ this.closeEditModal()
|
|
|
+ uni.showToast({
|
|
|
+ title:'保存数据出错',
|
|
|
+ icon:'none'
|
|
|
+ })
|
|
|
+
|
|
|
})
|
|
|
- this.closeEditModal()
|
|
|
- })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
manualPass(channelId,gateName){
|
|
|
if(this.opening){
|
|
@@ -200,34 +247,56 @@
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- this.parkingSite=resp.data.parkInfo;
|
|
|
- if(!this.parkingSite.pic_url){
|
|
|
- this.parkingSite.pic_url="../../static/img/header_bg.png";
|
|
|
- }
|
|
|
- this.chargeRule=resp.data.chargeRule;
|
|
|
- let othchargeRule=resp.data.othchargeRule||[];
|
|
|
- let othRuleTxt={ryc:[],xny:[]};
|
|
|
- othchargeRule.forEach((item) => {
|
|
|
- if(item.car_type=='1'){ //燃油车
|
|
|
- othRuleTxt.ryc.push(`${item.min_section}-${item.max_section}分钟:${item.parking_cost}元`);
|
|
|
- }
|
|
|
- else if(item.car_type=='2'){ //新能源车
|
|
|
- othRuleTxt.xny.push(`${item.min_section}-${item.max_section}分钟:${item.parking_cost}元`);
|
|
|
- }
|
|
|
- });
|
|
|
+ this.processParkInfo(resp.data.areas, resp.data.parkInfo,id)
|
|
|
|
|
|
- this.chargeRule['rule_txt']=`燃油车\n 免费时长:${this.chargeRule.free_duration}分钟,每小时费用:${this.chargeRule.hour_cost}元,${othRuleTxt.ryc.join(',')} \n新能源车\n 免费时长:${this.chargeRule.new_energy_free_duration}分钟,每小时费用:${this.chargeRule.new_energy_hour_cost}元,${othRuleTxt.xny.join(',')} \n每日封顶费用:${this.chargeRule.day_capping_cost}元`;
|
|
|
+ this.processRuleDatas(resp.data.chargeRule,resp.data.othchargeRule)
|
|
|
|
|
|
- //this.chargeRule['oth_rule_txt']=othRuleTxt.join(' ');
|
|
|
- console.log(resp.data.devs)
|
|
|
this.devs=this.processDevDatas(resp.data.devs,id); //resp.data.devs
|
|
|
- console.log(this.devs)
|
|
|
+ //console.log(this.devs)
|
|
|
|
|
|
}).catch(error => {
|
|
|
uni.hideLoading();
|
|
|
});
|
|
|
},
|
|
|
|
|
|
+ processParkInfo(areas,parkInfo,parkId){
|
|
|
+ if(!parkInfo.pic_url){
|
|
|
+ parkInfo.pic_url="../../static/img/header_bg.png"
|
|
|
+ }
|
|
|
+
|
|
|
+ let siteAry=null
|
|
|
+ if(parkId=='1'){ //荆鹏停车场
|
|
|
+ siteAry=areas.map(item=>{
|
|
|
+ let {areaName,area,totalParkingNumber,surplusParkingNumber}=item
|
|
|
+ return {areaName,area,totalParkingNumber,surplusParkingNumber}
|
|
|
+ })
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ siteAry=[{areaName:'全域停车场',totalParkingNumber:parkInfo.total_parking_number,surplusParkingNumber:parkInfo.surplus_parking_number}]
|
|
|
+ }
|
|
|
+ parkInfo['sites']=siteAry
|
|
|
+ this.parkingSite=parkInfo
|
|
|
+ this.editSites=JSON.parse(JSON.stringify(siteAry))
|
|
|
+ //console.log(this.parkingSite)
|
|
|
+ },
|
|
|
+
|
|
|
+ processRuleDatas(chargeRule,othchargeRule){
|
|
|
+ if(!othchargeRule){
|
|
|
+ othchargeRule=[]
|
|
|
+ }
|
|
|
+ let othRuleTxt={ryc:[],xny:[]};
|
|
|
+ othchargeRule.forEach((item) => {
|
|
|
+ if(item.car_type=='1'){ //燃油车
|
|
|
+ othRuleTxt.ryc.push(`${item.min_section}-${item.max_section}分钟:${item.parking_cost}元`);
|
|
|
+ }
|
|
|
+ else if(item.car_type=='2'){ //新能源车
|
|
|
+ othRuleTxt.xny.push(`${item.min_section}-${item.max_section}分钟:${item.parking_cost}元`);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.chargeRule=chargeRule||{}
|
|
|
+ this.chargeRule['rule_txt']=`燃油车\n 免费时长:${this.chargeRule.free_duration}分钟,每小时费用:${this.chargeRule.hour_cost}元,${othRuleTxt.ryc.join(',')} \n新能源车\n 免费时长:${this.chargeRule.new_energy_free_duration}分钟,每小时费用:${this.chargeRule.new_energy_hour_cost}元,${othRuleTxt.xny.join(',')} \n每日封顶费用:${this.chargeRule.day_capping_cost}元`;
|
|
|
+ },
|
|
|
+
|
|
|
//设备(通道设备-摄像头),分级显示(停车场-区域-出口、入口),根据所属道闸合并显示
|
|
|
/*
|
|
|
{
|
|
@@ -247,7 +316,7 @@
|
|
|
if(!devs){
|
|
|
return []
|
|
|
}
|
|
|
-
|
|
|
+ //console.log(devs)
|
|
|
if(parkId!='1'){ //非荆鹏停车场
|
|
|
devs.forEach(dev=>{
|
|
|
dev['gateName']=dev['channel_name']
|
|
@@ -267,11 +336,11 @@
|
|
|
}
|
|
|
areaKey=dev.area || 'all'
|
|
|
if(!glbDev[areaKey]){ //按区域分组
|
|
|
- glbDev[areaKey]={'areaName':api.getAreaName(areaKey),'gate':{}} //gate 道闸下的通道设备
|
|
|
+ glbDev[areaKey]={'areaName':dev.area_name||'','gate':{}} //gate 道闸下的通道设备
|
|
|
}
|
|
|
if(!glbDev[areaKey]['gate'][dev.channel_flag]){ //按所属道闸合并显示,道闸名=区域名+道闸序号+'入口/出口'
|
|
|
gateNameStr=`${glbDev[areaKey]['areaName']}道闸${dev.channel_flag||'1'}`
|
|
|
- gateNameStr=gateNameStr.replace('全部区域','')
|
|
|
+ //gateNameStr=gateNameStr.replace('全部区域','')
|
|
|
glbDev[areaKey]['gate'][dev.channel_flag]={'gateName':gateNameStr,'gateStatus':false,'onlineDevId':null, 'channels':[]}
|
|
|
}
|
|
|
glbDev[areaKey]['gate'][dev.channel_flag]['channels'].push(dev)
|
|
@@ -281,7 +350,7 @@
|
|
|
}
|
|
|
|
|
|
})
|
|
|
- //console.log(glbDev)
|
|
|
+ console.log(glbDev)
|
|
|
let gateAry=[]
|
|
|
for(let are in glbDev){
|
|
|
for(let gateIdx in glbDev[are]['gate']){
|
|
@@ -320,25 +389,41 @@
|
|
|
justify-content: space-between;
|
|
|
align-items: flex-start;
|
|
|
font-family: '华文行楷';
|
|
|
+ width:480rpx;
|
|
|
|
|
|
}
|
|
|
- .parking-panel .panel-left .left-txt{
|
|
|
+
|
|
|
+ .parking-panel .panel-left .panel-row,.edit-row{
|
|
|
+ display: flex;
|
|
|
+ flex-flow: row nowrap;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ width:100%;
|
|
|
+ padding:10rpx 0rpx;
|
|
|
+ box-sizing: border-box;
|
|
|
+ font-size:28rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .parking-panel .panel-left .panel-row .num-txt{
|
|
|
+ font-size: 28rpx;
|
|
|
+ font-weight: bold;
|
|
|
+ margin:0rpx 10rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .parking-panel .panel-left .panel-row .item-title{
|
|
|
font-size:24rpx;
|
|
|
- color:#695f5f;
|
|
|
- margin-top:15rpx;
|
|
|
-
|
|
|
+ font-weight: bold;
|
|
|
+ color:#5d5454;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
.parking-panel .panel-left .left-title{
|
|
|
font-weight: bold;
|
|
|
font-size:32rpx;
|
|
|
|
|
|
color:#000000;
|
|
|
}
|
|
|
- .left-txt .num-txt{
|
|
|
- font-size: 28rpx;
|
|
|
- font-weight: bold;
|
|
|
- margin:0rpx 10rpx;
|
|
|
- }
|
|
|
+
|
|
|
.newpower-txt{
|
|
|
color:#27bf3e;
|
|
|
margin:0rpx 10rpx;
|
|
@@ -392,4 +477,12 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
+ .eidt-content{
|
|
|
+ padding:10rpx 20rpx;
|
|
|
+ box-sizing: border-box;
|
|
|
+ }
|
|
|
+
|
|
|
+ .edit-row /deep/.u-field{
|
|
|
+ width:160rpx !important;
|
|
|
+ }
|
|
|
</style>
|