62 changed files with 5498 additions and 1759 deletions
|
After Width: | Height: | Size: 8.8 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1,685 @@ |
|||
<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> |
|||
<div class="resi-cell"> |
|||
<div class="resi-cell-label">房主手机</div> |
|||
<div class="resi-cell-value"> |
|||
<el-input v-model="ownerPhone" |
|||
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> |
|||
<el-button style="margin-left:10px" |
|||
class="diy-button--reset" |
|||
size="small" |
|||
@click="resetSearch">重置</el-button> |
|||
</div> |
|||
<div class="div_btn"> |
|||
|
|||
<el-button style="float:left" |
|||
class="diy-button--add" |
|||
size="small" |
|||
@click="handleAdd">新增楼栋</el-button> |
|||
<div class="btn_upload" |
|||
v-if="showImportBtn"> |
|||
<el-button style=";margin-left:10px" |
|||
class="diy-button--export" |
|||
size="small" |
|||
@click="handleExportModule('building')">下载楼栋模板</el-button> |
|||
|
|||
<el-upload style="" |
|||
ref="upload_building" |
|||
:multiple='false' |
|||
:show-file-list='false' |
|||
:before-upload="((file)=>{beforeUpload(file, 'building')})" |
|||
action="" |
|||
accept=".xls,.xlsx" |
|||
:http-request="(()=>{uploadFile( 'building')})"> |
|||
<el-button style="margin-left:10px" |
|||
size="small" |
|||
class="diy-button--delete">导入楼栋数据</el-button> |
|||
</el-upload> |
|||
<el-button style=";margin-left:10px" |
|||
class="diy-button--export" |
|||
size="small" |
|||
@click="handleExportModule('room')">下载房屋模板</el-button> |
|||
|
|||
<el-upload style="" |
|||
ref="upload_room" |
|||
:multiple='false' |
|||
:show-file-list='false' |
|||
:before-upload="((file)=>{beforeUpload(file, 'room')})" |
|||
action="" |
|||
accept=".xls,.xlsx" |
|||
:http-request="(()=>{uploadFile( 'room')})"> |
|||
<el-button style="margin-left:10px" |
|||
size="small" |
|||
class="diy-button--delete">导入房屋数据</el-button> |
|||
</el-upload> |
|||
</div> |
|||
<el-button style="float:left;margin-left:10px" |
|||
class="diy-button--reset" |
|||
size="small" |
|||
@click="handleExport">导出</el-button> |
|||
<el-button style="float:left;margin-left:10px" |
|||
class="diy-button--more" |
|||
size="small" |
|||
@click="deleteBatch">批量删除</el-button> |
|||
</div> |
|||
|
|||
<div class="div_table"> |
|||
<el-table ref="ref_table" |
|||
:data="tableData" |
|||
:header-cell-style="{background:'#2195FE',color:'#FFFFFF'}" |
|||
border |
|||
:height="tableHeight" |
|||
v-loading="tableLoading" |
|||
style="width: 100%" |
|||
@select-all="selectAll" |
|||
@selection-change="selectionChange"> |
|||
<el-table-column type="selection" |
|||
:selectable="checkSelect" |
|||
width="55"> |
|||
</el-table-column> |
|||
<el-table-column prop="buildingName" |
|||
label="楼栋名称" |
|||
min-width="180"> |
|||
</el-table-column> |
|||
<el-table-column prop="neighborHoodName" |
|||
label="所属小区" |
|||
min-width="160"> |
|||
</el-table-column> |
|||
<el-table-column prop="buildingType" |
|||
label="楼栋类型" |
|||
min-width="140"> |
|||
</el-table-column> |
|||
<el-table-column prop="totalUnitNum" |
|||
label="单元数"> |
|||
</el-table-column> |
|||
<el-table-column prop="totalFloorNum" |
|||
label="层数"> |
|||
</el-table-column> |
|||
<el-table-column prop="totalHouseNum" |
|||
label="总户数"> |
|||
</el-table-column> |
|||
|
|||
<el-table-column label="操作" |
|||
fixed="right" |
|||
width="140" |
|||
header-align="center" |
|||
align="center" |
|||
class="operate"> |
|||
<template slot-scope="scope"> |
|||
<!-- <el-button type="text" |
|||
style="color:#feb349;text-decoration: underline;" |
|||
size="small" |
|||
@click="handleToNextLevel(scope.row)">进入</el-button> --> |
|||
<el-button type="text" |
|||
class="div-table-button--detail" |
|||
size="small" |
|||
@click="handleDetail(scope.row)">查看</el-button> |
|||
<el-button v-if="scope.row.showBtn" |
|||
type="text" |
|||
class="div-table-button--edit" |
|||
size="small" |
|||
@click="handleEdit(scope.row)">修改</el-button> |
|||
|
|||
<el-button v-if="scope.row.showBtn" |
|||
type="text" |
|||
class="div-table-button--delete" |
|||
size="small" |
|||
@click="handleDelete(scope.row)">删除</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" |
|||
top="5vh" |
|||
width="900px" |
|||
class="dialog-h" |
|||
@closed="diaClose"> |
|||
<build-form ref="ref_form" |
|||
@dialogCancle="addFormCancle" |
|||
@dialogOk="addFormOk"></build-form> |
|||
</el-dialog> |
|||
|
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
|
|||
import BuildForm from './buildForm' |
|||
|
|||
import { requestPost } from "@/js/dai/request"; |
|||
import { mapGetters } from 'vuex' |
|||
import { Loading } from 'element-ui' // 引入Loading服务 |
|||
|
|||
let loading // 加载动画 |
|||
export default { |
|||
data () { |
|||
return { |
|||
importBuildingLoading: false, |
|||
importRoomLoading: false, |
|||
total: 0, |
|||
pageSize: 20, |
|||
pageNo: 0, |
|||
tableLoading: true, |
|||
|
|||
|
|||
agencyObj: {},//树所选的小区对象 |
|||
ownerName: '', |
|||
ownerPhone: '', |
|||
validTableDataNum: 0,//有效的数据数量,即有权限操作的数据数量 |
|||
selection: [], |
|||
|
|||
|
|||
//form相关 |
|||
formShow: false, |
|||
formTitle: '新增楼栋', |
|||
|
|||
} |
|||
}, |
|||
components: { |
|||
BuildForm |
|||
}, |
|||
async mounted () { |
|||
console.log('building11111111111111111111111111') |
|||
}, |
|||
computed: { |
|||
tableHeight () { |
|||
|
|||
return this.$store.state.inIframe ? this.clientHeight - 300 + this.iframeHeight : this.clientHeight - 300 |
|||
|
|||
}, |
|||
|
|||
...mapGetters(['clientHeight', 'iframeHeight']) |
|||
}, |
|||
methods: { |
|||
//重置搜索条件 |
|||
resetSearch () { |
|||
this.ownerName = '' |
|||
this.ownerPhone = '' |
|||
|
|||
this.pageSize = 10 |
|||
this.pageNo = 0 |
|||
// this.loadTable() |
|||
}, |
|||
handleSearch () { |
|||
this.loadTable() |
|||
}, |
|||
|
|||
checkSelect (row, index) { |
|||
let isChecked = false; |
|||
if (row.showBtn) { // 判断里面是否存在某个参数 |
|||
isChecked = true |
|||
} else { |
|||
isChecked = false |
|||
} |
|||
return isChecked |
|||
}, |
|||
|
|||
async loadTable (fromTree, treeObj) { |
|||
this.tableLoading = true |
|||
if (fromTree) { |
|||
|
|||
this.agencyObj = treeObj |
|||
|
|||
// if (this.agencyObj.pid === this.staffAgencyId) {//如果所选树的父级组织id和登录人员id相同,有权限 |
|||
// this.showImportBtn = true |
|||
// } else { |
|||
// this.showImportBtn = false |
|||
// } |
|||
} |
|||
|
|||
|
|||
console.log(this.agencyObj) |
|||
const url = "/gov/org/building/buildinglist" |
|||
let params = { |
|||
pageSize: this.pageSize, |
|||
pageNo: this.pageNo, |
|||
ownerName: this.ownerName, |
|||
ownerPhone: this.ownerPhone, |
|||
neighborHoodId: this.agencyObj.id |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
this.validTableDataNum = 0 |
|||
this.total = data.total |
|||
data.list.forEach(item => { |
|||
if (item.agencyId === this.staffAgencyId) { |
|||
item.showBtn = true |
|||
this.validTableDataNum++ |
|||
} else { |
|||
item.showBtn = false |
|||
} |
|||
|
|||
}); |
|||
this.tableData = data.list |
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
this.tableLoading = false |
|||
}, |
|||
|
|||
diaClose () { |
|||
this.$refs.ref_form.resetData() |
|||
this.formShow = false |
|||
}, |
|||
|
|||
handleDetail (row) { |
|||
this.formTitle = '楼栋详情' |
|||
this.formShow = true |
|||
this.$nextTick(() => { |
|||
this.$refs.ref_form.initForm('detail', row, this.agencyObj) |
|||
}) |
|||
}, |
|||
|
|||
handleAdd () { |
|||
this.formTitle = '新增楼栋' |
|||
this.formShow = true |
|||
this.$nextTick(() => { |
|||
this.$refs.ref_form.initForm('add', null, this.agencyObj) |
|||
}) |
|||
}, |
|||
|
|||
handleEdit (row) { |
|||
this.formTitle = '修改楼栋' |
|||
this.formShow = true |
|||
this.$nextTick(() => { |
|||
this.$refs.ref_form.initForm('edit', row, this.agencyObj) |
|||
}) |
|||
}, |
|||
|
|||
handleToNextLevel (row) { |
|||
this.$emit('toNextLevel', row, 'building') |
|||
}, |
|||
|
|||
addFormCancle () { |
|||
this.formShow = false |
|||
}, |
|||
addFormOk () { |
|||
this.formShow = false |
|||
this.loadTable() |
|||
this.$emit('refreshTree') |
|||
}, |
|||
|
|||
|
|||
deleteBatch () { |
|||
if (this.selection.length > 0) { |
|||
this.$confirm("确认删除选择的楼栋?", "提示", { |
|||
confirmButtonText: "确定", |
|||
cancelButtonText: "取消", |
|||
type: "warning" |
|||
}) |
|||
.then(() => { |
|||
this.deleteCommunityBatch() |
|||
}) |
|||
.catch(err => { |
|||
if (err == "cancel") { |
|||
// this.$message({ |
|||
// type: "info", |
|||
// message: "已取消删除" |
|||
// }); |
|||
} |
|||
|
|||
}); |
|||
} else { |
|||
this.$message.warning('请先选择要删除的楼栋') |
|||
} |
|||
}, |
|||
selectAll (selection) { |
|||
this.selection = selection |
|||
|
|||
}, |
|||
selectionChange (selection) { |
|||
this.selection = selection |
|||
|
|||
}, |
|||
async handleDelete (row) { |
|||
|
|||
this.$confirm("确认删除?", "提示", { |
|||
confirmButtonText: "确定", |
|||
cancelButtonText: "取消", |
|||
type: "warning" |
|||
}) |
|||
.then(() => { |
|||
this.deleteBuild(row) |
|||
}) |
|||
.catch(err => { |
|||
if (err == "cancel") { |
|||
// this.$message({ |
|||
// type: "info", |
|||
// message: "已取消删除" |
|||
// }); |
|||
} |
|||
|
|||
}); |
|||
|
|||
|
|||
}, |
|||
|
|||
async deleteCommunityBatch () { |
|||
let ids = [] |
|||
this.selection.forEach(element => { |
|||
|
|||
ids.push(element.buildingId) |
|||
}); |
|||
|
|||
const url = "/gov/org/house/delete" |
|||
|
|||
let params = { |
|||
type: 'building', |
|||
ids: ids |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
this.$message({ |
|||
type: "success", |
|||
message: "删除成功" |
|||
}); |
|||
this.$emit('refreshTree') |
|||
this.loadTable() |
|||
} else if (code > 8000) { |
|||
this.$message({ |
|||
showClose: true, |
|||
message: msg, |
|||
duration: 0 |
|||
}) |
|||
this.$emit('refreshTree') |
|||
this.loadTable() |
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
}, |
|||
|
|||
async deleteBuild (row) { |
|||
const url = "/gov/org/building/buildingdel" |
|||
|
|||
let params = { |
|||
buildingId: row.buildingId |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
this.$message({ |
|||
type: "success", |
|||
message: "删除成功" |
|||
}); |
|||
this.$emit('refreshTree') |
|||
this.loadTable() |
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
}, |
|||
|
|||
//导出表格 |
|||
async handleExport () { |
|||
let title = this.agencyObj.label |
|||
title = title + '—楼栋列表' |
|||
|
|||
const url = "/gov/org/building/exportbuildinginfo" |
|||
let params = { |
|||
ownerName: this.ownerName, |
|||
ownerPhone: this.ownerPhone, |
|||
neighborHoodId: this.agencyObj.id |
|||
} |
|||
|
|||
app.ajax.exportFilePost( |
|||
url, |
|||
params, |
|||
(data, rspMsg) => { |
|||
|
|||
this.download(data, title + '.xls') |
|||
}, |
|||
(rspMsg, data) => { |
|||
this.$message.error(rspMsg); |
|||
} |
|||
); |
|||
|
|||
}, |
|||
|
|||
// 下载文件 |
|||
download (data, fileName) { |
|||
if (!data) { |
|||
return |
|||
} |
|||
|
|||
var csvData = new Blob([data]) |
|||
|
|||
if (window.navigator && window.navigator.msSaveOrOpenBlob) { |
|||
window.navigator.msSaveOrOpenBlob(csvData, fileName); |
|||
} |
|||
// for Non-IE (chrome, firefox etc.) |
|||
else { |
|||
var a = document.createElement('a'); |
|||
document.body.appendChild(a); |
|||
a.style = 'display: none'; |
|||
var url = window.URL.createObjectURL(csvData); |
|||
a.href = url; |
|||
a.download = fileName; |
|||
a.click(); |
|||
a.remove(); |
|||
window.URL.revokeObjectURL(url); |
|||
} |
|||
|
|||
}, |
|||
|
|||
handleExportModule (type) { |
|||
|
|||
let title = '' |
|||
let url = "" |
|||
if (type === 'building') { |
|||
title = '楼栋导入模板' |
|||
url = '/gov/org/building/exporttemplate' |
|||
|
|||
} else if (type === 'room') { |
|||
title = '房屋导入模板' |
|||
url = '/gov/org/house/exporttemplate' |
|||
} |
|||
|
|||
|
|||
let params = {} |
|||
|
|||
app.ajax.exportFilePost( |
|||
url, |
|||
params, |
|||
(data, rspMsg) => { |
|||
|
|||
this.download(data, title + '.xls') |
|||
}, |
|||
(rspMsg, data) => { |
|||
this.$message.error(rspMsg); |
|||
} |
|||
); |
|||
}, |
|||
|
|||
|
|||
// 上传文件之前的钩子 |
|||
beforeUpload (file, type) { |
|||
this.files = file; |
|||
|
|||
const isText = file.type === 'application/vnd.ms-excel' |
|||
const isTextComputer = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' |
|||
|
|||
if (!isText && !isTextComputer) { |
|||
this.$message.error('请选择正确格式的文件') |
|||
this.files = null |
|||
this.fileName = '' |
|||
return false |
|||
} else { |
|||
this.fileName = file.name; |
|||
return true |
|||
} |
|||
|
|||
}, |
|||
// 上传文件个数超过定义的数量 |
|||
handleExceed (files, fileList) { |
|||
this.$message.warning(`当前限制选择 1 个文件,请删除后继续上传`) |
|||
}, |
|||
|
|||
async uploadFile (type) { |
|||
if (this.fileName == "") { |
|||
this.$message.warning('请选择要上传的文件!') |
|||
return false |
|||
} |
|||
this.$message({ |
|||
showClose: true, |
|||
message: '导入中,请到系统管理-导入记录中查看进度', |
|||
duration: 0 |
|||
}) |
|||
|
|||
|
|||
//清空上传列表 |
|||
let url = '' |
|||
let params = {} |
|||
let fileFormData = new FormData(); |
|||
fileFormData.append('file', this.files);//filename是键,file是值,就是要传的文件,test.zip是要传的文件名 |
|||
fileFormData.append('orgId', this.agencyObj.id);//filename是键,file是值,就是要传的文件,test.zip是要传的文件名 |
|||
fileFormData.append('orgType', this.agencyObj.level);//filename是键,file是值,就是要传的文件,test.zip是要传的文件名 |
|||
|
|||
// params.file = fileFormData |
|||
// params.orgId = this.agencyObj.id |
|||
// params.orgType = this.agencyObj.level |
|||
|
|||
if (type === 'building') { |
|||
this.$refs['upload_building'].clearFiles() |
|||
// url = 'http://192.168.51.26:8080/api/gov/org/building/buildingimport' |
|||
url = '/gov/org/building/buildingimport' |
|||
this.importBuildingLoading = true |
|||
|
|||
} else if (type === 'room') { |
|||
this.$refs['upload_room'].clearFiles() |
|||
// url = 'http://192.168.51.26:8080/api/gov/org/house/houseimport' |
|||
url = '/gov/org/house/houseimport' |
|||
this.importRoomLoading = true |
|||
} |
|||
|
|||
window.app.ajax.post2(url, fileFormData, |
|||
(data, rspMsg) => { |
|||
|
|||
if (data.code === 0 && data.msg == 'success') { |
|||
// this.$message.success('导入成功') |
|||
} else { |
|||
// this.$message({ |
|||
// showClose: true, |
|||
// message: rspMsg, |
|||
// duration: 0, |
|||
// type: "error" |
|||
// }) |
|||
// this.$message.error(rspMsg) |
|||
} |
|||
this.$emit('refreshTree') |
|||
this.loadTable() |
|||
if (type === 'building') { |
|||
this.importBuildingLoading = false |
|||
|
|||
} else if (type === 'room') { |
|||
this.importRoomLoading = false |
|||
} |
|||
}, |
|||
(rspMsg, data) => { |
|||
if (type === 'building') { |
|||
this.importBuildingLoading = false |
|||
|
|||
} else if (type === 'room') { |
|||
this.importRoomLoading = false |
|||
} |
|||
}, { headers: { 'Content-Type': 'multipart/form-data' } }) |
|||
|
|||
}, |
|||
|
|||
showMessage (msg) { |
|||
this.$alert(msg, '操作结果', { |
|||
confirmButtonText: '关闭', |
|||
callback: action => { |
|||
this.$emit('refreshTree') |
|||
this.loadTable() |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
handleSizeChange (val) { |
|||
this.pageSize = val |
|||
this.pageNo = 1 |
|||
this.loadTable() |
|||
}, |
|||
handleCurrentChange (val) { |
|||
this.pageNo = val |
|||
this.loadTable() |
|||
}, |
|||
|
|||
// 开启加载动画 |
|||
startLoading () { |
|||
loading = Loading.service({ |
|||
lock: true, // 是否锁定 |
|||
text: '正在加载……', // 加载中需要显示的文字 |
|||
background: 'rgba(0,0,0,.7)' // 背景颜色 |
|||
}) |
|||
}, |
|||
// 结束加载动画 |
|||
endLoading () { |
|||
// clearTimeout(timer); |
|||
if (loading) { |
|||
loading.close() |
|||
} |
|||
} |
|||
}, |
|||
watch: { |
|||
|
|||
}, |
|||
props: { |
|||
staffAgencyId: { |
|||
type: String, |
|||
default: '', |
|||
}, |
|||
showImportBtn: { |
|||
type: Boolean, |
|||
default: false, |
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
<style lang="scss" scoped > |
|||
@import "@/assets/scss/modules/visual/communityManage.scss"; |
|||
</style> |
|||
@ -0,0 +1,341 @@ |
|||
<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"> |
|||
|
|||
<build-table v-if="selTreeObj.level==='neighborHood'" |
|||
ref="ref_neighTable" |
|||
:staffAgencyId="staffAgencyId" |
|||
:showImportBtn="showImportBtn" |
|||
@toNextLevel="toNextLevel" |
|||
@refreshTree="refreshTree"></build-table> |
|||
<room-table v-else-if="selTreeObj.level==='building'" |
|||
:staffAgencyId="staffAgencyId" |
|||
:showImportBtn="showImportBtn" |
|||
ref="ref_buildingTable" |
|||
@refreshTree="refreshTree"></room-table> |
|||
<community-table v-else |
|||
@toNextLevel="toNextLevel" |
|||
:staffAgencyId="staffAgencyId" |
|||
ref="ref_communityTable" |
|||
@refreshTree="refreshTree"></community-table> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import CDialog from '@c/CDialog' |
|||
import communityTable from './communityTable' |
|||
import buildTable from './buildTable' |
|||
import roomTable from './roomTable' |
|||
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: 'showName' |
|||
}, |
|||
|
|||
selTreeObj: {}, |
|||
|
|||
centerPoint: [], |
|||
staffAgencyId: localStorage.getItem("agencyId"), |
|||
showImportBtn: false |
|||
|
|||
} |
|||
}, |
|||
components: { |
|||
CDialog |
|||
}, |
|||
async mounted () { |
|||
this.treeLoading = true |
|||
await this.loadOrgData() |
|||
await this.loadTree() |
|||
|
|||
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 - 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 = "/gov/org/building/treelist" |
|||
let params = {} |
|||
|
|||
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) |
|||
} |
|||
}, |
|||
|
|||
//加载组织数据 |
|||
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.getTreeObj(obj) |
|||
|
|||
this.$nextTick(() => { |
|||
|
|||
if (obj.level === 'building') {//点击楼栋 |
|||
this.$refs['ref_buildingTable'].loadTable(true, 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 |
|||
} 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); |
|||
}); |
|||
|
|||
}, |
|||
|
|||
//解析树数据 |
|||
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); |
|||
} |
|||
}, |
|||
components: { |
|||
communityTable, buildTable, roomTable |
|||
} |
|||
} |
|||
</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> |
|||
@ -0,0 +1,793 @@ |
|||
<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> |
|||
<div class="resi-cell"> |
|||
<div class="resi-cell-label">房主手机</div> |
|||
<div class="resi-cell-value"> |
|||
<el-input v-model="ownerPhone" |
|||
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> |
|||
<el-button style="margin-left:10px" |
|||
class="diy-button--reset" |
|||
size="small" |
|||
@click="resetSearch">重置</el-button> |
|||
<!-- <el-button style="margin-left:10px" |
|||
class="diy-button--reset" |
|||
size="small" |
|||
@click="resetSearch">重置</el-button> --> |
|||
</div> |
|||
<div class="div_btn"> |
|||
<el-button style="" |
|||
class="diy-button--add" |
|||
size="small" |
|||
@click="handleAdd">新增小区</el-button> |
|||
|
|||
<div class="btn_upload" |
|||
v-if="showImportBtn"> |
|||
<el-button style="" |
|||
class="diy-button--export" |
|||
size="small" |
|||
@click="handleExportModule('community')">下载小区模板</el-button> |
|||
|
|||
<el-upload ref="upload_community" |
|||
style="" |
|||
:multiple='false' |
|||
:show-file-list='false' |
|||
:before-upload="((file)=>{beforeUpload(file, 'community')})" |
|||
action="" |
|||
accept=".xls,.xlsx" |
|||
:http-request="(()=>{uploadFile( 'community')})"> |
|||
<el-button style="margin-left:10px" |
|||
size="small" |
|||
class="diy-button--delete">导入小区数据</el-button> |
|||
</el-upload> |
|||
|
|||
<el-button style=";margin-left:10px" |
|||
class="diy-button--export" |
|||
size="small" |
|||
@click="handleExportModule('building')">下载楼栋模板</el-button> |
|||
|
|||
<el-upload style="" |
|||
ref="upload_building" |
|||
:multiple='false' |
|||
:show-file-list='false' |
|||
:before-upload="((file)=>{beforeUpload(file, 'building')})" |
|||
action="" |
|||
accept=".xls,.xlsx" |
|||
:http-request="(()=>{uploadFile( 'building')})"> |
|||
<el-button style="margin-left:10px" |
|||
size="small" |
|||
class="diy-button--delete">导入楼栋数据</el-button> |
|||
</el-upload> |
|||
<el-button style=";margin-left:10px" |
|||
class="diy-button--export" |
|||
size="small" |
|||
@click="handleExportModule('room')">下载房屋模板</el-button> |
|||
|
|||
<el-upload style="" |
|||
ref="upload_room" |
|||
:multiple='false' |
|||
:show-file-list='false' |
|||
:before-upload="((file)=>{beforeUpload(file, 'room')})" |
|||
action="" |
|||
accept=".xls,.xlsx" |
|||
:http-request="(()=>{uploadFile( 'room')})"> |
|||
<el-button style="margin-left:10px" |
|||
size="small" |
|||
class="diy-button--delete">导入房屋数据</el-button> |
|||
</el-upload> |
|||
</div> |
|||
<el-button style="margin-left:10px" |
|||
class="diy-button--reset" |
|||
size="small" |
|||
@click="handleExport">导出</el-button> |
|||
<el-button v-if="agencyObj.level == 'community'" |
|||
style="margin-left:10px" |
|||
class="diy-button--qrcode" |
|||
size="small" |
|||
@click="handleDownQr(agencyObj, 'community')">社区二维码</el-button> |
|||
<el-button style="float:left;margin-left:10px" |
|||
class="diy-button--more" |
|||
size="small" |
|||
@click="deleteBatch">批量删除</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%" |
|||
:show-overflow-tooltip="true" |
|||
@select-all="selectAll" |
|||
@selection-change="selectionChange"> |
|||
<el-table-column type="selection" |
|||
:selectable="checkSelect" |
|||
width="55"> |
|||
</el-table-column> |
|||
<el-table-column prop="neighborHoodName" |
|||
label="小区名称" |
|||
min-width="100"> |
|||
<!-- <template slot-scope="scope"> |
|||
<a class="name-a" @click="handleDetail(scope.row)"> |
|||
{{ scope.row.neighborHoodName }} |
|||
</a> |
|||
</template> --> |
|||
</el-table-column> |
|||
<el-table-column prop="agencyName" |
|||
label="所属组织" |
|||
min-width="100"> |
|||
</el-table-column> |
|||
<el-table-column prop="gridName" |
|||
label="所属网格" |
|||
min-width="120"> |
|||
</el-table-column> |
|||
<!-- <el-table-column prop="总单元数" |
|||
label="所属网格" |
|||
min-width="80"> |
|||
</el-table-column> |
|||
<el-table-column prop="总户数" |
|||
label="所属网格" |
|||
min-width="80"> |
|||
</el-table-column> --> |
|||
<el-table-column prop="address" |
|||
label="详细地址" |
|||
min-width="180"> |
|||
</el-table-column> |
|||
|
|||
<el-table-column label="操作" |
|||
fixed="right" |
|||
width="140" |
|||
header-align="center" |
|||
align="center" |
|||
class="operate"> |
|||
<template slot-scope="scope"> |
|||
|
|||
<!-- <el-button type="text" |
|||
style="color:#feb349;text-decoration: underline;" |
|||
size="small" |
|||
@click="handleToNextLevel(scope.row)">进入</el-button> --> |
|||
<!-- <el-button type="text" |
|||
class="div-table-button--qr" |
|||
size="small" |
|||
@click="handleDownQr(scope.row, 'neighborHood')">二维码</el-button> --> |
|||
<el-button type="text" |
|||
class="div-table-button--detail" |
|||
size="small" |
|||
@click="handleDetail(scope.row)">查看</el-button> |
|||
<el-button v-if="scope.row.showBtn" |
|||
type="text" |
|||
class="div-table-button--edit" |
|||
size="small" |
|||
@click="handleEdit(scope.row)">修改</el-button> |
|||
|
|||
<el-button v-if="scope.row.showBtn" |
|||
type="text" |
|||
class="div-table-button--delete" |
|||
size="small" |
|||
@click="handleDelete(scope.row)">删除</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"> |
|||
<community-form ref="ref_form" |
|||
@dialogCancle="addFormCancle" |
|||
@dialogOk="addFormOk"></community-form> |
|||
</el-dialog> |
|||
|
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
|
|||
import CommunityForm from './communityForm' |
|||
|
|||
import { requestPost } from "@/js/dai/request"; |
|||
import { mapGetters } from 'vuex' |
|||
import { Loading } from 'element-ui' // 引入Loading服务 |
|||
import axios from 'axios' |
|||
|
|||
let loading // 加载动画 |
|||
export default { |
|||
data () { |
|||
return { |
|||
importBuildingLoading: false, |
|||
importRoomLoading: false, |
|||
importCommunityLoading: false, |
|||
total: 0, |
|||
pageSize: 20, |
|||
pageNo: 0, |
|||
tableLoading: true, |
|||
|
|||
showImportBtn: false,//是否显示操作按钮,根据登录人所属组织判断 |
|||
|
|||
agencyObj: {},//树所选的组织对象 |
|||
ownerName: '', |
|||
ownerPhone: '', |
|||
tableData: [], |
|||
validTableDataNum: 0,//有效的数据数量,即有权限操作的数据数量 |
|||
selection: [], |
|||
showDeletBtn: false, |
|||
|
|||
|
|||
//form相关 |
|||
formShow: false, |
|||
formTitle: '新增小区', |
|||
|
|||
files: "", |
|||
fileName: "", |
|||
uploadUlr: window.SITE_CONFIG['apiURL'] + '/gov/org/neighborhood/import' |
|||
|
|||
} |
|||
}, |
|||
components: { |
|||
CommunityForm |
|||
}, |
|||
async mounted () { |
|||
|
|||
}, |
|||
computed: { |
|||
tableHeight () { |
|||
|
|||
return this.$store.state.inIframe ? this.clientHeight - 300 + this.iframeHeight : this.clientHeight - 300 |
|||
|
|||
|
|||
}, |
|||
|
|||
...mapGetters(['clientHeight', 'iframeHeight']) |
|||
}, |
|||
methods: { |
|||
//重置搜索条件 |
|||
resetSearch () { |
|||
this.ownerName = '' |
|||
this.ownerPhone = '' |
|||
|
|||
this.pageSize = 10 |
|||
this.pageNo = 0 |
|||
// this.loadTable() |
|||
}, |
|||
handleSearch () { |
|||
this.loadTable() |
|||
}, |
|||
async loadTable (fromTree, treeObj) { |
|||
console.log(111, this.staffAgencyId) |
|||
|
|||
this.tableLoading = true |
|||
if (fromTree) { |
|||
this.agencyObj = treeObj |
|||
if (this.agencyObj.level === 'community') {//只有社区和网格显示操作按钮 |
|||
if (this.agencyObj.id === this.staffAgencyId) {//如果所选树的组织id和登录人员id相同,有权限 |
|||
this.showImportBtn = true |
|||
} else { |
|||
this.showImportBtn = false |
|||
} |
|||
} else if (this.agencyObj.level === 'grid') {//网格下 |
|||
if (this.agencyObj.pid === this.staffAgencyId) {//如果所选树的父级组织id和登录人员id相同,有权限 |
|||
this.showImportBtn = true |
|||
} else { |
|||
this.showImportBtn = false |
|||
} |
|||
} else { |
|||
this.showImportBtn = false |
|||
} |
|||
} |
|||
|
|||
const url = "/gov/org/neighborhood/neighborhoodlist" |
|||
|
|||
let params = { |
|||
pageSize: this.pageSize, |
|||
pageNo: this.pageNo, |
|||
ownerName: this.ownerName, |
|||
ownerPhone: this.ownerPhone, |
|||
level: this.agencyObj.level, |
|||
id: this.agencyObj.id |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
this.validTableDataNum = 0 |
|||
this.total = data.total |
|||
data.list.forEach(item => { |
|||
if (item.agencyId === this.staffAgencyId) { |
|||
item.showBtn = true |
|||
this.validTableDataNum++ |
|||
} else { |
|||
item.showBtn = false |
|||
} |
|||
|
|||
}); |
|||
this.tableData = data.list |
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
this.tableLoading = false |
|||
}, |
|||
|
|||
checkSelect (row, index) { |
|||
let isChecked = false; |
|||
if (row.showBtn) { // 判断里面是否存在某个参数 |
|||
isChecked = true |
|||
} else { |
|||
isChecked = false |
|||
} |
|||
return isChecked |
|||
}, |
|||
|
|||
|
|||
diaClose () { |
|||
this.$refs.ref_form.resetData() |
|||
this.formShow = false |
|||
}, |
|||
|
|||
handleDetail (row) { |
|||
this.formTitle = '小区详情' |
|||
this.formShow = true |
|||
this.$nextTick(() => { |
|||
this.$refs.ref_form.initForm('detail', row, this.agencyObj) |
|||
}) |
|||
}, |
|||
|
|||
handleAdd () { |
|||
this.formTitle = '新增小区' |
|||
this.formShow = true |
|||
this.$nextTick(() => { |
|||
this.$refs.ref_form.initForm('add', null, this.agencyObj) |
|||
}) |
|||
}, |
|||
|
|||
handleEdit (row) { |
|||
this.formTitle = '修改小区' |
|||
this.formShow = true |
|||
this.$nextTick(() => { |
|||
this.$refs.ref_form.initForm('edit', row, this.agencyObj) |
|||
}) |
|||
}, |
|||
|
|||
handleToNextLevel (row) { |
|||
this.$emit('toNextLevel', row, 'community') |
|||
}, |
|||
|
|||
addFormCancle () { |
|||
this.formShow = false |
|||
}, |
|||
addFormOk () { |
|||
this.formShow = false |
|||
this.loadTable() |
|||
this.$emit('refreshTree') |
|||
}, |
|||
|
|||
|
|||
deleteBatch () { |
|||
if (this.selection.length > 0) { |
|||
this.$confirm("确认删除选择的小区?", "提示", { |
|||
confirmButtonText: "确定", |
|||
cancelButtonText: "取消", |
|||
type: "warning" |
|||
}) |
|||
.then(() => { |
|||
this.deleteCommunityBatch() |
|||
}) |
|||
.catch(err => { |
|||
if (err == "cancel") { |
|||
// this.$message({ |
|||
// type: "info", |
|||
// message: "已取消删除" |
|||
// }); |
|||
} |
|||
|
|||
}); |
|||
} else { |
|||
this.$message.warning('请先选择要删除的小区') |
|||
} |
|||
}, |
|||
selectAll (selection) { |
|||
|
|||
this.selection = selection |
|||
|
|||
|
|||
}, |
|||
selectionChange (selection) { |
|||
this.selection = selection |
|||
|
|||
}, |
|||
|
|||
async handleDelete (row) { |
|||
|
|||
this.$confirm("确认删除?", "提示", { |
|||
confirmButtonText: "确定", |
|||
cancelButtonText: "取消", |
|||
type: "warning" |
|||
}) |
|||
.then(() => { |
|||
this.deleteCommunity(row) |
|||
}) |
|||
.catch(err => { |
|||
if (err == "cancel") { |
|||
// this.$message({ |
|||
// type: "info", |
|||
// message: "已取消删除" |
|||
// }); |
|||
} |
|||
|
|||
}); |
|||
}, |
|||
|
|||
async deleteCommunityBatch () { |
|||
let ids = [] |
|||
console.log(this.selection) |
|||
this.selection.forEach(element => { |
|||
|
|||
ids.push(element.neighborHoodId) |
|||
}); |
|||
|
|||
const url = "/gov/org/house/delete" |
|||
|
|||
let params = { |
|||
type: 'neighborHood', |
|||
ids: ids |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
this.$message({ |
|||
type: "success", |
|||
message: "删除成功" |
|||
}); |
|||
this.$emit('refreshTree') |
|||
this.loadTable() |
|||
} else if (code > 8000) { |
|||
this.$message({ |
|||
showClose: true, |
|||
message: msg, |
|||
duration: 0 |
|||
}) |
|||
this.$emit('refreshTree') |
|||
this.loadTable() |
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
}, |
|||
async deleteCommunity (row) { |
|||
const url = "/gov/org/neighborhood/neighborhooddel" |
|||
|
|||
let params = { |
|||
neighborHoodId: row.neighborHoodId |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
this.$message({ |
|||
type: "success", |
|||
message: "删除成功" |
|||
}); |
|||
this.$emit('refreshTree') |
|||
this.loadTable() |
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
}, |
|||
async handleDownQr (row, type) { |
|||
// const url = window.SITE_CONFIG['apiURL'] + `/gov/org/icneighborhood/createQrCode/${row.neighborHoodId}` |
|||
const url = '/gov/org/agency/create-qrcode' |
|||
const _id = type == 'community' ? row.id : row.neighborHoodId |
|||
const params = { |
|||
id: _id, |
|||
type |
|||
} |
|||
await axios({ |
|||
method: 'POST', |
|||
url: window.SITE_CONFIG['apiURL'] + url, |
|||
data: params, |
|||
responseType: 'blob' |
|||
}).then(res => { |
|||
console.log('res----1r', res) |
|||
if (res.headers["content-disposition"]) { |
|||
let fileName = window.decodeURI(res.headers["content-disposition"].split(";")[1].split("=")[1]) |
|||
console.log('filename', fileName) |
|||
this.download(res.data, fileName) //释放掉blob对象 |
|||
} else this.$message.error('下载失败') |
|||
// this.download(res.data, '1.png') |
|||
}) |
|||
}, |
|||
//导出表格 |
|||
async handleExport () { |
|||
let title = this.agencyObj.label |
|||
title = title + '—小区列表' |
|||
|
|||
const url = "/gov/org/neighborhood/exportneighborhoodinfo" |
|||
let params = { |
|||
ownerName: this.ownerName, |
|||
ownerPhone: this.ownerPhone, |
|||
level: this.agencyObj.level, |
|||
id: this.agencyObj.id |
|||
} |
|||
|
|||
app.ajax.exportFilePost( |
|||
url, |
|||
params, |
|||
(data, rspMsg) => { |
|||
|
|||
this.download(data, title + '.xls') |
|||
}, |
|||
(rspMsg, data) => { |
|||
this.$message.error(rspMsg); |
|||
} |
|||
); |
|||
|
|||
}, |
|||
|
|||
// 下载文件 |
|||
download (data, downFileName) { |
|||
if (!data) { |
|||
return |
|||
} |
|||
|
|||
var csvData = new Blob([data]) |
|||
|
|||
if (window.navigator && window.navigator.msSaveOrOpenBlob) { |
|||
window.navigator.msSaveOrOpenBlob(csvData, downFileName); |
|||
} |
|||
// for Non-IE (chrome, firefox etc.) |
|||
else { |
|||
var a = document.createElement('a'); |
|||
document.body.appendChild(a); |
|||
a.style = 'display: none'; |
|||
var url = window.URL.createObjectURL(csvData); |
|||
a.href = url; |
|||
a.download = downFileName; |
|||
a.click(); |
|||
a.remove(); |
|||
window.URL.revokeObjectURL(url); |
|||
} |
|||
|
|||
}, |
|||
|
|||
handleExportModule (type) { |
|||
let title = '' |
|||
let url = "" |
|||
if (type === 'community') { |
|||
title = '小区导入模板' |
|||
url = '/gov/org/neighborhood/exporttemplate' |
|||
|
|||
} else if (type === 'building') { |
|||
title = '楼栋导入模板' |
|||
url = '/gov/org/building/exporttemplate' |
|||
|
|||
} else if (type === 'room') { |
|||
title = '房间导入模板' |
|||
url = '/gov/org/house/exporttemplate' |
|||
} |
|||
|
|||
let params = {} |
|||
|
|||
app.ajax.exportFilePost( |
|||
url, |
|||
params, |
|||
(data, rspMsg) => { |
|||
|
|||
this.download(data, title + '.xls') |
|||
}, |
|||
(rspMsg, data) => { |
|||
this.$message.error(rspMsg); |
|||
} |
|||
); |
|||
}, |
|||
|
|||
// 上传文件之前的钩子 |
|||
beforeUpload (file, type) { |
|||
this.files = file; |
|||
|
|||
const isText = file.type === 'application/vnd.ms-excel' |
|||
const isTextComputer = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' |
|||
|
|||
if (!isText && !isTextComputer) { |
|||
this.$message.error('请选择正确格式的文件') |
|||
this.files = null |
|||
this.fileName = '' |
|||
return false |
|||
} else { |
|||
this.fileName = file.name; |
|||
return true |
|||
} |
|||
|
|||
}, |
|||
// 上传文件个数超过定义的数量 |
|||
handleExceed (files, fileList) { |
|||
this.$message.warning(`当前限制选择 1 个文件,请删除后继续上传`) |
|||
}, |
|||
|
|||
async uploadFile (type) { |
|||
|
|||
if (this.fileName == "") { |
|||
this.$message.warning('请选择要上传的文件!') |
|||
return false |
|||
} |
|||
|
|||
this.$message({ |
|||
showClose: true, |
|||
message: '导入中,请到系统管理-导入记录中查看进度', |
|||
duration: 0 |
|||
}) |
|||
|
|||
|
|||
//清空上传列表 |
|||
let url = '' |
|||
|
|||
let fileFormData = new FormData(); |
|||
fileFormData.append('file', this.files);//filename是键,file是值,就是要传的文件,test.zip是要传的文件名 |
|||
fileFormData.append('orgId', this.agencyObj.id);//filename是键,file是值,就是要传的文件,test.zip是要传的文件名 |
|||
fileFormData.append('orgType', this.agencyObj.level === 'grid' ? 'grid' : 'agency');//filename是键,file是值,就是要传的文件,test.zip是要传的文件名 |
|||
|
|||
if (type === 'community') { |
|||
this.importCommunityLoading = true |
|||
this.$refs['upload_community'].clearFiles() |
|||
url = '/gov/org/icneighborhood/neighborhoodimport' |
|||
|
|||
|
|||
} else if (type === 'building') { |
|||
this.$refs['upload_building'].clearFiles() |
|||
url = '/gov/org/building/buildingimport' |
|||
this.importBuildingLoading = true |
|||
|
|||
} else if (type === 'room') { |
|||
this.$refs['upload_room'].clearFiles() |
|||
url = '/gov/org/house/houseimport' |
|||
this.importRoomLoading = true |
|||
} |
|||
|
|||
window.app.ajax.post2(url, fileFormData, |
|||
(data, rspMsg) => { |
|||
|
|||
if (data.code === 0 && data.msg == 'success') { |
|||
// this.$message.success('导入成功') |
|||
} else { |
|||
// this.$message({ |
|||
// showClose: true, |
|||
// message: rspMsg, |
|||
// duration: 0, |
|||
// type: "error" |
|||
// }) |
|||
// this.$message.error(rspMsg) |
|||
} |
|||
this.$emit('refreshTree') |
|||
this.loadTable() |
|||
// this.showMessage(rspMsg) |
|||
if (type === 'community') { |
|||
this.importCommunityLoading = false |
|||
|
|||
} else if (type === 'building') { |
|||
this.importBuildingLoading = false |
|||
|
|||
} else if (type === 'room') { |
|||
this.importRoomLoading = false |
|||
} |
|||
}, |
|||
(rspMsg, data) => { |
|||
if (type === 'community') { |
|||
this.importCommunityLoading = false |
|||
|
|||
} else if (type === 'building') { |
|||
this.importBuildingLoading = false |
|||
|
|||
} else if (type === 'room') { |
|||
this.importRoomLoading = false |
|||
} |
|||
// this.$message.error(rspMsg) |
|||
}, { headers: { 'Content-Type': 'multipart/form-data' } }) |
|||
|
|||
|
|||
}, |
|||
|
|||
showMessage (msg) { |
|||
this.$alert(msg, '操作结果', { |
|||
confirmButtonText: '关闭', |
|||
callback: action => { |
|||
this.$emit('refreshTree') |
|||
this.loadTable() |
|||
} |
|||
}); |
|||
}, |
|||
handleSizeChange (val) { |
|||
this.pageSize = val |
|||
this.pageNo = 1 |
|||
this.loadTable() |
|||
}, |
|||
handleCurrentChange (val) { |
|||
this.pageNo = val |
|||
this.loadTable() |
|||
}, |
|||
|
|||
// 开启加载动画 |
|||
startLoading () { |
|||
loading = Loading.service({ |
|||
lock: true, // 是否锁定 |
|||
text: '正在加载……', // 加载中需要显示的文字 |
|||
background: 'rgba(0,0,0,.7)' // 背景颜色 |
|||
}) |
|||
}, |
|||
// 结束加载动画 |
|||
endLoading () { |
|||
// clearTimeout(timer); |
|||
if (loading) { |
|||
loading.close() |
|||
} |
|||
} |
|||
}, |
|||
watch: { |
|||
selection (val) { |
|||
|
|||
if (val.length > 0) { |
|||
this.showDeletBtn = true |
|||
} else { |
|||
this.showDeletBtn = false |
|||
} |
|||
} |
|||
}, |
|||
props: { |
|||
staffAgencyId: { |
|||
type: String, |
|||
default: '', |
|||
}, |
|||
|
|||
} |
|||
} |
|||
</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> |
|||
|
|||
@ -0,0 +1,716 @@ |
|||
<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> |
|||
<div class="resi-cell"> |
|||
<div class="resi-cell-label">房主手机</div> |
|||
<div class="resi-cell-value"> |
|||
<el-input v-model="ownerPhone" |
|||
class="resi-cell-input" |
|||
size="small" |
|||
clearable |
|||
placeholder="请输入内容"> |
|||
</el-input> |
|||
|
|||
</div> |
|||
</div> |
|||
<div class="resi-cell"> |
|||
<div class="resi-cell-label">房屋状态</div> |
|||
<div class="resi-cell-value"> |
|||
|
|||
<el-select class="item_width_1" |
|||
v-model="rentState" |
|||
placeholder="请选择" |
|||
size="small" |
|||
clearable> |
|||
<el-option v-for="item in rentList" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value"> |
|||
</el-option> |
|||
</el-select> |
|||
|
|||
</div> |
|||
</div> |
|||
<el-button style="margin-left:10px" |
|||
class="diy-button--search" |
|||
size="small" |
|||
@click="handleSearch">查询</el-button> |
|||
<el-button style="margin-left:10px" |
|||
class="diy-button--reset" |
|||
size="small" |
|||
@click="resetSearch">重置</el-button> |
|||
</div> |
|||
<div class="div_btn"> |
|||
|
|||
<el-button style="float:left" |
|||
class="diy-button--add" |
|||
size="small" |
|||
@click="handleAdd">新增房屋</el-button> |
|||
<div class="btn_upload" |
|||
v-if="showImportBtn"> |
|||
<el-button style="float:left" |
|||
class="diy-button--export" |
|||
size="small" |
|||
@click="handleExportModule">下载房屋模板</el-button> |
|||
<el-upload ref="upload" |
|||
:multiple='false' |
|||
:show-file-list='false' |
|||
:before-upload="beforeUpload" |
|||
action="" |
|||
accept=".xls,.xlsx" |
|||
:limit="1" |
|||
:on-exceed="handleExceed" |
|||
:http-request="uploadFile"> |
|||
<el-button style="margin-left:10px" |
|||
size="small" |
|||
class="diy-button--delete">导入房屋数据</el-button> |
|||
</el-upload> |
|||
</div> |
|||
<el-button style="float:left;margin-left:10px" |
|||
class="diy-button--reset" |
|||
size="small" |
|||
@click="handleExport">导出</el-button> |
|||
<el-button style="float:left;margin-left:10px" |
|||
class="diy-button--more" |
|||
size="small" |
|||
@click="deleteBatch">批量删除</el-button> |
|||
</div> |
|||
|
|||
<div class="div_table"> |
|||
<el-table ref="ref_table" |
|||
:data="tableData" |
|||
:header-cell-style="{background:'#2195FE',color:'#FFFFFF'}" |
|||
v-loading="tableLoading" |
|||
border |
|||
:height="tableHeight" |
|||
style="width: 100%" |
|||
@select-all="selectAll" |
|||
@selection-change="selectionChange"> |
|||
<el-table-column type="selection" |
|||
:selectable="checkSelect" |
|||
width="55"> |
|||
</el-table-column> |
|||
<el-table-column prop="houseNameShow" |
|||
label="房屋名称" |
|||
min-width="160"> |
|||
</el-table-column> |
|||
<el-table-column prop="neighborHoodName" |
|||
label="所属小区" |
|||
min-width="150"> |
|||
</el-table-column> |
|||
<el-table-column prop="buildingName" |
|||
label="所属楼栋" |
|||
width="80"> |
|||
</el-table-column> |
|||
<el-table-column prop="unitNumShow" |
|||
label="单元号" |
|||
width="70"> |
|||
</el-table-column> |
|||
<el-table-column prop="doorName" |
|||
label="门牌号" |
|||
width="70"> |
|||
</el-table-column> |
|||
<el-table-column prop="houseType" |
|||
label="类型" |
|||
width="50"> |
|||
</el-table-column> |
|||
<el-table-column prop="purpose" |
|||
label="用途" |
|||
width="50"> |
|||
</el-table-column> |
|||
<el-table-column prop="rentFlag" |
|||
label="房屋状态" |
|||
width="80"> |
|||
</el-table-column> |
|||
<el-table-column prop="ownerName" |
|||
label="房主姓名" |
|||
width="90"> |
|||
</el-table-column> |
|||
<el-table-column prop="ownerPhone" |
|||
label="房主电话" |
|||
width="110"> |
|||
</el-table-column> |
|||
<el-table-column prop="ownerIdCard" |
|||
label="身份证" |
|||
width="170"> |
|||
</el-table-column> |
|||
<el-table-column label="操作" |
|||
fixed="right" |
|||
width="140" |
|||
header-align="center" |
|||
align="center" |
|||
class="operate"> |
|||
<template slot-scope="scope"> |
|||
|
|||
<el-button type="text" |
|||
class="div-table-button--detail" |
|||
size="small" |
|||
@click="handleDetail(scope.row)">查看</el-button> |
|||
<el-button v-if="scope.row.showBtn" |
|||
type="text" |
|||
class="div-table-button--edit" |
|||
size="small" |
|||
@click="handleEdit(scope.row)">修改</el-button> |
|||
|
|||
<el-button v-if="scope.row.showBtn" |
|||
type="text" |
|||
class="div-table-button--delete" |
|||
size="small" |
|||
@click="handleDelete(scope.row)">删除</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="900px" |
|||
top="5vh" |
|||
class="dialog-h" |
|||
@closed="diaClose"> |
|||
<room-form ref="ref_form" |
|||
@dialogCancle="addFormCancle" |
|||
@dialogOk="addFormOk"></room-form> |
|||
</el-dialog> |
|||
|
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
|
|||
import roomForm from './roomForm' |
|||
|
|||
import { requestPost } from "@/js/dai/request"; |
|||
import { mapGetters } from 'vuex' |
|||
import { Loading } from 'element-ui' // 引入Loading服务 |
|||
|
|||
let loading // 加载动画 |
|||
export default { |
|||
data () { |
|||
return { |
|||
importRoomLoading: false, |
|||
total: 0, |
|||
pageSize: 20, |
|||
pageNo: 0, |
|||
tableLoading: true, |
|||
|
|||
// showImportBtn: false,//是否显示操作按钮,根据登录人所属组织判断 |
|||
|
|||
agencyObj: {},//树所选的小区对象 |
|||
ownerName: '', |
|||
ownerPhone: '', |
|||
rentState: '', |
|||
validTableDataNum: 0,//有效的数据数量,即有权限操作的数据数量 |
|||
selection: [], |
|||
showDeletBtn: false, |
|||
|
|||
tableData: [], |
|||
|
|||
//form相关 |
|||
formShow: false, |
|||
formTitle: '新增房屋', |
|||
|
|||
rentList: [ |
|||
{ |
|||
value: '1', |
|||
label: '出租' |
|||
}, |
|||
{ |
|||
value: '2', |
|||
label: '闲置' |
|||
}, |
|||
{ |
|||
value: '0', |
|||
label: '自住' |
|||
}, |
|||
] |
|||
|
|||
|
|||
} |
|||
}, |
|||
components: { |
|||
roomForm |
|||
}, |
|||
async mounted () { |
|||
|
|||
}, |
|||
computed: { |
|||
tableHeight () { |
|||
return this.$store.state.inIframe ? this.clientHeight - 300 + this.iframeHeight : this.clientHeight - 300 |
|||
|
|||
}, |
|||
|
|||
...mapGetters(['clientHeight', 'iframeHeight']) |
|||
}, |
|||
methods: { |
|||
//重置搜索条件 |
|||
resetSearch () { |
|||
this.ownerName = '' |
|||
this.ownerPhone = '' |
|||
this.rentState = '' |
|||
|
|||
this.pageSize = 10 |
|||
this.pageNo = 0 |
|||
// this.loadTable() |
|||
}, |
|||
|
|||
handleSearch () { |
|||
this.loadTable() |
|||
}, |
|||
|
|||
checkSelect (row, index) { |
|||
let isChecked = false; |
|||
if (row.showBtn) { // 判断里面是否存在某个参数 |
|||
isChecked = true |
|||
} else { |
|||
isChecked = false |
|||
} |
|||
return isChecked |
|||
}, |
|||
|
|||
async loadTable (fromTree, treeObj, ownerName, ownerPhone, rentState) { |
|||
|
|||
this.tableLoading = true |
|||
this.ownerName = ownerName |
|||
this.ownerPhone = ownerPhone |
|||
this.rentState = rentState |
|||
let params = { |
|||
pageSize: this.pageSize, |
|||
pageNo: this.pageNo, |
|||
|
|||
buildingId: this.agencyObj.id |
|||
} |
|||
if (fromTree) { |
|||
this.agencyObj = treeObj |
|||
// if (this.agencyObj.level === 'community') {//只有社区和网格显示操作按钮 |
|||
// if (this.agencyObj.id === this.staffAgencyId) {//如果所选树的组织id和登录人员id相同,有权限 |
|||
// this.showImportBtn = true |
|||
// } else { |
|||
// this.showImportBtn = false |
|||
// } |
|||
// } else if (this.agencyObj.level === 'grid') {//网格下 |
|||
// if (this.agencyObj.pid === this.staffAgencyId) {//如果所选树的父级组织id和登录人员id相同,有权限 |
|||
// this.showImportBtn = true |
|||
// } else { |
|||
// this.showImportBtn = false |
|||
// } |
|||
// } else { |
|||
// this.showImportBtn = false |
|||
// } |
|||
} else { |
|||
|
|||
params.ownerName = ownerName |
|||
params.ownerPhone = ownerPhone |
|||
params.rentState = rentState |
|||
} |
|||
|
|||
const url = "/gov/org/house/houselist" |
|||
|
|||
|
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
this.total = data.total |
|||
this.validTableDataNum = 0 |
|||
data.list.forEach(item => { |
|||
item.houseNameShow = item.neighborHoodName + item.buildingName + item.unitNum + '单元' + item.doorName |
|||
item.unitNumShow = item.unitNum + '单元' |
|||
if (item.agencyId === this.staffAgencyId) { |
|||
item.showBtn = true |
|||
this.validTableDataNum++ |
|||
} else { |
|||
item.showBtn = false |
|||
} |
|||
|
|||
}); |
|||
this.tableData = data.list |
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
this.tableLoading = false |
|||
}, |
|||
|
|||
diaClose () { |
|||
this.$refs.ref_form.resetData() |
|||
this.formShow = false |
|||
}, |
|||
|
|||
handleDetail (row) { |
|||
this.formTitle = '房屋详情' |
|||
this.formShow = true |
|||
this.$nextTick(() => { |
|||
this.$refs.ref_form.initForm('detail', row, this.agencyObj) |
|||
}) |
|||
}, |
|||
|
|||
handleAdd () { |
|||
|
|||
this.formTitle = '新增房屋' |
|||
this.formShow = true |
|||
this.$nextTick(() => { |
|||
this.$refs.ref_form.initForm('add', null, this.agencyObj) |
|||
}) |
|||
}, |
|||
|
|||
handleEdit (row) { |
|||
this.formTitle = '修改房屋' |
|||
this.formShow = true |
|||
this.$nextTick(() => { |
|||
this.$refs.ref_form.initForm('edit', row, this.agencyObj) |
|||
}) |
|||
}, |
|||
|
|||
addFormCancle () { |
|||
this.formShow = false |
|||
}, |
|||
addFormOk () { |
|||
this.formShow = false |
|||
this.loadTable() |
|||
}, |
|||
|
|||
|
|||
deleteBatch () { |
|||
if (this.selection.length > 0) { |
|||
this.$confirm("确认删除选择的房屋?", "提示", { |
|||
confirmButtonText: "确定", |
|||
cancelButtonText: "取消", |
|||
type: "warning" |
|||
}) |
|||
.then(() => { |
|||
this.deleteCommunityBatch() |
|||
}) |
|||
.catch(err => { |
|||
if (err == "cancel") { |
|||
// this.$message({ |
|||
// type: "info", |
|||
// message: "已取消删除" |
|||
// }); |
|||
} |
|||
|
|||
}); |
|||
} else { |
|||
this.$message.warning('请先选择要删除的房屋') |
|||
} |
|||
}, |
|||
selectAll (selection) { |
|||
this.selection = selection |
|||
|
|||
}, |
|||
selectionChange (selection) { |
|||
this.selection = selection |
|||
|
|||
}, |
|||
|
|||
async handleDelete (row) { |
|||
|
|||
this.$confirm("确认删除?", "提示", { |
|||
confirmButtonText: "确定", |
|||
cancelButtonText: "取消", |
|||
type: "warning" |
|||
}) |
|||
.then(() => { |
|||
this.deleteRoom(row) |
|||
}) |
|||
.catch(err => { |
|||
if (err == "cancel") { |
|||
// this.$message({ |
|||
// type: "info", |
|||
// message: "已取消删除" |
|||
// }); |
|||
} |
|||
|
|||
}); |
|||
|
|||
|
|||
}, |
|||
|
|||
async deleteCommunityBatch () { |
|||
let ids = [] |
|||
this.selection.forEach(element => { |
|||
|
|||
ids.push(element.houseId) |
|||
}); |
|||
|
|||
const url = "/gov/org/house/delete" |
|||
|
|||
let params = { |
|||
type: 'house', |
|||
ids: ids |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
this.$message({ |
|||
type: "success", |
|||
message: "删除成功" |
|||
}); |
|||
this.$emit('refreshTree') |
|||
this.loadTable() |
|||
} else if (code > 8000) { |
|||
this.$message({ |
|||
showClose: true, |
|||
message: msg, |
|||
duration: 0 |
|||
}) |
|||
this.$emit('refreshTree') |
|||
this.loadTable() |
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
}, |
|||
|
|||
async deleteRoom (row) { |
|||
const url = "/gov/org/house/housedel" |
|||
|
|||
let params = { |
|||
houseId: row.houseId |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
this.$message({ |
|||
type: "success", |
|||
message: "删除成功" |
|||
}); |
|||
this.$emit('refreshTree') |
|||
this.loadTable() |
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
}, |
|||
|
|||
//导出表格 |
|||
async handleExport () { |
|||
let title = this.agencyObj.label |
|||
title = title + '—房屋列表' |
|||
|
|||
const url = "/gov/org/house/exporthouseinfo" |
|||
let params = { |
|||
ownerName: this.ownerName, |
|||
ownerPhone: this.ownerPhone, |
|||
rentState: this.rentState, |
|||
buildingId: this.agencyObj.id |
|||
} |
|||
|
|||
app.ajax.exportFilePost( |
|||
url, |
|||
params, |
|||
(data, rspMsg) => { |
|||
|
|||
this.download(data, title + '.xls') |
|||
}, |
|||
(rspMsg, data) => { |
|||
this.$message.error(rspMsg); |
|||
} |
|||
); |
|||
|
|||
}, |
|||
|
|||
// 下载文件 |
|||
download (data, fileName) { |
|||
if (!data) { |
|||
return |
|||
} |
|||
|
|||
var csvData = new Blob([data]) |
|||
|
|||
if (window.navigator && window.navigator.msSaveOrOpenBlob) { |
|||
window.navigator.msSaveOrOpenBlob(csvData, fileName); |
|||
} |
|||
// for Non-IE (chrome, firefox etc.) |
|||
else { |
|||
var a = document.createElement('a'); |
|||
document.body.appendChild(a); |
|||
a.style = 'display: none'; |
|||
var url = window.URL.createObjectURL(csvData); |
|||
a.href = url; |
|||
a.download = fileName; |
|||
a.click(); |
|||
a.remove(); |
|||
window.URL.revokeObjectURL(url); |
|||
} |
|||
|
|||
}, |
|||
|
|||
handleExportModule () { |
|||
let title = '' |
|||
title = '房屋模板' |
|||
|
|||
const url = "/gov/org/house/exporttemplate" |
|||
let params = {} |
|||
|
|||
app.ajax.exportFilePost( |
|||
url, |
|||
params, |
|||
(data, rspMsg) => { |
|||
|
|||
this.download(data, title + '.xls') |
|||
}, |
|||
(rspMsg, data) => { |
|||
this.$message.error(rspMsg); |
|||
} |
|||
); |
|||
}, |
|||
|
|||
// 上传文件之前的钩子 |
|||
beforeUpload (file) { |
|||
this.files = file; |
|||
|
|||
const isText = file.type === 'application/vnd.ms-excel' |
|||
const isTextComputer = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' |
|||
|
|||
if (!isText && !isTextComputer) { |
|||
this.$message.error('请选择正确格式的文件') |
|||
return false |
|||
} else { |
|||
this.fileName = file.name; |
|||
return true |
|||
} |
|||
|
|||
}, |
|||
// 上传文件个数超过定义的数量 |
|||
handleExceed (files, fileList) { |
|||
this.$message.warning(`当前限制选择 1 个文件,请删除后继续上传`) |
|||
}, |
|||
|
|||
async uploadFile () { |
|||
|
|||
|
|||
if (this.fileName == "") { |
|||
this.$message.warning('请选择要上传的文件!') |
|||
return false |
|||
} |
|||
|
|||
this.$message({ |
|||
showClose: true, |
|||
message: '导入中,请到系统管理-导入记录中查看进度', |
|||
duration: 0 |
|||
}) |
|||
|
|||
//清空上传列表 |
|||
this.$refs['upload'].clearFiles() |
|||
|
|||
var url = '/gov/org/house/houseimport' |
|||
|
|||
let fileFormData = new FormData(); |
|||
fileFormData.append('file', this.files);//filename是键,file是值,就是要传的文件,test.zip是要传的文件名 |
|||
fileFormData.append('orgId', this.agencyObj.id);//filename是键,file是值,就是要传的文件,test.zip是要传的文件名 |
|||
fileFormData.append('orgType', this.agencyObj.level);//filename是键,file是值,就是要传的文件,test.zip是要传的文件名 |
|||
|
|||
this.importRoomLoading = true |
|||
window.app.ajax.post2(url, fileFormData, |
|||
(data, rspMsg) => { |
|||
|
|||
if (data.code === 0 && data.msg == 'success') { |
|||
// this.$message.success('导入成功') |
|||
} else { |
|||
// this.$message({ |
|||
// showClose: true, |
|||
// message: rspMsg, |
|||
// duration: 0, |
|||
// type: "error" |
|||
// }) |
|||
// this.$message.error(rspMsg) |
|||
} |
|||
this.$emit('refreshTree') |
|||
this.loadTable() |
|||
this.importRoomLoading = false |
|||
}, |
|||
(rspMsg, data) => { |
|||
this.importRoomLoading = false |
|||
}, { headers: { 'Content-Type': 'multipart/form-data' } }) |
|||
|
|||
|
|||
}, |
|||
|
|||
showMessage (msg) { |
|||
this.$alert(msg, '操作结果', { |
|||
confirmButtonText: '关闭', |
|||
callback: action => { |
|||
this.$emit('refreshTree') |
|||
this.loadTable() |
|||
|
|||
} |
|||
}); |
|||
}, |
|||
|
|||
handleSizeChange (val) { |
|||
this.pageSize = val |
|||
this.pageNo = 1 |
|||
this.loadTable() |
|||
}, |
|||
handleCurrentChange (val) { |
|||
this.pageNo = val |
|||
this.loadTable() |
|||
}, |
|||
|
|||
// 开启加载动画 |
|||
startLoading () { |
|||
loading = Loading.service({ |
|||
lock: true, // 是否锁定 |
|||
text: '正在加载……', // 加载中需要显示的文字 |
|||
background: 'rgba(0,0,0,.7)' // 背景颜色 |
|||
}) |
|||
}, |
|||
// 结束加载动画 |
|||
endLoading () { |
|||
// clearTimeout(timer); |
|||
if (loading) { |
|||
loading.close() |
|||
} |
|||
} |
|||
}, |
|||
watch: { |
|||
selection (val) { |
|||
|
|||
if (val.length > 0) { |
|||
this.showDeletBtn = true |
|||
} else { |
|||
this.showDeletBtn = false |
|||
} |
|||
} |
|||
}, |
|||
props: { |
|||
staffAgencyId: { |
|||
type: String, |
|||
default: '', |
|||
}, |
|||
showImportBtn: { |
|||
type: Boolean, |
|||
default: false, |
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
<style lang="scss" scoped > |
|||
@import "@/assets/scss/modules/visual/communityManage.scss"; |
|||
</style> |
|||
@ -0,0 +1,260 @@ |
|||
<template> |
|||
<div class="div_people_search"> |
|||
<!-- 组织路由 --> |
|||
<div class="div_top g-bread"> |
|||
<el-breadcrumb separator-class="el-icon-arrow-right"> |
|||
<el-breadcrumb-item v-for="item in breadList" :key="item.path" :to="{ path: item.path }"> |
|||
{{ item.meta.title }} |
|||
</el-breadcrumb-item> |
|||
|
|||
</el-breadcrumb> |
|||
</div> |
|||
|
|||
<div v-if="orgLevel!=='people'"> |
|||
|
|||
<div class="list_box"> |
|||
<div class="info_tip"> |
|||
<img src="../../../../assets/img/shuju/title-tip.png" |
|||
alt /> |
|||
<div class="tip_title">{{tableTitle}}</div> |
|||
</div> |
|||
<div class="warning-table"> |
|||
<div class="table"> |
|||
<div class="table-header"> |
|||
<div class="td td1">序号</div> |
|||
<div class="td td1">姓名</div> |
|||
<div class="td td3">所属网格</div> |
|||
<div class="td td3">所属房屋</div> |
|||
<div class="td td2">手机</div> |
|||
<div class="td td3">身份证</div> |
|||
<div class="td td1">性别</div> |
|||
<div class="td td2">出生日期</div> |
|||
<div class="td td1">操作</div> |
|||
|
|||
</div> |
|||
<div v-if="!loading && tableData.length> 0" |
|||
class="table-body"> |
|||
<div class="table-body-tr" |
|||
v-for="(item,index) in tableData" |
|||
:key='index'> |
|||
<div class="td td1">{{item.sort}} </div> |
|||
<div class="td td1">{{item.name}} </div> |
|||
<div class="td td3">{{item.gridName}} </div> |
|||
<div class="td td3">{{item.neighborHoodName + item.buildNum}} </div> |
|||
<!-- <div class="td td1">{{item.buildNum}} </div> --> |
|||
<div class="td td2">{{item.mobile}} </div> |
|||
<div class="td td3">{{item.idCard}} </div> |
|||
<div class="td td1">{{item.gender}} </div> |
|||
<div class="td td2">{{item.birthday}} </div> |
|||
<div @click="handelToPeople(item)" |
|||
class="td td1 btn_detail">{{'查看'}} </div> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
<div class="table-status" |
|||
v-if="loading"> |
|||
<screen-loading>加载中</screen-loading> |
|||
</div> |
|||
|
|||
<div class="table-status" |
|||
v-if="tableData.length == 0 && !loading"> |
|||
<div class="no-data"> |
|||
<img src="@/assets/img/modules/visual/noData.png" |
|||
class="no-data-img" /> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
<div class="pagination"> |
|||
<el-pagination background |
|||
layout="prev, pager, next, total" |
|||
:current-page="pageNo" |
|||
:page-size="pageSize" |
|||
:total="total" |
|||
@current-change="pageCurrentChangeHandle"> |
|||
</el-pagination> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- <people v-if="orgLevel==='people'" |
|||
:uid="selUserId" |
|||
ref="ref_people"></people> --> |
|||
<people-more v-show="showedMoreInfo" |
|||
v-if="info.userId" |
|||
:userId="info.userId" |
|||
:gridName="info.gridName" |
|||
@close="showedMoreInfo = false" /> |
|||
</div> |
|||
|
|||
</template> |
|||
|
|||
<script> |
|||
import { requestPost } from "@/js/dai/request"; |
|||
import People from "./people"; |
|||
import ScreenLoading from "@/views/modules/visual/cpts/loading"; |
|||
import peopleMore from "@/views/modules/visual/basicinfo/cpts/people-more"; |
|||
|
|||
export default { |
|||
name: "people-list", |
|||
components: { |
|||
People, ScreenLoading, peopleMore |
|||
}, |
|||
data () { |
|||
return { |
|||
showedMoreInfo: false, |
|||
tableTitle: '党员', |
|||
loading: false, |
|||
headerList: [], |
|||
tableData: [], |
|||
searchName: '', |
|||
pageSize: 10, |
|||
pageNo: 1, |
|||
total: 0, |
|||
orgLevel: 'search', |
|||
selUserId: '', |
|||
//下钻层级记录 |
|||
runNum: 0, |
|||
runAgencyArray: [], |
|||
info: {}, |
|||
breadList: [] |
|||
}; |
|||
}, |
|||
activated () { |
|||
|
|||
this.searchName = '' |
|||
this.tableData = [] |
|||
const { columnName, label } = this.$route.query |
|||
this.searchName = columnName |
|||
this.tableTitle = label |
|||
this.loadList() |
|||
|
|||
}, |
|||
beforeRouteEnter(to, from, next) { |
|||
const arr = [ {...from }, { ...to, meta: { title: '人员列表'}}] |
|||
next((vm) =>{ |
|||
vm.breadList = [ ...arr ] |
|||
}) |
|||
}, |
|||
methods: { |
|||
handleSearch () { |
|||
|
|||
}, |
|||
|
|||
|
|||
|
|||
async loadList () { |
|||
this.loading = true |
|||
const url = "/epmetuser/icresiuser/searchbycategory" |
|||
let params = { |
|||
columnName: this.searchName, |
|||
pageSize: this.pageSize, |
|||
pageNo: this.pageNo |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
this.loading = false |
|||
if (code === 0) { |
|||
this.total = data.total |
|||
this.tableData = data.list |
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
}, |
|||
|
|||
//点击查看 |
|||
handelToPeople (item) { |
|||
// this.toSubAgency('people', this.tableData[index].userId) |
|||
this.info = { ...item } |
|||
this.showedMoreInfo = true |
|||
}, |
|||
|
|||
pageCurrentChangeHandle (val) { |
|||
this.pageNo = val |
|||
this.loadList() |
|||
}, |
|||
|
|||
//下钻到下一级 type点击的类型:polygon 点击多边形(分为点击组织/小区) people 点击详情 |
|||
async toSubAgency (type, userId) { |
|||
|
|||
|
|||
this.orgLevel = 'people' |
|||
this.selUserId = userId |
|||
|
|||
|
|||
}, |
|||
|
|||
//返回所选组织 |
|||
handleClickBack () { |
|||
this.orgLevel = 'search' |
|||
|
|||
}, |
|||
|
|||
}, |
|||
destroyed () { |
|||
console.log("我已经离开了!"); |
|||
|
|||
}, |
|||
|
|||
}; |
|||
</script> |
|||
|
|||
<style |
|||
lang="scss" |
|||
src="@/assets/scss/modules/visual/basicInfoMain.scss" |
|||
scoped |
|||
></style> |
|||
|
|||
<style |
|||
lang="scss" |
|||
src="@/assets/scss/modules/visual/searchPerson.scss" |
|||
scoped |
|||
></style> |
|||
|
|||
|
|||
|
|||
<style lang="scss" scoped> |
|||
.div_search_list { |
|||
.el-input__inner[WarningColor="warning"] { |
|||
border-radius: 8px 0 0 8px; |
|||
height: 53px; |
|||
background-color: #01106800; |
|||
border: 2px solid #0082fb; |
|||
padding-left: 70px; |
|||
font-size: 18px; |
|||
font-family: PingFang SC; |
|||
font-weight: 400; |
|||
color: #ffffff; |
|||
} |
|||
} |
|||
.list_box { |
|||
width: 96%; |
|||
height: 780px; |
|||
margin: 20px auto; |
|||
} |
|||
.warning-table { |
|||
height: 640px; |
|||
} |
|||
.pagination { |
|||
padding-right: 0; |
|||
margin-top: 0; |
|||
text-align: right; |
|||
} |
|||
.g-bread { |
|||
padding: 10px 20px; |
|||
::v-deep .el-breadcrumb__item { |
|||
font-size: 16px; |
|||
.el-breadcrumb__inner { |
|||
color: #fff; |
|||
} |
|||
} |
|||
::v-deep .el-breadcrumb__item:first-child { |
|||
.el-breadcrumb__inner { |
|||
color: #a0c3d9; |
|||
} |
|||
} |
|||
} |
|||
</style> |
|||
@ -1,155 +0,0 @@ |
|||
<template> |
|||
<div class="aui-wrapper aui-page__login"> |
|||
<div class="aui-content__wrapper"> |
|||
<main class="aui-content"> |
|||
<div class="login-header"> |
|||
<h2 class="login-brand">{{ $t('brand.lg') }}</h2> |
|||
</div> |
|||
<div class="login-body"> |
|||
<h3 class="login-title">{{ $t('login.title') }}</h3> |
|||
<el-form :model="dataForm" |
|||
:rules="dataRule" |
|||
ref="dataForm" |
|||
@keyup.enter.native="dataFormSubmitHandle()" |
|||
status-icon> |
|||
<!-- <el-form-item> |
|||
<el-select v-model="$i18n.locale" |
|||
class="w-percent-100"> |
|||
<el-option v-for="(val, key) in i18nMessages" |
|||
:key="key" |
|||
:label="val._lang" |
|||
:value="key"></el-option> |
|||
</el-select> |
|||
</el-form-item> --> |
|||
<el-form-item prop="phone"> |
|||
<el-input v-model="dataForm.phone" |
|||
placeholder="手机号"> |
|||
<span slot="prefix" |
|||
class="el-input__icon"> |
|||
<svg class="icon-svg" |
|||
aria-hidden="true"> |
|||
<use xlink:href="#icon-user"></use> |
|||
</svg> |
|||
</span> |
|||
</el-input> |
|||
</el-form-item> |
|||
<el-form-item prop="password"> |
|||
<el-input v-model="dataForm.password" |
|||
type="password" |
|||
:placeholder="$t('login.password')"> |
|||
<span slot="prefix" |
|||
class="el-input__icon"> |
|||
<svg class="icon-svg" |
|||
aria-hidden="true"> |
|||
<use xlink:href="#icon-lock"></use> |
|||
</svg> |
|||
</span> |
|||
</el-input> |
|||
</el-form-item> |
|||
<el-form-item prop="captcha"> |
|||
<el-row :gutter="20"> |
|||
<el-col :span="14"> |
|||
<el-input v-model="dataForm.captcha" |
|||
:placeholder="$t('login.captcha')"> |
|||
<span slot="prefix" |
|||
class="el-input__icon"> |
|||
<svg class="icon-svg" |
|||
aria-hidden="true"> |
|||
<use xlink:href="#icon-safetycertificate"></use> |
|||
</svg> |
|||
</span> |
|||
</el-input> |
|||
</el-col> |
|||
<el-col :span="10" |
|||
class="login-captcha"> |
|||
<img :src="captchaPath" |
|||
@click="getCaptcha()"> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button type="primary" |
|||
@click="dataFormSubmitHandle()" |
|||
class="w-percent-100">{{ $t('login.title') }}</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
</div> |
|||
<div class="login-footer"> |
|||
<p> |
|||
<a href="https://demo.cloud.renren.io/renren-cloud" |
|||
target="_blank">{{ $t('login.demo') }}</a> |
|||
</p> |
|||
<!-- 2020 © renren.io --> |
|||
<p><a href="https://www.renren.io/" |
|||
target="_blank">{{ $t('login.copyright') }}</a></p> |
|||
</div> |
|||
</main> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import Cookies from 'js-cookie' |
|||
import debounce from 'lodash/debounce' |
|||
import { messages } from '@/i18n' |
|||
import { getUUID } from '@/utils' |
|||
export default { |
|||
data () { |
|||
return { |
|||
i18nMessages: messages, |
|||
captchaPath: '', |
|||
dataForm: { |
|||
app: 'oper', |
|||
client: 'web', |
|||
username: '', |
|||
phone: '', |
|||
password: '', |
|||
uuid: '', |
|||
captcha: '' |
|||
} |
|||
} |
|||
}, |
|||
computed: { |
|||
dataRule () { |
|||
return { |
|||
phone: [ |
|||
{ required: true, message: '手机号不能为空', trigger: 'blur' } |
|||
], |
|||
password: [ |
|||
{ required: true, message: '密码不能为空', trigger: 'blur' } |
|||
], |
|||
captcha: [ |
|||
{ required: true, message: '验证码不能为空', trigger: 'blur' } |
|||
] |
|||
} |
|||
} |
|||
}, |
|||
created () { |
|||
this.getCaptcha() |
|||
}, |
|||
methods: { |
|||
// 获取验证码 |
|||
getCaptcha () { |
|||
this.dataForm.uuid = getUUID() |
|||
this.captchaPath = `${window.SITE_CONFIG['apiURL']}/auth/login/captcha?uuid=${this.dataForm.uuid}` |
|||
}, |
|||
// 表单提交 |
|||
dataFormSubmitHandle: debounce(function () { |
|||
this.$refs['dataForm'].validate((valid, messageObj) => { |
|||
if (!valid) { |
|||
app.util.validateRule(messageObj) |
|||
} |
|||
this.$http.post('/auth/login/operweb/loginbypassword', this.dataForm).then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
this.getCaptcha() |
|||
return this.$message.error(res.msg) |
|||
} |
|||
localStorage.setItem('userType', 'oper') |
|||
localStorage.setItem('token', res.data.token) |
|||
this.$router.replace({ name: 'home' }).catch(() => { }) |
|||
}).catch(() => { }) |
|||
}) |
|||
}, 1000, { 'leading': true, 'trailing': false }) |
|||
} |
|||
} |
|||
</script> |
|||
Loading…
Reference in new issue