export_task_list.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  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="评卷名称" prop="workId">
  9. <el-select
  10. v-model="formSearch.workId"
  11. clearable
  12. filterable
  13. class="input"
  14. placeholder="请选择"
  15. size="small"
  16. style="width: 150px"
  17. >
  18. <el-option
  19. v-for="item in markWorkSelect"
  20. :key="item.workId"
  21. :label="item.markName"
  22. :value="item.workId"
  23. ></el-option>
  24. </el-select>
  25. </el-form-item>
  26. <el-form-item label="类型">
  27. <el-select
  28. v-model="formSearch.type"
  29. size="small"
  30. class="w180"
  31. placeholder="请选择"
  32. clearable
  33. @clear="clearTypeValue"
  34. >
  35. <el-option label="试卷检查" value="PAPER_CHECK"></el-option>
  36. </el-select>
  37. </el-form-item>
  38. <el-form-item label="状态">
  39. <el-select
  40. v-model="formSearch.status"
  41. size="small"
  42. class="w180"
  43. placeholder="请选择"
  44. clearable
  45. @clear="clearStatusValue"
  46. >
  47. <el-option label="导出中" value="EXPORTING"></el-option>
  48. <el-option label="成功" value="SUCCESS"></el-option>
  49. <el-option label="失败" value="ERROR"></el-option>
  50. </el-select>
  51. </el-form-item>
  52. <el-form-item>
  53. <el-button
  54. size="small"
  55. type="primary"
  56. icon="el-icon-search"
  57. @click="doSearch(1)"
  58. >查询
  59. </el-button>
  60. <el-button size="small" icon="el-icon-refresh" @click="resetSearchForm">
  61. 重置
  62. </el-button>
  63. </el-form-item>
  64. </el-form>
  65. <el-table
  66. v-loading="loading"
  67. :data="tableData"
  68. element-loading-text="数据加载中"
  69. style="width: 100%"
  70. border
  71. stripe
  72. >
  73. <el-table-column label="评卷ID" prop="workId" width="90px" sortable />
  74. <el-table-column
  75. label="评卷名称"
  76. prop="workName"
  77. width="105px"
  78. sortable
  79. />
  80. <el-table-column
  81. label="任务类型"
  82. prop="typeTitle"
  83. width="105px"
  84. sortable
  85. />
  86. <el-table-column
  87. label="任务状态"
  88. prop="statusTitle"
  89. width="105px"
  90. sortable
  91. />
  92. <el-table-column label="状态描述" prop="statusMsg" />
  93. <el-table-column label="创建人" prop="createName" width="90px" sortable />
  94. <el-table-column
  95. label="创建时间"
  96. prop="creationTime"
  97. width="155px"
  98. sortable
  99. />
  100. <el-table-column
  101. label="开始时间"
  102. prop="startTime"
  103. width="155px"
  104. sortable
  105. />
  106. <el-table-column label="结束时间" prop="endTime" width="155px" sortable />
  107. <el-table-column label="操作" width="180px">
  108. <template slot-scope="scope">
  109. <el-button
  110. size="mini"
  111. type="primary"
  112. icon="el-icon-download"
  113. :disabled="scope.row.status != 'SUCCESS'"
  114. plain
  115. @click="download(scope.row)"
  116. >下载
  117. </el-button>
  118. <el-button
  119. size="mini"
  120. type="danger"
  121. icon="el-icon-delete"
  122. :disabled="scope.row.status == 'EXPORTING'"
  123. plain
  124. @click="doDelete(scope.row)"
  125. >删除
  126. </el-button>
  127. </template>
  128. </el-table-column>
  129. </el-table>
  130. <div class="page pull-right">
  131. <el-pagination
  132. :current-page="formSearch.pageNo"
  133. :page-size="formSearch.pageSize"
  134. :page-sizes="[10, 20, 50, 100, 200, 300]"
  135. :total="totalElements"
  136. layout="total, sizes, prev, pager, next, jumper"
  137. @current-change="handlePagerNo"
  138. @size-change="handlePagerSize"
  139. ></el-pagination>
  140. </div>
  141. </section>
  142. </template>
  143. <script>
  144. import { mapState } from "vuex";
  145. import { MARKING_API, DATA_PROCESS_API } from "@/constants/constants";
  146. export default {
  147. data() {
  148. return {
  149. formSearch: {
  150. workId: "",
  151. type: null,
  152. status: null,
  153. pageNo: 1,
  154. pageSize: 10,
  155. },
  156. loading: false,
  157. tableData: [],
  158. totalElements: 0,
  159. markWorkList: [],
  160. };
  161. },
  162. computed: {
  163. ...mapState({ user: (state) => state.user }),
  164. markWorkSelect() {
  165. let markWorkNames = [];
  166. for (let markWork of this.markWorkList) {
  167. markWorkNames.push({
  168. workId: markWork.id,
  169. markName: markWork.name,
  170. });
  171. }
  172. return markWorkNames;
  173. },
  174. },
  175. created() {
  176. this.getMarkWorks();
  177. this.doSearch(1);
  178. },
  179. methods: {
  180. getMarkWorks() {
  181. this.$http
  182. .get(DATA_PROCESS_API + "/markWorks?status=1")
  183. .then((response) => {
  184. this.markWorkList = response.data;
  185. if (this.$route.query && this.$route.query.workId) {
  186. this.formSearch.workId = parseInt(this.$route.query.workId);
  187. }
  188. });
  189. },
  190. doSearch(pageNo) {
  191. this.formSearch.pageNo = pageNo;
  192. this.loading = true;
  193. let url = MARKING_API + "/export/task/list";
  194. this.$http.post(url, this.formSearch).then(
  195. (response) => {
  196. this.tableData = response.data.content;
  197. this.totalElements = response.data.totalElements;
  198. this.loading = false;
  199. },
  200. (error) => {
  201. console.log(error);
  202. this.loading = false;
  203. }
  204. );
  205. },
  206. doDelete(row) {
  207. this.$confirm("确认删除当前任务?", "提示", {
  208. confirmButtonText: "确定",
  209. cancelButtonText: "取消",
  210. type: "warning",
  211. }).then(() => {
  212. let url = MARKING_API + "/export/task/delete?taskId=" + row.id;
  213. this.$httpWithMsg.post(url).then(() => {
  214. this.$notify({
  215. type: "success",
  216. message: "删除成功",
  217. });
  218. this.doSearch();
  219. });
  220. });
  221. },
  222. download(row) {
  223. let opath = row.filePath;
  224. let indx = opath.lastIndexOf("/");
  225. let head = opath.substring(0, indx + 1);
  226. let tail = opath.substring(indx + 1);
  227. window.location.href = head + encodeURIComponent(tail);
  228. },
  229. handlePagerNo(pageNo) {
  230. this.doSearch(pageNo);
  231. },
  232. handlePagerSize(pageSize) {
  233. this.formSearch.pageSize = pageSize;
  234. this.doSearch(1);
  235. },
  236. clearTypeValue() {
  237. this.formSearch.type = null;
  238. },
  239. clearStatusValue() {
  240. this.formSearch.status = null;
  241. },
  242. resetSearchForm() {
  243. this.formSearch.examId = "";
  244. this.formSearch.type = null;
  245. this.formSearch.status = null;
  246. this.doSearch(1);
  247. },
  248. },
  249. };
  250. </script>
  251. <style scoped>
  252. .page {
  253. margin-top: 10px;
  254. }
  255. .pull-right {
  256. float: right;
  257. }
  258. .pull-left {
  259. float: left;
  260. }
  261. .w180 {
  262. width: 180px;
  263. }
  264. </style>