WaitTask.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <div class="wait-task">
  3. <div class="part-box part-box-pad">
  4. <el-table ref="TableList" :data="dataList">
  5. <el-table-column
  6. type="index"
  7. label="序号"
  8. width="50"
  9. :index="indexMethod"
  10. ></el-table-column>
  11. <el-table-column prop="paperNumber" label="试卷编号"></el-table-column>
  12. <el-table-column prop="type" label="课程(代码)">
  13. <template slot-scope="scope">
  14. {{ scope.row.courseName }}({{ scope.row.courseCode }})
  15. </template>
  16. </el-table-column>
  17. <el-table-column prop="cardRuleName" label="题卡规则"></el-table-column>
  18. <el-table-column prop="taskName" label="流程节点">
  19. <span slot-scope="scope">
  20. {{ scope.row.taskName | flowTaskNameFilter }}
  21. </span>
  22. </el-table-column>
  23. <el-table-column prop="createTime" label="创建时间" width="180">
  24. <span slot-scope="scope">{{
  25. scope.row.createTime | timestampFilter
  26. }}</span>
  27. </el-table-column>
  28. <el-table-column class-name="action-column" label="操作" width="100px">
  29. <template slot-scope="scope">
  30. <el-button class="btn-primary" type="text" @click="toDo(scope.row)"
  31. >立即处理</el-button
  32. >
  33. </template>
  34. </el-table-column>
  35. </el-table>
  36. <div class="part-page">
  37. <el-pagination
  38. background
  39. layout="total,prev, pager, next"
  40. :current-page="current"
  41. :total="total"
  42. :page-size="size"
  43. @current-change="toPage"
  44. >
  45. </el-pagination>
  46. </div>
  47. </div>
  48. <!-- ModifyTaskApply -->
  49. <modify-task-apply
  50. ref="ModifyTaskApply"
  51. :instance="curTask"
  52. @modified="taskModified"
  53. ></modify-task-apply>
  54. </div>
  55. </template>
  56. <script>
  57. import { mapActions } from "vuex";
  58. import { waitExamTaskListPage } from "../api";
  59. import ModifyTaskApply from "../components/ModifyTaskApply";
  60. export default {
  61. name: "wait-task",
  62. components: { ModifyTaskApply },
  63. data() {
  64. return {
  65. current: 1,
  66. size: this.GLOBAL.pageSize,
  67. total: 0,
  68. dataList: [],
  69. curTask: {}
  70. };
  71. },
  72. mounted() {
  73. this.initData();
  74. },
  75. methods: {
  76. ...mapActions("exam", ["updateWaitTaskCount"]),
  77. async initData() {
  78. const cachePageInfo = this.$ls.get("cachePageInfo");
  79. if (cachePageInfo) {
  80. this.current = cachePageInfo.page;
  81. await this.getList();
  82. this.$nextTick(() => {
  83. const curRow = this.dataList.find(
  84. item => item.id === cachePageInfo.curRowId
  85. );
  86. if (!curRow) return;
  87. this.toDo(curRow);
  88. });
  89. } else {
  90. this.toPage(1);
  91. }
  92. this.$ls.remove("cachePageInfo");
  93. },
  94. async getList() {
  95. const datas = {
  96. pageNumber: this.current,
  97. pageSize: this.size
  98. };
  99. const data = await waitExamTaskListPage(datas);
  100. this.dataList = data.records;
  101. this.total = data.total;
  102. },
  103. toPage(page) {
  104. this.current = page;
  105. this.getList();
  106. },
  107. toDo(task) {
  108. this.curTask = { ...task, source: "REVIEW" };
  109. this.$refs.ModifyTaskApply.open();
  110. },
  111. taskModified() {
  112. this.getList();
  113. this.updateWaitTaskCount();
  114. }
  115. },
  116. beforeRouteLeave(to, from, next) {
  117. if (to.name === "CardDesign") {
  118. this.$ls.set("cachePageInfo", {
  119. page: this.current,
  120. curRowId: this.curTask.id
  121. });
  122. } else {
  123. this.$ls.remove("cachePageInfo");
  124. }
  125. next();
  126. }
  127. };
  128. </script>