ManuscriptQuantity.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <div class="manuscriptIssued">
  3. <el-loading></el-loading>
  4. <el-breadcrumb separator-class="el-icon-arrow-right">
  5. <el-breadcrumb-item>全媒体平台</el-breadcrumb-item>
  6. <el-breadcrumb-item>融合号稿件数量排行榜</el-breadcrumb-item>
  7. </el-breadcrumb>
  8. <div class="groupType">
  9. <el-row class="mb-4">
  10. <el-button
  11. v-for="(cur, ind) in tabs.btns"
  12. :key="ind"
  13. :class="btnFocus.includes(cur) ? 'btnFocus' : ''"
  14. @click="handleClick(cur)"
  15. >{{ cur }}</el-button
  16. >
  17. <el-checkbox
  18. v-if="tabs.btns.length"
  19. v-model="checkedAll"
  20. label="全选"
  21. size="large"
  22. border
  23. @change="handleCheck"
  24. class="checkAll"
  25. />
  26. </el-row>
  27. </div>
  28. <div class="card-rank">
  29. <div>
  30. <el-table :data="tableData" header-row-class-name="card-tabs-header">
  31. <el-table-column align="center" prop="AccountName" label="融合号" />
  32. <el-table-column align="center" prop="cnt" label="稿件数量" />
  33. </el-table>
  34. </div>
  35. </div>
  36. </div>
  37. </template>
  38. <script>
  39. import { getRongheArticleCnt, getAccountType } from "@/api/index";
  40. const ElLoading = require("element-plus/lib/el-loading/index");
  41. import "element-plus/lib/theme-chalk/el-loading.css";
  42. export default {
  43. name: "ManuscriptQuantity",
  44. data() {
  45. return {
  46. btnFocus: [],
  47. tabs: {
  48. name: "融合号稿件数量排行榜",
  49. btns: [],
  50. },
  51. tableData: [],
  52. checkedAll: false,
  53. };
  54. },
  55. mounted() {
  56. this.setFansCntTypeData();
  57. },
  58. methods: {
  59. handleClick(e) {
  60. if (this.btnFocus.includes(e) && this.btnFocus.length !== 1) {
  61. this.btnFocus = this.btnFocus.filter((v) => {
  62. return v !== e;
  63. });
  64. this.checkedAll = false;
  65. } else if (!this.btnFocus.includes(e)) {
  66. this.btnFocus.push(e);
  67. }
  68. this.setTableData();
  69. },
  70. handleCheck() {
  71. this.btnFocus = this.checkedAll ? this.tabs.btns : [];
  72. this.setTableData();
  73. },
  74. setTableData() {
  75. const that = this;
  76. this.tableData = [];
  77. this.curPage = 0;
  78. this.load = ElLoading.default.service();
  79. getRongheArticleCnt({ types: this.btnFocus })
  80. .then((res) => {
  81. that.total = res.length;
  82. that.tableData = res;
  83. that.load.close();
  84. })
  85. .catch((err) => {
  86. that.tableData = [];
  87. console.log("catch", err);
  88. });
  89. },
  90. setFansCntTypeData() {
  91. const that = this;
  92. getAccountType()
  93. .then((res) => {
  94. const [cur] = res;
  95. that.btnFocus = [cur];
  96. that.tabs.btns = res;
  97. that.setTableData();
  98. })
  99. .catch((err) => {
  100. that.tabs.btns = [];
  101. console.log("catch", err);
  102. });
  103. },
  104. },
  105. };
  106. </script>
  107. <style>
  108. .manuscriptIssued {
  109. margin: 10px;
  110. }
  111. .card-tabs,
  112. .el-tabs__header {
  113. padding: 0 100px;
  114. }
  115. .groupType {
  116. padding: 15px 10px;
  117. box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.12);
  118. }
  119. .card-rank {
  120. padding: 10px 15px;
  121. box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.12);
  122. display: flex;
  123. align-items: flex-start;
  124. justify-content: space-between;
  125. }
  126. .card-rank div {
  127. width: 100%;
  128. }
  129. h4 {
  130. text-align: left;
  131. color: #e18116;
  132. margin-bottom: 50px;
  133. font-weight: bold;
  134. }
  135. .card-tabs-header th {
  136. background: #f5f7fa !important;
  137. }
  138. .layputPage {
  139. text-align: right;
  140. margin: 15px 0px 10px;
  141. }
  142. .btnFocus {
  143. color: #fff !important;
  144. border-color: #409eff !important;
  145. background-color: #409eff !important;
  146. }
  147. .checkAll{
  148. margin-left: 10px;
  149. }
  150. </style>