MarkSettingWork.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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. :disabled="markingBtnDisable(scope.row)"
  53. @click="marking(scope.row)"
  54. type="primary"
  55. size="mini"
  56. plain
  57. >阅卷</el-button
  58. >
  59. </div>
  60. </template>
  61. </el-table-column>
  62. </el-table>
  63. <div class="page pull-right">
  64. <el-pagination
  65. background
  66. @current-change="handleCurrentChange"
  67. @size-change="handleSizeChange"
  68. :current-page="currentPage"
  69. :page-size="pageSize"
  70. :page-sizes="[10, 20, 50, 100]"
  71. layout="total, sizes, prev, pager, next, jumper"
  72. :total="total"
  73. >
  74. </el-pagination>
  75. </div>
  76. </div>
  77. </div>
  78. </section>
  79. </div>
  80. </template>
  81. <script>
  82. import { DATA_PROCESS_API, MARKING_API } from "@/constants/constants";
  83. import { mapState } from "vuex";
  84. export default {
  85. data() {
  86. return {
  87. formSearch: {
  88. name: ""
  89. },
  90. tableData: [],
  91. totalTableData: [],
  92. currentPage: 1,
  93. pageSize: 10,
  94. total: 0,
  95. markWorkId: "",
  96. loading: false,
  97. isMarkingView: true
  98. };
  99. },
  100. methods: {
  101. markingBtnDisable(row) {
  102. if (row.progress == 100) {
  103. return true;
  104. } else {
  105. return false;
  106. }
  107. },
  108. initMarkWork() {
  109. this.loading = true;
  110. this.$http
  111. .get(DATA_PROCESS_API + "/markWorks?userId=" + this.user.userId)
  112. .then(response => {
  113. this.totalTableData = response.data;
  114. this.total = response.data.length;
  115. this.filterMarkWork();
  116. this.paging();
  117. this.loading = false;
  118. });
  119. },
  120. searchMarkWork() {
  121. this.filterMarkWork();
  122. this.paging();
  123. },
  124. filterMarkWork() {
  125. var tempData = this.totalTableData.filter(element => {
  126. if (this.formSearch.name) {
  127. return element.name.includes(this.formSearch.name);
  128. } else {
  129. return true;
  130. }
  131. });
  132. this.tableData = tempData;
  133. this.total = tempData.length;
  134. },
  135. handleCurrentChange(val) {
  136. this.currentPage = val;
  137. this.filterMarkWork();
  138. this.paging();
  139. //this.searchMarkWork()
  140. },
  141. handleSizeChange(val) {
  142. this.pageSize = val;
  143. this.filterMarkWork();
  144. this.paging();
  145. //this.searchMarkWork()
  146. },
  147. paging() {
  148. var start = (this.currentPage - 1) * this.pageSize;
  149. var end =
  150. this.currentPage * this.pageSize < this.total
  151. ? this.currentPage * this.pageSize
  152. : this.total;
  153. var tempData = [];
  154. console.log(`当前页: ${this.currentPage},开始:${start},结束:${end}`);
  155. for (let i = start; i < end; i++) {
  156. tempData.push(this.tableData[i]);
  157. }
  158. console.log(tempData);
  159. this.tableData = tempData;
  160. },
  161. settingMarkWork(row) {
  162. var url =
  163. "/marking/mark_setting_main/" +
  164. row.id +
  165. "/" +
  166. row.examId +
  167. "/" +
  168. row.name;
  169. this.$router.push({
  170. path: url
  171. });
  172. },
  173. marking(row) {
  174. var userId = this.user.userId;
  175. var self = this;
  176. var url = "/marking/" + row.id + "/" + row.examType;
  177. self.$http
  178. .get(
  179. MARKING_API +
  180. "/markTasks/count?workId=" +
  181. row.id +
  182. "&userId=" +
  183. userId
  184. )
  185. .then(response => {
  186. if (response.data > 0) {
  187. self.$router.push({
  188. path: url
  189. });
  190. } else {
  191. self.$notify({
  192. message: "没有评卷任务",
  193. type: "warning"
  194. });
  195. }
  196. });
  197. }
  198. },
  199. computed: {
  200. routeType() {
  201. return this.$route.params.type;
  202. },
  203. ...mapState({ user: state => state.user })
  204. },
  205. created() {
  206. this.initMarkWork();
  207. }
  208. };
  209. </script>