Browse Source

党员中心户

shibei_master
zhaoyongnian 3 years ago
parent
commit
d86deddcfb
  1. 182
      src/views/modules/plugins/power/kernelhousehold.vue
  2. 2
      src/views/modules/plugins/power/kernelhouseholdForm.vue
  3. 2
      src/views/modules/plugins/power/kernelhouseholdTable.vue

182
src/views/modules/plugins/power/kernelhousehold.vue

@ -1,31 +1,48 @@
<template> <template>
<div class="div_main"> <div>
<div :style="{height:rowHeight}" <div class="div_search">
class="div_tree"> <el-form :rules="dataRule" :inline="true">
<el-input placeholder="输入关键字进行过滤" <el-form-item label="所属组织" prop="deptName">
v-model="filterText"> <el-cascader
</el-input> style="width:350px"
<el-scrollbar :style="{height:treeHeight}" placeholder="请选择所属组织"
class="scrollar"> :options="agencytree"
<el-tree ref="ref_tree" v-model="agencyId"
v-loading="treeLoading" :props="{ expandTrigger: 'hover', label: 'orgName', value: 'orgId', children: 'subOrgList' }"
class="filter_tree" clearable/>
:data="treeData" </el-form-item>
:props="defaultProps" <el-form-item>
:highlight-current="true" <el-button type="primary" icon="el-icon-search" size="mini" @click="loadTree()">加载动力主轴</el-button>
node-key="id" </el-form-item>
:expand-on-click-node="false" </el-form>
default-expand-all
:filter-node-method="filterNode"
@node-click="handleNodeClick">
</el-tree>
</el-scrollbar>
</div> </div>
<div :style="{height:rowHeight}" <div class="div_main">
class="div_table"> <div :style="{height:rowHeight}"
<kernelhousehold-table :axisStructId="axisStructId" ref="ref_communityTable"></kernelhousehold-table> 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>
</div> </div>
</template> </template>
@ -34,14 +51,13 @@ import CDialog from '@c/CDialog'
import kernelhouseholdTable from './kernelhouseholdTable' import kernelhouseholdTable from './kernelhouseholdTable'
import { requestPost } from "@/js/dai/request"; import { requestPost } from "@/js/dai/request";
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { Loading } from 'element-ui' // Loading
let loading //
export default { export default {
data () { data () {
return { return {
agencytree: [], //
agencyId: '',
filterText: '', filterText: '',
treeLoading: true, treeLoading: false,
treeData: [], treeData: [],
defaultProps: { defaultProps: {
children: 'children', children: 'children',
@ -53,37 +69,42 @@ export default {
} }
}, },
async mounted () { async mounted () {
this.treeLoading = true // this.treeLoading = true
await this.loadTree() // await this.loadTree()
this.treeLoading = false await this.getAgencyTree()
// this.treeLoading = false
}, },
computed: { computed: {
rowHeight () { 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 () { 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: { 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" const url = "/pli/power/data/axis/structTree"
let params = { let params = {
agencyId: '1495655378069753857' agencyId: this.agencyId[this.agencyId.length-1]
} }
const { data, code, msg } = await requestPost(url, params) const { data, code, msg } = await requestPost(url, params)
this.treeLoading = false
if (code === 0) { if (code === 0) {
this.treeData = data 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 { } else {
this.$message.error(msg) this.$message.error(msg)
} }
@ -95,20 +116,55 @@ export default {
if (!value) return true; if (!value) return true;
return data.name.indexOf(value) !== -1; return data.name.indexOf(value) !== -1;
}, },
// //
startLoading () { async getAgencyTree(){
loading = Loading.service({ const url = '/data/aggregator/org/agencytree'
lock: true, //
text: '正在加载……', // let params = {
background: 'rgba(0,0,0,.7)' // 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)
}
}, },
// removeByOrgType (orgArray, orgType) {
endLoading () { if (orgArray && orgArray.length > 0) {
// clearTimeout(timer); for (let p = orgArray.length - 1; p >= 0; p--) {
if (loading) { let orgInfo = orgArray[p]
loading.close() 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: { watch: {
@ -122,7 +178,15 @@ export default {
} }
</script> </script>
<style lang="scss" scoped > <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 { .div_main {
margin-top: 10px;
display: flex; display: flex;
} }
.scrollar { .scrollar {

2
src/views/modules/plugins/power/kernelhouseholdForm.vue

@ -97,7 +97,7 @@ export default {
}, },
computed: { computed: {
tableHeight () { tableHeight () {
return this.$store.state.inIframe ? this.clientHeight - 300 + this.iframeHeight : this.clientHeight - 300 return this.$store.state.inIframe ? this.clientHeight - 410 + this.iframeHeight : this.clientHeight - 410
}, },
...mapGetters(['clientHeight', 'iframeHeight']) ...mapGetters(['clientHeight', 'iframeHeight'])
}, },

2
src/views/modules/plugins/power/kernelhouseholdTable.vue

@ -105,7 +105,7 @@ export default {
}, },
computed: { computed: {
tableHeight () { tableHeight () {
return this.$store.state.inIframe ? this.clientHeight - 300 + this.iframeHeight : this.clientHeight - 300 return this.$store.state.inIframe ? this.clientHeight - 410 + this.iframeHeight : this.clientHeight - 410
}, },
...mapGetters(['clientHeight', 'iframeHeight']) ...mapGetters(['clientHeight', 'iframeHeight'])
}, },

Loading…
Cancel
Save