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

生活缴费导入导出

上级 108db7c6
...@@ -339,13 +339,13 @@ export default { ...@@ -339,13 +339,13 @@ export default {
return return
} }
if (typeof window.navigator.msSaveBlob !== 'undefined') { if (typeof window.navigator.msSaveBlob !== 'undefined') {
window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xlsx') window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls')
} else { } else {
let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' })) let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
let link = document.createElement('a') let link = document.createElement('a')
link.style.display = 'none' link.style.display = 'none'
link.href = url link.href = url
link.setAttribute('download', fileName + '.xlsx') link.setAttribute('download', fileName + '.xls')
document.body.appendChild(link) document.body.appendChild(link)
link.click() link.click()
document.body.removeChild(link) //下载完成移除元素 document.body.removeChild(link) //下载完成移除元素
......
...@@ -29,11 +29,16 @@ ...@@ -29,11 +29,16 @@
<!-- 操作按钮区域 --> <!-- 操作按钮区域 -->
<div class="table-operator"> <div class="table-operator">
<a-button @click="onMeterReading" type="primary" icon="plus">抄表</a-button> <a-button @click="onMeterReading" type="primary" icon="plus">抄表</a-button>
<a-button type="primary" icon="download" @click="handleExportXls('t_property_settled')">导出</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-button type="primary" icon="import">导入</a-button>
</a-upload>
<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="onBatchCallpay"><a-icon type="message"/>催缴</a-menu-item> <a-menu-item key="1" @click="onBatchCallpay"><a-icon type="message" />催缴</a-menu-item>
<a-menu-item key="2" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> <a-menu-item key="2" @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>
...@@ -47,24 +52,12 @@ ...@@ -47,24 +52,12 @@
<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: 1500}" bordered rowKey="id" :columns="columns"
ref="table" :dataSource="dataSource" :pagination="ipagination" :loading="loading" :rowSelection="{
size="middle"
:scroll="{ x: 1500, y: 300 }"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{
selectedRowKeys: selectedRowKeys, selectedRowKeys: selectedRowKeys,
onChange: onSelectChange, onChange: onSelectChange,
getCheckboxProps: onCheckboxProps getCheckboxProps: onCheckboxProps
}" }" class="j-table-force-nowrap" @change="handleTableChange">
class="j-table-force-nowrap"
@change="handleTableChange"
>
<span slot="ownerId" slot-scope="text, record"> <span slot="ownerId" slot-scope="text, record">
<span>{{record.ownerName}}{{record.ownerPhone}}</span> <span>{{record.ownerName}}{{record.ownerPhone}}</span>
</span> </span>
...@@ -77,9 +70,9 @@ ...@@ -77,9 +70,9 @@
<span slot="action" slot-scope="text, record"> <span slot="action" slot-scope="text, record">
<a @click="onDetail(record.id)">查看</a> <a @click="onDetail(record.id)">查看</a>
<template v-if="record.paymentStatus === 'unPaid'"> <template v-if="record.paymentStatus === 'unPaid'">
<a-divider type="vertical"/> <a-divider type="vertical" />
<a @click="onCallPay(record.id)">催缴</a> <a @click="onCallPay(record.id)">催缴</a>
<a-divider type="vertical"/> <a-divider type="vertical" />
<a @click="handleDelete(record)">删除</a> <a @click="handleDelete(record)">删除</a>
</template> </template>
</span> </span>
...@@ -95,25 +88,26 @@ ...@@ -95,25 +88,26 @@
</template> </template>
<script> <script>
import { getBuildingListApi, getUnitListApi, getRoomListApi, callPayMentApi } from '@/api/api' import { getBuildingListApi, getUnitListApi, getRoomListApi, callPayMentApi } from '@/api/api'
import { JeecgListMixin } from '@/mixins/JeecgListMixin' import { downFile } from '@/api/manage'
import NoticeModal from './modules/NoticeModal' import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import {PAYMENT_STATUS, RELATION_SHIP, filterDictTextByStatic} from '@/assets/static.js' import NoticeModal from './modules/NoticeModal'
import { PAYMENT_STATUS, RELATION_SHIP, filterDictTextByStatic } from '@/assets/static.js'
const columns = [ const columns = [
{ {
title: '收费类型', title: '收费类型',
dataIndex: 'chargeTypeName', dataIndex: 'chargeTypeName',
key: 'chargeTypeName', key: 'chargeTypeName',
width: 120, width: 120,
align: 'center' align: 'center',
}, },
{ {
title: '收费项目', title: '收费项目',
dataIndex: 'chargeItem', dataIndex: 'chargeItem',
key: 'chargeItem', key: 'chargeItem',
width: 120, width: 120,
align: 'center' align: 'center',
}, },
{ {
title: '业主', title: '业主',
...@@ -121,7 +115,7 @@ ...@@ -121,7 +115,7 @@
key: 'ownerId', key: 'ownerId',
width: 160, width: 160,
scopedSlots: { customRender: 'ownerId' }, scopedSlots: { customRender: 'ownerId' },
align: 'center' align: 'center',
}, },
{ {
title: '与业主关系', title: '与业主关系',
...@@ -129,9 +123,9 @@ ...@@ -129,9 +123,9 @@
key: 'relationShip', key: 'relationShip',
width: 120, width: 120,
align: 'center', align: 'center',
customRender: function(text) { customRender: function (text) {
return filterDictTextByStatic(RELATION_SHIP, text); return filterDictTextByStatic(RELATION_SHIP, text)
} },
}, },
{ {
title: '住户', title: '住户',
...@@ -139,7 +133,7 @@ ...@@ -139,7 +133,7 @@
key: 'residentPhone', key: 'residentPhone',
width: 160, width: 160,
scopedSlots: { customRender: 'residentPhone' }, scopedSlots: { customRender: 'residentPhone' },
align: 'center' align: 'center',
}, },
{ {
title: '房屋编号', title: '房屋编号',
...@@ -147,21 +141,21 @@ ...@@ -147,21 +141,21 @@
scopedSlots: { customRender: 'roomId' }, scopedSlots: { customRender: 'roomId' },
key: 'roomId', key: 'roomId',
width: 140, width: 140,
align: 'center' align: 'center',
}, },
{ {
title: '金额(元)', title: '金额(元)',
dataIndex: 'totalAmount', dataIndex: 'totalAmount',
key: 'totalAmount', key: 'totalAmount',
width: 120, width: 120,
align: 'center' align: 'center',
}, },
{ {
title: '本期读表时间', title: '本期读表时间',
dataIndex: 'meterReadingTime', dataIndex: 'meterReadingTime',
key: 'meterReadingTime', key: 'meterReadingTime',
width: 150, width: 150,
align: 'center' align: 'center',
}, },
{ {
title: '缴费状态', title: '缴费状态',
...@@ -169,30 +163,30 @@ ...@@ -169,30 +163,30 @@
key: 'paymentStatus', key: 'paymentStatus',
width: 120, width: 120,
align: 'center', align: 'center',
customRender: function(text) { customRender: function (text) {
return filterDictTextByStatic(PAYMENT_STATUS, text); return filterDictTextByStatic(PAYMENT_STATUS, text)
} },
}, },
{ {
title: '缴费单号', title: '缴费单号',
dataIndex: 'paymentNum', dataIndex: 'paymentNum',
key: 'paymentNum', key: 'paymentNum',
width: 120, width: 120,
align: 'center' align: 'center',
}, },
{ {
title: '缴费日期', title: '缴费日期',
dataIndex: 'paymentTime', dataIndex: 'paymentTime',
key: 'paymentTime', key: 'paymentTime',
width: 150, width: 150,
align: 'center' align: 'center',
}, },
{ {
title: '创建日期', title: '创建日期',
dataIndex: 'createTime', dataIndex: 'createTime',
key: 'createTime', key: 'createTime',
width: 150, width: 150,
align: 'center' align: 'center',
}, },
{ {
title: '操作', title: '操作',
...@@ -200,44 +194,52 @@ ...@@ -200,44 +194,52 @@
scopedSlots: { customRender: 'action' }, scopedSlots: { customRender: 'action' },
align: 'center', align: 'center',
width: 150, width: 150,
fixed: 'right' fixed: 'right',
} },
] ]
export default { export default {
name: 'PermissionListAsync', name: 'PermissionListAsync',
mixins: [JeecgListMixin], mixins: [JeecgListMixin],
components: {NoticeModal}, components: { NoticeModal },
data() { data() {
return { return {
// 表头 // 表头
columns: columns, columns: columns,
url: { url: {
list: "/property-community/payment/communityPayment/list", list: '/property-community/payment/communityPayment/list',
delete: '/property-community/payment/communityPayment/delete', delete: '/property-community/payment/communityPayment/delete',
deleteBatch: '/property-community/payment/communityPayment/deleteBatch' deleteBatch: '/property-community/payment/communityPayment/deleteBatch',
exportXlsUrl: '/property-community/payment/communityPayment/exportXls',
importExcelUrl: 'property-community/payment/communityPayment/importExcel',
downloadExcelUrl: '/property-community/payment/communityPayment/downloadPaymentTemplate',
}, },
treeData: [] treeData: [],
} }
}, },
created () { created() {
this.getBuildingList() this.getBuildingList()
// this.initDictData() // this.initDictData()
}, },
computed: {
importExcelUrl: function () {
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
},
},
methods: { methods: {
onCheckboxProps(record) { onCheckboxProps(record) {
let props = { let props = {
disabled: record.paymentStatus === 'paid', disabled: record.paymentStatus === 'paid',
name: record.chargeTypeName name: record.chargeTypeName,
} }
return props return props
}, },
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,
} }
}) })
}, },
...@@ -245,39 +247,39 @@ ...@@ -245,39 +247,39 @@
console.log(value, optios) console.log(value, optios)
}, },
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()
} }
}); })
}, },
onMeterReading() { onMeterReading() {
this.$refs.modalForm.add(); this.$refs.modalForm.add()
this.$refs.modalForm.title = "抄表"; this.$refs.modalForm.title = '抄表'
this.$refs.modalForm.disableSubmit = false; this.$refs.modalForm.disableSubmit = false
}, },
onBatchCallpay() { onBatchCallpay() {
// console.log(this.selectionRows) // console.log(this.selectionRows)
...@@ -286,34 +288,58 @@ ...@@ -286,34 +288,58 @@
}, },
onDetail(id) { onDetail(id) {
this.$router.push({ this.$router.push({
path: '/property/living-detail?id=' + id path: '/property/living-detail?id=' + id,
}); })
}, },
onCallPay(chooseIds) { onCallPay(chooseIds) {
let that = this let that = this
this.$confirm({ this.$confirm({
title: "催缴账单", title: '催缴账单',
content: "是否催缴当前选择的账单发送给对应业主?", content: '是否催缴当前选择的账单发送给对应业主?',
onOk: function () { onOk: function () {
that.loading = true; that.loading = true
callPayMentApi({chooseIds}).then((res) => { callPayMentApi({ chooseIds })
.then((res) => {
if (res.success) { if (res.success) {
//重新计算分页问题 //重新计算分页问题
that.$message.success(res.message); that.$message.success(res.message)
// that.searchQuery(); // that.searchQuery();
that.onClearSelected(); that.onClearSelected()
} else { } else {
that.$message.warning(res.message); that.$message.warning(res.message)
}
}).finally(() => {
that.loading = false;
});
}
});
} }
})
.finally(() => {
that.loading = false
})
},
})
},
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 + '.xls')
} 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 + '.xls')
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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论