ScanStatistics.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <div class="scan-statistics">
  3. <div class="part-box part-box-filter">
  4. <el-form
  5. ref="FilterForm"
  6. class="filter-form"
  7. label-position="left"
  8. label-width="85px"
  9. inline
  10. >
  11. <template v-if="checkPrivilege('condition', 'condition')">
  12. <el-form-item label="日期:">
  13. <el-date-picker
  14. v-model="filter.scanDate"
  15. type="date"
  16. value-format="timestamp"
  17. placeholder="日期选择"
  18. >
  19. </el-date-picker>
  20. </el-form-item>
  21. <el-form-item label="扫描员:">
  22. <el-input
  23. style="width: 180px"
  24. v-model.trim="filter.scanner"
  25. placeholder="扫描员"
  26. clearable
  27. ></el-input>
  28. </el-form-item>
  29. </template>
  30. <el-form-item label-width="0px">
  31. <el-button
  32. v-if="checkPrivilege('button', 'select')"
  33. type="primary"
  34. @click="toPage(1)"
  35. >查询</el-button
  36. >
  37. </el-form-item>
  38. <el-form-item>
  39. <el-button
  40. v-if="checkPrivilege('button', 'export')"
  41. type="primary"
  42. :loading="downloading"
  43. @click="toExport"
  44. >导出</el-button
  45. >
  46. </el-form-item>
  47. </el-form>
  48. </div>
  49. <div class="part-box part-box-pad">
  50. <el-table ref="TableList" :data="dataList">
  51. <el-table-column
  52. type="index"
  53. label="序号"
  54. width="70"
  55. :index="indexMethod"
  56. ></el-table-column>
  57. <el-table-column prop="scanner" label="扫描员"></el-table-column>
  58. <el-table-column
  59. prop="pictureCount"
  60. label="扫描图片(张)"
  61. ></el-table-column>
  62. <el-table-column
  63. prop="studentCount"
  64. label="扫描学生数"
  65. ></el-table-column>
  66. <el-table-column prop="scanDate" label="扫描日期" width="140">
  67. <span slot-scope="scope">{{ scope.row.scanDate | dateFilter }}</span>
  68. </el-table-column>
  69. </el-table>
  70. <div class="part-page">
  71. <el-pagination
  72. background
  73. layout="total,prev, pager, next"
  74. :current-page="current"
  75. :total="total"
  76. :page-size="size"
  77. @current-change="toPage"
  78. >
  79. </el-pagination>
  80. </div>
  81. </div>
  82. </div>
  83. </template>
  84. <script>
  85. import { scanStatisticsListQuery, exportScanStatistics } from "../api";
  86. import { downloadByApi } from "@/plugins/download";
  87. export default {
  88. name: "scan-statistics",
  89. data() {
  90. return {
  91. filter: {
  92. scanDate: "",
  93. scanner: "",
  94. },
  95. current: 1,
  96. size: this.GLOBAL.pageSize,
  97. total: 0,
  98. dataList: [],
  99. downloading: false,
  100. };
  101. },
  102. mounted() {
  103. this.getList();
  104. },
  105. methods: {
  106. async getList() {
  107. if (!this.checkPrivilege("list", "list")) return;
  108. const datas = {
  109. ...this.filter,
  110. pageNumber: this.current,
  111. pageSize: this.size,
  112. };
  113. const data = await scanStatisticsListQuery(datas);
  114. this.dataList = data.records;
  115. this.total = data.total;
  116. },
  117. toPage(page) {
  118. this.current = page;
  119. this.getList();
  120. },
  121. async toExport() {
  122. if (this.downloading) return;
  123. this.downloading = true;
  124. const res = await downloadByApi(() => {
  125. return exportScanStatistics(this.filter);
  126. }).catch((e) => {
  127. this.$message.error(e || "下载失败,请重新尝试!");
  128. });
  129. this.downloading = false;
  130. if (!res) return;
  131. this.$message.success("下载成功!");
  132. },
  133. },
  134. };
  135. </script>