This commit is contained in:
liuye
2021-12-30 19:54:57 +08:00
parent 1536c29b0a
commit 0a497180b3

View File

@@ -39,7 +39,7 @@
<AiEmpty v-if="!list.length" style="padding-bottom:80px;"/>
</div>
</div>
<u-select v-model="showSelect" :list="selectList" label-name="cellName" value-name="id"
<u-select v-model="showSelect" :list="selectList" label-name="cellName" value-name="valueId"
@confirm="confirmSelect"></u-select>
<u-popup v-model="show" mode="bottom" border-radius="14" height="1000">
<div class="popup">
@@ -153,15 +153,13 @@ export default {
selectList: [],
selectCellIndex: 0,
houseId: '',
detail: {}
detail: {},
cellName: '',
eachUnitNumber: ''
}
},
computed: {
...mapState(['user']),
cellName() {
let building = this.selectList.find(e => e.id == this.detail.id)
return building?.cellName || ""
}
},
created() {
this.$dict.load('householdRelation', 'houselivingStatus', 'houseLeaseSituation', 'houseUseStatus',
@@ -178,19 +176,22 @@ export default {
methods: {
getSelectList(communityId) {
//通过小区ID获取楼栋列表,用来切换楼栋
this.$http.post(`/app/appcommunitybuildinginfo/list`, null, {
this.$http.post(`/app/appcommunitybuildinginfo/listByUnitNumber`, null, {
params: {communityId, size: 999}
}).then(res => {
if (res?.data) {
this.selectList = []
res.data.records.forEach(e => {
for (let i = 0; i < e.unitNumber; i++) {
this.selectList.push({
...e,
cellName: `${e.communityName + e.buildingNumber}${i+1}单元`
})
}
this.selectList.push({
...e,
cellName: `${e.communityName + e.buildingNumber}${e.eachUnitNumber}单元`,
valueId: `${e.id}${e.eachUnitNumber}`
})
})
this.cellName = this.selectList[0].cellName
this.eachUnitNumber = this.selectList[0].eachUnitNumber
this.getStatistics()
this.getList()
}
})
},
@@ -202,17 +203,15 @@ export default {
}).then(res => {
if (res?.data) {
this.detail = res.data
this.getStatistics()
this.getList()
this.getSelectList(res.data.communityId)
}
})
},
getStatistics() {
//获取楼栋统计信息
let {id, unitNumber: unitNum} = this.detail
let {id} = this.detail
this.$http.post(`app/appcommunitybuildinginfo/statistics`, null, {
params: {id, unitNum}
params: {id, unitNum: this.eachUnitNumber}
}).then(res => {
if (res?.data) {
this.numInfo = res.data.unit
@@ -221,9 +220,9 @@ export default {
},
getList() {
//获取房间列表
let {id: buildingId, unitNumber} = this.detail
let {id: buildingId} = this.detail
this.$http.post(`app/appcommunityhouseinfo/list`, null, {
params: {size: 10000, buildingId, unitNumber}
params: {size: 10000, buildingId, unitNumber: this.eachUnitNumber}
}).then(res => {
if (res?.data) {
this.list = res.data.records
@@ -245,10 +244,12 @@ export default {
},
confirmSelect(e) {
this.selectList.map((item, index) => {
if (item.id == e[0].value) {
if (item.valueId == e[0].value) {
this.selectCellIndex = index
}
})
this.cellName = this.selectList[this.selectCellIndex].cellName
this.eachUnitNumber = this.selectList[this.selectCellIndex].eachUnitNumber
this.getStatistics()
this.getList()
},