s9neiBuZhiLiangCol.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <div @click="toDetailed()" class="statisticsPage" :style="{width:width}">
  3. <div :id="id" :style="{height:height}"/>
  4. <!-- 打开详情弹窗-->
  5. <div v-if="dialogOff">
  6. <dialogView
  7. :dialogOff = "dialogOff"
  8. @close = "close"
  9. :title="title"
  10. :data="data"
  11. />
  12. </div>
  13. </div>
  14. </template>
  15. <script>
  16. import echarts from 'echarts'
  17. import dialogView from '../properties/s9neiBuZhiLiangPro.vue'
  18. import {GetPercent,GetMax} from '../js/config.js'
  19. export default {
  20. components:{
  21. dialogView
  22. },
  23. props: {
  24. data: {
  25. type: Object,
  26. },
  27. width:{
  28. type:String,
  29. default:"20%"
  30. },
  31. height:{
  32. type:String,
  33. default: window.screen.height/5+"px"
  34. },
  35. id:{
  36. type:String,
  37. default:"s9neibu"
  38. },
  39. click:{
  40. type:String,
  41. default:'true'
  42. },
  43. colorw:{
  44. type:String,
  45. default:'true'
  46. }
  47. },
  48. data () {
  49. return {
  50. title:'质量控制数量',
  51. dialogOff:false,
  52. measured:[]
  53. }
  54. },
  55. mounted(){
  56. this.drawLine();
  57. },
  58. methods: {
  59. close(){
  60. this.dialogOff = false
  61. },
  62. /* 跳转统计页面*/
  63. toDetailed(){
  64. if(this.click == "true"){
  65. this.dialogOff = true
  66. }
  67. },
  68. drawLine(){
  69. // let beginInof = Number(this.data.t_complaintBegin.number)
  70. // let endInof = Number(this.data.t_complaintEnd.number)
  71. let s9neibu = echarts.init(document.getElementById(this.id))
  72. // let beingDate=this.data.t_complaintBegin.date
  73. // let endDate=this.data.t_complaintEnd.date
  74. var option;
  75. let e = []
  76. e.push(this.data.t_mjzlkzxbNum.val[0])
  77. //v3
  78. // let e=[this.data.t_complaintNum.number[0],this.data.t_complaintNum.numberAll[0],this.data.t_complaintNum.res[0]]
  79. option = {
  80. grid: {
  81. top: '20%',
  82. left: '3%',
  83. right: '4%',
  84. bottom: '10%',
  85. containLabel: true
  86. },
  87. title: {
  88. text: this.title,
  89. textStyle:{ fontSize:14,color: this.colorw }
  90. // subtext: " "+beingDate+"-"+endDate
  91. },
  92. legend: {},
  93. tooltip: {
  94. trigger: 'axis',
  95. axisPointer: {
  96. type: 'shadow'
  97. },
  98. formatter: function (datas) {
  99. console.log(datas,'sdsdds')
  100. var res=datas[0].data[0]+"<BR>"+'已完成:'+datas[0].data[2]+"<BR>"
  101. res+='总计划:'+datas[0].data[1]+"<BR>"
  102. res+='百分比:'+(datas[0].data[1]==null||datas[0].data[1]==0?"0.00":(datas[0].data[2]/datas[0].data[1]*100).toFixed(2))+"%"
  103. return res
  104. }
  105. },
  106. dataset: {
  107. source: e
  108. },
  109. xAxis: { type: 'category' },
  110. yAxis: {
  111. min: 0,
  112. minInterval: 1
  113. },
  114. // Declare several bar series, each will be mapped
  115. // to a column of dataset.source by default.
  116. series: [{
  117. type: 'bar',
  118. itemStyle: {color: '#cccc33'},
  119. barWidth: '20%',
  120. label: {
  121. show: true,
  122. position: 'top'
  123. },
  124. },
  125. {
  126. type: 'bar',
  127. itemStyle: {color: '#66CCCC'},
  128. barWidth: '20%',
  129. label: {
  130. show: true,
  131. position: 'top'
  132. },
  133. }
  134. ]
  135. };
  136. option && s9neibu.setOption(option);
  137. }
  138. }
  139. }
  140. </script>
  141. <style scoped>
  142. #s9neibu:hover{
  143. transition: all 0.5s;
  144. transform:scale(1.03);
  145. }
  146. .statisticsPage{
  147. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  148. float: left;
  149. }
  150. </style>