2 changed files with 922 additions and 0 deletions
@ -0,0 +1,356 @@ |
|||
<template> |
|||
<div class="mode-block resi-container"> |
|||
<el-card ref="searchCard" class="search-card"> |
|||
<el-form :inline="true" :model="dataForm" size="small"> |
|||
<el-form-item label="所属组织" label-width="100px" |
|||
prop="agencyId"> |
|||
<el-cascader ref="cascaderUnit" v-model="dataForm.agencyId" :options="optionsA" :props="{ checkStrictly: true, emitPath: false,children:'subAgencyList',label:'agencyName',value:'agencyId'}" clearable /> |
|||
<!-- <template slot-scope="{ node, data }"> |
|||
<div @click="cascaderClick(data)"> |
|||
<span>{{ data.objectName }}</span> |
|||
<span v-if="!node.isLeaf"> ({{ data.children.length }}) </span> |
|||
</div> |
|||
</template> --> |
|||
</el-form-item> |
|||
<el-form-item label="时间范围" |
|||
prop="startTime"> |
|||
<el-date-picker v-model="timeRange" |
|||
type="daterange" |
|||
clearable |
|||
size="small" |
|||
range-separator="至" |
|||
start-placeholder="选择日期" |
|||
end-placeholder="选择日期" |
|||
value-format="yyyy-MM-dd"> |
|||
</el-date-picker> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button type="primary" size="small" class="diy-button--search" @click="handleSearch">查询</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
</el-card> |
|||
<el-card class="resi-card-table"> |
|||
<div class="resi-row-btn"> |
|||
<el-button @click="totalHandle" |
|||
class="diy-button--add" |
|||
size="small">总计</el-button> |
|||
<el-button @click="exportHandle" |
|||
class="diy-button--reset" |
|||
size="small">导出</el-button> |
|||
</div> |
|||
<el-table class="resi-table" v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%" |
|||
:height="tableHeight"> |
|||
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column> |
|||
<el-table-column min-width="100" prop="orgName" label="网格员数" header-align="center" align="center" /> |
|||
<el-table-column min-width="100" prop="memberCount" label="所属社区" header-align="center" align="center" /> |
|||
<el-table-column min-width="100" prop="projectCount" label="上报数量" header-align="center" align="center" /> |
|||
<el-table-column min-width="110" prop="closedCount" label="办结数" header-align="center" align="center" /> |
|||
<el-table-column min-width="110" prop="projectAve" label="人均上报" header-align="center" align="center" /> |
|||
<el-table-column min-width="110" prop="closedAve" label="人均办结" header-align="center" align="center" /> |
|||
</el-table> |
|||
<div> |
|||
<el-pagination |
|||
@size-change="handleSizeChange" |
|||
@current-change="handleCurrentChange" |
|||
:current-page.sync="pageNo" |
|||
:page-sizes="[20, 50, 100, 200]" |
|||
:page-size="pageSize" |
|||
layout="sizes, prev, pager, next, total" |
|||
:total="total" |
|||
> |
|||
</el-pagination> |
|||
</div> |
|||
</el-card> |
|||
<!-- 弹窗, 新增 / 修改 --> |
|||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update> |
|||
<el-dialog |
|||
title="总计" |
|||
:visible.sync="totalVisible" |
|||
width="60%"> |
|||
<template> |
|||
<el-table |
|||
:data="tableData" |
|||
style="width: 100%" |
|||
height="200"> |
|||
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column> |
|||
<el-table-column min-width="100" prop="orgName" label="网格员数" header-align="center" align="center" /> |
|||
<el-table-column min-width="100" prop="memberCount" label="所属社区" header-align="center" align="center" /> |
|||
<el-table-column min-width="100" prop="projectCount" label="上报数量" header-align="center" align="center" /> |
|||
<el-table-column min-width="110" prop="closedCount" label="办结数" header-align="center" align="center" /> |
|||
<el-table-column min-width="110" prop="projectAve" label="人均上报" header-align="center" align="center" /> |
|||
<el-table-column min-width="110" prop="closedAve" label="人均办结" header-align="center" align="center" /> |
|||
</el-table> |
|||
</template> |
|||
</el-dialog> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { mapGetters } from "vuex"; |
|||
// import AddOrUpdate from './factagencyuserhousedaily-add-or-update' |
|||
export default { |
|||
data () { |
|||
return { |
|||
mixinViewModuleOptions: { |
|||
getDataListURL: '/data/stats/factAgencyUserHouseDaily/page', |
|||
getDataListIsPage: true, |
|||
deleteURL: '/data/stats/factAgencyUserHouseDaily', |
|||
deleteIsBatch: true, |
|||
exportURL: '/data/stats/factAgencyUserHouseDaily/export' |
|||
}, |
|||
optionsA: [], |
|||
totalVisible: false, |
|||
timeRange: '', |
|||
dataForm: { |
|||
agencyId: '', |
|||
startTime: '', |
|||
endTime: '', |
|||
type: '' |
|||
}, |
|||
total: 0, |
|||
tableData: [], |
|||
pageNo: 1, |
|||
pageSize: 20 |
|||
} |
|||
}, |
|||
components: { |
|||
// AddOrUpdate |
|||
}, |
|||
created () { |
|||
this.getGridList() |
|||
this.getTableList() |
|||
// this.getValiheList() |
|||
}, |
|||
watch: { |
|||
timeRange (val) { |
|||
if (Array.isArray(val) && val.length == 2) { |
|||
this.dataForm.startTime = val[0]; |
|||
this.dataForm.endTime = val[1]; |
|||
} else { |
|||
this.dataForm.startTime = ""; |
|||
this.dataForm.endTime = ""; |
|||
} |
|||
} |
|||
}, |
|||
computed: { |
|||
...mapGetters(["clientHeight", "iframeHeight"]), |
|||
tableHeight() { |
|||
const h = this.clientHeight - 360 + this.iframeHeigh; |
|||
const _h = this.clientHeight - 360; |
|||
return this.$store.state.inIframe ? h : _h; |
|||
}, |
|||
}, |
|||
methods: { |
|||
|
|||
handleSearch() { |
|||
this.dataForm.type = 1 |
|||
this.pageNo = 1 |
|||
this.getTableList() |
|||
}, |
|||
handleSizeChange(val) { |
|||
console.log(`每页 ${val} 条`); |
|||
this.pageSize = val; |
|||
this.getTableList(); |
|||
}, |
|||
handleCurrentChange(val) { |
|||
console.log(`当前页: ${val}`); |
|||
this.pageNo = val; |
|||
this.getTableList(); |
|||
}, |
|||
exportHandle () { |
|||
const url = this.mixinViewModuleOptions.exportURL |
|||
this.$http({ |
|||
method: 'GET', |
|||
url, |
|||
responseType: 'blob', |
|||
params: this.dataForm |
|||
}).then(res => { |
|||
// this.download(res.data, title + '.xls') |
|||
if (res.headers["content-disposition"]) { |
|||
let fileName = window.decodeURI(res.headers["content-disposition"].split(";")[1].split("=")[1]) |
|||
console.log('filename', fileName) |
|||
let blob = new Blob([res.data], { type: 'application/vnd.ms-excel' }) |
|||
var url = window.URL.createObjectURL(blob) |
|||
var aLink = document.createElement('a') |
|||
aLink.style.display = 'none' |
|||
aLink.href = url |
|||
aLink.setAttribute('download', fileName) |
|||
document.body.appendChild(aLink) |
|||
aLink.click() |
|||
document.body.removeChild(aLink) //下载完成移除元素 |
|||
window.URL.revokeObjectURL(url) //释放掉blob对象 |
|||
} else this.$message.error('下载失败') |
|||
}).catch(err => { |
|||
console.log('err', err) |
|||
return this.$message.error('网络错误') |
|||
}) |
|||
}, |
|||
cascaderClick (nodeData) { |
|||
this.dataForm.agencyId = nodeData.objectId; |
|||
this.dataForm.level = nodeData.objectType |
|||
this.$refs.cascaderUnit.checkedValue = nodeData.objectId; |
|||
this.$refs.cascaderUnit.computePresentText(); |
|||
this.$refs.cascaderUnit.toggleDropDownVisible(false); |
|||
|
|||
}, |
|||
totalHandle () { |
|||
this.tableData = [] |
|||
this.dataForm.type = 0 |
|||
this.$http |
|||
.get('/data/stats/factAgencyUserHouseDaily/total',{params: this.dataForm}) |
|||
.then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} else { |
|||
console.log('获取查询详情成功', res.data) |
|||
if (res.data) this.tableData.push(res.data) |
|||
} |
|||
}) |
|||
.catch(() => { |
|||
return this.$message.error('网络错误') |
|||
}) |
|||
this.totalVisible = true |
|||
}, |
|||
getTableList() { |
|||
const { user } = this.$store.state |
|||
|
|||
this.$http |
|||
.post('/data/aggregator/org/orgProjectDetailList', this.dataForm) |
|||
.then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} else { |
|||
this.dataList = res.data.list |
|||
this.total = res.data.total |
|||
} |
|||
}) |
|||
.catch(() => { |
|||
return this.$message.error('网络错误') |
|||
}) |
|||
}, |
|||
getGridList() { |
|||
const { user } = this.$store.state |
|||
const params = { |
|||
agencyId: user.agencyId, |
|||
client: 'gov' |
|||
} |
|||
this.$http |
|||
// .post('/gov/org/userhouse/service/serviceScopeTree') |
|||
// .post('/data/aggregator/org/agencytree', params) |
|||
.post('/gov/org/customeragency/staffinagencylist') |
|||
.then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} else { |
|||
console.log('获取查询详情成功', res.data) |
|||
let { agencyList, subAgencyList } = res.data |
|||
// this.optionsA = res.data |
|||
// console.log(this.optionsA); |
|||
const _arr = [{...agencyList, subAgencyList: [...subAgencyList] }] |
|||
this.optionsA = this.deepTree(_arr) |
|||
console.log('optionsA----', this.optionsA) |
|||
} |
|||
}) |
|||
.catch(() => { |
|||
return this.$message.error('网络错误') |
|||
}) |
|||
}, |
|||
deepTree(arr) { |
|||
if (Array.isArray(arr)) { |
|||
return arr.map(item => { |
|||
return { |
|||
...item, |
|||
subAgencyList: item.subAgencyList.length > 0 && this.deepTree(item.subAgencyList) || null |
|||
} |
|||
}) |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
<style> |
|||
.block{ |
|||
position: absolute; |
|||
left: 0px; |
|||
display: inline-block; |
|||
width: 35px; |
|||
height: 50px; |
|||
background: #fff; |
|||
} |
|||
.cascader-block .el-cascader-node>.el-radio{ |
|||
display: none; |
|||
} |
|||
</style> |
|||
<style lang="scss" scoped> |
|||
.blacklist-reason { |
|||
width: 100%; |
|||
height: 80px; |
|||
border: 1px solid #e4e4e4; |
|||
border-radius: 4px; |
|||
resize: none; |
|||
padding: 8px; |
|||
box-sizing: border-box; |
|||
} |
|||
</style> |
|||
<style lang="scss" scoped> |
|||
@import "@/assets/scss/buttonstyle.scss"; |
|||
|
|||
.resi-container .resi-card-table { |
|||
::v-deep .el-table th { |
|||
color: #fff; |
|||
background-color: rgba(33, 149, 254, 1); |
|||
// border-right: 1px solid rgba(33, 149, 254, 1); |
|||
} |
|||
} |
|||
.resi-table { |
|||
::v-deep .el-button--text { |
|||
text-decoration: underline; |
|||
} |
|||
::v-deep .btn-color-del { |
|||
margin-left: 10px; |
|||
color: rgba(213, 16, 16, 1); |
|||
} |
|||
::v-deep .btn-color-edit { |
|||
color: rgba(0, 167, 169, 1); |
|||
} |
|||
} |
|||
.form-wr { |
|||
.input-width { |
|||
width: 260px; |
|||
|
|||
} |
|||
.input-width-textarea { |
|||
width: 500px; |
|||
} |
|||
.imsg-list { |
|||
display: flex; |
|||
align-items: center; |
|||
.imgs-item { |
|||
position: relative; |
|||
margin-right: 10px; |
|||
.el-icon-delete { |
|||
position: absolute; |
|||
top: 0; |
|||
right: 0; |
|||
font-size: 18px; |
|||
color: red; |
|||
z-index: 3; |
|||
cursor: pointer; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
.div-content { |
|||
width: 100%; |
|||
overflow: hidden; |
|||
text-overflow: ellipsis; |
|||
white-space: nowrap; |
|||
} |
|||
.resi-row-btn { |
|||
margin-bottom: 13px; |
|||
.upload-btn { |
|||
display: inline-block; |
|||
margin: 0 10px; |
|||
} |
|||
} |
|||
</style> |
@ -0,0 +1,566 @@ |
|||
<template> |
|||
<div class="div_main"> |
|||
|
|||
<div :style="{height:rowHeight}" |
|||
class="div_tree"> |
|||
<el-input placeholder="输入关键字进行过滤" |
|||
v-model="filterText"> |
|||
</el-input> |
|||
<el-scrollbar :style="{height:treeHeight}" |
|||
class="scrollar"> |
|||
<el-tree ref="ref_tree" |
|||
v-loading="treeLoading" |
|||
class="filter_tree" |
|||
:data="treeData" |
|||
:props="defaultProps" |
|||
:highlight-current="true" |
|||
node-key="id" |
|||
:default-expanded-keys="openNodes" |
|||
:expand-on-click-node="false" |
|||
:filter-node-method="filterNode" |
|||
@node-click="handleNodeClick"> |
|||
|
|||
<span slot-scope="{ node, data }" |
|||
class="custom-tree-node"> |
|||
<span :id="data.id">{{ data.showName }}</span> |
|||
</span> |
|||
</el-tree> |
|||
</el-scrollbar> |
|||
|
|||
</div> |
|||
|
|||
<div :style="{height:rowHeight}" |
|||
class=div_left> |
|||
|
|||
<div class="div_search marginl-20"> |
|||
<el-form :inline="true" |
|||
ref="ref_searchform" |
|||
:label-width="'80px'"> |
|||
<div> |
|||
|
|||
<el-form-item label="房主姓名" |
|||
prop="ownerName"> |
|||
<el-input v-model="ownerName" |
|||
class="item_width_2" |
|||
size="small" |
|||
clearable |
|||
placeholder="请输入内容"> |
|||
|
|||
</el-input> |
|||
</el-form-item> |
|||
<el-form-item label="联系方式" |
|||
prop="ownerPhone"> |
|||
<el-input v-model="ownerPhone" |
|||
class="item_width_2" |
|||
size="small" |
|||
clearable |
|||
placeholder="请输入手机"> |
|||
</el-input> |
|||
|
|||
</el-form-item> |
|||
|
|||
<el-form-item label="房屋状态" |
|||
prop="rentFlag"> |
|||
<el-select class="item_width_2" |
|||
v-model="rentFlag" |
|||
placeholder="请选择" |
|||
size="small" |
|||
clearable> |
|||
<el-option v-for="item in rentList" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value"> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="房屋用途" |
|||
prop="purpose"> |
|||
<el-select v-model="purpose" |
|||
class="item_width_2" |
|||
placeholder="请选择" |
|||
size="small" |
|||
clearable> |
|||
<el-option v-for="item in purposeArr" |
|||
:key="item.dictValue" |
|||
:label="item.dictName" |
|||
:value="item.dictValue"> |
|||
</el-option> |
|||
</el-select> |
|||
|
|||
</el-form-item> |
|||
|
|||
<el-form-item label="备注" |
|||
prop="remark"> |
|||
<el-input v-model="remark" |
|||
class="item_width_2" |
|||
size="small" |
|||
clearable |
|||
placeholder="请输入备注"> |
|||
</el-input> |
|||
</el-form-item> |
|||
<el-form-item label="更新时间" |
|||
prop="updateStartDate"> |
|||
<el-date-picker v-model="updateStartDate" |
|||
:picker-options="startPickerOptions" |
|||
class="item_width_2" |
|||
size="small" |
|||
type="date" |
|||
value-format="yyyyMMdd" |
|||
value="yyyy-MM-dd" |
|||
placeholder="开始时间"> |
|||
</el-date-picker> |
|||
<span class="data-tag">至</span> |
|||
<el-date-picker v-model="updateEndDate" |
|||
:picker-options="endPickerOptions" |
|||
class="item_width_2 data-tag" |
|||
size="small" |
|||
type="date" |
|||
value-format="yyyyMMdd" |
|||
value="yyyy-MM-dd" |
|||
placeholder="结束时间"> |
|||
</el-date-picker> |
|||
</el-form-item> |
|||
|
|||
<el-button style="margin-left:30px" |
|||
size="small" |
|||
class="diy-button--search" |
|||
@click="handleSearch">查询</el-button> |
|||
<el-button style="margin-left:10px" |
|||
size="small" |
|||
class="diy-button--reset" |
|||
@click="resetSearch">重置</el-button> |
|||
</div> |
|||
</el-form> |
|||
</div> |
|||
<div class=div_left_table> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import CDialog from '@c/CDialog' |
|||
import { requestPost } from "@/js/dai/request"; |
|||
import { mapGetters } from 'vuex' |
|||
import { Loading } from 'element-ui' // 引入Loading服务 |
|||
|
|||
let loading // 加载动画 |
|||
export default { |
|||
data () { |
|||
let endDisabledDate = (time) => {//这个关键属性我们一定要写在data的里面并且return的外面,这是动态改变区间的关键 |
|||
let nowData = Date.now() |
|||
if (this.updateStartDate) { |
|||
let startTime = new Date(this.updateStartDate) |
|||
return time.getTime() > nowData || time.getTime() < startTime || time.getTime() === startTime |
|||
} else { |
|||
return time.getTime() > nowData |
|||
} |
|||
|
|||
} |
|||
let startDisabledDate = (time) => {//这个关键属性我们一定要写在data的里面并且return的外面,这是动态改变区间的关键 |
|||
let nowData = Date.now() |
|||
return time.getTime() > nowData |
|||
} |
|||
return { |
|||
filterText: '', |
|||
treeLoading: true, |
|||
treeData: [], |
|||
openNodes: [], |
|||
defaultProps: { |
|||
children: 'children', |
|||
label: 'showName' |
|||
}, |
|||
|
|||
selTreeObj: {}, |
|||
|
|||
centerPoint: [], |
|||
staffAgencyId: localStorage.getItem("agencyId"), |
|||
showImportBtn: false, |
|||
|
|||
rentList: [ |
|||
{ |
|||
value: '1', |
|||
label: '出租' |
|||
}, |
|||
{ |
|||
value: '2', |
|||
label: '闲置' |
|||
}, |
|||
{ |
|||
value: '0', |
|||
label: '自住' |
|||
}, |
|||
{ |
|||
value: '3', |
|||
label: '未出售' |
|||
}, |
|||
], |
|||
ownerName: '', |
|||
ownerPhone: '', |
|||
rentFlag: '', |
|||
purpose: '', |
|||
remark: '', |
|||
updateStartDate: '', |
|||
updateEndDate: '', |
|||
showRoomTable: false, |
|||
selObj: {}, |
|||
purposeArr: [ |
|||
{ dictValue: '1', dictName: '住宅' }, |
|||
{ dictValue: '2', dictName: '商业' }, |
|||
{ dictValue: '3', dictName: '办公' }, |
|||
{ dictValue: '4', dictName: '工业' }, |
|||
{ dictValue: '5', dictName: '仓储' }, |
|||
{ dictValue: '6', dictName: '商住混用' }, |
|||
{ dictValue: '7', dictName: '其他' } |
|||
], |
|||
endPickerOptions: { |
|||
disabledDate: endDisabledDate |
|||
}, |
|||
startPickerOptions: { |
|||
disabledDate: startDisabledDate |
|||
}, |
|||
} |
|||
}, |
|||
components: { |
|||
CDialog |
|||
}, |
|||
async mounted () { |
|||
this.treeLoading = true |
|||
|
|||
await this.loadOrgData() |
|||
await this.loadTree() |
|||
// await this.loadOpenNode() |
|||
|
|||
await this.$refs['ref_communityTable'].loadTable(true, this.selTreeObj) |
|||
if (this.treeData.length > 0) { |
|||
this.$nextTick(() => { |
|||
// ref_tree 元素的ref value 绑定的node-key |
|||
this.$refs.ref_tree.setCurrentKey(this.treeData[0].id); |
|||
}); |
|||
} |
|||
this.treeLoading = false |
|||
|
|||
}, |
|||
computed: { |
|||
rowHeight () { |
|||
|
|||
return this.$store.state.inIframe ? this.clientHeight - 140 + this.iframeHeight + 'px' : this.clientHeight - 140 + 'px' |
|||
|
|||
}, |
|||
treeHeight () { |
|||
return this.$store.state.inIframe ? this.clientHeight - 200 + this.iframeHeight + 'px' : this.clientHeight - 200 + 'px' |
|||
|
|||
}, |
|||
|
|||
...mapGetters(['clientHeight', 'iframeHeight']) |
|||
}, |
|||
methods: { |
|||
|
|||
handleSearch () { |
|||
// if (this.ownerName || this.ownerPhone || this.rentFlag || this.purpose || this.remark) { |
|||
this.showRoomTable = true |
|||
|
|||
this.$nextTick(() => { |
|||
this.$refs['ref_buildingTable'].loadTable('search', this.selTreeObj) |
|||
}) |
|||
// } else { |
|||
// this.$message.warning('请输入查询条件') |
|||
// } |
|||
|
|||
|
|||
}, |
|||
|
|||
//重置搜索条件 |
|||
resetSearch () { |
|||
this.ownerName = '' |
|||
this.ownerPhone = '' |
|||
this.rentFlag = '' |
|||
this.purpose = '' |
|||
this.remark = '' |
|||
this.updateStartDate = '' |
|||
this.updateEndDate = '' |
|||
|
|||
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" |
|||
let params = {} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
this.openNodes = [] |
|||
this.openNodes.push(data[0].id) |
|||
|
|||
this.treeData = data |
|||
if (!isRefresh && data.length > 0) { |
|||
|
|||
this.selTreeObj = data[0] |
|||
if (!this.selTreeObj.latitude) { |
|||
this.selTreeObj.latitude = this.centerPoint[0] |
|||
} |
|||
|
|||
if (!this.selTreeObj.longitude) { |
|||
this.selTreeObj.longitude = this.centerPoint[1] |
|||
} |
|||
} |
|||
|
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
}, |
|||
|
|||
//加载组织数据 |
|||
async loadOrgData () { |
|||
const url = "/gov/org/agency/maporg" |
|||
// const url = "http://yapi.elinkservice.cn/mock/245/gov/org/agency/maporg" |
|||
let params = {} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
this.centerPoint = [] |
|||
|
|||
this.centerPoint.push(data.latitude) |
|||
this.centerPoint.push(data.longitude) |
|||
|
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
|
|||
}, |
|||
|
|||
handleNodeClick (obj) { |
|||
this.ownerName = '' |
|||
this.ownerPhone = '' |
|||
this.rentFlag = '' |
|||
this.purpose = '' |
|||
this.remark = '' |
|||
this.updateStartDate = '' |
|||
this.updateEndDate = '' |
|||
this.showRoomTable = false |
|||
|
|||
this.selObj = JSON.parse(JSON.stringify(obj)) |
|||
this.getTreeObj(obj) |
|||
|
|||
this.$nextTick(() => { |
|||
if (obj.level === 'building') {//点击楼栋 |
|||
this.$refs['ref_buildingTable'].loadTable('tree', this.selTreeObj) |
|||
|
|||
} else if (obj.level === 'neighborHood') {//点击小区 |
|||
this.$refs['ref_neighTable'].loadTable(true, this.selTreeObj) |
|||
|
|||
} else { |
|||
this.$refs['ref_communityTable'].loadTable(true, this.selTreeObj) |
|||
} |
|||
}) |
|||
|
|||
}, |
|||
|
|||
//添加小区结束 |
|||
async refreshTree () { |
|||
this.treeLoading = true |
|||
await this.loadTree(this.selTreeObj.id) |
|||
this.$nextTick(() => { |
|||
// ref_tree 元素的ref value 绑定的node-key |
|||
this.$refs.ref_tree.setCurrentKey(this.selTreeObj.id); |
|||
}); |
|||
this.treeLoading = false |
|||
}, |
|||
|
|||
//进入下一级 |
|||
toNextLevel (row, level) { |
|||
|
|||
if (level === 'community') { |
|||
this.selTreeObj = this.$refs.ref_tree.getNode(row.neighborHoodId).data |
|||
this.openNodes.push(this.selTreeObj.id) |
|||
} else { |
|||
this.selTreeObj = this.$refs.ref_tree.getNode(row.buildingId).data |
|||
} |
|||
|
|||
|
|||
this.handleNodeClick(this.selTreeObj) |
|||
this.$nextTick(() => { |
|||
// ref_tree 元素的ref value 绑定的node-key |
|||
this.$refs.ref_tree.setCurrentKey(this.selTreeObj.id); |
|||
}); |
|||
|
|||
const node = document.getElementById(this.selTreeObj.id) // 通过Id获取到对应的dom元素 |
|||
setTimeout(() => { |
|||
if (node) { |
|||
this.$nextTick(() => { |
|||
node.scrollIntoView({ block: 'center' }) // 通过scrollIntoView方法将对应的dom元素定位到可见区域 【block: 'center'】这个属性是在垂直方向居中显示 |
|||
}) |
|||
} |
|||
}, 100) |
|||
|
|||
|
|||
}, |
|||
|
|||
//解析树数据 |
|||
getTreeObj (obj) { |
|||
// 树接口: |
|||
// 组织:组织id、组织名称、type、经度、纬度 |
|||
// 小区:小区id、小区名称、type、所属网格id、所属网格名称、所属组织id、所属组织名称、经度、纬度 |
|||
// 楼:楼id、楼名称、type、所属小区id、所属小区名称 |
|||
if (obj.level === 'building') {//点击楼栋 |
|||
let neighborHoodNode = this.$refs.ref_tree.getNode(obj.pid)//所属小区 |
|||
|
|||
let gridNode = this.$refs.ref_tree.getNode(neighborHoodNode.data.pid)//所属网格 |
|||
let agencyNode = this.$refs.ref_tree.getNode(gridNode.data.pid)//所属社区 |
|||
obj.agencyId = agencyNode.data.id |
|||
obj.agencyName = agencyNode.data.label |
|||
obj.gridId = gridNode.data.id |
|||
obj.gridName = gridNode.data.label |
|||
obj.neighborHoodId = neighborHoodNode.data.id |
|||
obj.neighborHoodName = neighborHoodNode.data.label |
|||
if (obj.agencyId === this.staffAgencyId) { |
|||
this.showImportBtn = true |
|||
} else { |
|||
this.showImportBtn = false |
|||
} |
|||
|
|||
} else if (obj.level === 'neighborHood') {//点击小区 |
|||
let gridNode = this.$refs.ref_tree.getNode(obj.pid) |
|||
let agencyNode = this.$refs.ref_tree.getNode(gridNode.data.pid) |
|||
obj.gridId = gridNode.data.id |
|||
obj.gridName = gridNode.data.label |
|||
obj.agencyId = agencyNode.data.id |
|||
obj.agencyName = agencyNode.data.label |
|||
if (obj.agencyId === this.staffAgencyId) { |
|||
this.showImportBtn = true |
|||
} else { |
|||
this.showImportBtn = false |
|||
} |
|||
|
|||
} else { |
|||
|
|||
} |
|||
|
|||
if (!obj.latitude) { |
|||
obj.latitude = this.centerPoint[0] |
|||
} |
|||
|
|||
if (!obj.longitude) { |
|||
obj.longitude = this.centerPoint[1] |
|||
} |
|||
this.selTreeObj = obj |
|||
console.log(this.selTreeObj) |
|||
|
|||
}, |
|||
|
|||
filterNode (value, data) { |
|||
if (!value) return true; |
|||
return data.label.indexOf(value) !== -1; |
|||
}, |
|||
|
|||
// 开启加载动画 |
|||
startLoading () { |
|||
loading = Loading.service({ |
|||
lock: true, // 是否锁定 |
|||
text: '正在加载……', // 加载中需要显示的文字 |
|||
background: 'rgba(0,0,0,.7)' // 背景颜色 |
|||
}) |
|||
}, |
|||
// 结束加载动画 |
|||
endLoading () { |
|||
// clearTimeout(timer); |
|||
if (loading) { |
|||
loading.close() |
|||
} |
|||
} |
|||
}, |
|||
watch: { |
|||
filterText (val) { |
|||
this.$refs.ref_tree.filter(val); |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
|
|||
<style> |
|||
/* .aui-content > .el-tabs > .el-tabs__content { |
|||
padding: 0px; |
|||
} */ |
|||
|
|||
.el-tree-node:focus > .el-tree-node__content { |
|||
/* background-color: #ccc !important; */ |
|||
color: #2195fe; |
|||
} |
|||
</style> |
|||
<style lang="scss" scoped> |
|||
.div_tree { |
|||
/deep/ .el-scrollbar__wrap { |
|||
overflow-x: hidden !important; |
|||
} |
|||
} |
|||
</style> |
|||
|
|||
<style lang="scss" scoped > |
|||
@import "@/assets/scss/modules/visual/communityManage.scss"; |
|||
@import "@/assets/scss/modules/management/list-main.scss"; |
|||
</style> |
|||
|
|||
<style lang="scss" scoped > |
|||
.div_main { |
|||
display: flex; |
|||
} |
|||
.scrollar { |
|||
margin-top: 10px; |
|||
} |
|||
|
|||
.div_tree { |
|||
flex: 0 0 280px; |
|||
background-color: #ffffff; |
|||
border-radius: 5px; |
|||
padding: 10px; |
|||
overflow-y: hidden; |
|||
} |
|||
.filter_tree { |
|||
overflow-x: auto; |
|||
} |
|||
|
|||
// .div_table { |
|||
// margin-left: 15px; |
|||
// // flex: 1; |
|||
// width: calc(100% - 300px); |
|||
// background-color: #ffffff; |
|||
// border-radius: 5px; |
|||
// padding: 10px; |
|||
// } |
|||
.div_left { |
|||
// flex: 1; |
|||
width: calc(100% - 300px); |
|||
} |
|||
.div_left_table { |
|||
margin-top: 10px; |
|||
margin-left: 15px; |
|||
background-color: #ffffff; |
|||
border-radius: 5px; |
|||
padding: 10px; |
|||
} |
|||
</style> |
|||
|
|||
|
Loading…
Reference in new issue