s13shengWuCol.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <template>
  2. <div 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/s13shengWuPro.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:"s13shengwu"
  38. },
  39. click:{
  40. type:String,
  41. default:'true'
  42. },
  43. },
  44. data () {
  45. return {
  46. title:'投诉回复及时率',
  47. dialogOff:false,
  48. measured:[]
  49. }
  50. },
  51. mounted(){
  52. this.drawLine();
  53. },
  54. methods: {
  55. close(){
  56. this.dialogOff = false
  57. },
  58. /* 跳转统计页面*/
  59. toDetailed(){
  60. if(this.click == "true"){
  61. this.dialogOff = true
  62. }
  63. },
  64. drawLine(){
  65. // let beginInof = Number(this.data.t_complaintBegin.number)
  66. // let endInof = Number(this.data.t_complaintEnd.number)
  67. let s13shengwu = echarts.init(document.getElementById(this.id))
  68. // let beingDate=this.data.t_complaintBegin.date
  69. // let endDate=this.data.t_complaintEnd.date
  70. var option;
  71. //v2
  72. // let that = this
  73. // for (let i = 0; i < that.data.t_complaintNum.date.length; i++) {
  74. // let result = 0
  75. // if(that.data.t_mjwtsqbNum.number[i] === 0){
  76. // result = Math.floor(that.data.t_complaintNum.number[i]/1 * 10000) / 100
  77. // }else{
  78. // result = Math.floor(that.data.t_complaintNum.number[i]/that.data.t_mjwtsqbNum.number[i] * 10000) / 100
  79. // }
  80. // that.measured.push(result)
  81. // // console.log(that.data.t_complaintNum.number[i], that.data.t_mjwtsqbNum.number[i], result, 'res')
  82. // }
  83. //v3
  84. let e=[this.data.t_complaintNum.number[0],this.data.t_complaintNum.num48[0]]
  85. option = {
  86. //v3
  87. legend: {},
  88. tooltip: {
  89. trigger: 'axis',
  90. axisPointer: {
  91. type: 'shadow'
  92. },
  93. // formatter: function (params) {
  94. // return params[0].data[0] + '<br/>满意份数:' + params[0].data[1] + '<br/>调查总份数: ' + params[0].data[2];
  95. // }
  96. },
  97. // dataset: {
  98. // source: barData
  99. // },
  100. xAxis: { type: 'category',data:['有效投诉总次数','投诉后48h内达成一致解决方案次数']},
  101. yAxis: [
  102. {
  103. type: 'value',
  104. scale: true,
  105. name: '数量',
  106. max: this.data.t_complaintNum.number[0]>this.data.t_complaintNum.num48[0]?this.data.t_complaintNum.number[0]+1:this.data.t_complaintNum.num48[0]+1,
  107. min: 0,
  108. boundaryGap: [0.2, 0.2]
  109. },
  110. // {
  111. // type: 'value',
  112. // scale: true,
  113. // name: '客户投诉率',
  114. // max: this.data.t_complaintNum.res[0],
  115. // min: 0,
  116. // axisLabel: {
  117. // formatter: '{value} %'
  118. // }
  119. // }
  120. ],
  121. // Declare several bar series, each will be mapped
  122. // to a column of dataset.source by default.
  123. // series: [{ type: 'bar' }],
  124. series: [
  125. {
  126. data: e,
  127. type: 'bar',
  128. barWidth: '20%',
  129. itemStyle: {
  130. color: '#cc6633'
  131. },
  132. label: {
  133. show: true,
  134. position: 'top'
  135. },
  136. }
  137. ],
  138. grid: {
  139. top: '30%',
  140. left: '3%',
  141. right: '4%',
  142. bottom: '10%',
  143. containLabel: true
  144. },
  145. title: {
  146. text: this.title,
  147. textStyle:{ fontSize:14 }
  148. // subtext: " "+beingDate+"-"+endDate
  149. },
  150. //v2
  151. // rotate: {
  152. // min: -90,
  153. // max: 90
  154. // },
  155. // grid: {
  156. // top: '20%',
  157. // left: '3%',
  158. // right: '4%',
  159. // bottom: '10%',
  160. // containLabel: true
  161. // },
  162. // title: {
  163. // text: this.title,
  164. // subtext: ' '+this.data.t_complaintNum.date[0]+'-'+this.data.t_complaintNum.date[this.data.t_complaintNum.date.length-1],
  165. // },
  166. // xAxis: {
  167. // type: 'category',
  168. // data: this.data.t_complaintNum.date
  169. // },
  170. // yAxis: {
  171. // // max:this.data.t_complaintBegin.number>this.data.t_complaintEnd.number?this.data.t_complaintBegin.number+1:this.data.t_complaintEnd.number+1,
  172. // // max: Math.max(...this.measured),
  173. // // min:0,
  174. // type: 'value',
  175. // axisLabel: {
  176. // show: true,
  177. // textStyle:{color:'#000'},
  178. // interval: 'auto',
  179. // formatter: '{value} %'
  180. // },
  181. // },
  182. // tooltip: {
  183. // trigger: 'axis',
  184. // axisPointer: {
  185. // type: 'shadow'
  186. // },
  187. // formatter: function (params) {
  188. // // console.log(params,'tousu ')
  189. // return params[0].axisValue + '<br/>客户投诉率:' + params[0].data;
  190. // }
  191. // // formatter:
  192. // // function (datas) {
  193. // // let year1 = datas[0].dataIndex==0||datas[0].dataIndex==2;
  194. // // var res=(year1?beingDate+':':endDate+':')+datas[0].name+':'+datas[0].value
  195. // // return res
  196. // // }
  197. // },
  198. // series: [
  199. // {
  200. // itemStyle: {
  201. // normal: {
  202. // color: function(params) {
  203. // var colorList = [
  204. // '#F0805A','#B5C334','#FCCE10','#E87C25','#27727B',
  205. // '#FE8463','#9BCA63','#FAD860','#F3A43B','#60C0DD',
  206. // '#D7504B','#C6E579','#F4E001','#F0805A','#26C0C0'
  207. // ];
  208. // return colorList[params.dataIndex]
  209. // },
  210. // }
  211. // },
  212. // data: this.measured,
  213. // type: 'bar',
  214. // barWidth:50
  215. // }
  216. // ]
  217. };
  218. option && s13shengwu.setOption(option);
  219. }
  220. }
  221. }
  222. </script>
  223. <style scoped>
  224. #s13shengwu:hover{
  225. transition: all 0.5s;
  226. transform:scale(1.03);
  227. }
  228. .statisticsPage{
  229. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  230. float: left;
  231. }
  232. </style>