futureTwelveMonths.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <div>
  3. <boxBorder title="未来12月项目预计签约金额/预计成交金额分析" class1="20px 20px" height="282px">
  4. <template slot="charts">
  5. <el-tooltip effect="dark" placement="top-start" style="margin-top: 3px;margin-left:240px;position: relative;z-index: 50">
  6. <div slot="content">
  7. {{
  8. $t(
  9. '预计签约金额 × 项目成交率'
  10. )
  11. }}
  12. </div>
  13. <!-- <i class="el-icon-question" style="color: #afb0be;float: right"></i>-->
  14. <img
  15. width="14px"
  16. height="14px"
  17. src="../../../assets/icons/prompt_icon.svg"
  18. />
  19. </el-tooltip>
  20. <div ref="chartRef" style="height: 220px;margin-top: -25px;position: relative;z-index: 20">
  21. </div>
  22. </template>
  23. </boxBorder>
  24. </div>
  25. </template>
  26. <script>
  27. import boxBorder from './boxBorder'
  28. import {Column} from "@antv/g2plot";
  29. export default {
  30. name: "futureTwelveMonths",
  31. components:{
  32. boxBorder
  33. },
  34. data(){
  35. return {
  36. chartMap:[],
  37. chartMapData:[],
  38. }
  39. },
  40. methods:{
  41. chartData(init,data){
  42. let index = 0
  43. let indexNew = 0
  44. data.forEach((item,num) =>{
  45. if (num == index){
  46. this.chartMapData[indexNew] = {
  47. "signdate_due":item.signdate_due,
  48. "value":Math.round(this.tool.unitConversion(item.signamount_due,10000) * 100)/100,
  49. "name":this.$t('预计签约金额')
  50. }
  51. indexNew = indexNew + 1
  52. this.chartMapData[indexNew] = {
  53. "signdate_due":item.signdate_due,
  54. "value":Math.round(this.tool.unitConversion(item.dealamount_due,10000) * 100)/100,
  55. "name":this.$t('预计成交金额')
  56. }
  57. indexNew = indexNew + 1
  58. index = index + 1
  59. }
  60. })
  61. console.log(this.chartMapData,'chartMapData')
  62. if (init){
  63. this.chartMap = new Column(this.$refs.chartRef,{
  64. color:['#3874F6','#F29C37'],
  65. data:this.chartMapData,
  66. isGroup: true,
  67. xField: 'signdate_due',
  68. yField: 'value',
  69. seriesField: 'name',
  70. /** 设置颜色 */
  71. //color: ['#1ca9e6', '#f88c24'],
  72. /** 设置间距 */
  73. // marginRatio: 0.1,
  74. label: {
  75. // 可手动配置 label 数据标签位置
  76. position: 'top', // 'top', 'middle', 'bottom'
  77. offsetY:12,
  78. // 可配置附加的布局方法
  79. layout: [
  80. // 数据标签防遮挡
  81. { type: 'interval-hide-overlap' },
  82. ],
  83. style: {
  84. fill: '#444444',
  85. opacity: 0.9,
  86. fontSize:12
  87. },
  88. formatter: (datum) =>{
  89. return '¥' + this.tool.formatAmount(datum.value,2)
  90. }
  91. },
  92. tooltip: {
  93. formatter: (datum) => {
  94. return {
  95. name:datum.name,
  96. value:'¥' + this.tool.formatAmount(datum.value,2)
  97. }
  98. }
  99. }
  100. });
  101. this.chartMap.render()
  102. }else {
  103. this.chartMap.changeData(this.chartMapData)
  104. }
  105. }
  106. }
  107. }
  108. </script>
  109. <style scoped>
  110. </style>