studentSpecialSettings.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <section class="content">
  3. <div class="box box-info">
  4. <div
  5. v-loading.body="loading"
  6. v-loading.fullscreen="loading"
  7. class="box-body"
  8. element-loading-text="请稍后..."
  9. >
  10. <!-- 表单 -->
  11. <el-form inline :model="formSearch">
  12. <el-form-item label="学生ID">
  13. <el-input
  14. v-model="formSearch.studentId"
  15. placeholder="学生ID"
  16. ></el-input>
  17. </el-form-item>
  18. <el-form-item label="身份证号">
  19. <el-input
  20. v-model="formSearch.identityNumber"
  21. placeholder="身份证号"
  22. ></el-input>
  23. </el-form-item>
  24. <el-form-item>
  25. <el-button
  26. size="small"
  27. type="primary"
  28. icon="el-icon-search"
  29. @click="handleSearchBtn"
  30. >查询</el-button
  31. >
  32. <el-button
  33. size="small"
  34. type="primary"
  35. icon="el-icon-arrow-left"
  36. @click="back"
  37. >返回</el-button
  38. >
  39. </el-form-item>
  40. </el-form>
  41. <div class="block-seperator"></div>
  42. <!-- 页面列表 -->
  43. <el-table :data="tableData" border resizable stripe style="width: 100%">
  44. <el-table-column
  45. prop="studentId"
  46. width="180"
  47. label="学生ID"
  48. ></el-table-column>
  49. <el-table-column
  50. prop="identityNumber"
  51. label="学生身份证"
  52. ></el-table-column>
  53. <el-table-column
  54. width="180"
  55. prop="beginTime"
  56. label="考试开始时间"
  57. ></el-table-column>
  58. <el-table-column
  59. width="180"
  60. prop="endTime"
  61. label="考试结束时间"
  62. ></el-table-column>
  63. <el-table-column width="120" label="是否禁止考试">
  64. <template slot-scope="scope">
  65. <div>
  66. <span>{{ getYesNo(scope.row.examLimit) }}</span>
  67. </div>
  68. </template>
  69. </el-table-column>
  70. </el-table>
  71. <div class="page pull-right">
  72. <el-pagination
  73. v-if="paginationShow"
  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. </div>
  83. </div>
  84. </div>
  85. </section>
  86. </template>
  87. <script>
  88. import { EXAM_WORK_API } from "@/constants/constants.js";
  89. import { mapState } from "vuex";
  90. export default {
  91. name: "StudentSpecialSettings",
  92. data() {
  93. return {
  94. loading: false,
  95. paginationShow: false,
  96. yesNoList: [
  97. {
  98. value: true,
  99. label: "是",
  100. },
  101. {
  102. value: false,
  103. label: "否",
  104. },
  105. ],
  106. formSearch: {
  107. examId: null,
  108. studentId: null,
  109. identityNumber: null,
  110. },
  111. tableData: [],
  112. currentPage: 1,
  113. pageSize: 10,
  114. total: 10,
  115. };
  116. },
  117. computed: {
  118. ...mapState({ user: (state) => state.user }),
  119. isSuperAdmin() {
  120. return this.user.roleList.some((role) => role.roleCode == "SUPER_ADMIN");
  121. },
  122. },
  123. //初始化查询
  124. created() {
  125. this.formSearch.examId = this.$route.params.id;
  126. this.searchForm();
  127. },
  128. methods: {
  129. getYesNo(val) {
  130. for (let temv of this.yesNoList) {
  131. if (temv.value == val) {
  132. return temv.label;
  133. }
  134. }
  135. },
  136. back() {
  137. this.$router.push({ path: "/examwork/examInfo" });
  138. },
  139. handleSearchBtn() {
  140. this.currentPage = 1;
  141. this.searchForm();
  142. },
  143. handleSizeChange(val) {
  144. this.pageSize = val;
  145. this.currentPage = 1;
  146. this.searchForm();
  147. },
  148. handleCurrentChange(val) {
  149. this.currentPage = val;
  150. this.searchForm();
  151. },
  152. //查询
  153. searchForm() {
  154. let regx = /^\d*$/;
  155. if (this.formSearch.studentId && !regx.test(this.formSearch.studentId)) {
  156. this.$notify({
  157. title: "警告",
  158. message: "学生ID只能输入数字",
  159. type: "warning",
  160. });
  161. return false;
  162. }
  163. this.loading = true;
  164. let temParams = Object.assign({}, this.formSearch);
  165. if (!temParams.identityNumber) {
  166. delete temParams.identityNumber;
  167. }
  168. var url =
  169. EXAM_WORK_API +
  170. "/exam/getStudentSpecialSettingsList/" +
  171. (this.currentPage - 1) +
  172. "/" +
  173. this.pageSize;
  174. this.$httpWithMsg
  175. .get(url, { params: temParams })
  176. .then((response) => {
  177. this.tableData = response.data.list;
  178. this.total = response.data.total;
  179. this.loading = false;
  180. this.$nextTick(function () {
  181. this.paginationShow = true;
  182. });
  183. })
  184. .finally(() => (this.loading = false));
  185. },
  186. },
  187. };
  188. </script>
  189. <style scoped>
  190. .page {
  191. margin-top: 10px;
  192. }
  193. .pull-length {
  194. width: 300px;
  195. }
  196. .pull-center {
  197. margin-top: 20px;
  198. }
  199. .editForm .el-form-item {
  200. margin-bottom: 12px;
  201. }
  202. </style>