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