提交 450e2f3f authored 作者: 何忠建's avatar 何忠建

业主模板下载

上级 72b89a3c
...@@ -71,6 +71,7 @@ const getRoomListApi = (params)=>getAction("/property-community/building/communi ...@@ -71,6 +71,7 @@ const getRoomListApi = (params)=>getAction("/property-community/building/communi
const addCommunityOwner = (params)=>postAction("/property-community/info/communityOwner/add",params); const addCommunityOwner = (params)=>postAction("/property-community/info/communityOwner/add",params);
const geCommunityOwnertInfoApi = (params)=>getAction("/property-community/info/communityOwner/queryById",params); const geCommunityOwnertInfoApi = (params)=>getAction("/property-community/info/communityOwner/queryById",params);
const auditCommunityOwnerApi = (params)=>postAction("/property-community/info/communityOwner/audit",params); const auditCommunityOwnerApi = (params)=>postAction("/property-community/info/communityOwner/audit",params);
const downloadOwnerTemplate = (params)=>postAction("/property-community/info/communityOwner/downloadOwnerTemplate",params);
// 生活缴费-费用规则 // 生活缴费-费用规则
const geCommunityRuleListApi = (params)=>getAction("/property-company/system/companyChargerule/communityRuleList",params); const geCommunityRuleListApi = (params)=>getAction("/property-company/system/companyChargerule/communityRuleList",params);
...@@ -195,6 +196,7 @@ export { ...@@ -195,6 +196,7 @@ export {
getBuildingListApi, getBuildingListApi,
getUnitListApi, getUnitListApi,
getRoomListApi, getRoomListApi,
downloadOwnerTemplate,
addCommunityOwner, addCommunityOwner,
geCommunityOwnertInfoApi, geCommunityOwnertInfoApi,
auditCommunityOwnerApi, auditCommunityOwnerApi,
......
...@@ -12,14 +12,16 @@ ...@@ -12,14 +12,16 @@
<a-col :md="6" :sm="8"> <a-col :md="6" :sm="8">
<a-form-model-item label="房屋用途"> <a-form-model-item label="房屋用途">
<a-select style="width: 100%" v-model="queryParam.chargeType" placeholder="请选择房屋用途"> <a-select style="width: 100%" v-model="queryParam.chargeType" placeholder="请选择房屋用途">
<a-select-option v-for="item in useOptions" :key="item.value" :value="item.value">{{item.label}}</a-select-option> <a-select-option v-for="item in useOptions" :key="item.value"
:value="item.value">{{item.label}}</a-select-option>
</a-select> </a-select>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :md="6" :sm="8"> <a-col :md="6" :sm="8">
<a-form-model-item label="认证状态"> <a-form-model-item label="认证状态">
<a-select style="width: 100%" v-model="queryParam.chargeType" placeholder="请选择认证状态"> <a-select style="width: 100%" v-model="queryParam.chargeType" placeholder="请选择认证状态">
<a-select-option v-for="item in certificationOptions" :key="item.value" :value="item.value">{{item.label}}</a-select-option> <a-select-option v-for="item in certificationOptions" :key="item.value"
:value="item.value">{{item.label}}</a-select-option>
</a-select> </a-select>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
...@@ -36,21 +38,23 @@ ...@@ -36,21 +38,23 @@
<div style="display:flex"> <div style="display:flex">
<div style="flex: none;width:200px" v-if="treeData.length"> <div style="flex: none;width:200px" v-if="treeData.length">
<a-tree v-if="treeDataFlag" :load-data="onLoadData" :tree-data="treeData" @select="onClickTree" style="max-height: 600px;overflow-y:auto" /> <a-tree v-if="treeDataFlag" :load-data="onLoadData" :tree-data="treeData" @select="onClickTree"
style="max-height: 600px;overflow-y:auto" />
</div> </div>
<div style="flex:auto;padding-left:10px"> <div style="flex:auto;padding-left:10px">
<!-- 操作按钮区域 --> <!-- 操作按钮区域 -->
<div class="table-operator"> <div class="table-operator">
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
<!-- <a-button icon="download" >模板下载</a-button> --> <a-button icon="download" @click="downloadExportXls()">模板下载</a-button>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader"
:action="importExcelUrl" @change="handleImportExcel">
<a-button type="primary" icon="import">导入</a-button> <a-button type="primary" icon="import">导入</a-button>
</a-upload> </a-upload>
<a-button type="primary" icon="download" @click="handleExportXls('业主管理')">导出</a-button> <a-button type="primary" icon="download" @click="handleExportXls('业主管理')">导出</a-button>
<a-dropdown v-if="selectedRowKeys.length > 0"> <a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay"> <a-menu slot="overlay">
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> <a-menu-item key="1" @click="batchDel"><a-icon type="delete" />删除</a-menu-item>
</a-menu> </a-menu>
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
</a-dropdown> </a-dropdown>
...@@ -64,20 +68,10 @@ ...@@ -64,20 +68,10 @@
<a style="margin-left: 24px" v-if="selectedRowKeys.length > 0" @click="onClearSelected">清空</a> <a style="margin-left: 24px" v-if="selectedRowKeys.length > 0" @click="onClearSelected">清空</a>
</div> </div>
<a-table <a-table ref="table" size="middle" :scroll="{x:true}" bordered rowKey="id" :columns="columns"
ref="table" :dataSource="dataSource" :pagination="ipagination" :loading="loading"
size="middle" :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" class="j-table-force-nowrap"
:scroll="{x:true}" @change="handleTableChange">
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
class="j-table-force-nowrap"
@change="handleTableChange"
>
<span slot="ownerName" slot-scope="text, record"> <span slot="ownerName" slot-scope="text, record">
<span>{{record.ownerName}}{{record.ownerPhone}}</span> <span>{{record.ownerName}}{{record.ownerPhone}}</span>
</span> </span>
...@@ -93,7 +87,7 @@ ...@@ -93,7 +87,7 @@
</template> </template>
<template v-else-if="record.auditStatus === 'refuse'"> <template v-else-if="record.auditStatus === 'refuse'">
<a @click="handleEdit(record)">详情</a> <a @click="handleEdit(record)">详情</a>
<a-divider type="vertical"/> <a-divider type="vertical" />
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)" placement="topLeft"> <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)" placement="topLeft">
<a>删除</a> <a>删除</a>
</a-popconfirm> </a-popconfirm>
...@@ -101,10 +95,10 @@ ...@@ -101,10 +95,10 @@
<template v-else> <template v-else>
<a @click="handleEdit(record)">编辑</a> <a @click="handleEdit(record)">编辑</a>
<a-divider type="vertical"/> <a-divider type="vertical" />
<a-dropdown> <a-dropdown>
<a class="ant-dropdown-link"> <a class="ant-dropdown-link">
更多 <a-icon type="down"/> 更多 <a-icon type="down" />
</a> </a>
<a-menu slot="overlay"> <a-menu slot="overlay">
<a-menu-item> <a-menu-item>
...@@ -132,91 +126,92 @@ ...@@ -132,91 +126,92 @@
</template> </template>
<script> <script>
import { getBuildingListApi, getUnitListApi, getRoomListApi } from '@/api/api' import { getBuildingListApi, getUnitListApi, getRoomListApi, downloadOwnerTemplate } from '@/api/api'
import { JeecgListMixin } from '@/mixins/JeecgListMixin' import { downFile } from '@/api/manage'
import NoticeModal from './modules/NoticeModal' import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import {filterDictTextByCache} from '@/components/dict/JDictSelectUtil' import NoticeModal from './modules/NoticeModal'
import {RELATION_SHIP, filterDictTextByStatic} from '@/assets/static.js' import { filterDictTextByCache } from '@/components/dict/JDictSelectUtil'
import {ajaxGetDictItems,getDictItemsFromCache} from '@/api/api' import { RELATION_SHIP, filterDictTextByStatic } from '@/assets/static.js'
import { ajaxGetDictItems, getDictItemsFromCache } from '@/api/api'
const columns = [ const columns = [
{ {
title: '业主', title: '业主',
dataIndex: 'ownerName', dataIndex: 'ownerName',
scopedSlots: { customRender: 'ownerName' }, scopedSlots: { customRender: 'ownerName' },
key: 'ownerName', key: 'ownerName',
align: 'center' align: 'center',
}, },
{ {
title: '与业主关系', title: '与业主关系',
dataIndex: 'relationShip', dataIndex: 'relationShip',
key: 'relationShip', key: 'relationShip',
align: 'center', align: 'center',
customRender: function(text) { customRender: function (text) {
return filterDictTextByStatic(RELATION_SHIP, text); return filterDictTextByStatic(RELATION_SHIP, text)
} },
}, },
{ {
title: '住户', title: '住户',
dataIndex: 'residentName', dataIndex: 'residentName',
key: 'residentName', key: 'residentName',
scopedSlots: { customRender: 'residentName' }, scopedSlots: { customRender: 'residentName' },
align: 'center' align: 'center',
}, },
{ {
title: '房屋用途', title: '房屋用途',
dataIndex: 'useTo', dataIndex: 'useTo',
key: 'useTo', key: 'useTo',
align: 'center', align: 'center',
customRender: function(text) { customRender: function (text) {
return filterDictTextByCache('house_purpose', text); return filterDictTextByCache('house_purpose', text)
} },
}, },
{ {
title: '房屋编号', title: '房屋编号',
dataIndex: 'buildingName', dataIndex: 'buildingName',
key: 'buildingName', key: 'buildingName',
scopedSlots: { customRender: 'buildingName' }, scopedSlots: { customRender: 'buildingName' },
align: 'center' align: 'center',
}, },
{ {
title: '建筑面积(m2)', title: '建筑面积(m2)',
dataIndex: 'floorSpace', dataIndex: 'floorSpace',
key: 'floorSpace', key: 'floorSpace',
align: 'center' align: 'center',
}, },
{ {
title: '是否认证', title: '是否认证',
dataIndex: 'isAuth', dataIndex: 'isAuth',
key: 'isAuth', key: 'isAuth',
align: 'center', align: 'center',
customRender: function(text) { customRender: function (text) {
return filterDictTextByCache('yn', text); return filterDictTextByCache('yn', text)
} },
}, },
{ {
title: '审核状态', title: '审核状态',
dataIndex: 'auditStatus', dataIndex: 'auditStatus',
key: 'auditStatus', key: 'auditStatus',
align: 'center', align: 'center',
customRender: function(text) { customRender: function (text) {
return filterDictTextByCache('auditStatus', text); return filterDictTextByCache('auditStatus', text)
} },
}, },
{ {
title: '操作', title: '操作',
dataIndex: 'action', dataIndex: 'action',
scopedSlots: { customRender: 'action' }, scopedSlots: { customRender: 'action' },
align: 'center', align: 'center',
width: 150 width: 150,
} },
] ]
export default { export default {
name: 'PermissionListAsync', name: 'PermissionListAsync',
mixins: [JeecgListMixin], mixins: [JeecgListMixin],
components: { components: {
NoticeModal NoticeModal,
}, },
data() { data() {
return { return {
...@@ -226,67 +221,68 @@ ...@@ -226,67 +221,68 @@
// 表头 // 表头
columns: columns, columns: columns,
url: { url: {
list: "/property-community/info/communityOwner/list", list: '/property-community/info/communityOwner/list',
delete: '/property-community/info/communityOwner/delete', delete: '/property-community/info/communityOwner/delete',
deleteBatch: '/property-community/info/communityOwner/deleteBatch', deleteBatch: '/property-community/info/communityOwner/deleteBatch',
exportXlsUrl: "/property-community/info/communityOwner/exportXls", exportXlsUrl: '/property-community/info/communityOwner/exportXls',
importExcelUrl:"property-community/info/communityOwner/importExcel" importExcelUrl: 'property-community/info/communityOwner/importExcel',
downloadExcelUrl: 'property-community/info/communityOwner/downloadOwnerTemplate',
}, },
treeData: [] treeData: [],
} }
}, },
created () { created() {
this.getBuildingList() this.getBuildingList()
this.initDictData() this.initDictData()
}, },
computed: { computed: {
importExcelUrl: function(){ importExcelUrl: function () {
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
} },
}, },
methods: { methods: {
initDictData() { initDictData() {
//优先从缓存中读取字典配置 //优先从缓存中读取字典配置
if(getDictItemsFromCache('owner_certification_status')){ if (getDictItemsFromCache('owner_certification_status')) {
this.useOptions = getDictItemsFromCache('house_purpose'); this.useOptions = getDictItemsFromCache('house_purpose')
this.certificationOptions = getDictItemsFromCache('owner_certification_status'); this.certificationOptions = getDictItemsFromCache('owner_certification_status')
return return
} }
// //根据字典Code, 初始化字典数组 // //根据字典Code, 初始化字典数组
ajaxGetDictItems('house_purpose', null).then((res) => { ajaxGetDictItems('house_purpose', null).then((res) => {
if (res.success) { if (res.success) {
this.useOptions = res.result; this.useOptions = res.result
} }
}) })
ajaxGetDictItems('owner_certification_status', null).then((res) => { ajaxGetDictItems('owner_certification_status', null).then((res) => {
if (res.success) { if (res.success) {
this.certificationOptions = res.result; this.certificationOptions = res.result
} }
}) })
}, },
async getBuildingList() { async getBuildingList() {
let {result} = await getBuildingListApi() let { result } = await getBuildingListApi()
this.treeData = result.map(item=> { this.treeData = result.map((item) => {
return { return {
title: item.buildingName, title: item.buildingName,
key: item.id key: item.id,
} }
}) })
}, },
onClickTree(value, option) { onClickTree(value, option) {
let level = option.node.pos.split('-').length let level = option.node.pos.split('-').length
if(level === 2) { if (level === 2) {
this.queryParam['buildingId'] = value[0] this.queryParam['buildingId'] = value[0]
this.queryParam['unitId'] = undefined this.queryParam['unitId'] = undefined
this.queryParam['roomId'] = undefined this.queryParam['roomId'] = undefined
} }
if(level === 3) { if (level === 3) {
this.queryParam['buildingId'] = undefined this.queryParam['buildingId'] = undefined
this.queryParam['unitId'] = value[0] this.queryParam['unitId'] = value[0]
this.queryParam['roomId'] = undefined this.queryParam['roomId'] = undefined
} }
if(level === 4) { if (level === 4) {
this.queryParam['buildingId'] = undefined this.queryParam['buildingId'] = undefined
this.queryParam['unitId'] = undefined this.queryParam['unitId'] = undefined
this.queryParam['roomId'] = value[0] this.queryParam['roomId'] = value[0]
...@@ -295,49 +291,71 @@ ...@@ -295,49 +291,71 @@
}, },
onSearchReset() { onSearchReset() {
this.treeDataFlag = false this.treeDataFlag = false
setTimeout(()=> { setTimeout(() => {
this.treeDataFlag = true this.treeDataFlag = true
}, 30) }, 30)
this.searchReset() this.searchReset()
}, },
onLoadData(treeNode) { onLoadData(treeNode) {
return new Promise(async resolve => { return new Promise(async (resolve) => {
if (treeNode.dataRef.children) { if (treeNode.dataRef.children) {
resolve(); resolve()
return; return
} }
if(treeNode.pos.split('-').length === 2) { if (treeNode.pos.split('-').length === 2) {
let {result} = await getUnitListApi({id: treeNode.eventKey}) let { result } = await getUnitListApi({ id: treeNode.eventKey })
treeNode.dataRef.children = result.map(item=> { treeNode.dataRef.children = result.map((item) => {
return { return {
title: item.unitName, title: item.unitName,
key: item.id key: item.id,
} }
}) })
this.treeData = [...this.treeData]; this.treeData = [...this.treeData]
resolve(); resolve()
} else { } else {
let {result} = await getRoomListApi({id: treeNode.eventKey}) let { result } = await getRoomListApi({ id: treeNode.eventKey })
treeNode.dataRef.children = result.map(item=> { treeNode.dataRef.children = result.map((item) => {
return { return {
title: item.roomNum, title: item.roomNum,
key: item.id, key: item.id,
isLeaf: true isLeaf: true,
} }
}) })
this.treeData = [...this.treeData]; this.treeData = [...this.treeData]
resolve(); resolve()
} }
}); })
}, },
onRoutetAdd(id) { onRoutetAdd(id) {
this.$router.push({ this.$router.push({
path: '/information/owner-add?id=' + id path: '/information/owner-add?id=' + id,
}); })
} },
downloadExportXls() {
let fileName ='业主管理模板';
downFile(this.url.downloadExcelUrl, '').then((data) => {
if (!data) {
this.$message.warning('文件下载失败')
return
} }
if (typeof window.navigator.msSaveBlob !== 'undefined') {
window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xlsx')
} else {
let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
let link = document.createElement('a')
link.style.display = 'none'
link.href = url
link.setAttribute('download', fileName + '.xlsx')
document.body.appendChild(link)
link.click()
document.body.removeChild(link) //下载完成移除元素
window.URL.revokeObjectURL(url) //释放掉blob对象
} }
})
},
},
}
</script> </script>
<style scoped> <style scoped>
@import '~@assets/less/common.less'; @import '~@assets/less/common.less';
</style> </style>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论