From 4ab91f1708c4fc90982b91637cede5214a1803e2 Mon Sep 17 00:00:00 2001 From: lijiarao Date: Fri, 21 Oct 2022 18:33:44 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BF=AE=E6=94=B9]=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=9B=BE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/formatMoney.js | 1 + src/views/dashboard/IncomeSortEcharts.vue | 19 ++++++++++--------- src/views/dashboard/NotReceivedEcharts.vue | 9 +++++---- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/utils/formatMoney.js b/src/utils/formatMoney.js index d8dde8c..4cb8d52 100644 --- a/src/utils/formatMoney.js +++ b/src/utils/formatMoney.js @@ -1,4 +1,5 @@ export function formatMoney(money) { + if(money === '') return '' var num = (money || 0).toString(), re = /\d{3}$/, result = '' diff --git a/src/views/dashboard/IncomeSortEcharts.vue b/src/views/dashboard/IncomeSortEcharts.vue index 7f9b12e..ffb1874 100644 --- a/src/views/dashboard/IncomeSortEcharts.vue +++ b/src/views/dashboard/IncomeSortEcharts.vue @@ -171,7 +171,7 @@ export default { dataSource.map((item, index) => { let dataIndex = 'key' + index tableData[0][dataIndex] = item.money - tableData[1][dataIndex] = item.value + '%' + tableData[1][dataIndex] = item.value ? item.value +'%' :'' }) this.dataSource = tableData } @@ -250,6 +250,7 @@ export default { * 处理表头 * */ initColumns(data) { + const newData = data.slice(0,5) this.columns = [ { title: '', @@ -259,7 +260,7 @@ export default { scopedSlots: {customRender: 'text'} }, ] - data.map((item, index) => { + newData.map((item, index) => { this.columns.push({ title: item.name_dictText, align: 'center', @@ -268,13 +269,13 @@ export default { scopedSlots: {customRender: 'allMoney'} },) }) - // this.columns.push( { - // title: '总数', - // align: 'center', - // width: 70, - // dataIndex: 'allMoney', - // scopedSlots: {customRender: 'text'} - // },) + this.columns.push( { + title: '总数', + align: 'center', + width: 70, + dataIndex: 'key5', + scopedSlots: {customRender: 'allMoney'} + },) }, // 处理圆点 initPoint(data, color) { diff --git a/src/views/dashboard/NotReceivedEcharts.vue b/src/views/dashboard/NotReceivedEcharts.vue index a9c2595..fbcf668 100644 --- a/src/views/dashboard/NotReceivedEcharts.vue +++ b/src/views/dashboard/NotReceivedEcharts.vue @@ -177,7 +177,7 @@ export default { let color = ['#069F99', '#88C87E ', '#6D7FD0', '#FA9D81', '#A5B3FF'] let echartsData = data.reduce((pre, val) => { return pre.concat({value: val.money, name: val.name, money: val.money}) - }, []) + }, []).slice(0,4) echartsData = this.initPoint(echartsData, color) let chartDom = document.getElementById('notReceived') let myChart = echarts.init(chartDom) @@ -198,10 +198,11 @@ export default { } }, legend: { + left:'15%', bottom: '2%', - right: '5%', - padding: [0, 80, 0, 80], - itemGap:75 + right: '2%', + padding: [0, 50, 0, 50], + itemGap:50 }, labelLine: { lineStyle: {