s8sheBeiHeCha.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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/s8sheBeiHeChaPro.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:"s8sheBeiHeCha"
  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. }
  53. },
  54. mounted(){
  55. this.drawLine();
  56. },
  57. methods: {
  58. close(){
  59. this.dialogOff = false
  60. },
  61. /* 跳转统计页面*/
  62. toDetailed(){
  63. if(this.click == "true"){
  64. this.dialogOff = true
  65. }
  66. },
  67. drawLine(){
  68. let s8sheBeiHeCha = echarts.init(document.getElementById(this.id))
  69. // let beginInof = GetPercent(Number(this.data.t_sbhcjlbBegin.number),Number(this.data.t_sbhcjhBegin.number))
  70. // let endInof = GetPercent(Number(this.data.t_sbhcjlbEnd.number),Number(this.data.t_sbhcjhEnd.number))
  71. // let data1 = [];
  72. // data1.push(this.data.t_sbhcjhBegin.number);
  73. // data1.push(this.data.t_sbhcjhEnd.number);
  74. // let data2 = [];
  75. // data2.push(this.data.t_sbhcjlbBegin.number);
  76. // data2.push(this.data.t_sbhcjlbEnd.number);
  77. // let data3 = [];
  78. // data3.push(this.data.t_sbhcjlbBegin.date);
  79. // data3.push(this.data.t_sbhcjlbEnd.date);
  80. // let max1=GetMax(data1)+1;
  81. // let max2=GetMax(data2)+1;
  82. // let maxVal=max1>max2?max1:max2;
  83. // console.log("max1:",max1,"max2:",max2);
  84. let e = (100 -this.data.t_sbhcjlbNum.valna).toFixed(2)
  85. const that = this
  86. let option = {
  87. title: {
  88. text: this.title,
  89. // subtext: 'Fake Data',
  90. left: 'left',
  91. textStyle:{ fontSize:14,color: this.colorw }
  92. },
  93. tooltip: {
  94. trigger: 'item'
  95. },
  96. color:['#33cc33','#cc33cc'],
  97. series: [
  98. {
  99. type: 'pie',
  100. radius: '50%',
  101. label: {
  102. formatter: function (arg) {
  103. const mid = that.data.t_sbhcjlbNum.valAll == 0 ? '' : arg.data.value + "%"+'\n'
  104. return arg.data.name +'\n' + mid + arg.data.v2
  105. }
  106. },
  107. data: [
  108. { value: this.data.t_sbhcjlbNum.valna, name: '完成率',v2:this.data.t_sbhcjlbNum.valnum },
  109. { value: this.data.t_sbhcjlbNum.valAll==0?0:e, name: '未完成率' ,v2:this.data.t_sbhcjlbNum.valAll-this.data.t_sbhcjlbNum.valnum}
  110. ],
  111. emphasis: {
  112. itemStyle: {
  113. shadowBlur: 10,
  114. shadowOffsetX: 0,
  115. shadowColor: 'rgba(0, 0, 0, 0.5)'
  116. }
  117. }
  118. }
  119. ]
  120. };
  121. option && s8sheBeiHeCha.setOption(option);
  122. }
  123. }
  124. }
  125. </script>
  126. <style scoped>
  127. #s8sheBeiHeCha:hover{
  128. transition: all 0.5s;
  129. transform:scale(1.03);
  130. }
  131. .statisticsPage{
  132. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  133. float: left;
  134. }
  135. </style>