Browse Source

党员中心户

shibei_master
zhaoyongnian 3 years ago
parent
commit
f94df233cf
  1. 177
      src/views/modules/plugins/power/kernelhousehold.vue
  2. 180
      src/views/modules/plugins/power/kernelhouseholdForm.vue
  3. 217
      src/views/modules/plugins/power/kernelhouseholdTable.vue

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

@ -0,0 +1,177 @@
<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 :style="{height:rowHeight}"
class="div_table">
<kernelhousehold-table :axisStructId="axisStructId" ref="ref_communityTable"></kernelhousehold-table>
</div>
</div>
</template>
<script>
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 {
filterText: '',
treeLoading: true,
treeData: [],
defaultProps: {
children: 'children',
label: 'name'
},
selTreeObj: {},
centerPoint: [],
axisStructId: '' // id
}
},
async mounted () {
this.treeLoading = true
await this.loadTree()
this.treeLoading = false
},
computed: {
rowHeight () {
return this.$store.state.inIframe ? this.clientHeight - 120 + this.iframeHeight + 'px' : this.clientHeight - 120 + 'px'
},
treeHeight () {
return this.$store.state.inIframe ? this.clientHeight - 200 + this.iframeHeight + 'px' : this.clientHeight - 200 + 'px'
},
...mapGetters(['clientHeight', 'iframeHeight'])
},
methods: {
async loadTree (isRefresh) {
const url = "/pli/power/data/axis/structTree"
let params = {
agencyId: '1495655378069753857'
}
const { data, code, msg } = await requestPost(url, params)
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)
}
},
handleNodeClick (obj) {
this.axisStructId = obj.id
},
filterNode (value, data) {
if (!value) return true;
return data.name.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);
}
},
components: {
kernelhouseholdTable, CDialog
}
}
</script>
<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_btn {
margin-top: 20px;
}
.row {
padding: 10px;
}
</style>
<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>

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

@ -0,0 +1,180 @@
<template>
<div>
<div class="dialog-h-content scroll-h">
<div>
<div class="div_search">
<div class="resi-cell">
<div class="resi-cell-label">房屋</div>
<div class="resi-cell-value">
<el-input v-model="keyword"
style="width:350px"
class="resi-cell-input"
size="small"
clearable
placeholder="请输入“小区名称,楼号,如:亿联小区,1号楼">
</el-input>
</div>
</div>
<el-button style="margin-left:10px"
class="diy-button--search"
size="small"
@click="handleSearch">查询</el-button>
</div>
<div class="div_table">
<el-table ref="ref_table"
:data="tableData"
border
:height="tableHeight"
v-loading="tableLoading"
:header-cell-style="{background:'#2195FE',color:'#FFFFFF'}"
style="width: 100%"
@selection-change="selectionChange">
<el-table-column type="selection"
width="55">
</el-table-column>
<el-table-column prop="houseName"
label="房屋名称">
</el-table-column>
<el-table-column prop="neighborHoodName"
label="所属小区">
</el-table-column>
<el-table-column prop="buildingName"
label="所属楼栋">
</el-table-column>
<el-table-column prop="ownerName"
label="房主姓名">
</el-table-column>
<el-table-column prop="ownerPhone"
label="房主电话">
</el-table-column>
</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>
</div>
</div>
</div>
<div class="div_btn">
<el-button size="small"
@click="handleCancle"> </el-button>
<el-button size="small"
type="primary"
:disabled="btnDisable"
@click="handleComfirm"> </el-button>
</div>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import { requestPost } from "@/js/dai/request";
export default {
data () {
return {
btnDisable: false,
keyword: '',
//
tableData: [],
tableLoading: false,
selection: [],
total: 0,
pageSize: 20,
pageNo: 0,
}
},
props: {
axisStructId: { // id
type: String,
default: ''
}
},
computed: {
tableHeight () {
return this.$store.state.inIframe ? this.clientHeight - 300 + this.iframeHeight : this.clientHeight - 300
},
...mapGetters(['clientHeight', 'iframeHeight'])
},
components: {},
// mounted () {
// this.tableLoading = true
// this.loadTable()
// },
methods: {
//
handleSearch() {
this.tableLoading = true
this.loadTable()
},
selectionChange (selection) {
this.selection = []
selection.forEach(element => {
this.selection.push(element.houseId)
});
},
handleSizeChange (val) {
this.pageSize = val
this.pageNo = 1
this.loadTable()
},
handleCurrentChange (val) {
this.pageNo = val
this.loadTable()
},
//
async handleComfirm () {
if (this.selection.length === 0 || !this.selection) {
return this.$message.error('请选择房屋')
}
const url = "/pli/power/kernelHousehold/bind";
let params = {
axisStructId: this.axisStructId,
houseIdList: this.selection
}
const { data, code, msg } = await requestPost(url, params);
this.tableLoading = false
if (code === 0) {
this.$emit('dialogOk')
}
},
//
handleCancle () {
this.$emit('dialogCancle')
},
//
async loadTable () {
const url = "/gov/org/house/search";
let params = {
keyword: this.keyword,
pageSize: this.pageSize,
pageNo: this.pageNo
}
const { data, code, msg } = await requestPost(url, params);
this.tableLoading = false
if (code === 0) {
this.total = data.total || 0;
this.tableData = data.list ? data.list.map((item) => { return item }) : []
}
}
},
}
</script>
<style lang="scss" scoped >
@import "@/assets/scss/modules/visual/communityManage.scss";
</style>
<style lang="scss" scoped>
.div_btn{
display: flex;
align-items: center;
justify-content: center;
}
</style>

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

