From 154e65f83ebaa60350b0c51fca5d8621b078d5f3 Mon Sep 17 00:00:00 2001 From: jiangyy Date: Tue, 25 Oct 2022 17:07:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=BF=E5=B1=8B=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/base/community/community.vue | 178 ++++++++++-------- .../modules/base/community/roomTable.vue | 32 ++++ 2 files changed, 134 insertions(+), 76 deletions(-) diff --git a/src/views/modules/base/community/community.vue b/src/views/modules/base/community/community.vue index 3970bc7a2..074edc48e 100644 --- a/src/views/modules/base/community/community.vue +++ b/src/views/modules/base/community/community.vue @@ -220,6 +220,10 @@ :ownerPhone="ownerPhone" :rentFlag="rentFlag" :purpose="purpose" + :neighborHoodId="neighborHoodId" + :buildingId="buildingId" + :buildingUnitId="buildingUnitId" + :houseId="houseId" :remark="remark" :updateStartDate="updateStartDate" :updateEndDate="updateEndDate" @@ -252,6 +256,7 @@ import roomTable from './roomTable' import { requestPost } from "@/js/dai/request"; import { mapGetters } from 'vuex' import { Loading } from 'element-ui' // 引入Loading服务 +import nextTick from 'dai-js/tools/nextTick' let loading // 加载动画 export default { @@ -350,7 +355,7 @@ export default { await this.loadOrgData() await this.loadTree() // await this.loadOpenNode() - this.getValiheList() + this.getValiheList('', '') await this.$refs['ref_communityTable'].loadTable(true, this.selTreeObj) if (this.treeData.length > 0) { @@ -382,86 +387,90 @@ export default { this.buildingUnitId = ""; this.houseId = ""; this.getBuildList(); - this.getUniList(); - this.getHouseList(); + // this.getUniList(); + // this.getHouseList(); }, handleChangeB (val) { this.buildingUnitId = ""; this.houseId = ""; this.getUniList(); - this.getHouseList(); + // this.getHouseList(); }, handleChangeD () { this.houseId = ""; this.getHouseList(); }, - getValiheList () { + async getValiheList () { const { user } = this.$store.state; if (!this.selGridId) { this.selAgencyId = this.selAgencyId ? this.selAgencyId : user.agencyId } - this.$http - .post("/gov/org/icneighborhood/neighborhoodoption", { - gridId: this.selGridId, - agencyId: this.selAgencyId, - }) - .then(({ data: res }) => { - if (res.code !== 0) { - return this.$message.error(res.msg); - } else { - this.optionsV = res.data; - this.neighborHoodId = '' - this.buildingId = ""; - this.buildingUnitId = ""; - this.houseId = ""; - } - }) - .catch(() => { - return this.$message.error("网络错误"); - }); + const url = "/gov/org/icneighborhood/neighborhood-options"; + // const url = "http://yapi.elinkservice.cn/mock/245/epmetuser/epidemicPrevention/page" + let params = { + gridId: this.selGridId, + agencyId: this.selAgencyId, + isPage: false + }; + + const { data, code, msg } = await requestPost(url, params); + + if (code === 0) { + this.optionsV = data; + + this.neighborHoodId = "" + this.buildingId = ""; + this.buildingUnitId = ""; + this.houseId = ""; + } else { + this.$message.error(msg); + } + + }, - getBuildList () { - this.$http - .post("/gov/org/icbuilding/buildingoption", { - neighborHoodId: this.neighborHoodId, - }) - .then(({ data: res }) => { - if (res.code !== 0) { - return this.$message.error(res.msg); - } else { + async getBuildList () { + const url = "/gov/org/icbuilding/buildingoption"; + // const url = "http://yapi.elinkservice.cn/mock/245/epmetuser/epidemicPrevention/page" + let params = { + neighborHoodId: this.neighborHoodId, + }; + + const { data, code, msg } = await requestPost(url, params); + + if (code === 0) { + this.optionsB = data; + this.buildingId = ""; + this.buildingUnitId = ""; + this.houseId = ""; + } else { + this.$message.error(msg); + } + - this.optionsB = res.data; - this.buildingId = ""; - this.buildingUnitId = ""; - this.houseId = ""; - } - }) - .catch(() => { - return this.$message.error("网络错误"); - }); }, - getUniList () { - this.$http - .post("/gov/org/icbuildingunit/unitoption", { - buildingId: this.buildingId, - }) - .then(({ data: res }) => { - if (res.code !== 0) { - return this.$message.error(res.msg); - } else { + async getUniList () { + + const url = "/gov/org/icbuildingunit/unitoption"; + // const url = "http://yapi.elinkservice.cn/mock/245/epmetuser/epidemicPrevention/page" + let params = { + buildingId: this.buildingId, + }; + + const { data, code, msg } = await requestPost(url, params); + + if (code === 0) { + this.optionsD = data; + this.buildingUnitId = ""; + this.houseId = ""; + } else { + this.$message.error(msg); + } + - this.optionsD = res.data; - this.buildingUnitId = ""; - this.houseId = ""; - } - }) - .catch(() => { - return this.$message.error("网络错误"); - }); }, getHouseList () { this.$http @@ -503,6 +512,10 @@ export default { this.remark = '' this.updateStartDate = '' this.updateEndDate = '' + this.neighborHoodId = '' + this.buildingId = '' + this.buildingUnitId = '' + this.houseId = '' this.pageSize = 10 this.pageNo = 1 @@ -572,7 +585,7 @@ export default { }, - handleNodeClick (obj) { + async handleNodeClick (obj) { this.ownerName = '' this.ownerPhone = '' this.rentFlag = '' @@ -584,27 +597,40 @@ export default { this.selObj = JSON.parse(JSON.stringify(obj)) this.getTreeObj(obj) + await nextTick(1000) - this.$nextTick(() => { - if (obj.level === 'building') {//点击楼栋 - this.$refs['ref_buildingTable'].loadTable('tree', this.selTreeObj) + if (obj.level === 'building') {//点击楼栋 + this.$refs['ref_buildingTable'].loadTable('tree', this.selTreeObj) + this.selAgencyId = '' + this.selGridId = '' + await this.getValiheList() + this.neighborHoodId = this.selTreeObj.pid + await this.getBuildList() + this.buildingId = this.selTreeObj.id + await this.getUniList() - } else if (obj.level === 'neighborHood') {//点击小区 - this.$refs['ref_neighTable'].loadTable(true, this.selTreeObj) - } else { - this.$refs['ref_communityTable'].loadTable(true, this.selTreeObj) + } else if (obj.level === 'neighborHood') {//点击小区 + this.$refs['ref_neighTable'].loadTable(true, this.selTreeObj) + this.selAgencyId = '' + this.selGridId = '' + await this.getValiheList() + this.neighborHoodId = this.selTreeObj.id + await this.getBuildList() - if (obj.level === 'grid') { - this.selAgencyId = '' - this.selGridId = this.selTreeObj.id - } else { - this.selAgencyId = this.selTreeObj.id - this.selGridId = '' - } - this.getValiheList() + } else { + this.$refs['ref_communityTable'].loadTable(true, this.selTreeObj) + + if (obj.level === 'grid') { + this.selAgencyId = '' + this.selGridId = this.selTreeObj.id + } else { + this.selAgencyId = this.selTreeObj.id + this.selGridId = '' } - }) + this.getValiheList('', '') + } + }, diff --git a/src/views/modules/base/community/roomTable.vue b/src/views/modules/base/community/roomTable.vue index 354b3684d..3183efbff 100644 --- a/src/views/modules/base/community/roomTable.vue +++ b/src/views/modules/base/community/roomTable.vue @@ -297,6 +297,10 @@ export default { sortType: this.sortType, updateStartDate: this.updateStartDate, updateEndDate: this.updateEndDate, + neighborHoodId: this.neighborHoodId, + buildingId: this.buildingId, + buildingUnitId: this.buildingUnitId, + houseId: this.houseId, }; this.$refs.baobiao.init({ elseParams: { @@ -401,6 +405,10 @@ export default { sortType: this.sortType, updateStartDate: this.updateStartDate, updateEndDate: this.updateEndDate, + neighborHoodId: this.neighborHoodId, + buildingId: this.buildingId, + buildingUnitId: this.buildingUnitId, + houseId: this.houseId, }; const url = "/gov/org/house/houselist"; @@ -602,6 +610,10 @@ export default { updateStartDate: this.updateStartDate, updateEndDate: this.updateEndDate, buildingId: this.agencyObj.id, + neighborHoodId: this.neighborHoodId, + buildingId: this.buildingId, + buildingUnitId: this.buildingUnitId, + houseId: this.houseId, }; if (this.agencyObj.level === "grid") { @@ -699,6 +711,10 @@ export default { remark: this.remark, updateStartDate: this.updateStartDate, updateEndDate: this.updateEndDate, + neighborHoodId: this.neighborHoodId, + buildingId: this.buildingId, + buildingUnitId: this.buildingUnitId, + houseId: this.houseId, buildingId: "", neighborHoodId: "", }; @@ -891,6 +907,22 @@ export default { type: String, default: "", }, + neighborHoodId: { + type: String, + default: "", + }, + buildingId: { + type: String, + default: "", + }, + buildingUnitId: { + type: String, + default: "", + }, + houseId: { + type: String, + default: "", + }, }, };