s13shengWuCol.vue 7.3 KB

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