MarkSettingWork.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template lang="html">
  2. <div>
  3. <section class="content">
  4. <div class="box box-info">
  5. <div class="box-body">
  6. <el-form
  7. :inline="true"
  8. :model="formSearch"
  9. label-position="right"
  10. label-width="100px"
  11. >
  12. <el-form-item label="评卷工作名称" class="pull-left">
  13. <el-input
  14. placeholder="评卷工作名称"
  15. v-model="formSearch.name"
  16. @keyup.native="searchMarkWork"
  17. ></el-input>
  18. </el-form-item>
  19. </el-form>
  20. <el-table
  21. stripe
  22. v-loading="loading"
  23. element-loading-text="拼命加载中"
  24. :data="tableData"
  25. border
  26. style="width: 100%"
  27. >
  28. <el-table-column label="评卷工作名称" width="250" prop="name">
  29. </el-table-column>
  30. <el-table-column label="考试批次" width="250" prop="examName">
  31. </el-table-column>
  32. <el-table-column label="考试类型" width="100">
  33. <template slot-scope="scope">
  34. <div>
  35. <span>{{ scope.row.examType | examTypeFilter }}</span>
  36. </div>
  37. </template>
  38. </el-table-column>
  39. <el-table-column
  40. label="进度(%)"
  41. width="100"
  42. prop="progress"
  43. sortable
  44. >
  45. </el-table-column>
  46. <el-table-column label="备注" width="100" prop="remark">
  47. </el-table-column>
  48. <el-table-column :context="_self" label="操作">
  49. <template slot-scope="scope">
  50. <div class="pull-left">
  51. <el-button
  52. @click="marking(scope.row)"
  53. type="primary"
  54. size="mini"
  55. plain
  56. >阅卷</el-button
  57. >
  58. </div>
  59. </template>
  60. </el-table-column>
  61. </el-table>
  62. <div class="page pull-right">
  63. <el-pagination
  64. background
  65. @current-change="handleCurrentChange"
  66. @size-change="handleSizeChange"
  67. :current-page="currentPage"
  68. :page-size="pageSize"
  69. :page-sizes="[10, 20, 50, 100, 200, 300]"
  70. layout="total, sizes, prev, pager, next, jumper"
  71. :total="total"
  72. >
  73. </el-pagination>
  74. </div>
  75. </div>
  76. </div>
  77. </section>
  78. </div>
  79. </template>
  80. <script>
  81. import { DATA_PROCESS_API, MARKING_API } from "@/constants/constants";
  82. import { mapState } from "vuex";
  83. export default {
  84. data() {
  85. return {
  86. formSearch: {
  87. name: ""
  88. },
  89. tableData: [],
  90. totalTableData: [],
  91. currentPage: 1,
  92. pageSize: 10,
  93. total: 0,
  94. markWorkId: "",
  95. loading: false,
  96. isMarkingView: true
  97. };
  98. },
  99. methods: {
  100. initMarkWork() {
  101. this.loading = true;
  102. this.$http
  103. .get(DATA_PROCESS_API + "/markWorks?userId=" + this.user.userId)
  104. .then(response => {
  105. this.totalTableData = response.data;
  106. this.total = response.data.length;
  107. this.filterMarkWork();
  108. this.paging();
  109. this.loading = false;
  110. });
  111. },
  112. searchMarkWork() {
  113. this.filterMarkWork();
  114. this.paging();
  115. },
  116. filterMarkWork() {
  117. var tempData = this.totalTableData.filter(element => {
  118. if (this.formSearch.name) {
  119. return element.name.includes(this.formSearch.name);
  120. } else {
  121. return true;
  122. }
  123. });
  124. this.tableData = tempData;
  125. this.total = tempData.length;
  126. },
  127. handleCurrentChange(val) {
  128. this.currentPage = val;
  129. this.filterMarkWork();
  130. this.paging();
  131. //this.searchMarkWork()
  132. },
  133. handleSizeChange(val) {
  134. this.pageSize = val;
  135. this.filterMarkWork();
  136. this.paging();
  137. //this.searchMarkWork()
  138. },
  139. paging() {
  140. var start = (this.currentPage - 1) * this.pageSize;
  141. var end =
  142. this.currentPage * this.pageSize < this.total
  143. ? this.currentPage * this.pageSize
  144. : this.total;
  145. var tempData = [];
  146. console.log(`当前页: ${this.currentPage},开始:${start},结束:${end}`);
  147. for (let i = start; i < end; i++) {
  148. tempData.push(this.tableData[i]);
  149. }
  150. console.log(tempData);
  151. this.tableData = tempData;
  152. },
  153. settingMarkWork(row) {
  154. var url =
  155. "/marking/mark_setting_main/" +
  156. row.id +
  157. "/" +
  158. row.examId +
  159. "/" +
  160. row.name;
  161. this.$router.push({
  162. path: url
  163. });
  164. },
  165. marking(row) {
  166. var userId = this.user.userId;
  167. var self = this;
  168. var url = "/marking/" + row.id + "/" + row.examType;
  169. self.$http
  170. .get(
  171. MARKING_API +
  172. "/markTasks/count?workId=" +
  173. row.id +
  174. "&userId=" +
  175. userId
  176. )
  177. .then(response => {
  178. if (response.data > 0) {
  179. self.$router.push({
  180. path: url
  181. });
  182. } else {
  183. self.$notify({
  184. message: "没有评卷任务",
  185. type: "warning"
  186. });
  187. }
  188. });
  189. }
  190. },
  191. computed: {
  192. routeType() {
  193. return this.$route.params.type;
  194. },
  195. ...mapState({ user: state => state.user })
  196. },
  197. created() {
  198. this.initMarkWork();
  199. }
  200. };
  201. </script>