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