adReadData.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <template>
  2. <div class="content">
  3. <header>浏览数据</header>
  4. <div class="main">
  5. <div class="chart-box">
  6. <div :id="type + 'pie1'" style="width:100%"></div>
  7. </div>
  8. <div style="flex:1;">
  9. <div class="title-box">
  10. <div class="title">未浏览{{ type == 'agency' ? '经销商' : '业务员' }}</div>
  11. <exportExcel :tablecols="unReadData.tablecols" :param="unReadData.params"
  12. :excelTitle="type == 'agency' ? '推广素材经销商未浏览表' : '推广素材团队未浏览表'" />
  13. </div>
  14. <!-- 未读表格 -->
  15. <tableLayout style="margin-top:16px" :layout="unReadData.tablecols" :data="unReadData.list"
  16. :custom="true">
  17. <template v-slot:customcol="scope">
  18. <div v-if="scope.column.columnname == 'region'">
  19. {{ scope.column.data.province }}{{ scope.column.data.city }}{{ scope.column.data.county }}
  20. </div>
  21. <p v-else>{{ scope.column.data[scope.column.columnname] }}</p>
  22. </template>
  23. </tableLayout>
  24. <div style="margin-top:16px;text-align:right">
  25. <el-pagination background small @current-change="handlUnReadCurrentChange"
  26. :current-page="unReadData.pageNumber" :page-size="unReadData.pageSize"
  27. layout="total, prev, pager, next, jumper" :total="unReadData.total">
  28. </el-pagination>
  29. </div>
  30. <div class="title-box" style="margin-top:30px">
  31. <div class="title">已浏览{{ type == 'agency' ? '经销商' : '业务员' }}</div>
  32. <exportExcel :tablecols="readData.tablecols" :param="readData.params"
  33. :excelTitle="type == 'agency' ? '推广素材经销商已浏览表' : '推广素材团队已浏览表'" />
  34. </div>
  35. <!-- 已读表格 -->
  36. <tableLayout style="margin-top:16px" :layout="readData.tablecols" :data="readData.list" :custom="true">
  37. <template v-slot:customcol="scope">
  38. <div v-if="scope.column.columnname == 'region'">
  39. {{ scope.column.data.province }}{{ scope.column.data.city }}{{ scope.column.data.county }}
  40. </div>
  41. <div v-else-if="scope.column.columnname == 'isdownloadfile'">
  42. {{ scope.column.data.isdownloadfile == 1 ? '是' : '否' }}
  43. </div>
  44. <p v-else>{{ scope.column.data[scope.column.columnname] }}</p>
  45. </template>
  46. </tableLayout>
  47. <div style="margin-top:16px;text-align:right">
  48. <el-pagination background small @current-change="handlReadCurrentChange"
  49. :current-page="readData.pageNumber" :page-size="readData.pageSize"
  50. layout="total, prev, pager, next, jumper" :total="readData.total">
  51. </el-pagination>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. </template>
  57. <script>
  58. import exportExcel from "@/components/export_excel";
  59. import { Pie } from '@antv/g2plot';
  60. export default {
  61. props: ["type"],
  62. components: { exportExcel },
  63. data() {
  64. return {
  65. //已读对象
  66. readData: {
  67. tablecols: [],
  68. list: [],
  69. pageNumber: 1,
  70. pageSize: 10,
  71. total: 0
  72. },
  73. //未读对象
  74. unReadData: {
  75. tablecols: [],
  76. list: [],
  77. pageNumber: 1,
  78. pageSize: 10,
  79. total: 0
  80. }
  81. }
  82. },
  83. methods: {
  84. /* 获取已读表格 */
  85. getReadList() {
  86. let params = {
  87. classname: this.classname,
  88. "method": "getReadList",
  89. "content": {
  90. "sat_sharematerialid": this.$route.query.id,
  91. pageNumber: this.readData.pageNumber,
  92. pageSize: this.readData.pageSize,
  93. "isAll": false
  94. }
  95. };
  96. this.$api.requested(params).then(res => {
  97. if (res.msg != '成功') return this.$message.error(res.data);
  98. this.readData.params = params;
  99. this.readData.list = res.data;
  100. this.readData.pageNumber = res.pageNumber;
  101. this.readData.total = res.total;
  102. });
  103. },
  104. /* 获取未读表格 */
  105. getUnReadList() {
  106. let params = {
  107. classname: this.classname,
  108. "method": "getUnReadList",
  109. "content": {
  110. "sat_sharematerialid": this.$route.query.id,
  111. pageNumber: this.unReadData.pageNumber,
  112. pageSize: this.unReadData.pageSize,
  113. "isAll": false
  114. }
  115. };
  116. this.$api.requested(params).then(res => {
  117. if (res.msg != '成功') return this.$message.error(res.data);
  118. this.unReadData.params = params;
  119. this.unReadData.list = res.data;
  120. this.unReadData.pageNumber = res.pageNumber;
  121. this.unReadData.total = res.total;
  122. });
  123. },
  124. /* 已读切换分页 */
  125. handlReadCurrentChange(index) {
  126. this.readData.pageNumber = index;
  127. this.getReadList();
  128. },
  129. /* 未读切换分页 */
  130. handlUnReadCurrentChange(index) {
  131. this.unReadData.pageNumber = index;
  132. this.getUnReadList();
  133. },
  134. /* 渲染表格 */
  135. renderer(data) {
  136. const piePlot = new Pie(this.type + 'pie1', {
  137. appendPadding: 10,
  138. data,
  139. angleField: 'value',
  140. colorField: 'type',
  141. radius: 0.75,
  142. color: ['#FBB33B', '#F77655'],
  143. legend: {
  144. position: 'leftTop'
  145. },
  146. label: {
  147. type: 'spider',
  148. labelHeight: 28,
  149. content: '{name}\n{percentage}',
  150. },
  151. interactions: [{ type: 'element-selected' }, { type: 'element-active' }],
  152. });
  153. piePlot.render();
  154. },
  155. },
  156. created() {
  157. //判断经销商数据还是内部数据
  158. this.readData.tablecols = this.tool.tabelCol('archives_adlist')[`${this.type}ReadTable`].tablecols;
  159. this.unReadData.tablecols = this.tool.tabelCol('archives_adlist')[`${this.type}UnreadTable`].tablecols;
  160. this.classname = this.type == 'agency' ? "webmanage.saletool.sharematerial.statistics.agent" : "webmanage.saletool.sharematerial.statistics.team";
  161. this.getUnReadList();
  162. this.getReadList();
  163. },
  164. mounted() {
  165. this.$api.requested({
  166. "classname": this.type == 'agency' ? "webmanage.saletool.sharematerial.statistics.agent" : "webmanage.saletool.sharematerial.statistics.team",
  167. "method": "getData",
  168. "content": {
  169. "sat_sharematerialid": this.$route.query.id
  170. }
  171. }).then(res => {
  172. if (res.msg != '成功') return this.$message.error(res.data);
  173. const data = [
  174. { type: '未浏览', value: res.data.unReadNum },
  175. { type: '已浏览', value: res.data.readNum },
  176. ];
  177. this.renderer(data);
  178. })
  179. }
  180. }
  181. </script>
  182. <style scoped>
  183. @import url('./public.css');
  184. </style>