@ -0,0 +1,217 @@
<template>
<div>
<div class="div_search">
<div class="resi-cell">
<div class="resi-cell-label">房主姓名</div>
<div class="resi-cell-value">
<el-input v-model="ownerName"
class="resi-cell-input"
size="small"
clearable
placeholder="请输入内容">
</el-input>
</div>
</div>
<el-button style="margin-left:10px"
class="diy-button--search"
size="small"
@click="handleSearch">查询</el-button>
</div>
<div class="div_btn">
<el-button style=""
class="diy-button--add"
size="small"
@click="handleAdd">绑定</el-button>
</div>
<div class="div_table">
<el-table ref="ref_table"
:data="tableData"
border
:height="tableHeight"
v-loading="tableLoading"
:header-cell-style="{background:'#2195FE',color:'#FFFFFF'}"
style="width: 100%">
<el-table-column prop="ownerName"
label="姓名"
width="100">
</el-table-column>
<el-table-column prop="address"
label="地址">
</el-table-column>
<el-table-column label="操作"
fixed="right"
width="80"
header-align="center"
align="center"
class="operate">
<template slot-scope="scope">
<el-button type="text"
class="div-table-button--delete"
size="small"
@click="handleDelete(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</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>
</div>
<!-- 修改弹出框 -->
<el-dialog :visible.sync="formShow"
:close-on-click-modal="false"
:close-on-press-escape="false"
:title="formTitle"
width="850px"
top="5vh"
class="dialog-h"
@closed="diaClose">
<kernelhousehold-form ref="ref_form"
@dialogCancle="addFormCancle"
@dialogOk="addFormOk"
:axisStructId="axisStructId"></kernelhousehold-form>
</el-dialog>
</div>
</template>
<script>
import KernelhouseholdForm from './kernelhouseholdForm'
import { requestPost } from "@/js/dai/request";
import { mapGetters } from 'vuex'
export default {
data () {
return {
total: 0,
pageSize: 20,
pageNo: 0,
tableLoading: false,
ownerName: '',
tableData: [],
//form
formShow: false,
formTitle: '绑定'
}
},
components: {
KernelhouseholdForm
},
computed: {
tableHeight () {
return this.$store.state.inIframe ? this.clientHeight - 300 + this.iframeHeight : this.clientHeight - 300
},
...mapGetters(['clientHeight', 'iframeHeight'])
},
methods: {
async loadTable () {
this.tableLoading = true
const url = "/pli/power/kernelHousehold/page"
let params = {
pageSize: this.pageSize,
pageNo: this.pageNo,
axisStructId: this.axisStructId,
ownerName: this.ownerName
}
const { data, code, msg, total } = await requestPost(url, params)
if (code === 0) {
this.total = data.total || 0;
this.tableData = data.list ? data.list.map((item) => { return item }) : []
} else {
this.$message.error(msg)
}
this.tableLoading = false
},
//
async handleDelete (id) {
this.$confirm("确认删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.deleteKernelhousehold(id)
}).catch(err => {
console.log('取消删除')
})
},
async deleteKernelhousehold (id) {
const url = "/pli/power/kernelHousehold/delete"
const { data, code, msg } = await requestPost(url, [id])
if (code === 0) {
this.$message({
type: "success",
message: "删除成功"
});
this.loadTable()
} else {
this.$message.error(msg)
}
},
handleSizeChange (val) {
this.pageSize = val
this.pageNo = 1
this.loadTable()
},
handleCurrentChange (val) {
this.pageNo = val
this.loadTable()
},
handleSearch () {
if (!this.axisStructId) {
return this.$message.error('请选择动力主轴节点')
}
this.loadTable()
},
diaClose () {
// this.$refs.ref_form.resetData()
this.formShow = false
},
handleAdd () {
if (this.axisStructId) {
this.formShow = true
} else {
return this.$message.error('请选择动力主轴节点')
}
},
addFormCancle () {
this.formShow = false
},
addFormOk () {
this.formShow = false
this.loadTable()
},
},
props: {
axisStructId: {
type: String,
default: '',
}
},
watch: {
axisStructId (newName) {
if (newName) {
this.pageSize = 20
this.pageNo = 1
this.loadTable()
}
}
},
}
</script>
<style lang="scss" scoped >
@import "@/assets/scss/modules/visual/communityManage.scss";
</style>
<style >
.el-message.is-closable .el-message__content {
line-height: 20px;
}
</style>
Loading…
Cancel
Save