Files
income_payments_client/src/views/statisticalReport/WholeInstituteStatisticsList.vue
T
2021-10-15 18:08:38 +08:00

488 lines
16 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">
<a-input placeholder="请输入来款单位" v-model="queryParam.chargeCompanyTemporaryName"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="来款项目" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入来款项目" v-model="queryParam.projectName"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="项目负责人" :labelCol="labelCol" :wrapperCol="wrapperCol">
<select-principal placeholder="请选择项目负责人" v-model="queryParam.principalNameId"></select-principal>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="所属科室" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-tree-select
style="width:100%"
:dropdownStyle="{ maxHeight: '200px',maxWidth:'100px','overflow-x':'hidden',' overflow-y': 'auto' }"
:treeData="treeDepartData"
:replaceFields="replaceFields"
v-model="queryParam.departCode"
placeholder="请选择科室">
</a-tree-select>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="来款用途" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-dict-select-tag v-model="queryParam.chargeUse" placeholder="请选择来款用途" dictCode="payment_charge_use"/>
</a-form-item>
</a-col>
<a-col :xl="10" :lg="11" :md="12" :sm="24">
<a-form-item label="应收款项" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input
placeholder="请输入应收款项"
v-model="queryParam.allMoney"
class="query-group-cust"
@change="checkMoney('start')"></a-input>
<span class="query-group-split-cust"></span>
<a-input
placeholder="请输入应收款项"
v-model="queryParam.allMoneyTwo"
class="query-group-cust"
@change="checkMoney('end')"></a-input>
</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.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-dict-select-tag v-model="queryParam.pack"
placeholder="请选择是否打包"
dictCode="yn"/>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="付款状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-dict-select-tag v-model="queryParam.payStatue"
placeholder="请选择付款状态"
dictCode="pay_statistics_status"/>
</a-form-item>
</a-col>
<a-col :xl="4" :lg="7" :md="8" :sm="24">
<span class="table-page-search-submitButtons">
<a-button type="primary" icon="search" @click="searchQuery"
v-has="'wholeInstituteStatistics: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="'wholeInstituteStatistics:export'">导出
</a-button>
</div>
<!-- 操作按钮区域-end-->
<!-- table表格区域-->
<div>
<a-table
ref="table"
size="middle"
bordered
rowKey="id"
:columns="columns"
:scroll="{x: 1300}"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
@change="handleTableChange"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
:class="dataSource.length === 0 ? 'show-scroll' : ''"
class="j-table-force-nowrap main-table">
<!-- 项目名称-->
<template slot="projectName" slot-scope="text, record">
<j-ellipsis :value="text" :length="18" class="primary-color"
@click="openDetailModal(record)"></j-ellipsis>
</template>
<template slot="text" slot-scope="text">
<j-ellipsis :value="text" :length="18"></j-ellipsis>
</template>
<template slot="footer" v-if="dataSource.length > 0">
<a-table
size="middle"
ref="footTable"
rowKey="projectId"
:columns="columnsFooter"
:scroll="{x: 1300}"
:dataSource="footerDataSource"
:showHeader="false"
:pagination="false"
class="j-table-force-nowrap footer-table">
<!-- 项目名称-->
<template slot="projectName" slot-scope="text, record">
<j-ellipsis :value="text" :length="18" class="primary-color"
@click="openDetailModal(record)"></j-ellipsis>
</template>
<template slot="text" slot-scope="text">
<j-ellipsis :value="text" :length="18"></j-ellipsis>
</template>
</a-table>
</template>
</a-table>
</div>
</a-card>
<project-detail-modal ref="projectDetail" not-id></project-detail-modal>
</div>
</template>
<script>
import IconImg from '@/assets/imgs/icon/icon_statistical_report.png'
import PageHeaderTitle from '../../components/layouts/PageHeaderTitle'
import { JeroListMixin } from '../../mixins/JeroListMixin'
import { getAllDepartTreeList } from '../../api/incomePaymentsApi'
import SelectPrincipal from '../../components/company/SelectPrincipal'
import JYearDate from '../../components/jero/JYearDate'
import { getAction } from '../../api/manage'
import ProjectDetailModal from '../../components/ProjectDetailModal'
export default {
name: 'WholeInstituteStatisticsList',
components: { PageHeaderTitle, SelectPrincipal, JYearDate, ProjectDetailModal },
mixins: [JeroListMixin],
data() {
return {
IconImg,
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 10 }
},
treeDepartData: [],
replaceFields: {
value: 'orgCode'
},
columns: [
{
title: '序号',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: 'center',
customRender: function (t, r, index) {
return parseInt(index) + 1
}
}, {
title: '项目名称',
align: 'center',
// width: 200,
dataIndex: 'projectName',
scopedSlots: { customRender: 'projectName' }
}, {
title: '负责人',
align: 'center',
width: 140,
dataIndex: 'principalName',
scopedSlots: { customRender: 'text' }
}, {
title: '所属科室',
align: 'center',
width: 140,
dataIndex: 'depart',
scopedSlots: { customRender: 'text' }
}, {
title: '应收金额',
align: 'center',
width: 200,
dataIndex: 'allMoney',
scopedSlots: { customRender: 'text' }
}, {
title: '实收金额',
align: 'center',
width: 200,
dataIndex: 'comeAllMoney',
scopedSlots: { customRender: 'text' }
}, {
title: '来款用途',
align: 'center',
dataIndex: 'chargeUse_text',
width: 150
}
],
columnsFooter: [
{
title: '序号',
dataIndex: 'title',
key: 'rowIndex',
width: 120,
align: 'center'
}, {
title: '项目名称',
align: 'center',
// width: 200,
dataIndex: 'projectName',
scopedSlots: { customRender: 'text' }
}, {
title: '负责人',
align: 'center',
width: 140,
dataIndex: 'principalName',
scopedSlots: { customRender: 'text' }
}, {
title: '所属科室',
align: 'center',
width: 140,
dataIndex: 'depart',
scopedSlots: { customRender: 'text' }
}, {
title: '应收金额',
align: 'center',
width: 200,
dataIndex: 'allMoney',
scopedSlots: { customRender: 'text' }
}, {
title: '实收金额',
align: 'center',
width: 200,
dataIndex: 'comeAllMoney',
scopedSlots: { customRender: 'text' }
}, {
title: '来款用途',
align: 'center',
dataIndex: 'chargeUse_text',
width: 150
}
],
footerDataSource: [],
// 给定当年作为来款年份默认查询条件
queryParam: {
year: new Date().getFullYear().toString()
},
lastQueryParam: {
year: new Date().getFullYear().toString()
},
url: {
list: '/statistics/allProjectStatistics/list',
exportXlsUrl: '/statistics/allProjectStatistics/statistics/excel'
},
validateMoney: true
}
},
created() {
this.loadDepartTreeData()
},
mounted() {
this.setScroll()
},
methods: {
/**
* 同步表与footer滚动,保留底部滚动条
*/
setScroll() {
if (this.dataSource.length === 0) {
return
}
let dom = this.$refs.footTable.$el.querySelectorAll('.ant-table-body')[0]
dom.addEventListener(
'scroll',
() => {
this.$refs.table.$el.querySelectorAll(
'.ant-table-body'
)[0].scrollLeft = dom.scrollLeft
},
true
)
},
/**
* 获取科室(部门)数据
*/
loadDepartTreeData() {
getAllDepartTreeList().then((res) => {
if (res.success) {
this.treeDepartData = []
let treeList = res.result
for (let a = 0; a < treeList.length; a++) {
let temp = treeList[a]
temp.isLeaf = temp.leaf
this.treeDepartData.push(temp)
}
} else {
this.$message.warn(res.message)
}
})
},
loadData(arg) {
if (!this.url.list) {
this.$message.error('请设置url.list属性!')
return
}
//加载数据 若传入参数1则加载第一页的内容
if (arg === 1) {
this.ipagination.current = 1
}
let params = this.getQueryParams()//查询条件
if (params.hasOwnProperty.call(params, 'allMoney') && params.hasOwnProperty.call(params, 'allMoneyTwo')) {
if (Number(params.allMoney) > Number(params.allMoneyTwo)) {
this.$message.warn('应收款项范围不正确,请修改')
return
}
}
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.toString(),
comeAllMoney: res.result.sumOfReallyMoney.toString()
}
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)
},
/**
* 搜索金额校验
* @param type 起始范围--start,终止范围--end
*/
checkMoney(type) {
if (type === 'start') {
this.queryParam.allMoney = this.queryParam.allMoney.replace(/[^0-9.]/g, '')
let pointIndex = this.queryParam.allMoney.indexOf('.')
// 包含小数点,保留小数点后两位
if (pointIndex > -1) {
this.queryParam.allMoney = this.queryParam.allMoney.substr(0, pointIndex + 3)
// 截取整数部分
let str = this.queryParam.allMoney.slice(0, pointIndex)
// 整数部分大于十位则去掉十位之后的整数部门,并将小数部分拼接
if (str.length > 10) {
str = str.substr(0, 10)
this.queryParam.allMoney = str + this.queryParam.allMoney.substr(pointIndex, 3)
}
}
// 不包含小数点且输入数字超过十位保留前十位数据
if (pointIndex === -1 && this.queryParam.allMoney.length > 10) {
this.queryParam.allMoney = this.queryParam.allMoney.substr(0, 10)
}
return
}
if (type === 'end') {
this.queryParam.allMoneyTwo = this.queryParam.allMoneyTwo.replace(/[^0-9.]/g, '')
let pointIndex = this.queryParam.allMoneyTwo.indexOf('.')
// 包含小数点,保留小数点后两位
if (pointIndex > -1) {
this.queryParam.allMoneyTwo = this.queryParam.allMoneyTwo.substr(0, pointIndex + 3)
// 截取整数部分
let str = this.queryParam.allMoneyTwo.slice(0, pointIndex)
// 整数部分大于十位则去掉十位之后的整数部门,并将小数部分拼接
if (str.length > 10) {
str = str.substr(0, 10)
this.queryParam.allMoneyTwo = str + this.queryParam.allMoneyTwo.substr(pointIndex, 3)
}
}
// 不包含小数点且输入数字超过十位保留前十位数据
if (pointIndex === -1 && this.queryParam.allMoneyTwo.length > 10) {
this.queryParam.allMoneyTwo = this.queryParam.allMoneyTwo.substr(0, 10)
}
return
}
}
}
}
</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;
background-color: #F5F5F5;
}
/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>