[修改] 修改统计图问题

This commit is contained in:
lijiarao
2022-10-21 18:33:44 +08:00
parent 34ca17da1d
commit 4ab91f1708
3 changed files with 16 additions and 13 deletions
+1
View File
@@ -1,4 +1,5 @@
export function formatMoney(money) { export function formatMoney(money) {
if(money === '') return ''
var num = (money || 0).toString(), var num = (money || 0).toString(),
re = /\d{3}$/, re = /\d{3}$/,
result = '' result = ''
+10 -9
View File
@@ -171,7 +171,7 @@ export default {
dataSource.map((item, index) => { dataSource.map((item, index) => {
let dataIndex = 'key' + index let dataIndex = 'key' + index
tableData[0][dataIndex] = item.money tableData[0][dataIndex] = item.money
tableData[1][dataIndex] = item.value + '%' tableData[1][dataIndex] = item.value ? item.value +'%' :''
}) })
this.dataSource = tableData this.dataSource = tableData
} }
@@ -250,6 +250,7 @@ export default {
* 处理表头 * 处理表头
* */ * */
initColumns(data) { initColumns(data) {
const newData = data.slice(0,5)
this.columns = [ this.columns = [
{ {
title: '', title: '',
@@ -259,7 +260,7 @@ export default {
scopedSlots: {customRender: 'text'} scopedSlots: {customRender: 'text'}
}, },
] ]
data.map((item, index) => { newData.map((item, index) => {
this.columns.push({ this.columns.push({
title: item.name_dictText, title: item.name_dictText,
align: 'center', align: 'center',
@@ -268,13 +269,13 @@ export default {
scopedSlots: {customRender: 'allMoney'} scopedSlots: {customRender: 'allMoney'}
},) },)
}) })
// this.columns.push( { this.columns.push( {
// title: '总数', title: '总数',
// align: 'center', align: 'center',
// width: 70, width: 70,
// dataIndex: 'allMoney', dataIndex: 'key5',
// scopedSlots: {customRender: 'text'} scopedSlots: {customRender: 'allMoney'}
// },) },)
}, },
// 处理圆点 // 处理圆点
initPoint(data, color) { initPoint(data, color) {
+5 -4
View File
@@ -177,7 +177,7 @@ export default {
let color = ['#069F99', '#88C87E ', '#6D7FD0', '#FA9D81', '#A5B3FF'] let color = ['#069F99', '#88C87E ', '#6D7FD0', '#FA9D81', '#A5B3FF']
let echartsData = data.reduce((pre, val) => { let echartsData = data.reduce((pre, val) => {
return pre.concat({value: val.money, name: val.name, money: val.money}) return pre.concat({value: val.money, name: val.name, money: val.money})
}, []) }, []).slice(0,4)
echartsData = this.initPoint(echartsData, color) echartsData = this.initPoint(echartsData, color)
let chartDom = document.getElementById('notReceived') let chartDom = document.getElementById('notReceived')
let myChart = echarts.init(chartDom) let myChart = echarts.init(chartDom)
@@ -198,10 +198,11 @@ export default {
} }
}, },
legend: { legend: {
left:'15%',
bottom: '2%', bottom: '2%',
right: '5%', right: '2%',
padding: [0, 80, 0, 80], padding: [0, 50, 0, 50],
itemGap:75 itemGap:50
}, },
labelLine: { labelLine: {
lineStyle: { lineStyle: {