salesfunnel.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. // 各模块文件存储占比
  2. <template>
  3. <div class="container normal-panel">
  4. <div >
  5. <p class="title">销售漏斗图</p>
  6. <div id="containerFunnel"></div>
  7. </div>
  8. <div>
  9. <p class="title">表格数据</p>
  10. <el-table
  11. :data="tableData"
  12. style="width: 100%"
  13. size="small"
  14. border>
  15. <el-table-column
  16. prop="stagename"
  17. label="阶段"
  18. width="180">
  19. </el-table-column>
  20. <el-table-column
  21. prop="projectqty"
  22. label="项目数"
  23. width="180">
  24. </el-table-column>
  25. <el-table-column
  26. prop="signamount_due"
  27. label="签约金额(万元)">
  28. </el-table-column>
  29. <el-table-column
  30. prop="totalinvestment"
  31. label="总计预计投资金额(万元)">
  32. </el-table-column>
  33. <el-table-column
  34. prop="budgetary"
  35. label="项目预算(万元)">
  36. </el-table-column>
  37. </el-table>
  38. </div>
  39. </div>
  40. </template>
  41. <script>
  42. import { Funnel } from '@antv/g2plot';
  43. export default {
  44. data () {
  45. return {
  46. chartPie:null,
  47. tableData:[]
  48. }
  49. },
  50. methods:{
  51. renderPie() {
  52. this.chartPie = new Funnel('containerFunnel', {
  53. data: [],
  54. width:500,
  55. xField: 'stagename',
  56. yField: 'sequence1',
  57. legend: false,
  58. label: {
  59. formatter: (datum) => {
  60. return `${datum.stagename}:${datum.projectqty}`;
  61. },
  62. },
  63. tooltip:{
  64. customContent: (title, items) => {
  65. // 构建自定义内容
  66. const content = `<div>
  67. <ul style="padding:20px">
  68. ${items.map((item) => `<li>${title}: ${item.data.projectqty}</li>`).join('')}
  69. </ul>
  70. </div>`;
  71. return content;
  72. },
  73. },
  74. conversionTag: {
  75. formatter: (datum) => {
  76. return `${((datum[Funnel.CONVERSATION_FIELD][1] / datum[Funnel.CONVERSATION_FIELD][0]) * 100).toFixed(2)}%`;
  77. },
  78. },
  79. // 关闭 conversionTag 转化率 展示
  80. // conversionTag: false,
  81. });
  82. this.chartPie.render();
  83. this.getProportionOfFileModel()
  84. },
  85. async getProportionOfFileModel () {
  86. let param = {
  87. "id": 20230630151504,
  88. "content": {
  89. "where": {
  90. "begindate": "",
  91. "enddate":"",
  92. "departmentid":""
  93. }
  94. }
  95. }
  96. const res = await this.$api.requested(param)
  97. this.tableData = res.data
  98. this.chartPie.changeData(res.data)
  99. }
  100. },
  101. mounted () {
  102. this.renderPie()
  103. }
  104. }
  105. </script>
  106. <style>
  107. </style>
  108. <style scoped>
  109. .title{
  110. height: 20px;
  111. line-height: 20px;
  112. font-size: 14px;
  113. text-indent: 7px;
  114. font-weight: bold;
  115. color: #333333;
  116. margin-bottom: 20px;
  117. border-left: .3rem solid #3874F6;
  118. }
  119. .container{
  120. height:calc(100vh - 200px)
  121. }
  122. </style>