onlineQuestion.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <div>
  3. <boxCom v-if="pageData" title="线上问题" :page-data="pageData" @change="tabChange">
  4. <!-- <div>线上问题:{{ active }}</div> -->
  5. <div class="echarts-wrapper">
  6. <div class="pie-wrapper">
  7. <div class="total-wrapper">
  8. 总数:<span class="total" @click.stop="reportBizName = ''">{{ tabData.total }}</span>
  9. </div>
  10. <div
  11. id="a_tylo_oo_2ppmn_ayghs"
  12. class="pir"
  13. style="width: 100%; height: 160px"
  14. />
  15. </div>
  16. <div v-if="tabData" class="detail-wrapper">
  17. <div class="fontWeight" style="margin-bottom: 10px;">{{ tabData.title }}</div>
  18. <div
  19. v-for="item in tabData.onlineProblemCopywriters.filter((elm) =>
  20. reportBizName ? elm.reportBizName === reportBizName : true
  21. )"
  22. :key="item.reportBizName"
  23. >
  24. <div>{{ item.reportBizName }}:{{ item.priorityStr }}</div>
  25. <div v-for="(pitem, pIndex) in item.problemDetails" :key="pIndex">
  26. <div class="fontWeight" style="color: #ED8F41;margin-top: 10px;">{{ pitem.subClientType }}</div>
  27. <div v-for="(dItem, dIndex) in pitem.details" :key="dIndex">
  28. <div style="margin-top: 5px;">
  29. <span class="fontWeight">{{ dIndex + 1 }}、</span
  30. ><span class="fontWeight">{{ dItem.priority }}问题:</span
  31. >{{ dItem.problem }}
  32. </div>
  33. <div v-html="dItem.reason" />
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. </boxCom>
  40. </div>
  41. </template>
  42. <script type="text/javascript">
  43. import { getOnlineProblemPieChart } from '@/api/qualityMonthlyReport/edit'
  44. import echarts from 'echarts'
  45. import boxCom from './box'
  46. export default {
  47. name: 'OnlineQuestion',
  48. components: {
  49. boxCom
  50. },
  51. data() {
  52. return {
  53. active: 'APP',
  54. myChart: null,
  55. pageData: null,
  56. tabData: null,
  57. reportBizName: null,
  58. option: null,
  59. pieData: []
  60. }
  61. },
  62. mounted() {
  63. this.init()
  64. // this.echartsInit()
  65. },
  66. methods: {
  67. async init() {
  68. const res = await getOnlineProblemPieChart(this.$route.query.reportId)
  69. this.pageData = res.data.map((elm) => {
  70. return {
  71. ...elm,
  72. onlineProblemCopywriters: elm.onlineProblemCopywriters.map((item) => {
  73. return {
  74. ...item,
  75. value: item.total,
  76. name: item.reportBizName
  77. }
  78. })
  79. }
  80. })
  81. this.active = this.pageData[0].clientType
  82. this.tabData = this.pageData[0]
  83. this.$nextTick(() => {
  84. this.echartsInit()
  85. })
  86. },
  87. echartsInit() {
  88. this.option = {
  89. color: [
  90. '#5470c6',
  91. '#91cc75',
  92. '#fac858',
  93. '#ee6666',
  94. '#73c0de',
  95. '#3ba272',
  96. '#fc8452',
  97. '#9a60b4',
  98. '#ea7ccc'
  99. ],
  100. tooltip: {
  101. trigger: 'item'
  102. },
  103. series: [
  104. {
  105. // name: '访问来源',
  106. type: 'pie',
  107. radius: '80%',
  108. data: this.tabData.onlineProblemCopywriters.filter(elm => elm.total),
  109. emphasis: {
  110. itemStyle: {
  111. shadowBlur: 0,
  112. shadowOffsetX: 0,
  113. shadowColor: 'rgba(0, 0, 0, 0.5)'
  114. }
  115. }
  116. }
  117. ]
  118. }
  119. // console.log(this.tabData)
  120. // 基于准备好的dom,初始化echarts实例
  121. this.myChart = echarts.init(
  122. document.getElementById('a_tylo_oo_2ppmn_ayghs')
  123. )
  124. // 绘制图表
  125. this.myChart.setOption(this.option)
  126. this.myChart.on('click', (params) => {
  127. this.reportBizName = params.data.name
  128. })
  129. },
  130. tabChange(value) {
  131. this.active = value
  132. this.reportBizName = ''
  133. this.tabData = this.pageData.filter(
  134. (elm) => elm.clientType === this.active
  135. )[0]
  136. console.log(this.tabData)
  137. console.log(this.tabData.onlineProblemCopywriters)
  138. this.option.series[0].data = this.tabData.onlineProblemCopywriters.filter(elm => elm.total)
  139. this.myChart.setOption(this.option)
  140. }
  141. }
  142. }
  143. </script>
  144. <style scoped lang="less">
  145. .echarts-wrapper {
  146. margin-top: -10px;
  147. display: flex;
  148. color: #333;
  149. font-size: 14px;
  150. .pie-wrapper {
  151. width: 50%;
  152. .total-wrapper {
  153. color: #666;
  154. margin-top: 10px;
  155. .total {
  156. color: #409eff;
  157. font-size: 18px;
  158. cursor: pointer;
  159. }
  160. }
  161. }
  162. .detail-wrapper {
  163. width: 50%;
  164. padding: 10px;
  165. height: 270px;
  166. margin-bottom: 10px;
  167. overflow-y: scroll;
  168. }
  169. .fontWeight {
  170. color: #333;
  171. font-weight: 500;
  172. }
  173. }
  174. </style>