clueChange.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <div class="div-new-box-new">
  3. <div class="content-new-content">
  4. <div class="div-line"></div>
  5. <div class="title">近12月线索转化分析</div>
  6. <div style="float: right">
  7. <departmentSalesperson ref="departmentSalesperson" class="inline-16" @depSelect="depSelect" @personSelect="personSelect"></departmentSalesperson>
  8. <span class="search__label inline-16">分析日期:</span>
  9. <el-date-picker
  10. v-model="enddate"
  11. style="margin-right: 10px !important;"
  12. type="date"
  13. :clearable="false"
  14. @change="changeDate"
  15. format="yyyy-MM-dd"
  16. value-format="yyyy-MM-dd"
  17. size="small"
  18. range-separator="至"
  19. start-placeholder="开始月份"
  20. end-placeholder="结束月份">
  21. </el-date-picker>
  22. </div>
  23. </div>
  24. <div class="chart">
  25. <div id="clueChangeAnalysisChart" style="height: 300px;"></div>
  26. </div>
  27. </div>
  28. </template>
  29. <script>
  30. import departmentSalesperson from "@/views/salesData/components/departmentSalesperson";
  31. import {DualAxes} from "@antv/g2plot";
  32. export default {
  33. name: "clueChange",
  34. components:{departmentSalesperson},
  35. props:["dataid"],
  36. data(){
  37. return {
  38. chartDualAxes:null,
  39. param:{
  40. "id": 20231015124404,
  41. "content": {
  42. "type": 0,
  43. "dataid": '',
  44. "enddate":""
  45. }
  46. },
  47. enddate:new Date().getFullYear() + '-' + (new Date().getMonth() + 1) + '-' + new Date().getDate(),
  48. histogram:[],
  49. lineChart:[]
  50. }
  51. },
  52. methods:{
  53. async listData(val){
  54. this.renderPie(val)
  55. },
  56. async queryModel(val){
  57. console.log('执行111')
  58. this.param.content.dataid = val || this.dataid
  59. this.param.content.enddate = this.enddate
  60. const res = await this.$api.requested(this.param)
  61. this.histogram = res.data.histogram
  62. this.lineChart = res.data.lineChart
  63. this.chartDualAxes.changeData([this.histogram,this.lineChart])
  64. },
  65. renderPie(val){
  66. this.chartDualAxes = new DualAxes('clueChangeAnalysisChart', {
  67. data:[this.histogram,this.lineChart],
  68. xField: 'date',
  69. yField: ['value','value'],
  70. geometryOptions: [
  71. {
  72. geometry: 'line',
  73. isGroup: true,
  74. seriesField: 'key',
  75. },
  76. {
  77. geometry: 'line',
  78. seriesField: 'key',
  79. lineStyle: {
  80. lineWidth: 2,
  81. },
  82. },
  83. ],
  84. });
  85. this.chartDualAxes.render();
  86. this.queryModel(val)
  87. },
  88. changeDate(){
  89. this.queryModel(this.param.content.dataid)
  90. },
  91. /*选择部门*/
  92. depSelect(val){
  93. this.param.content.type = 1
  94. this.param.content.dataid = val
  95. this.queryModel(val)
  96. },
  97. /*选择业务员*/
  98. personSelect(val){
  99. this.param.content.type = 0
  100. this.param.content.dataid = val
  101. this.queryModel(val)
  102. }
  103. }
  104. }
  105. </script>
  106. <style scoped>
  107. </style>