s3tousuCol.vue 7.5 KB

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