export_task_list.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <section style="margin-top: 0px;">
  3. <el-form
  4. :model="formSearch"
  5. :inline="true"
  6. style="border-bottom: 1px solid rgb(221, 221, 221);margin-bottom: 10px;"
  7. >
  8. <el-form-item label="考试名称">
  9. <el-select
  10. v-model="formSearch.examId"
  11. :remote-method="getExams"
  12. @clear="getExams"
  13. placeholder="请选择"
  14. remote
  15. filterable
  16. clearable
  17. size="small"
  18. class="w180"
  19. >
  20. <el-option
  21. v-for="item in examList"
  22. :key="item.id"
  23. :label="item.name"
  24. :value="item.id"
  25. ></el-option>
  26. </el-select>
  27. </el-form-item>
  28. <el-form-item label="类型">
  29. <el-select
  30. v-model="formSearch.type"
  31. size="small"
  32. class="w180"
  33. placeholder="请选择"
  34. @clear="clearTypeValue"
  35. clearable
  36. >
  37. <el-option label="考试明细" value="EXAM_DETAIL"></el-option>
  38. <el-option label="成绩统计" value="SCORE_STATISTIC"></el-option>
  39. </el-select>
  40. </el-form-item>
  41. <el-form-item label="状态">
  42. <el-select
  43. v-model="formSearch.status"
  44. size="small"
  45. class="w180"
  46. placeholder="请选择"
  47. @clear="clearStatusValue"
  48. clearable
  49. >
  50. <el-option label="未开始" value="NONE"></el-option>
  51. <el-option label="导出中" value="EXPORTING"></el-option>
  52. <el-option label="成功" value="SUCCESS"></el-option>
  53. <el-option label="失败" value="ERROR"></el-option>
  54. </el-select>
  55. </el-form-item>
  56. <el-form-item>
  57. <el-button
  58. size="small"
  59. type="primary"
  60. icon="el-icon-search"
  61. @click="doSearch(1)"
  62. >查询
  63. </el-button>
  64. <el-button size="small" icon="el-icon-refresh" @click="resetSearchForm">
  65. 重置
  66. </el-button>
  67. </el-form-item>
  68. </el-form>
  69. <el-table
  70. v-loading="loading"
  71. :data="tableData"
  72. element-loading-text="数据加载中"
  73. style="width:100%;"
  74. border
  75. stripe
  76. >
  77. </el-table>
  78. <div class="page pull-right">
  79. <el-pagination
  80. @current-change="handlePagerNo"
  81. :current-page="formSearch.pageNo"
  82. @size-change="handlePagerSize"
  83. :page-size="formSearch.pageSize"
  84. :page-sizes="[10, 20, 50, 100, 200, 300]"
  85. :total="totalElements"
  86. layout="total, sizes, prev, pager, next, jumper"
  87. ></el-pagination>
  88. </div>
  89. </section>
  90. </template>
  91. <script>
  92. import { mapState } from "vuex";
  93. export default {
  94. data() {
  95. return {
  96. formSearch: {
  97. examId: "",
  98. type: null,
  99. status: null,
  100. pageNo: 1,
  101. pageSize: 10
  102. },
  103. loading: false,
  104. tableData: [],
  105. totalElements: 0,
  106. examList: []
  107. };
  108. },
  109. methods: {
  110. getExams(examName) {
  111. if (!examName) {
  112. examName = "";
  113. }
  114. this.$http
  115. .get("/api/ecs_exam_work/exam/queryByNameLike", {
  116. params: {
  117. name: examName,
  118. examTypes: "ONLINE#OFFLINE#ONLINE_HOMEWORK"
  119. }
  120. })
  121. .then(response => {
  122. this.examList = response.data;
  123. });
  124. },
  125. doSearch(pageNo) {
  126. this.formSearch.pageNo = pageNo;
  127. this.loading = true;
  128. let url = "/api/ecs_oe_admin/export/task/list";
  129. this.$http.post(url, this.formSearch).then(
  130. response => {
  131. this.tableData = response.data.content;
  132. this.totalElements = response.data.totalElements;
  133. this.loading = false;
  134. },
  135. error => {
  136. console.log(error);
  137. this.loading = false;
  138. }
  139. );
  140. },
  141. handlePagerNo(pageNo) {
  142. this.doSearch(pageNo);
  143. },
  144. handlePagerSize(pageSize) {
  145. this.formSearch.pageSize = pageSize;
  146. this.doSearch(1);
  147. },
  148. clearTypeValue() {
  149. this.formSearch.type = null;
  150. },
  151. clearStatusValue() {
  152. this.formSearch.status = null;
  153. },
  154. resetSearchForm() {
  155. this.formSearch.examId = "";
  156. this.formSearch.type = null;
  157. this.formSearch.status = null;
  158. this.doSearch(1);
  159. }
  160. },
  161. computed: {
  162. ...mapState({ user: state => state.user })
  163. },
  164. created() {
  165. this.getExams();
  166. this.doSearch(1);
  167. }
  168. };
  169. </script>
  170. <style scoped>
  171. .page {
  172. margin-top: 10px;
  173. }
  174. .pull-right {
  175. float: right;
  176. }
  177. .pull-left {
  178. float: left;
  179. }
  180. .w180 {
  181. width: 180px;
  182. }
  183. </style>