personPerformance.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <div @click="toDetailed()" class="statisticsPage" style="width:100%;height:85%">
  3. <div id="chart" 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/personAllDetails'
  17. export default {
  18. data() {
  19. return {
  20. // title:'人员培训',
  21. dialogOff:false,
  22. userInfo:[]
  23. }
  24. },
  25. components:{
  26. dialogView
  27. },
  28. props:{
  29. data: {
  30. type: Array,
  31. },
  32. date: {
  33. type: String,
  34. },
  35. click:{
  36. type:String,
  37. default:'true'
  38. },
  39. },
  40. watch: {
  41. data(v) {
  42. this.getEchartData()
  43. }
  44. },
  45. mounted() {
  46. this.getEchartData()
  47. },
  48. methods: {
  49. close(){
  50. this.dialogOff = false
  51. },
  52. /* 跳转统计页面*/
  53. toDetailed(){
  54. if(this.click == "true"){
  55. this.dialogOff = true
  56. }
  57. },
  58. getEchartData() {
  59. if (true) {
  60. let that = this
  61. let myChart = echarts.init(document.getElementById("chart"))
  62. let option = {
  63. legend: {
  64. textStyle:{
  65. color:'#fff'
  66. }
  67. },
  68. tooltip: {},
  69. color:['#66CC00'],
  70. xAxis: {
  71. type: 'category',
  72. data: this.data[0],
  73. axisLabel:{//修改坐标系字体颜色
  74. show:true,
  75. textStyle:{
  76. color:"#fff"
  77. }
  78. },
  79. axisLine: {
  80. show: true,
  81. lineStyle: {
  82. color: "rgba(255,255,255,1)",
  83. type: "solid"
  84. }
  85. }
  86. },
  87. yAxis: {
  88. type: 'value',
  89. axisLabel:{//修改坐标系字体颜色
  90. show:true,
  91. textStyle:{
  92. color:"#fff"
  93. }
  94. },
  95. axisLine: {//y轴线的颜色以及宽度
  96. show: true,
  97. lineStyle: {
  98. color: "rgba(255,255,255,1)",
  99. type: "solid"
  100. },
  101. },
  102. splitLine: {
  103. show: false
  104. }
  105. },
  106. series: [
  107. {
  108. data: this.data[1],
  109. type: 'bar',
  110. name: '销量',
  111. // showBackground: true,
  112. backgroundStyle: {
  113. color: 'rgba(180, 180, 180, 0.2)'
  114. },
  115. label: {
  116. show: true,
  117. position: 'top',
  118. formatter: function(params) {
  119. if (params.value > 0) {
  120. return params.value;
  121. } else {
  122. return '';
  123. }
  124. }
  125. }
  126. }
  127. ]
  128. };
  129. myChart.on('click', function (params) {
  130. that.userInfo[0] = params.dataIndex+1
  131. // that.userInfo[1] = params.data.NAME_
  132. })
  133. option && myChart.setOption(option);
  134. }
  135. },
  136. },
  137. }
  138. </script>
  139. <style lang="scss" scoped>
  140. </style>