index.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <div class="hot-layout">
  3. <div class="h-txt theme-color1">文物数据总览
  4. <el-button @click="exportXls" style="float:right" type="primary" size="mini">导出文物</el-button>
  5. </div>
  6. <div class="hot-table">
  7. <ul class="hot-header">
  8. <li><span>文物名称</span></li>
  9. <li><span>文物类别</span></li>
  10. <li><span>展示类别</span></li>
  11. <li><span>点赞数</span></li>
  12. <li><span>下载数</span></li>
  13. <li><span>搜索数</span></li>
  14. </ul>
  15. <div class="list-con" v-if="dataTable.length>0">
  16. <ul class="content" v-for="(item,i) in dataTable" :key="i">
  17. <li><span>{{item['name']}}</span></li>
  18. <li><span>{{item['typeName']}}</span></li>
  19. <li><span>{{item['typeName']}}</span></li>
  20. <li><span>{{item['likeNum']}}</span></li>
  21. <li><span>{{item['downloadNum']}}</span></li>
  22. <li><span>{{item['searchNum']}}</span></li>
  23. </ul>
  24. </div>
  25. </div>
  26. </div>
  27. </template>
  28. <script>
  29. export default {
  30. data () {
  31. return {
  32. dataTable: []
  33. }
  34. },
  35. methods: {
  36. async getDate () {
  37. let result = await this.$http.post('/statistics/collectionTotal')
  38. this.dataTable = result.data
  39. },
  40. async exportXls () {
  41. let result = await this.$http({
  42. method: 'post',
  43. url: '/statistics/exportCollectionTotal',
  44. responseType: 'arraybuffer'
  45. })
  46. const url = window.URL.createObjectURL(new Blob([result], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'}))
  47. const link = document.createElement('a')
  48. link.style.display = 'none'
  49. link.href = url
  50. link.setAttribute('download', '文物数据总览.xlsx')
  51. document.body.appendChild(link)
  52. link.click()
  53. document.body.removeChild(link)
  54. }
  55. },
  56. mounted () {
  57. this.getDate()
  58. }
  59. }
  60. </script>
  61. <style scoped>
  62. .hot-layout{
  63. position: relative;
  64. height: 100%;
  65. }
  66. .h-txt{
  67. width: 100%;
  68. position: absolute;
  69. padding: 1.5rem;
  70. font-weight: bold;
  71. }
  72. .hot-table{
  73. padding: 60px 1.5rem 0;
  74. }
  75. .hot-table .hot-header{
  76. margin-top: 1.5rem;
  77. display: flex;
  78. justify-content: space-between;
  79. }
  80. .hot-table .hot-header li{
  81. flex: 1;
  82. font-size: 14px;
  83. color: rgba(0, 0, 0, .38);
  84. text-align: center;
  85. font-weight: bold;
  86. }
  87. .hot-table .hot-header li span{
  88. display: inline-block;
  89. margin: 0 auto;
  90. }
  91. .list-con{
  92. width: 100%;
  93. height: 290px;
  94. overflow-x: hidden;
  95. overflow-y: auto;
  96. padding: 20px 0;
  97. }
  98. .content{
  99. width: 100%;
  100. padding-right: 10px;
  101. display: flex;
  102. justify-content: space-between;
  103. border-top: 1px solid #f5f5f5;
  104. line-height: 2;
  105. }
  106. .content li{
  107. flex: 1;
  108. font-size: 14px;
  109. color: rgba(0, 0, 0, .38);
  110. text-align: center;
  111. font-weight: bold;
  112. }
  113. .content li:first-of-type{
  114. color: #000;
  115. }
  116. .content li span{
  117. display: inline-block;
  118. margin: 0 auto;
  119. }
  120. </style>