adDownloadData.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 + 'pie2'" 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="unDownload.tablecols" :param="unDownload.params"
  12. :excelTitle="type == 'agency' ? '推广素材经销商未下载表' : '推广素材团队未下载表'" />
  13. </div>
  14. <!-- 未下载表格 -->
  15. <tableLayout style="margin-top:16px" :layout="unDownload.tablecols" :data="unDownload.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="handlUnCurrentChange"
  26. :current-page="unDownload.pageNumber" :page-size="unDownload.pageSize"
  27. layout="total, prev, pager, next, jumper" :total="unDownload.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="download.tablecols" :param="download.params"
  33. :excelTitle="type == 'agency' ? '推广素材经销商已下载表' : '推广素材团队已下载表'" />
  34. </div>
  35. <!-- 已读表格 -->
  36. <tableLayout style="margin-top:16px" :layout="download.tablecols" :data="download.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="handlCurrentChange"
  49. :current-page="download.pageNumber" :page-size="download.pageSize"
  50. layout="total, prev, pager, next, jumper" :total="download.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. download: {
  67. tablecols: [],
  68. list: [],
  69. pageNumber: 1,
  70. pageSize: 10,
  71. total: 0
  72. },
  73. //未下载
  74. unDownload: {
  75. tablecols: [],
  76. list: [],
  77. pageNumber: 1,
  78. pageSize: 10,
  79. total: 0
  80. }
  81. }
  82. },
  83. methods: {
  84. /* 渲染图表 */
  85. renderer(data) {
  86. const piePlot = new Pie(this.type + 'pie2', {
  87. appendPadding: 10,
  88. data,
  89. angleField: 'value',
  90. colorField: 'type',
  91. radius: 0.75,
  92. color: ['#38C2F6','#5D76E4'],
  93. legend: {
  94. position: 'leftTop'
  95. },
  96. label: {
  97. type: 'spider',
  98. labelHeight: 28,
  99. content: '{name}\n{percentage}',
  100. },
  101. interactions: [{ type: 'element-selected' }, { type: 'element-active' }],
  102. });
  103. piePlot.render();
  104. },
  105. getDownloadList() {
  106. let params = {
  107. "classname": this.classname,
  108. "method": "getDownloadList",
  109. "content": {
  110. "sat_sharematerialid": this.$route.query.id,
  111. "pageNumber": this.download.pageNumber,
  112. "pageSize": this.download.pageSize,
  113. "isAll": false
  114. }
  115. };
  116. this.$api.requested(params).then(res => {
  117. console.log(this.type, "下载", res)
  118. if (res.msg != '成功') return this.$message.error(res.data);
  119. this.download.params = params;
  120. this.download.list = res.data;
  121. this.download.pageNumber = res.pageNumber;
  122. this.download.total = res.total;
  123. });
  124. },
  125. getUnDownloadList() {
  126. let params = {
  127. "classname": this.classname,
  128. "method": "getUnDownloadList",
  129. "content": {
  130. "sat_sharematerialid": this.$route.query.id,
  131. "pageNumber": this.unDownload.pageNumber,
  132. "pageSize": this.unDownload.pageSize,
  133. "isAll": false
  134. }
  135. };
  136. this.$api.requested(params).then(res => {
  137. console.log(this.type, "未下载", res)
  138. if (res.msg != '成功') return this.$message.error(res.data);
  139. this.unDownload.params = params;
  140. this.unDownload.list = res.data;
  141. this.unDownload.pageNumber = res.pageNumber;
  142. this.unDownload.total = res.total;
  143. });
  144. },
  145. /* 已-切换分页 */
  146. handlCurrentChange(index) {
  147. this.download.pageNumber = index;
  148. this.getDownloadList();
  149. },
  150. /* 未-切换分页 */
  151. handlUnCurrentChange(index) {
  152. this.unDownload.pageNumber = index;
  153. this.getUnDownloadList();
  154. },
  155. },
  156. created() {
  157. this.download.tablecols = this.tool.tabelCol('archives_adlist')[`${this.type}DownloadTable`].tablecols;
  158. this.unDownload.tablecols = this.tool.tabelCol('archives_adlist')[`${this.type}UndownloadTable`].tablecols;
  159. this.classname = `webmanage.saletool.sharematerial.statistics${this.type == 'agency' ? ".agent" : ".team"}`;
  160. this.getDownloadList();
  161. this.getUnDownloadList();
  162. },
  163. mounted() {
  164. this.$api.requested({
  165. "classname": this.type == 'agency' ? "webmanage.saletool.sharematerial.statistics.agent" : "webmanage.saletool.sharematerial.statistics.team",
  166. "method": "getData",
  167. "content": {
  168. "sat_sharematerialid": this.$route.query.id
  169. }
  170. }).then(res => {
  171. if (res.msg != '成功') return this.$message.error(res.data);
  172. const data = [
  173. { type: '未下载', value: res.data.unDownloadNum },
  174. { type: '已下载', value: res.data.downloadNum },
  175. ];
  176. this.renderer(data);
  177. })
  178. }
  179. }
  180. </script>
  181. <style scoped>
  182. @import url('./public.css');
  183. </style>