From a9ddce0a21917cb9ab9b9463dfeea253fd07dec6 Mon Sep 17 00:00:00 2001 From: fengachen <373943794@qq.com> Date: Thu, 2 Jun 2022 11:38:14 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E9=87=91=E9=A2=9D=E4=BF=AE=E6=94=B9=E4=B8=BA=E5=8D=83?= =?UTF-8?q?=E5=88=86=E4=BD=8D=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/formatMoney.js | 41 +++++++++++++++++++ .../WholeInstituteStatisticsList.vue | 26 ++++++++++-- .../IndividualPaymentStatisticsList.vue | 30 ++++++++++++-- .../ProjectPaymentStatisticsList.vue | 26 ++++++++++-- .../EnterprisePaymentStatisticsDetail.vue | 28 ++++++++++--- .../EnterprisePaymentStatisticsList.vue | 25 +++++++++-- .../WorkingGroupPaymentStatisticsDetail.vue | 26 ++++++++++-- .../WorkingGroupPaymentStatisticsList.vue | 27 ++++++++++-- 8 files changed, 200 insertions(+), 29 deletions(-) create mode 100644 src/utils/formatMoney.js diff --git a/src/utils/formatMoney.js b/src/utils/formatMoney.js new file mode 100644 index 0000000..e523d2b --- /dev/null +++ b/src/utils/formatMoney.js @@ -0,0 +1,41 @@ +export function formatMoney(money) { + var num = (money || 0).toString(), + re = /\d{3}$/, + result = '' + var point = '' + if (num.indexOf('.') !== -1) { + point = num.substring(num.indexOf('.')) + num = parseInt(num) + + } + while (re.test(num)) { + result = RegExp.lastMatch + result + if (num !== RegExp.lastMatch) { + result = ',' + result + num = RegExp.leftContext + } else { + num = '' + break + } + } + if (num) { + result = num + result + } + + function _(result) { + return result.replace('-,', '-') + } + function __(result) { + if (result[0] === ',') { + result = result.substring(1) + } + return result + } + function ___(result) { + if (result[0] === '.') { + result = '0' + result + } + return result + } + return ___(__(_(result) + point)) +} diff --git a/src/views/statisticalReport/WholeInstituteStatisticsList.vue b/src/views/statisticalReport/WholeInstituteStatisticsList.vue index 12fb4fe..fa6dafd 100644 --- a/src/views/statisticalReport/WholeInstituteStatisticsList.vue +++ b/src/views/statisticalReport/WholeInstituteStatisticsList.vue @@ -138,6 +138,14 @@ + + + + @@ -191,6 +207,7 @@ import { getAction } from '../../api/manage' import ProjectDetailModal from '../../components/ProjectDetailModal' import { downloadFile } from '../../api/manage' import StatusSlot from '../../components/tools/StatusSlot' +import {formatMoney} from '@/utils/formatMoney' export default { name: 'WholeInstituteStatisticsList', @@ -256,13 +273,13 @@ export default { align: 'center', width: 200, dataIndex: 'allMoney', - scopedSlots: { customRender: 'text' } + scopedSlots: { customRender: 'allMoney' } }, { title: '实收金额', align: 'center', width: 200, dataIndex: 'comeAllMoney', - scopedSlots: { customRender: 'text' } + scopedSlots: { customRender: 'allMoney' } }, { title: '来款用途', align: 'center', @@ -311,13 +328,13 @@ export default { align: 'center', width: 200, dataIndex: 'allMoney', - scopedSlots: { customRender: 'text' } + scopedSlots: { customRender: 'allMoney' } }, { title: '实收金额', align: 'center', width: 200, dataIndex: 'comeAllMoney', - scopedSlots: { customRender: 'text' } + scopedSlots: { customRender: 'allMoney' } }, { title: '来款用途', align: 'center', @@ -350,6 +367,7 @@ export default { this.setScroll() }, methods: { + formatMoney, /** * 同步表与footer滚动,保留底部滚动条 */ diff --git a/src/views/statisticalReport/departmentStatistics/IndividualPaymentStatisticsList.vue b/src/views/statisticalReport/departmentStatistics/IndividualPaymentStatisticsList.vue index d6ddc63..aae9dde 100644 --- a/src/views/statisticalReport/departmentStatistics/IndividualPaymentStatisticsList.vue +++ b/src/views/statisticalReport/departmentStatistics/IndividualPaymentStatisticsList.vue @@ -90,6 +90,14 @@ + + + + @@ -124,6 +140,7 @@ import JYearDate from '../../../components/jero/JYearDate' import SelectPrincipal from '../../../components/company/SelectPrincipal' import { getAllDepartTreeList } from '../../../api/incomePaymentsApi' import { getAction } from '@api/manage' +import {formatMoney} from '@/utils/formatMoney' export default { name: 'IndividualPaymentStatisticsList', @@ -164,12 +181,14 @@ export default { title: '应收金额', align: 'center', width: 140, - dataIndex: 'allMoney' + dataIndex: 'allMoney', + scopedSlots: {customRender: 'allMoney'} }, { title: '实收金额', align: 'center', width: 140, - dataIndex: 'comeAllMoney' + dataIndex: 'comeAllMoney', + scopedSlots: {customRender: 'allMoney'} }, { title: '个人完成率', align: 'center', @@ -194,12 +213,14 @@ export default { title: '应收金额', align: 'center', width: 140, - dataIndex: 'allMoney' + dataIndex: 'allMoney', + scopedSlots: {customRender: 'allMoney'} }, { title: '实收金额', align: 'center', width: 140, - dataIndex: 'comeAllMoney' + dataIndex: 'comeAllMoney', + scopedSlots: {customRender: 'allMoney'} }, { title: '个人完成率', align: 'center', @@ -228,6 +249,7 @@ export default { this.setScroll() }, methods: { + formatMoney, // 同步表与footer滚动,保留底部滚动条 setScroll() { if (this.dataSource.length === 0) { diff --git a/src/views/statisticalReport/departmentStatistics/ProjectPaymentStatisticsList.vue b/src/views/statisticalReport/departmentStatistics/ProjectPaymentStatisticsList.vue index a3f634a..0223cfe 100644 --- a/src/views/statisticalReport/departmentStatistics/ProjectPaymentStatisticsList.vue +++ b/src/views/statisticalReport/departmentStatistics/ProjectPaymentStatisticsList.vue @@ -110,6 +110,14 @@ + + + + + + + + @@ -132,6 +148,7 @@ import JYearDate from '../../../components/jero/JYearDate' import { getAction } from '@api/manage' import ProjectDetailModal from '../../../components/ProjectDetailModal' import StatusSlot from '../../../components/tools/StatusSlot' +import {formatMoney} from '@/utils/formatMoney' export default { name: 'EnterprisePaymentStatisticsDetail', @@ -173,7 +190,7 @@ export default { width: 300, dataIndex: 'chargeCompanyName', scopedSlots: { customRender: 'text' } - }, , { + }, { title: '是否打包', align: 'center', width: 100, @@ -184,13 +201,13 @@ export default { align: 'center', width: 160, dataIndex: 'allMoney', - scopedSlots: { customRender: 'text' } + scopedSlots: { customRender: 'allMoney' } }, { title: '实收金额', align: 'center', width: 160, dataIndex: 'comeAllMoney', - scopedSlots: { customRender: 'text' } + scopedSlots: { customRender: 'allMoney' } }, { title: '来款用途', align: 'center', @@ -229,13 +246,13 @@ export default { align: 'center', width: 160, dataIndex: 'allMoney', - scopedSlots: { customRender: 'text' } + scopedSlots: { customRender: 'allMoney' } }, { title: '实收金额', align: 'center', width: 160, dataIndex: 'comeAllMoney', - scopedSlots: { customRender: 'text' } + scopedSlots: { customRender: 'allMoney' } }, { title: '来款用途', align: 'center', @@ -262,6 +279,7 @@ export default { this.setScroll() }, methods: { + formatMoney, // 同步表与footer滚动,保留底部滚动条 setScroll() { if (this.dataSource.length === 0) { diff --git a/src/views/statisticalReport/enterprisePaymentStatistics/EnterprisePaymentStatisticsList.vue b/src/views/statisticalReport/enterprisePaymentStatistics/EnterprisePaymentStatisticsList.vue index 41efb18..f52979c 100644 --- a/src/views/statisticalReport/enterprisePaymentStatistics/EnterprisePaymentStatisticsList.vue +++ b/src/views/statisticalReport/enterprisePaymentStatistics/EnterprisePaymentStatisticsList.vue @@ -81,6 +81,13 @@
{{ text }}
+ 详情 @@ -109,6 +116,14 @@ + + @@ -126,6 +141,7 @@ import JYearDate from '../../../components/jero/JYearDate' import { getAction } from '@api/manage' import CompanySelect from '@comp/company/CompanySelect' import { filterObj } from '../../../utils/util' +import {formatMoney} from '@/utils/formatMoney' export default { name: 'EnterprisePaymentStatisticsList', @@ -166,13 +182,13 @@ export default { align: 'center', width: 160, dataIndex: 'allMoney', - scopedSlots: { customRender: 'text' } + scopedSlots: { customRender: 'allMoney' } }, { title: '实收总金额', align: 'center', width: 160, dataIndex: 'comeAllMoney', - scopedSlots: { customRender: 'text' } + scopedSlots: { customRender: 'allMoney' } }, { title: '到账率', align: 'center', @@ -205,13 +221,13 @@ export default { align: 'center', width: 160, dataIndex: 'allMoney', - scopedSlots: { customRender: 'text' } + scopedSlots: { customRender: 'allMoney' } }, { title: '实收总金额', align: 'center', width: 160, dataIndex: 'comeAllMoney', - scopedSlots: { customRender: 'text' } + scopedSlots: { customRender: 'allMoney' } }, { title: '到账率', align: 'center', @@ -241,6 +257,7 @@ export default { this.setScroll() }, methods: { + formatMoney, goDetail(record) { this.$router.push({ path: '/statisticalReport/enterprisePaymentStatistics/EnterprisePaymentStatisticsDetail', diff --git a/src/views/statisticalReport/workingGroupPaymentStatistics/WorkingGroupPaymentStatisticsDetail.vue b/src/views/statisticalReport/workingGroupPaymentStatistics/WorkingGroupPaymentStatisticsDetail.vue index 335bd80..b05fb8c 100644 --- a/src/views/statisticalReport/workingGroupPaymentStatistics/WorkingGroupPaymentStatisticsDetail.vue +++ b/src/views/statisticalReport/workingGroupPaymentStatistics/WorkingGroupPaymentStatisticsDetail.vue @@ -99,6 +99,14 @@ + + 详情 @@ -127,6 +135,14 @@ @click="openDetailModal(record)"> + + @@ -147,6 +163,7 @@ import SelectPrincipal from '../../../components/company/SelectPrincipal' import JYearDate from '../../../components/jero/JYearDate' import { getAction } from '../../../api/manage' import StatusSlot from '../../../components/tools/StatusSlot' +import {formatMoney} from '@/utils/formatMoney' export default { name: 'WorkingGroupPaymentStatisticsDetail', @@ -200,13 +217,13 @@ export default { align: 'center', width: 160, dataIndex: 'allMoney', - scopedSlots: { customRender: 'text' } + scopedSlots: { customRender: 'allMoney' } }, { title: '实收金额', align: 'center', width: 160, dataIndex: 'comeAllMoney', - scopedSlots: { customRender: 'text' } + scopedSlots: { customRender: 'allMoney' } }, { title: '来款用途', align: 'center', @@ -253,13 +270,13 @@ export default { align: 'center', width: 160, dataIndex: 'allMoney', - scopedSlots: { customRender: 'text' } + scopedSlots: { customRender: 'allMoney' } }, { title: '实收金额', align: 'center', width: 160, dataIndex: 'comeAllMoney', - scopedSlots: { customRender: 'text' } + scopedSlots: { customRender: 'allMoney' } }, { title: '来款用途', align: 'center', @@ -283,6 +300,7 @@ export default { } }, methods: { + formatMoney, loadData(arg) { if (!this.url.list) { this.$message.error('请设置url.list属性!') diff --git a/src/views/statisticalReport/workingGroupPaymentStatistics/WorkingGroupPaymentStatisticsList.vue b/src/views/statisticalReport/workingGroupPaymentStatistics/WorkingGroupPaymentStatisticsList.vue index 7cd91c3..adb3e4e 100644 --- a/src/views/statisticalReport/workingGroupPaymentStatistics/WorkingGroupPaymentStatisticsList.vue +++ b/src/views/statisticalReport/workingGroupPaymentStatistics/WorkingGroupPaymentStatisticsList.vue @@ -84,6 +84,14 @@ + + 详情 @@ -117,6 +125,15 @@
{{ text }}
+ + + @@ -132,6 +149,7 @@ import PageHeaderTitle from '../../../components/layouts/PageHeaderTitle' import { JeroListMixin } from '../../../mixins/JeroListMixin' import JYearDate from '../../../components/jero/JYearDate' import { getAction } from '../../../api/manage' +import {formatMoney} from '@/utils/formatMoney' export default { name: 'WorkingGroupPaymentStatisticsList', @@ -172,13 +190,13 @@ export default { align: 'center', width: 160, dataIndex: 'allMoney', - scopedSlots: { customRender: 'text' } + scopedSlots: { customRender: 'allMoney' } }, { title: '实收总金额', align: 'center', width: 160, dataIndex: 'comeAllMoney', - scopedSlots: { customRender: 'text' } + scopedSlots: { customRender: 'allMoney' } }, { title: '实收完成率', align: 'center', @@ -212,13 +230,13 @@ export default { align: 'center', width: 160, dataIndex: 'allMoney', - scopedSlots: { customRender: 'text' } + scopedSlots: { customRender: 'allMoney' } }, { title: '实收总金额', align: 'center', width: 160, dataIndex: 'comeAllMoney', - scopedSlots: { customRender: 'text' } + scopedSlots: { customRender: 'allMoney' } }, { title: '实收完成率', align: 'center', @@ -245,6 +263,7 @@ export default { } }, methods: { + formatMoney, loadData(arg) { if (!this.url.list) { this.$message.error('请设置url.list属性!')