downList.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <!-- -->
  2. <template>
  3. <div class="m-container">
  4. <h2>
  5. <div class="squrt"></div>
  6. 下载列表
  7. </h2>
  8. <div class="m-core">
  9. <save-form :inline="true" class="searchForm" :model="searchForm" @submit="search" @reset='onReSet'>
  10. <el-form-item prop="type">
  11. <!-- downTypeList -->
  12. <el-form-item>
  13. <el-select
  14. v-model.trim="searchForm.type"
  15. clearable
  16. filterable
  17. placeholder="文件搜索类型"
  18. >
  19. <el-option
  20. v-for="(item, index) in downTypeList"
  21. :key="index"
  22. :value="item.value"
  23. :label="item.label"
  24. ></el-option>
  25. </el-select>
  26. </el-form-item>
  27. </el-form-item>
  28. <el-form-item>
  29. <el-button native-type="submit" type="primary">搜索</el-button>
  30. <el-button native-type="reset" type="danger">重置</el-button>
  31. </el-form-item>
  32. </save-form>
  33. <div class="tableWrap">
  34. <el-table
  35. style="width: 100%"
  36. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  37. :data="tableList"
  38. >
  39. <el-table-column
  40. width="120"
  41. align="center"
  42. prop="id"
  43. label="下载编号"
  44. ></el-table-column>
  45. <el-table-column
  46. align="center"
  47. prop="name"
  48. label="文件名"
  49. ></el-table-column>
  50. <el-table-column align="center" prop="type" label="文件类型">
  51. <template slot-scope="scope">
  52. <div>
  53. {{ scope.row.type |downListType }}
  54. </div>
  55. </template>
  56. </el-table-column>
  57. <el-table-column align="center" prop="status" label="文件状态">
  58. <template slot-scope="scope">
  59. <div>
  60. {{ scope.row.status == 0 ? "生成中" : "已生成" }}
  61. </div>
  62. </template>
  63. </el-table-column>
  64. <el-table-column align="center" prop=" createTime" label="生成时间">
  65. <template slot-scope="scope">
  66. <div>
  67. {{ scope.row.createTime | dateForMinFormat }}
  68. </div>
  69. </template>
  70. </el-table-column>
  71. <el-table-column prop="fileUrl" label="下载地址" align="center">
  72. <template slot-scope="scope">
  73. <div>
  74. <a
  75. :href="scope.row.fileUrl"
  76. target="view_window"
  77. v-if="scope.row.status != 0"
  78. style="color: var(--color-primary)"
  79. >点击下载</a
  80. >
  81. </div>
  82. </template>
  83. </el-table-column>
  84. </el-table>
  85. <pagination
  86. sync
  87. :total.sync="rules.total"
  88. :page.sync="rules.page"
  89. :limit.sync="rules.limit"
  90. :page-sizes="rules.page_size"
  91. @pagination="getList"
  92. />
  93. </div>
  94. </div>
  95. </div>
  96. </template>
  97. <script>
  98. import axios from "axios";
  99. import { getToken } from "@/utils/auth";
  100. import pagination from "@/components/Pagination/index";
  101. import load from "@/utils/loading";
  102. import {downTypeList} from "@/utils/searchArray"
  103. import { managerDownloadList } from "./api";
  104. export default {
  105. components: { pagination },
  106. data() {
  107. return {
  108. searchForm: {
  109. order: null,
  110. userId: null,
  111. },
  112. downTypeList,
  113. tableList: [],
  114. rules: {
  115. // 分页规则
  116. limit: 10, // 限制显示条数
  117. page: 1, // 当前页
  118. total: 0, // 总条数
  119. page_size: [10, 20, 40, 50], // 选择限制显示条数
  120. },
  121. };
  122. },
  123. //生命周期 - 创建完成(可以访问当前this实例)
  124. created() {},
  125. //生命周期 - 挂载完成(可以访问DOM元素)
  126. mounted() {
  127. // 获取分部
  128. this.init();
  129. },
  130. methods: {
  131. init() {
  132. this.getList();
  133. },
  134. async getList() {
  135. try {
  136. const res = await managerDownloadList({
  137. ...this.searchForm,
  138. page: this.rules.page,
  139. rows: this.rules.limit,
  140. });
  141. this.tableList = res.data.rows;
  142. this.rules.total = res.data.total;
  143. } catch (e) {
  144. console.log(e);
  145. }
  146. },
  147. search() {
  148. this.rules.page = 1;
  149. this.getList();
  150. },
  151. onReSet() {
  152. this.searchForm.type = null;
  153. this.search()
  154. },
  155. },
  156. };
  157. </script>
  158. <style lang='scss' scoped>
  159. </style>