Browse Source

111

dev-yantai-fangwu
jiangyy 3 years ago
parent
commit
b8b7adc910
  1. 12
      src/views/modules/base/community/buildTable.vue
  2. 332
      src/views/modules/base/community/community.vue
  3. 4
      src/views/modules/base/community/roomTable.vue

12
src/views/modules/base/community/buildTable.vue

@ -365,11 +365,6 @@ export default {
this.agencyObj = treeObj
// if (this.agencyObj.pid === this.staffAgencyId) {//idid
// this.showImportBtn = true
// } else {
// this.showImportBtn = false
// }
}
@ -412,12 +407,7 @@ export default {
},
async handleDetail (row) {
// this.formTitle = ''
// this.formShow = true
// const _data = await this.detail(row)
// this.$nextTick(() => {
// this.$refs.ref_form.initForm('detail', _data, this.agencyObj)
// })
this.detailShow = true

332
src/views/modules/base/community/community.vue

@ -3,9 +3,9 @@
<div :style="{height:rowHeight}"
class="div_tree">
<el-input placeholder="输入关键字进行过滤"
<!-- <el-input placeholder="输入关键字进行过滤"
v-model="filterText">
</el-input>
</el-input> -->
<el-scrollbar :style="{height:treeHeight}"
class="scrollar">
<el-tree ref="ref_tree"
@ -15,10 +15,11 @@
:props="defaultProps"
:highlight-current="true"
node-key="id"
:default-expanded-keys="openNodes"
:expand-on-click-node="false"
:filter-node-method="filterNode"
@node-click="handleNodeClick">
@node-click="handleNodeClick"
lazy
:load="lazyLoadTree">
<span slot-scope="{ node, data }"
class="custom-tree-node">
@ -122,72 +123,6 @@
</el-date-picker>
</el-form-item>
<el-form-item label="所属房屋">
<div class="resi-cell-value">
<div class="resi-cell-col">
<el-form-item prop="neighborHoodId">
<el-select v-model.trim="neighborHoodId"
:disabled="vDisabled"
placeholder="小区"
size="small"
clearable
class="resi-cell-select"
@change="handleChangeV">
<el-option v-for="item in optionsV"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="buildingId">
<el-select v-model.trim="buildingId"
placeholder="楼号"
:disabled="!neighborHoodId || bDisabled"
size="small"
clearable
class="resi-cell-select resi-cell-select-middle list_item_width_1"
@change="handleChangeB">
<el-option v-for="item in optionsB"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="buildingUnitId">
<el-select v-model.trim="buildingUnitId"
placeholder="单元"
size="small"
:disabled="!buildingId"
clearable
class="resi-cell-select resi-cell-select-middle list_item_width_1"
@change="handleChangeD">
<el-option v-for="item in optionsD"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="houseId">
<el-select v-model.trim="houseId"
placeholder="房号"
:disabled="!buildingUnitId"
size="small"
clearable
class="resi-cell-select resi-cell-select-middle list_item_width_1">
<el-option v-for="item in optionsH"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</div>
</div>
</el-form-item>
<el-button style="margin-left:30px"
size="small"
class="diy-button--search"
@ -221,10 +156,6 @@
:ownerPhone="ownerPhone"
:rentFlag="rentFlag"
:purpose="purpose"
:neighborHoodId="neighborHoodId"
:buildingId="buildingId"
:buildingUnitId="buildingUnitId"
:houseId="houseId"
:remark="remark"
:updateStartDate="updateStartDate"
:updateEndDate="updateEndDate"
@ -277,7 +208,7 @@ export default {
return time.getTime() > nowData
}
return {
filterText: '',
// filterText: '',
treeLoading: true,
treeData: [],
openNodes: [],
@ -335,19 +266,10 @@ export default {
disabledDate: startDisabledDate
},
optionsV: [],
optionsB: [],
optionsH: [],
optionsD: [],
neighborHoodId: "",
buildingId: "",
buildingUnitId: "",
houseId: "",
selGridId: '',
selAgencyId: '',
vDisabled: false,
bDisabled: false,
}
},
components: {
@ -358,8 +280,6 @@ export default {
await this.loadOrgData()
await this.loadTree()
// await this.loadOpenNode()
this.getValiheList('', '')
await this.$refs['ref_communityTable'].loadTable(true, this.selTreeObj)
if (this.treeData.length > 0) {
@ -373,7 +293,6 @@ export default {
},
computed: {
rowHeight () {
return this.$store.state.inIframe ? this.clientHeight - 140 + this.iframeHeight + 'px' : this.clientHeight - 140 + 'px'
},
@ -385,114 +304,35 @@ export default {
...mapGetters(['clientHeight', 'iframeHeight'])
},
methods: {
handleChangeV (val) {
this.buildingId = "";
this.buildingUnitId = "";
this.houseId = "";
this.getBuildList();
// this.getUniList();
// this.getHouseList();
},
handleChangeB (val) {
this.buildingUnitId = "";
this.houseId = "";
this.getUniList();
// this.getHouseList();
},
handleChangeD () {
this.houseId = "";
this.getHouseList();
},
async getValiheList () {
const { user } = this.$store.state;
if (!this.selGridId) {
this.selAgencyId = this.selAgencyId ? this.selAgencyId : user.agencyId
}
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);
}
},
async lazyLoadTree (node, resolve) {
console.log(node)
// debugger
if (node.level !== 0) {
const url = "/gov/org/building/next-tree-node"
let params = {
id: node.data.id,
level: node.data.level
}
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)
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
resolve(data)
if (code === 0) {
this.optionsB = data;
this.buildingId = "";
this.buildingUnitId = "";
this.houseId = "";
} else {
this.$message.error(msg);
} else {
this.$message.error(msg)
}
}
// this.$http.get(`/sys/region/list?pid=${tree.id}`).then(({ data: res }) => {
// if (res.code !== 0) {
// return this.$message.error(res.msg)
// }
// resolve(res.data)
// }).catch(() => { })
},
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);
}
},
getHouseList () {
this.$http
.post("/gov/org/ichouse/houseoption", { unitId: this.buildingUnitId })
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
} else {
this.optionsH = res.data;
this.houseId = "";
}
})
.catch(() => {
return this.$message.error("网络错误");
});
},
handleSearch () {
// if (this.ownerName || this.ownerPhone || this.rentFlag || this.purpose || this.remark) {
this.showRoomTable = true
@ -516,45 +356,28 @@ export default {
this.remark = ''
this.updateStartDate = ''
this.updateEndDate = ''
this.neighborHoodId = ''
this.buildingId = ''
this.buildingUnitId = ''
this.houseId = ''
this.pageSize = 10
this.pageNo = 1
// this.handleNodeClick(this.selObj)
// this.loadTable()
},
async loadOpenNode () {
const url = "/gov/org/building/tree-ids"
let params = {}
const { data, code, msg } = await requestPost(url, params)
if (code === 0) {
this.openNodes = data
} else {
this.$message.error(msg)
}
},
async loadTree (isRefresh) {
const url = "/gov/org/building/treelist"
const url = "/gov/org/building/treeinit"
let params = {}
const { data, code, msg } = await requestPost(url, params)
if (code === 0) {
this.openNodes = []
this.openNodes.push(data[0].id)
this.openNodes.push(data.id)
this.treeData = data
if (!isRefresh && data.length > 0) {
this.treeData = []
this.treeData.push(data)
this.selTreeObj = data[0]
if (!isRefresh && data) {
this.selTreeObj = data
if (!this.selTreeObj.latitude) {
this.selTreeObj.latitude = this.centerPoint[0]
}
@ -602,30 +425,22 @@ export default {
this.selObj = JSON.parse(JSON.stringify(obj))
this.getTreeObj(obj)
await nextTick(1000)
this.vDisabled = false
this.bDisabled = false
if (obj.level === 'building') {//
this.selAgencyId = ''
this.selGridId = ''
await this.getValiheList()
this.neighborHoodId = this.selTreeObj.pid
await this.getBuildList()
this.buildingId = this.selTreeObj.id
await this.getUniList()
this.$refs['ref_buildingTable'].loadTable('tree', this.selTreeObj)
this.vDisabled = true
this.bDisabled = true
} else if (obj.level === 'neighborHood') {//
this.selAgencyId = ''
this.selGridId = ''
await this.getValiheList()
this.neighborHoodId = this.selTreeObj.id
await this.getBuildList()
this.$refs['ref_neighTable'].loadTable(true, this.selTreeObj)
this.vDisabled = true
} else {
this.$refs['ref_communityTable'].loadTable(true, this.selTreeObj)
@ -636,7 +451,7 @@ export default {
this.selAgencyId = this.selTreeObj.id
this.selGridId = ''
}
this.getValiheList('', '')
}
@ -654,30 +469,51 @@ export default {
},
//
toNextLevel (row, level) {
async toNextLevel (row, level) {
console.log(row)
if (level === 'community') {
this.selTreeObj = this.$refs.ref_tree.getNode(row.neighborHoodId).data
this.openNodes.push(this.selTreeObj.id)
this.selTreeObj.id = row.neighborHoodId
this.selTreeObj.label = row.neighborHoodName
this.selTreeObj.latitude = row.latitude
this.selTreeObj.level = 'neighborHood'
this.selTreeObj.longitude = row.longitude
} else {
this.selTreeObj = this.$refs.ref_tree.getNode(row.buildingId).data
this.selTreeObj.id = row.buildingId
this.selTreeObj.label = row.buildingName
this.selTreeObj.latitude = row.latitude
this.selTreeObj.level = "building"
this.selTreeObj.longitude = row.longitude
}
console.log(this.selTreeObj)
this.handleNodeClick(this.selTreeObj)
this.$nextTick(() => {
// ref_tree ref value node-key
this.$refs.ref_tree.setCurrentKey(this.selTreeObj.id);
});
this.ownerName = ''
this.ownerPhone = ''
this.rentFlag = ''
this.purpose = ''
this.remark = ''
this.updateStartDate = ''
this.updateEndDate = ''
this.showRoomTable = false
const node = document.getElementById(this.selTreeObj.id) // Iddom
setTimeout(() => {
if (node) {
this.$nextTick(() => {
node.scrollIntoView({ block: 'center' }) // scrollIntoViewdom block: 'center'
})
}
}, 100)
this.selObj = JSON.parse(JSON.stringify(this.selTreeObj))
// this.getTreeObj(obj)
await nextTick(1000)
if (this.selObj.level === 'building') {//
this.selAgencyId = ''
this.selGridId = ''
this.$refs['ref_buildingTable'].loadTable('tree', this.selTreeObj)
} else if (this.selObj.level === 'neighborHood') {//
this.selAgencyId = ''
this.selGridId = ''
this.$refs['ref_neighTable'].loadTable(true, this.selTreeObj)
}
},
@ -756,9 +592,9 @@ export default {
}
},
watch: {
filterText (val) {
this.$refs.ref_tree.filter(val);
}
// filterText (val) {
// this.$refs.ref_tree.filter(val);
// }
},
components: {
communityTable, buildTable, roomTable

4
src/views/modules/base/community/roomTable.vue

@ -425,10 +425,6 @@ export default {
this.agencyLevel = "agency";
}
// if (fromTree) {
// this.agencyObj = treeObj
// }
let params = {
pageSize: this.pageSize,
pageNo: this.pageNo,

Loading…
Cancel
Save