module.exports = { formatPercent: formatPercent, formatPercent_:formatPercent_, formatItemState: formatItemState, formatIndexColor: formatIndexColor, formatItemStateColor: formatItemStateColor, formatDiffIndexImage: formatDiffIndexImage } // 用户分析-格式化百分比 function formatPercent (value) { if (value) { return (parseFloat(value * 100).toFixed(2)) + '%' } else { return value } } // 用户分析-格式化百分比去掉后两位小数 function formatPercent_(value) { if (value) { return (parseFloat(value * 100).toFixed(0)) + '%' } else { return value } } // 难点搞点Top10-项目状态 function formatItemState (value) { if (value === 0) { return '处理中' } else if (value === 5) { return '已关闭' } else if (value === 10) { return '已结案' } } // 难点搞点Top10-项目状态背景色 function formatItemStateColor (value) { if (value === 0) { return '#FFC438' } else if (value === 5) { return '#d5d5d5' } else if (value === 10) { return '#29B9A5' } } // 基层实况-群众最关注的问题 index颜色 function formatIndexColor (index) { if (index === 1) { return '#FF5D31' } else if (index === 2) { return '#FD8227' } else if (index === 3) { return '#FFD016' } else if (index === 4) { return '#BD5FFE' } else if (index === 5) { return '#49A3FF' } else if (index >= 6) { return '#29B9A5' } } // 难点堵点-index排序背景图 function formatDiffIndexImage (index) { if (index === 1) { return '../../../../images/diff-first.png' } else if (index === 2) { return '../../../../images/diff-second.png' } else if (index === 3) { return '../../../../images/diff-third.png' } else if (index >= 4) { return '../../../../images/diff-forth.png' } }