s1jianCe.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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/s1jianCePro.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:"25%"
  30. },
  31. height:{
  32. type:String,
  33. default: window.screen.height/5+"px"
  34. },
  35. id:{
  36. type:String,
  37. default:"s1jianCe"
  38. },
  39. click:{
  40. type:String,
  41. default:'true'
  42. },
  43. },
  44. data () {
  45. return {
  46. title:'检测报告差错率',
  47. dialogOff:false,
  48. }
  49. },
  50. mounted(){
  51. this.drawLine();
  52. },
  53. methods: {
  54. close(){
  55. this.dialogOff = false
  56. },
  57. /* 跳转统计页面*/
  58. toDetailed(){
  59. if(this.click == "true"){
  60. this.dialogOff = true
  61. }
  62. },
  63. drawLine(){
  64. var echarts = require('echarts');
  65. let s1jianCe = echarts.init(document.getElementById(this.id))
  66. // let data = [];
  67. // data.push(Number(this.data.t_gdyrqcwt5Begin.number<0?0-this.data.t_gdyrqcwt5Begin.number:this.data.t_gdyrqcwt5Begin.number)*100)
  68. // data.push(Number(this.data.t_gdyrqcwt5End.number<0?0-this.data.t_gdyrqcwt5End.number:this.data.t_gdyrqcwt5End.number)*100)
  69. // data.push(Number(this.data.t_gdyrqcwt6Begin.number<0?0-this.data.t_gdyrqcwt6Begin.number:this.data.t_gdyrqcwt6Begin.number)*100)
  70. // data.push(Number(this.data.t_gdyrqcwt6End.number<0?0-this.data.t_gdyrqcwt6End.number:this.data.t_gdyrqcwt6End.number)*100)
  71. // let dataAxis = [];
  72. // dataAxis.push("准确率");
  73. // dataAxis.push("准确率");
  74. // dataAxis.push("完成率");
  75. // // dataAxis.push("完成率");
  76. // let beingDate=this.data.t_gdyrqcwt5Begin.date
  77. // let endDate=this.data.t_gdyrqcwt5End.date
  78. // let e=[this.data.t_mjjcbgNum.number[0],this.data.t_mjjcbgNum.numberAll[0],this.data.t_mjjcbgNum.res[0]]
  79. let e = 100 -this.data.t_mjjcbgNum.res[0]
  80. let option = {
  81. //v3
  82. title: {
  83. text: this.title,
  84. // subtext: 'Fake Data',
  85. left: 'left',
  86. textStyle:{ fontSize:14 }
  87. },
  88. tooltip: {
  89. trigger: 'item'
  90. },
  91. series: [
  92. {
  93. type: 'pie',
  94. radius: '50%',
  95. label: {
  96. formatter: '{b}: {d}%'
  97. },
  98. data: [
  99. { value: this.data.t_mjjcbgNum.res[0], name: '检测报告差错率' },
  100. { value: e, name: '检测报告正确率' }
  101. ],
  102. emphasis: {
  103. itemStyle: {
  104. shadowBlur: 10,
  105. shadowOffsetX: 0,
  106. shadowColor: 'rgba(0, 0, 0, 0.5)'
  107. }
  108. }
  109. }
  110. ]
  111. };
  112. option && s1jianCe.setOption(option);
  113. }
  114. }
  115. }
  116. </script>
  117. <style scoped>
  118. #s1jianCe:hover{
  119. transition: all 0.5s;
  120. transform:scale(1.03);
  121. }
  122. .statisticsPage{
  123. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  124. float: left;
  125. }
  126. </style>