You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

226 lines
4.7 KiB

<template>
<navigation-general :title="title">
<template v-slot:right>
<view class="nav-right">
<view class="right-item">{{totalHouse}}</view>
<view class="right-item">未排查{{weiPaimo}}</view>
</view>
</template>
<view class="building-list">
<view class="house-c">
<view class="c-item" v-for="(item,index) in buildingInfo.floor" :key="index">
{{buildingInfo.floor - index}}层
</view>
<view class="c-item">单元</view>
</view>
<scroll-view class="house-list" scroll-x="true" scroll-left="120">
<view class="list-scroll-x" :style="handlerWidth">
<view class="color-rows" v-for="(item,index) in groupedRooms" :key="index">
<color-item :showBuildingName="true" :showColorName="false" :item="house" v-for="house in item"
:key="house.id"></color-item>
</view>
<view class="color-rows">
<view class="unitItem" v-for="unitItem in buildingInfo.unit" :key="unitItem">
{{unitItem}} 单元
</view>
</view>
</view>
</scroll-view>
</view>
<u-mask :show="show">
<view class="loading-css">
<u-loading mode="flower" size="50"></u-loading>
<view class="loading-text">加载中</view>
</view>
</u-mask>
</navigation-general>
</template>
<script>
import {
getBuilding,
} from '@/api/taicangpop/building'
import {
handleColor
} from '@/utils/handlerColor.js'
import {
getNumNew
} from '@/api/taicangpop/data'
export default {
data() {
return {
show: true,
boxTop: 0,
queryParams: {
buildingId: undefined
},
title: '',
buildingInfo: {},
newHouseList: [],
totalHouse: 0,
weiPaimo: 0
};
},
computed: {
handlerWidth() {
return {
width: (this.buildingInfo.house + 1) * 122 + 'rpx'
}
},
groupedRooms() {
if (this.newHouseList.length == 0) return
this.weiPaimo = 0
// 初始化每层楼的数组
let floors = Array.from({
length: this.buildingInfo.floor
}, () => [])
// 遍历房间数据
this.newHouseList.forEach((room) => {
if (room.daycount > 0) this.weiPaimo = this.weiPaimo + 1
// 提取房间号前几位作为楼层号
let floor = (parseInt(room.name) / 100) | 0
// 将房间加入对应楼层数组
if (floor > 0 && floor <= this.buildingInfo.floor) {
floors[floor - 1].push(handleColor(room))
}
})
// 对每层楼的房间进行排序
floors.forEach((floorRooms) => {
floorRooms.sort((a, b) => parseInt(a.name) - parseInt(b.name))
})
this.show = false
return floors.reverse()
},
},
onLoad(option) {
const systemData = this.$u.sys()
this.boxTop = (systemData.statusBarHeight + 44) * 2
this.title = option.deptname
this.queryParams.buildingId = option.buildingId
this.getBuildingInfo()
},
methods: {
//楼信息
async getBuildingInfo() {
const res = await getBuilding(this.queryParams.buildingId)
this.buildingInfo = res.data
this.getAllHouse()
},
//获取所有的户
async getAllHouse() {
this.show = true
let res = await getNumNew({
buildingId: this.queryParams.buildingId
})
this.newHouseList = res.data
this.totalHouse = this.newHouseList.length
},
}
}
</script>
<style lang="scss">
page {
background: #113666;
}
</style>
<style lang="scss" scoped>
.nav-right {
margin-right: 14rpx;
display: flex;
flex-direction: column;
align-items: center;
.right-item {
box-sizing: border-box;
padding: 0 6rpx;
font-size: 22rpx;
background: #fff;
color: red;
}
.right-item:last-child {
margin-top: 4rpx;
background-color: red;
color: #fff;
}
}
.building-list {
width: 100%;
display: flex;
align-items: center;
// 楼层数样式/
.house-c {
background: linear-gradient(to bottom,
rgba(149, 18, 58, 0.4) 10%,
#95123a 70%,
rgba(149, 18, 58, 0.4) 90%);
.c-item {
width: 120rpx;
text-align: center;
line-height: 60rpx;
height: 60rpx;
font-size: 28rpx;
color: #fff;
// background-color: rgb(64, 158, 255);
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
}
//所有户
.house-list {
background: #113666;
height: 100%;
.list-scroll-x {
height: 100%;
color: #fff;
.color-rows {
width: 100%;
display: flex;
height: 60rpx;
align-items: center;
.color-item {
width: 100rpx;
margin-left: 20rpx;
}
.unitItem {
font-size: 28rpx;
flex: 1;
height: 100%;
line-height: 60rpx;
text-align: center;
}
}
}
}
}
/deep/ .loading-css {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.loading-text {
color: #fff;
font-size: 28rpx;
margin-top: 10rpx;
}
}
</style>