提交 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,212 +126,236 @@ ...@@ -132,212 +126,236 @@
</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: '与业主关系',
dataIndex: 'relationShip',
key: 'relationShip',
align: 'center',
customRender: function (text) {
return filterDictTextByStatic(RELATION_SHIP, text)
}, },
{ },
title: '与业主关系', {
dataIndex: 'relationShip', title: '住户',
key: 'relationShip', dataIndex: 'residentName',
align: 'center', key: 'residentName',
customRender: function(text) { scopedSlots: { customRender: 'residentName' },
return filterDictTextByStatic(RELATION_SHIP, text); align: 'center',
} },
}, {
{ title: '房屋用途',
title: '住户', dataIndex: 'useTo',
dataIndex: 'residentName', key: 'useTo',
key: 'residentName', align: 'center',
scopedSlots: { customRender: 'residentName' }, customRender: function (text) {
align: 'center' return filterDictTextByCache('house_purpose', text)
},
{
title: '房屋用途',
dataIndex: 'useTo',
key: 'useTo',
align: 'center',
customRender: function(text) {
return filterDictTextByCache('house_purpose', text);
}
}, },
{ },
title: '房屋编号', {
dataIndex: 'buildingName', title: '房屋编号',
key: 'buildingName', dataIndex: 'buildingName',
scopedSlots: { customRender: 'buildingName' }, key: 'buildingName',
align: 'center' scopedSlots: { customRender: 'buildingName' },
align: 'center',
},
{
title: '建筑面积(m2)',
dataIndex: 'floorSpace',
key: 'floorSpace',
align: 'center',
},
{
title: '是否认证',
dataIndex: 'isAuth',
key: 'isAuth',
align: 'center',
customRender: function (text) {
return filterDictTextByCache('yn', text)
}, },
{ },
title: '建筑面积(m2)', {
dataIndex: 'floorSpace', title: '审核状态',
key: 'floorSpace', dataIndex: 'auditStatus',
align: 'center' key: 'auditStatus',
}, align: 'center',
{ customRender: function (text) {
title: '是否认证', return filterDictTextByCache('auditStatus', text)
dataIndex: 'isAuth',
key: 'isAuth',
align: 'center',
customRender: function(text) {
return filterDictTextByCache('yn', text);
}
},
{
title: '审核状态',
dataIndex: 'auditStatus',
key: 'auditStatus',
align: 'center',
customRender: function(text) {
return filterDictTextByCache('auditStatus', text);
}
}, },
{ },
title: '操作', {
dataIndex: 'action', title: '操作',
scopedSlots: { customRender: 'action' }, dataIndex: 'action',
align: 'center', scopedSlots: { customRender: 'action' },
width: 150 align: 'center',
} width: 150,
] },
]
export default { export default {
name: 'PermissionListAsync', name: 'PermissionListAsync',
mixins: [JeecgListMixin], mixins: [JeecgListMixin],
components: { components: {
NoticeModal NoticeModal,
}, },
data() { data() {
return { return {
treeDataFlag: true, treeDataFlag: true,
useOptions: [], useOptions: [],
certificationOptions: [], certificationOptions: [],
// 表头 // 表头
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() {
this.getBuildingList()
this.initDictData()
},
computed: {
importExcelUrl: function () {
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
},
},
methods: {
initDictData() {
//优先从缓存中读取字典配置
if (getDictItemsFromCache('owner_certification_status')) {
this.useOptions = getDictItemsFromCache('house_purpose')
this.certificationOptions = getDictItemsFromCache('owner_certification_status')
return
} }
// //根据字典Code, 初始化字典数组
ajaxGetDictItems('house_purpose', null).then((res) => {
if (res.success) {
this.useOptions = res.result
}
})
ajaxGetDictItems('owner_certification_status', null).then((res) => {
if (res.success) {
this.certificationOptions = res.result
}
})
}, },
created () { async getBuildingList() {
this.getBuildingList() let { result } = await getBuildingListApi()
this.initDictData() this.treeData = result.map((item) => {
return {
title: item.buildingName,
key: item.id,
}
})
}, },
computed: { onClickTree(value, option) {
importExcelUrl: function(){ let level = option.node.pos.split('-').length
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; if (level === 2) {
this.queryParam['buildingId'] = value[0]
this.queryParam['unitId'] = undefined
this.queryParam['roomId'] = undefined
}
if (level === 3) {
this.queryParam['buildingId'] = undefined
this.queryParam['unitId'] = value[0]
this.queryParam['roomId'] = undefined
} }
if (level === 4) {
this.queryParam['buildingId'] = undefined
this.queryParam['unitId'] = undefined
this.queryParam['roomId'] = value[0]
}
this.searchQuery()
},
onSearchReset() {
this.treeDataFlag = false
setTimeout(() => {
this.treeDataFlag = true
}, 30)
this.searchReset()
}, },
methods: { onLoadData(treeNode) {
initDictData() { return new Promise(async (resolve) => {
//优先从缓存中读取字典配置 if (treeNode.dataRef.children) {
if(getDictItemsFromCache('owner_certification_status')){ resolve()
this.useOptions = getDictItemsFromCache('house_purpose');
this.certificationOptions = getDictItemsFromCache('owner_certification_status');
return return
} }
// //根据字典Code, 初始化字典数组 if (treeNode.pos.split('-').length === 2) {
ajaxGetDictItems('house_purpose', null).then((res) => { let { result } = await getUnitListApi({ id: treeNode.eventKey })
if (res.success) { treeNode.dataRef.children = result.map((item) => {
this.useOptions = res.result; return {
} title: item.unitName,
}) key: item.id,
ajaxGetDictItems('owner_certification_status', null).then((res) => { }
if (res.success) { })
this.certificationOptions = res.result; this.treeData = [...this.treeData]
} resolve()
}) } else {
}, let { result } = await getRoomListApi({ id: treeNode.eventKey })
async getBuildingList() { treeNode.dataRef.children = result.map((item) => {
let {result} = await getBuildingListApi() return {
this.treeData = result.map(item=> { title: item.roomNum,
return { key: item.id,
title: item.buildingName, isLeaf: true,
key: item.id }
} })
}) this.treeData = [...this.treeData]
}, resolve()
onClickTree(value, option) {
let level = option.node.pos.split('-').length
if(level === 2) {
this.queryParam['buildingId'] = value[0]
this.queryParam['unitId'] = undefined
this.queryParam['roomId'] = undefined
} }
if(level === 3) { })
this.queryParam['buildingId'] = undefined },
this.queryParam['unitId'] = value[0] onRoutetAdd(id) {
this.queryParam['roomId'] = undefined this.$router.push({
path: '/information/owner-add?id=' + id,
})
},
downloadExportXls() {
let fileName ='业主管理模板';
downFile(this.url.downloadExcelUrl, '').then((data) => {
if (!data) {
this.$message.warning('文件下载失败')
return
} }
if(level === 4) { if (typeof window.navigator.msSaveBlob !== 'undefined') {
this.queryParam['buildingId'] = undefined window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xlsx')
this.queryParam['unitId'] = undefined } else {
this.queryParam['roomId'] = value[0] 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对象
} }
this.searchQuery() })
}, },
onSearchReset() { },
this.treeDataFlag = false }
setTimeout(()=> {
this.treeDataFlag = true
}, 30)
this.searchReset()
},
onLoadData(treeNode) {
return new Promise(async resolve => {
if (treeNode.dataRef.children) {
resolve();
return;
}
if(treeNode.pos.split('-').length === 2) {
let {result} = await getUnitListApi({id: treeNode.eventKey})
treeNode.dataRef.children = result.map(item=> {
return {
title: item.unitName,
key: item.id
}
})
this.treeData = [...this.treeData];
resolve();
} else {
let {result} = await getRoomListApi({id: treeNode.eventKey})
treeNode.dataRef.children = result.map(item=> {
return {
title: item.roomNum,
key: item.id,
isLeaf: true
}
})
this.treeData = [...this.treeData];
resolve();
}
});
},
onRoutetAdd(id) {
this.$router.push({
path: '/information/owner-add?id=' + id
});
}
}
}
</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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论