index.vue 5.0 KB

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