teamPerformance.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <div @click="toDetailed()" class="statisticsPage" style="width:100%;height:85%">
  3. <div id="tmec" style="width:100%;height:100%"></div>
  4. <div v-if="dialogOff">
  5. <dialogView
  6. :dialogOff = "dialogOff"
  7. @close = "close"
  8. :data="userInfo"
  9. :date="date"
  10. />
  11. </div>
  12. </div>
  13. </template>
  14. <script>
  15. import echarts from 'echarts'
  16. import dialogView from '../messageBox/teamAllDetails'
  17. export default {
  18. data() {
  19. return {
  20. dialogOff:false,
  21. userInfo:[]
  22. }
  23. },
  24. components:{
  25. dialogView
  26. },
  27. props:{
  28. data: {
  29. type: Array,
  30. },
  31. date: {
  32. type: String,
  33. },
  34. click:{
  35. type:String,
  36. default:'true'
  37. },
  38. },
  39. watch: {
  40. data(v) {
  41. this.getEchartData()
  42. }
  43. },
  44. mounted() {
  45. this.getEchartData()
  46. },
  47. methods: {
  48. close(){
  49. this.dialogOff = false
  50. },
  51. /* 跳转统计页面*/
  52. toDetailed(){
  53. if(this.click == "true"){
  54. this.dialogOff = true
  55. }
  56. },
  57. getEchartData() {
  58. if (true) {
  59. let that = this
  60. let tmecs= echarts.init(document.getElementById("tmec"))
  61. let option = {
  62. legend: {
  63. textStyle:{
  64. color:'#fff'
  65. }
  66. },
  67. tooltip: {},
  68. color:['#99FF00'],
  69. dataset: {
  70. dimensions: ['NAME_', 'jiage'],
  71. source: this.data
  72. },
  73. xAxis: {
  74. type: 'category',
  75. axisLabel:{//修改坐标系字体颜色
  76. show:true,
  77. textStyle:{
  78. color:"#fff"
  79. }
  80. },
  81. axisLine: {
  82. show: true,
  83. lineStyle: {
  84. color: "rgba(255,255,255,1)",
  85. type: "solid"
  86. }
  87. }
  88. },
  89. yAxis: {
  90. axisLabel:{//修改坐标系字体颜色
  91. show:true,
  92. textStyle:{
  93. color:"#fff"
  94. }
  95. },
  96. axisLine: {//y轴线的颜色以及宽度
  97. show: true,
  98. lineStyle: {
  99. color: "rgba(255,255,255,1)",
  100. type: "solid"
  101. },
  102. },
  103. splitLine: {
  104. show: false
  105. }
  106. },
  107. series: [{ name: '销量',type: 'bar',barWidth:'10%',label: {show: true,position: 'top'} }]
  108. };
  109. tmecs.on('click', function (params) {
  110. // console.log(params.data.bian_zhi_ren_)
  111. that.userInfo[0] = params.data.bian_zhi_ren_
  112. that.userInfo[1] = params.data.NAME_
  113. // console.log(params.dataIndex);
  114. })
  115. option && tmecs.setOption(option);
  116. }
  117. },
  118. },
  119. }
  120. </script>
  121. <style lang="scss" scoped>
  122. </style>