MarkSettingWork.vue 6.1 KB

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