s2manYiDuPro.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  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 {GetPercent,GetMax} from '../js/config.js'
  18. import dialogView from '../properties/s2manYiDuPro.vue'
  19. export default {
  20. components:{
  21. dialogView
  22. },
  23. props: {
  24. data: {
  25. type: Object,
  26. },
  27. width:{
  28. type:String,
  29. default:"25%"
  30. },
  31. height:{
  32. type:String,
  33. default: window.screen.height/5+"px"
  34. // default: "100%"
  35. },
  36. id:{
  37. type:String,
  38. default:"s2manYiDu"
  39. },
  40. click:{
  41. type:String,
  42. default:'true'
  43. },
  44. colorw:{
  45. type:String,
  46. default:'true'
  47. }
  48. },
  49. data () {
  50. return {
  51. title:'客户满意度',
  52. dialogOff:false,
  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 s2manYiDu = echarts.init(document.getElementById(this.id))
  70. // let data2 = [];
  71. // data2.push(Number(this.data.t_myddc2Begin.number*100))
  72. // data2.push(Number(this.data.t_myddc2End.number*100))
  73. // data2.push(Number(this.data.t_myddc3Begin.number*100))
  74. // data2.push(Number(this.data.t_myddc3End.number*100))
  75. // let dataAxis = [];
  76. // dataAxis.push("检测")
  77. // dataAxis.push("检测")
  78. // dataAxis.push("满意率")
  79. // dataAxis.push("满意率")
  80. // let barData = []
  81. // for (let i = 0; i < this.data.t_khmydtjbNum.date.length; i++) {
  82. // let e=[]
  83. // if (this.data.t_khmydtjbNum.numberAll[i]===0) {
  84. // e =[this.data.t_khmydtjbNum.date[i], 0]
  85. // } else {
  86. // e =[this.data.t_khmydtjbNum.date[i], Math.floor(this.data.t_khmydtjbNum.number[i]/this.data.t_khmydtjbNum.numberAll[i] * 10000) / 100]
  87. // }
  88. // barData.push(e)
  89. // }
  90. let e=[this.data.t_khmydtjbNum.num,this.data.t_khmydtjbNum.number[0]]
  91. // let e=100-this.data.t_khmydtjbNum.res[0]
  92. let beingDate=this.data.t_myddc2Begin.date
  93. let endDate=this.data.t_myddc2End.date
  94. let option = {
  95. // title: {
  96. // text: this.title,
  97. // // subtext: 'Fake Data',
  98. // left: 'left',
  99. // textStyle:{ fontSize:14 }
  100. // },
  101. // tooltip: {
  102. // trigger: 'item'
  103. // },
  104. // color:['#00ccff','#cc3333'],
  105. // series: [
  106. // {
  107. // type: 'pie',
  108. // radius: '50%',
  109. // label: {
  110. // formatter: '{b}: {d}%'
  111. // },
  112. // data: [
  113. // { value: this.data.t_khmydtjbNum.res[0], name: '客户满意率' },
  114. // { value: e, name: '客户不满意率' }
  115. // ],
  116. // emphasis: {
  117. // itemStyle: {
  118. // shadowBlur: 10,
  119. // shadowOffsetX: 0,
  120. // shadowColor: 'rgba(0, 0, 0, 0.5)'
  121. // }
  122. // }
  123. // }
  124. // ]
  125. //v3
  126. legend: {},
  127. tooltip: {
  128. trigger: 'axis',
  129. axisPointer: {
  130. type: 'shadow'
  131. },
  132. // formatter: function (params) {
  133. // return params[0].data[0] + '<br/>满意份数:' + params[0].data[1] + '<br/>调查总份数: ' + params[0].data[2];
  134. // }
  135. },
  136. // dataset: {
  137. // source: barData
  138. // },
  139. xAxis: {
  140. type: 'category',
  141. // data:['满意份数', '调查份数', '满意度']
  142. data:['有效问卷总分','评分得分']
  143. },
  144. yAxis: [
  145. {
  146. type: 'value',
  147. scale: true,
  148. name: '份数',
  149. max: this.data.t_khmydtjbNum.number[0]>this.data.t_khmydtjbNum.numberAll[0]?this.data.t_khmydtjbNum.number[0]+1:this.data.t_khmydtjbNum.numberAll[0]+1,
  150. min: 0,
  151. // boundaryGap: [0.2, 0.2]
  152. },
  153. // {
  154. // type: 'value',
  155. // scale: true,
  156. // name: '满意度',
  157. // max: this.data.t_khmydtjbNum.res[0],
  158. // min: 0,
  159. // axisLabel: {
  160. // formatter: '{value} %'
  161. // }
  162. // }
  163. ],
  164. // Declare several bar series, each will be mapped
  165. // to a column of dataset.source by default.
  166. // series: [{ type: 'bar' }],
  167. series: [
  168. {
  169. data: e,
  170. type: 'bar',
  171. barWidth: '20%',
  172. itemStyle: {
  173. color: '#66CCCC'
  174. },
  175. label: {
  176. show: true,
  177. position: 'top'
  178. },
  179. }
  180. ],
  181. grid: {
  182. top: '20%',
  183. left: '3%',
  184. right: '4%',
  185. bottom: '10%',
  186. containLabel: true
  187. },
  188. title: {
  189. text: this.title,
  190. textStyle:{ fontSize:14,color: this.colorw }
  191. // subtext: " "+beingDate+"-"+endDate
  192. },
  193. //v1
  194. // xAxis: {
  195. // data: dataAxis,
  196. // axisLabel: {
  197. // inside: false,
  198. // color: '#000',
  199. // interval:0
  200. // },
  201. // axisTick: {
  202. // show: true
  203. // },
  204. // axisLine: {
  205. // show: true
  206. // },
  207. // z: 10
  208. // },
  209. // yAxis: {
  210. // axisLine: {
  211. // show: false
  212. // },
  213. // axisTick: {
  214. // show: false
  215. // },
  216. // axisLabel: {
  217. // show: true,
  218. // textStyle:{color:'#000'},
  219. // interval: 'auto',
  220. // formatter: '{value} %'
  221. // },
  222. // },
  223. // dataZoom: [
  224. // {
  225. // type: 'inside'
  226. // }
  227. // ],
  228. // tooltip: {
  229. // trigger: 'axis',
  230. // axisPointer: {
  231. // type: 'shadow'
  232. // },
  233. // formatter: function (datas) {
  234. // let year1 = datas[0].dataIndex==0||datas[0].dataIndex==2;
  235. // var res=(year1?beingDate+':':endDate+':')+datas[0].name+':'+((datas[0].value-1))+"%"
  236. // return res
  237. // }
  238. // },
  239. // series: [
  240. // {
  241. // type: 'bar',
  242. // showBackground: true,
  243. // itemStyle: {
  244. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  245. // { offset: 0, color: '#83bff6' },
  246. // { offset: 0.5, color: '#188df0' },
  247. // { offset: 1, color: '#188df0' }
  248. // ])
  249. // },
  250. // emphasis: {
  251. // itemStyle: {
  252. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  253. // { offset: 0, color: '#2378f7' },
  254. // { offset: 0.7, color: '#2378f7' },
  255. // { offset: 1, color: '#83bff6' }
  256. // ])
  257. // }
  258. // },
  259. // data: data2
  260. // }
  261. // ]
  262. };
  263. option && s2manYiDu.setOption(option);
  264. }
  265. }
  266. }
  267. </script>
  268. <style scoped>
  269. #s2manYiDu:hover{
  270. transition: all 0.5s;
  271. transform:scale(1.03);
  272. }
  273. .statisticsPage{
  274. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  275. float: left;
  276. }
  277. </style>