Files
income_payments_client/src/views/statisticalReport/departmentAllStatistics/DepartmentAllStatistics.vue
T

324 lines
8.9 KiB
Vue

<!-- 科室总体统计 -->
<template>
<div>
<page-header-title :img-for-icon="IconImg"></page-header-title>
<a-card :bordered="false">
<!-- 查询区域-start -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="项目年份" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-year-date style="width:100%" placeholder="请选择项目年份" v-model="queryParam.year"></j-year-date>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="确认年份" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-year-date style="width:100%" placeholder="请选择确认年份" v-model="queryParam.paymentYear"></j-year-date>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span class="table-page-search-submitButtons">
<a-button type="primary" icon="search" @click="searchQuery"
v-has="'departmentAllStatistics:search'">查询</a-button>
<a-button icon="reload" @click="searchReset" class="reset-button">重置</a-button>
</span>
</a-col>
</a-row>
</a-form>
</div>
<!-- /查询区域-end-->
<!-- 操作按钮区域-->
<div class="table-operator">
<a-button type="primary" icon="export" @click="handleExportXls('科室总体统计')"
v-has="'departmentAllStatistics:export'">导出
</a-button>
</div>
<!-- 操作按钮区域-end-->
<!-- table表格区域-->
<div>
<a-table
size="middle"
ref="table"
bordered
rowKey="projectId"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:scroll="{x: 1100}"
@change="handleTableChange"
:class="dataSource.length === 0 ? 'show-scroll' : ''"
class="j-table-force-nowrap main-table">
<template slot="text" slot-scope="text">
<j-ellipsis :value="text" :length="18"></j-ellipsis>
</template>
<template slot="allMoney" slot-scope="text">
<a-tooltip>
<template slot="title">{{ formatMoney(text) }}</template>
<div class="table-text">{{ formatMoney(text) }}</div>
</a-tooltip>
</template>
<template slot="footer" v-if="dataSource.length > 0">
<a-table
size="middle"
ref="footTable"
rowKey="id"
:columns="columnsFooter"
:dataSource="footerDataSource"
:showHeader="false"
:pagination="false"
:scroll="{x: 1100}"
class="j-table-force-nowrap footer-table">
<template slot="allMoney" slot-scope="text">
<a-tooltip>
<template slot="title">{{ formatMoney(text) }}</template>
<div class="table-text">{{ formatMoney(text) }}</div>
</a-tooltip>
</template>
<template slot="text" slot-scope="text">
<j-ellipsis :value="text" :length="18"></j-ellipsis>
</template>
</a-table>
</template>
</a-table>
</div>
</a-card>
</div>
</template>
<script>
import IconImg from '@/assets/imgs/icon/icon_statistical_report.png'
import PageHeaderTitle from '../../../components/layouts/PageHeaderTitle'
import JYearDate from '../../../components/jero/JYearDate'
import { JeroListMixin } from '../../../mixins/JeroListMixin'
import { getAction } from '../../../api/manage'
import {formatMoney} from '@/utils/formatMoney'
const defaultTableColumns = [
{
title: '序号',
dataIndex: '',
key: 'rowIndex',
width: 100,
align: 'center',
customRender: function (t, r, index) {
return parseInt(index) + 1
}
}, {
title: '部门',
align: 'center',
width: 300,
dataIndex: 'departName',
scopedSlots: {customRender: 'text'}
},
{
title: '合同总金额',
align: 'center',
width: 160,
dataIndex: 'allMoney',
sorter: true,
scopedSlots: {customRender: 'allMoney'}
},
{
title: '确认收入金额',
align: 'center',
width: 150,
sorter: true,
dataIndex: 'confirmAmount',
scopedSlots: {customRender: 'allMoney'}
},
{
title: '开票金额',
align: 'center',
width: 150,
sorter: true,
dataIndex: 'billMoney',
scopedSlots: {customRender: 'allMoney'}
},
{
title: '到账总金额',
align: 'center',
width: 160,
dataIndex: 'comeAllMoney',
sorter: true,
scopedSlots: {customRender: 'allMoney'}
},
{
title: '确收率',
align: 'center',
width: 160,
dataIndex: 'finishRate',
scopedSlots: {customRender: 'text'}
}
]
export default {
name: 'DepartmentAllStatistics',
components: {PageHeaderTitle, JYearDate},
mixins: [JeroListMixin],
data() {
return {
IconImg,
labelCol: {
xs: {span: 24},
sm: {span: 5}
},
wrapperCol: {
xs: {span: 24},
sm: {span: 10}
},
url: {
list: '/statistics/allProjectStatistics/listDepartment',
exportXlsUrl: '/statistics/allProjectStatistics/department/excelProject'
},
columns: defaultTableColumns,
// 总计表头,与主表表头一致
columnsFooter: defaultTableColumns,
// 总计数据
footerDataSource: [],
// 给定当年作为来款年份默认查询条件
queryParam: {
year: new Date().getFullYear().toString()
},
lastQueryParam: {
year: new Date().getFullYear().toString()
},
}
},
mounted() {
this.setScroll()
},
methods: {
formatMoney,
// 同步表与footer滚动,保留底部滚动条
setScroll() {
if (this.dataSource.length === 0) {
return
}
let dom = this.$refs.footTable.$el.querySelectorAll('.ant-table-body')[0]
console.log(this.$refs.footTable.$el.querySelectorAll('.ant-table-body'))
dom.addEventListener(
'scroll',
() => {
this.$refs.table.$el.querySelectorAll(
'.ant-table-body'
)[0].scrollLeft = dom.scrollLeft
},
true
)
},
loadData(arg) {
if (!this.url.list) {
this.$message.error('请设置url.list属性!')
return
}
//加载数据 若传入参数1则加载第一页的内容
if (arg === 1) {
this.ipagination.current = 1
}
let params = this.getQueryParams()//查询条件
this.loading = true
getAction(this.url.list, params).then((res) => {
if (res.success) {
this.dataSource = res.result.pageList.records
// this.dataSource = res.result.pageList.records
let obj = {
id: '1',
title: '总计',
allMoney: res.result.sumOfMoney || '0.00' + '',
comeAllMoney: res.result.sumOfReallyMoney || '0.00' + '',
billMoney: res.result.sumOfBillMoney || '0.00' + '',
confirmAmount: res.result.sumOfConfirmAmount || '0.00' + ''
}
this.footerDataSource = [obj]
if (res.result.pageList.total) {
this.ipagination.total = res.result.pageList.total
//清空列表选中
this.onClearSelected()
} else {
this.ipagination.total = 0
}
}
if (this.dataSource.length > 0) {
this.$nextTick(() => {
this.setScroll()
})
}
if (res.code === 510) {
this.$message.warning(res.message)
}
this.loading = false
}).finally(() => {
this.loading = false
})
},
searchReset() {
this.lastQueryParam = {
year: new Date().getFullYear().toString()
}
this.queryParam = {
year: new Date().getFullYear().toString()
}
this.loadData(1)
},
}
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';
// 隐藏主列表的横向滚动条
.main-table {
/deep/ .ant-table-body {
overflow-x: hidden !important;
}
/deep/ .ant-table-footer {
padding: 0 0;
}
/deep/ .ant-table.ant-table-bordered .ant-table-footer {
border-left: none;
margin-top: -2px;
}
}
.show-scroll {
/deep/ .ant-table-body {
overflow-x: auto !important;
}
}
// 去除底部表格边框
.footer-table {
/deep/ .ant-table-tbody > tr > td {
border: none;
}
/deep/ .ant-table-fixed-right table {
border-left: none !important;
background: none;
}
/deep/ .ant-table-body {
overflow-x: auto !important;
}
/deep/ .ant-table-bordered .ant-table-header > table {
border-left: none;
}
}
</style>