From 1724dcec269af097cd0c091b3b18ad33919035b6 Mon Sep 17 00:00:00 2001 From: mengxiaolong Date: Fri, 8 Jan 2021 16:27:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AA=E9=99=A9=E4=B8=9A=E7=BB=A9=E6=8E=92?= =?UTF-8?q?=E8=A1=8C=E6=B7=BB=E5=8A=A0=E5=90=88=E8=AE=A1=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../institutionalPerform/Organization.vue | 115 ++++++++++++------ 1 file changed, 78 insertions(+), 37 deletions(-) diff --git a/src/views/ebiz/institutionalPerform/Organization.vue b/src/views/ebiz/institutionalPerform/Organization.vue index 88655b2d3..69549c306 100644 --- a/src/views/ebiz/institutionalPerform/Organization.vue +++ b/src/views/ebiz/institutionalPerform/Organization.vue @@ -9,13 +9,17 @@ - + + + + - @@ -84,53 +88,73 @@ export default { tableColumns: [ [ [ - { name: '机构', key: 'name' }, - { name: '预收标保(万元)', key: 'ysbb' }, - { name: '预收件数(件)', key: 'ysjs' }, - { name: '承保标保(万元)', key: 'bzbf' }, - { name: '承保件数(件)', key: 'cbjs' } + { isInt: false, name: '机构', key: 'name' }, + { isInt: false, name: '预收标保(万元)', key: 'ysbb' }, + { isInt: true, name: '预收件数(件)', key: 'ysjs' }, + { isInt: false, name: '承保标保(万元)', key: 'bzbf' }, + { isInt: true, name: '承保件数(件)', key: 'cbjs' } ], [ - { name: '机构', key: 'name' }, - { name: '预收标保(万元)', key: 'ysbb' }, - { name: '预收件数(件)', key: 'ysjs' }, - { name: '承保标保(万元)', key: 'bzbf' }, - { name: '承保件数(件)', key: 'cbjs' }, - { name: '承保同比', key: 'cbtb' }, - { name: '承保环比', key: 'cbhb' } + { isInt: false, name: '机构', key: 'name' }, + { isInt: false, name: '预收标保(万元)', key: 'ysbb' }, + { isInt: true, name: '预收件数(件)', key: 'ysjs' }, + { isInt: false, name: '承保标保(万元)', key: 'bzbf' }, + { isInt: true, name: '承保件数(件)', key: 'cbjs' }, + { isInt: false, name: '承保同比', key: 'cbtb' }, + { isInt: false, name: '承保环比', key: 'cbhb' } ], [ - { name: '机构', key: 'name' }, - { name: '承保标保(万元)', key: 'bzbf' }, - { name: '标保目标', key: 'bbmb' }, - { name: '标保目标达成率', key: 'bbmbdcl' }, - { name: '差距', key: 'cj' } + { isInt: false, name: '机构', key: 'name' }, + { isInt: false, name: '承保标保(万元)', key: 'bzbf' }, + { isInt: false, name: '标保目标', key: 'bbmb' }, + { isInt: false, name: '标保目标达成率', key: 'bbmbdcl' }, + { isInt: false, name: '差距', key: 'cj' } ], [ - { name: '机构', key: 'name' }, - { name: '承保标保(万元)', key: 'bzbf' } + { isInt: false, name: '机构', key: 'name' }, + { isInt: false, name: '承保标保(万元)', key: 'bzbf' } ] ], [ - { name: '机构', key: 'name' }, - { name: '活动人力(人)', key: 'hdrl' }, - { name: '合格人力(人)', key: 'hgrl' }, - { name: '桂冠人力(人)', key: 'ggrl' }, - { name: '桂冠正式会员(人)', key: 'gghy' }, - { name: '双冠人力(人)', key: 'sgrl' }, - { name: '新增人力(人)', key: 'xzrl' } + { isInt: false, name: '机构', key: 'name' }, + { isInt: true, name: '活动人力(人)', key: 'hdrl' }, + { isInt: true, name: '合格人力(人)', key: 'hgrl' }, + { isInt: true, name: '桂冠人力(人)', key: 'ggrl' }, + { isInt: true, name: '桂冠正式会员(人)', key: 'gghy' }, + { isInt: true, name: '双冠人力(人)', key: 'sgrl' }, + { isInt: true, name: '新增人力(人)', key: 'xzrl' } ], [ - { name: '产品', key: 'productName' }, - { name: '承保标保(万元)', key: 'cbbb' }, - { name: '承保件数(件)', key: 'cbItems' }, - { name: '保费占比(%)', key: 'percent' } + { isInt: false, name: '产品', key: 'productName' }, + { isInt: false, name: '承保标保(万元)', key: 'cbbb' }, + { isInt: true, name: '承保件数(件)', key: 'cbItems' }, + { isInt: false, name: '保费占比(%)', key: 'percent' } ] ], - values: [] + values: [], + totals: [] } }, methods: { + calculateTotal() { + this.totals = [] + let columns = JSON.parse(JSON.stringify(this.columns)) + columns.splice(0, 1) + console.dir(columns) + for (let column of columns) { + let key = column.key + let total = this.values.reduce((prevVal, currVal) => { + let count = column.isInt ? parseInt(currVal[key]) : parseFloat(currVal[key]) + return prevVal + count + }, 0) + + if (column.isInt) { + this.totals.push(total) + } else { + this.totals.push(parseFloat(total.toFixed(2))) + } + } + }, setShortName() { for (let org of this.values) { for (let shortName of orgShortNames) { @@ -145,24 +169,28 @@ export default { case 'prem': this.values = data.list ? data.list : [] this.setShortName() + this.calculateTotal() break case 'active': this.values = data.listRL ? data.listRL : [] this.setShortName() + this.calculateTotal() break case 'product': this.values = data.productDTO ? data.productDTO : [] this.calculate() + this.calculateTotal() break } }, calculate() { let allPrice = this.values.reduce((prevVal, currVal) => { - return prevVal + Number(currVal.cbbb) + return prevVal + parseFloat(currVal.cbbb) }, 0) this.values.map(product => { - product.allPrice = allPrice.toFixed(2) - product.percent = ((product.cbbb / allPrice) * 100).toFixed(2) + product.allPrice = allPrice + let percent = ((product.cbbb / allPrice) * 100).toFixed(8) + product.percent = percent return product }) } @@ -177,7 +205,16 @@ export default { }, filters: { blankFilter(val) { - return val ? val : '-' + if (isNaN(parseFloat(val))) { + return val ? val : '-' + } else { + let res = parseFloat(val).toFixed(2) + if (res.endsWith('.00')) { + return res.split('.')[0] + } else { + return res + } + } } } } @@ -262,4 +299,8 @@ th.fixedWidth { position: sticky; left: 59px; } + +*::-webkit-scrollbar { + display: none; +}
排名 + {{ column.name }}
合计{{ total | blankFilter }}
{{ index + 1 }} + {{ value[key] | blankFilter }}