|
|
@ -1,31 +1,48 @@ |
|
|
|
<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" |
|
|
|
:expand-on-click-node="false" |
|
|
|
default-expand-all |
|
|
|
:filter-node-method="filterNode" |
|
|
|
@node-click="handleNodeClick"> |
|
|
|
</el-tree> |
|
|
|
</el-scrollbar> |
|
|
|
<div> |
|
|
|
<div class="div_search"> |
|
|
|
<el-form :rules="dataRule" :inline="true"> |
|
|
|
<el-form-item label="所属组织" prop="deptName"> |
|
|
|
<el-cascader |
|
|
|
style="width:350px" |
|
|
|
placeholder="请选择所属组织" |
|
|
|
:options="agencytree" |
|
|
|
v-model="agencyId" |
|
|
|
:props="{ expandTrigger: 'hover', label: 'orgName', value: 'orgId', children: 'subOrgList' }" |
|
|
|
clearable/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item> |
|
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="loadTree()">加载动力主轴</el-button> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
</div> |
|
|
|
<div :style="{height:rowHeight}" |
|
|
|
class="div_table"> |
|
|
|
<kernelhousehold-table :axisStructId="axisStructId" ref="ref_communityTable"></kernelhousehold-table> |
|
|
|
<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" |
|
|
|
:expand-on-click-node="false" |
|
|
|
default-expand-all |
|
|
|
:filter-node-method="filterNode" |
|
|
|
@node-click="handleNodeClick"> |
|
|
|
</el-tree> |
|
|
|
</el-scrollbar> |
|
|
|
</div> |
|
|
|
<div :style="{height:rowHeight}" |
|
|
|
class="div_table"> |
|
|
|
<kernelhousehold-table :axisStructId="axisStructId" ref="ref_communityTable"></kernelhousehold-table> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
@ -34,14 +51,13 @@ import CDialog from '@c/CDialog' |
|
|
|
import kernelhouseholdTable from './kernelhouseholdTable' |
|
|
|
import { requestPost } from "@/js/dai/request"; |
|
|
|
import { mapGetters } from 'vuex' |
|
|
|
import { Loading } from 'element-ui' // 引入Loading服务 |
|
|
|
|
|
|
|
let loading // 加载动画 |
|
|
|
export default { |
|
|
|
data () { |
|
|
|
return { |
|
|
|
agencytree: [], // 所属组织 |
|
|
|
agencyId: '', |
|
|
|
filterText: '', |
|
|
|
treeLoading: true, |
|
|
|
treeLoading: false, |
|
|
|
treeData: [], |
|
|
|
defaultProps: { |
|
|
|
children: 'children', |
|
|
@ -53,37 +69,42 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
async mounted () { |
|
|
|
this.treeLoading = true |
|
|
|
await this.loadTree() |
|
|
|
this.treeLoading = false |
|
|
|
// this.treeLoading = true |
|
|
|
// await this.loadTree() |
|
|
|
await this.getAgencyTree() |
|
|
|
// this.treeLoading = false |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
rowHeight () { |
|
|
|
return this.$store.state.inIframe ? this.clientHeight - 120 + this.iframeHeight + 'px' : this.clientHeight - 120 + 'px' |
|
|
|
return this.$store.state.inIframe ? this.clientHeight - 230 + this.iframeHeight + 'px' : this.clientHeight - 230 + 'px' |
|
|
|
}, |
|
|
|
treeHeight () { |
|
|
|
return this.$store.state.inIframe ? this.clientHeight - 200 + this.iframeHeight + 'px' : this.clientHeight - 200 + 'px' |
|
|
|
return this.$store.state.inIframe ? this.clientHeight - 310 + this.iframeHeight + 'px' : this.clientHeight - 310 + 'px' |
|
|
|
}, |
|
|
|
...mapGetters(['clientHeight', 'iframeHeight']) |
|
|
|
...mapGetters(['clientHeight', 'iframeHeight']), |
|
|
|
|
|
|
|
dataRule () { |
|
|
|
return { |
|
|
|
deptName:[ |
|
|
|
{ required: true, message: "请选择", trigger: "blur" } |
|
|
|
] |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
async loadTree (isRefresh) { |
|
|
|
async loadTree () { |
|
|
|
if (this.agencyId.length === 0 || !this.agencyId) { |
|
|
|
return this.$message.error('请选择所属组织') |
|
|
|
} |
|
|
|
this.treeLoading = true |
|
|
|
const url = "/pli/power/data/axis/structTree" |
|
|
|
let params = { |
|
|
|
agencyId: '1495655378069753857' |
|
|
|
agencyId: this.agencyId[this.agencyId.length-1] |
|
|
|
} |
|
|
|
const { data, code, msg } = await requestPost(url, params) |
|
|
|
this.treeLoading = false |
|
|
|
if (code === 0) { |
|
|
|
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) |
|
|
|
} |
|
|
@ -95,20 +116,55 @@ export default { |
|
|
|
if (!value) return true; |
|
|
|
return data.name.indexOf(value) !== -1; |
|
|
|
}, |
|
|
|
// 开启加载动画 |
|
|
|
startLoading () { |
|
|
|
loading = Loading.service({ |
|
|
|
lock: true, // 是否锁定 |
|
|
|
text: '正在加载……', // 加载中需要显示的文字 |
|
|
|
background: 'rgba(0,0,0,.7)' // 背景颜色 |
|
|
|
}) |
|
|
|
// 获取组织列表 |
|
|
|
async getAgencyTree(){ |
|
|
|
const url = '/data/aggregator/org/agencytree' |
|
|
|
|
|
|
|
let params = { |
|
|
|
agencyId:this.agencyId, |
|
|
|
client:'gov' |
|
|
|
} |
|
|
|
|
|
|
|
const { data, code, msg } = await requestPost(url,params) |
|
|
|
|
|
|
|
if (code === 0) { |
|
|
|
let _data |
|
|
|
if (data) { |
|
|
|
_data = this.removeByOrgType(data, 'agency') |
|
|
|
if (_data) { |
|
|
|
this.agencytree = this.removeEmptySubOrgList(_data) |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.$message.error(msg) |
|
|
|
} |
|
|
|
}, |
|
|
|
// 结束加载动画 |
|
|
|
endLoading () { |
|
|
|
// clearTimeout(timer); |
|
|
|
if (loading) { |
|
|
|
loading.close() |
|
|
|
} |
|
|
|
removeByOrgType (orgArray, orgType) { |
|
|
|
if (orgArray && orgArray.length > 0) { |
|
|
|
for (let p = orgArray.length - 1; p >= 0; p--) { |
|
|
|
let orgInfo = orgArray[p] |
|
|
|
if (orgInfo) { |
|
|
|
if (orgInfo.orgType !== orgType) { |
|
|
|
orgArray.splice(p, 1) |
|
|
|
} else { |
|
|
|
this.removeByOrgType(orgInfo.subOrgList, orgType) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return orgArray |
|
|
|
}, |
|
|
|
removeEmptySubOrgList (orgArray) { |
|
|
|
orgArray.forEach((orgInfo) => { |
|
|
|
if (orgInfo && orgInfo.subOrgList) { |
|
|
|
if (orgInfo.subOrgList.length === 0) { |
|
|
|
orgInfo.subOrgList = undefined |
|
|
|
} else { |
|
|
|
this.removeEmptySubOrgList(orgInfo.subOrgList) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
return orgArray; |
|
|
|
} |
|
|
|
}, |
|
|
|
watch: { |
|
|
@ -122,7 +178,15 @@ export default { |
|
|
|
} |
|
|
|
</script> |
|
|
|
<style lang="scss" scoped > |
|
|
|
.div_search { |
|
|
|
width: calc(100% - 5px); |
|
|
|
background: #ffffff; |
|
|
|
border-radius: 4px; |
|
|
|
padding: 30px 20px 5px; |
|
|
|
box-shadow: 0px 2px 12px 0px rgba(0, 0, 0, 0.1); |
|
|
|
} |
|
|
|
.div_main { |
|
|
|
margin-top: 10px; |
|
|
|
display: flex; |
|
|
|
} |
|
|
|
.scrollar { |
|
|
|