index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <!--
  2. * @Author: WangQiBiao
  3. * @Date: 2019-09-25 14:10:08
  4. * @LastEditors: mozhuangru
  5. * @LastEditTime: 2019-10-11 17:45:38
  6. * @Description: 在线沟通
  7. -->
  8. <template>
  9. <div class="communication">
  10. <TitleCom :isBorder="true">在线沟通</TitleCom>
  11. <div class="map">
  12. <div class="map-item proportion" id="proportion"></div>
  13. <div class="map-item satisfaction" id="satisfaction"></div>
  14. </div>
  15. <div class="linst-line"></div>
  16. <div class="list">
  17. <div class="list-item" v-for="(item, idx) in dialogData" :key="idx">
  18. <div class="list-item-lf">
  19. <TagCom type="time">{{item.createAt}}</TagCom>
  20. <span class="list-item-txt">{{item.content}}</span>
  21. </div>
  22. <div class="list-item-lr">
  23. <TagCom v-if="item.label === '建议'" type="advice">建议</TagCom>
  24. <TagCom v-if="item.label === '表扬'" type="praise">表扬</TagCom>
  25. <TagCom v-if="item.label === '投诉'" type="complaints">投诉</TagCom>
  26. <TagCom v-if="item.label === '咨询'" type="consulting">咨询</TagCom>
  27. </div>
  28. </div>
  29. </div>
  30. </div>
  31. </template>
  32. <script>
  33. import TitleCom from '@/components/title'
  34. import TagCom from '@/components/tag'
  35. import echarts from 'echarts'
  36. import { api } from '@/api'
  37. export default {
  38. data () {
  39. return {
  40. dialogData: []
  41. }
  42. },
  43. components: {
  44. TitleCom,
  45. TagCom
  46. },
  47. mounted () {
  48. this.init()
  49. setInterval(() => {
  50. this.init()
  51. }, 30000)
  52. },
  53. methods: {
  54. init () {
  55. api.getDialogRecord().then(res => {
  56. this.dialogData = res.data.data.list
  57. })
  58. this.circleProportionMap()
  59. this.createSatisfactionMap()
  60. },
  61. /**
  62. * 占比
  63. */
  64. circleProportionMap () {
  65. var myChart = echarts.init(document.getElementById('proportion'))
  66. var option = {
  67. // backgroundColor: '#2c343c',
  68. series: [
  69. {
  70. type: 'pie',
  71. radius: '46%',
  72. // radius: ['35%', '60%'],
  73. roseType: 'radius',
  74. center: ['50%', '50%'],
  75. label: {
  76. normal: {
  77. formatter: '{b|{b}}\n{c}',
  78. fontSize: 10,
  79. lineHeight: 14,
  80. rich: {
  81. b: {
  82. color: '#fff',
  83. fontSize: 10
  84. }
  85. }
  86. }
  87. },
  88. data: [
  89. {
  90. value: 1652,
  91. name: '咨询',
  92. label: {
  93. show: true,
  94. color: '#00F5FF'
  95. },
  96. itemStyle: {
  97. color: '#00F5FF'
  98. }
  99. },
  100. {
  101. value: 2462,
  102. name: '投诉',
  103. label: {
  104. show: true,
  105. color: '#ed4f46'
  106. },
  107. itemStyle: {
  108. color: '#ed4f46'
  109. }
  110. },
  111. {
  112. value: 591,
  113. name: '建议',
  114. label: {
  115. show: true,
  116. color: '#0998FF'
  117. },
  118. itemStyle: {
  119. color: '#0998FF'
  120. }
  121. },
  122. {
  123. value: 350,
  124. name: '表扬',
  125. label: {
  126. show: true,
  127. color: '#07E144'
  128. },
  129. itemStyle: {
  130. color: '#07E144'
  131. }
  132. }
  133. ]
  134. }
  135. ]
  136. }
  137. myChart.setOption(option)
  138. },
  139. /**
  140. * 满意度
  141. */
  142. createSatisfactionMap () {
  143. var myChart = echarts.init(document.getElementById('satisfaction'))
  144. var option = {
  145. // backgroundColor: '#2c343b',
  146. series: [
  147. {
  148. name: '满意度',
  149. hoverAnimation: false,
  150. type: 'pie',
  151. radius: ['70%', '100%'],
  152. label: {
  153. normal: {
  154. formatter: '{a|{a}}\n{b|{b}}',
  155. fontSize: 10,
  156. lineHeight: 14,
  157. position: 'center',
  158. rich: {
  159. a: {
  160. color: '#00CAFF',
  161. fontSize: 10
  162. },
  163. b: {
  164. color: '#00FAA8',
  165. fontSize: 14
  166. }
  167. }
  168. }
  169. },
  170. data: [
  171. {
  172. value: 83.2,
  173. name: '83.2%',
  174. itemStyle: {
  175. color: '#07E144'
  176. }
  177. },
  178. {
  179. value: 16.8,
  180. itemStyle: {
  181. color: '#262795'
  182. }
  183. }
  184. ]
  185. }
  186. ]
  187. }
  188. myChart.setOption(option)
  189. }
  190. }
  191. }
  192. </script>
  193. <style lang="scss" scoped>
  194. @import './index.scss';
  195. </style>