commonForm.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <template>
  2. <el-form :model="form" label-width="70px">
  3. <el-col :span="6">
  4. <el-form-item label="考试批次">
  5. <el-select
  6. class="form_search_width"
  7. v-model="form.examId"
  8. filterable
  9. remote
  10. :remote-method="getExams"
  11. @change="changeExam"
  12. clearable
  13. @clear="getExams"
  14. placeholder="请选择考试批次"
  15. size="small"
  16. >
  17. <el-option
  18. v-for="item in examList"
  19. :key="item.id"
  20. :label="item.name"
  21. :value="item.id"
  22. >
  23. </el-option>
  24. </el-select>
  25. </el-form-item>
  26. </el-col>
  27. <el-col :span="6">
  28. <el-form-item label="学习中心">
  29. <el-select
  30. class="form_search_width"
  31. v-if="currentPagePrivileges.ORG_FIND_ALL"
  32. v-model="form.orgId"
  33. filterable
  34. remote
  35. :remote-method="getOrgs"
  36. @change="getCourses"
  37. clearable
  38. @clear="getOrgs"
  39. placeholder="全部"
  40. size="small"
  41. >
  42. <el-option
  43. v-for="item in orgList"
  44. :key="item.id"
  45. :label="item.name"
  46. :value="item.id"
  47. >
  48. </el-option>
  49. </el-select>
  50. <el-input
  51. class="form_search_width"
  52. size="small"
  53. v-model="orgName"
  54. v-if="!currentPagePrivileges.ORG_FIND_ALL"
  55. :disabled="true"
  56. >
  57. </el-input>
  58. </el-form-item>
  59. </el-col>
  60. <el-col :span="6">
  61. <el-form-item label="课程">
  62. <el-select
  63. class="form_search_width"
  64. v-model="form.courseId"
  65. clearable
  66. filterable
  67. placeholder="全部"
  68. size="small"
  69. >
  70. <el-option
  71. v-for="item in courseList"
  72. :key="item.id"
  73. :label="item.name"
  74. :value="item.id"
  75. >
  76. </el-option>
  77. </el-select>
  78. </el-form-item>
  79. </el-col>
  80. <el-col :span="6">
  81. <el-form-item label="学生姓名">
  82. <el-input
  83. size="small"
  84. v-model="form.studentName"
  85. placeholder="姓名"
  86. class="form_search_width"
  87. >
  88. </el-input>
  89. </el-form-item>
  90. </el-col>
  91. <el-col :span="6">
  92. <el-form-item label="课程层次">
  93. <el-select
  94. class="form_search_width"
  95. v-model="form.courseLevel"
  96. clearable
  97. placeholder="不限"
  98. size="small"
  99. >
  100. <el-option
  101. v-for="item in courseLevels"
  102. :key="item.code"
  103. :label="item.name"
  104. :value="item.code"
  105. >
  106. </el-option>
  107. </el-select>
  108. </el-form-item>
  109. </el-col>
  110. <el-col :span="6">
  111. <el-form-item label="身份证号">
  112. <el-input
  113. class="form_search_width"
  114. size="small"
  115. v-model="form.identityNumber"
  116. placeholder="身份证号"
  117. >
  118. </el-input>
  119. </el-form-item>
  120. </el-col>
  121. <el-col :span="6">
  122. <el-form-item label="学号">
  123. <el-input
  124. size="small"
  125. v-model="form.studentCode"
  126. placeholder="学号"
  127. class="form_search_width"
  128. >
  129. </el-input>
  130. </el-form-item>
  131. </el-col>
  132. <slot></slot>
  133. </el-form>
  134. </template>
  135. <script>
  136. import { COURSE_LEVELS } from "../constants/constants";
  137. import { mapState } from "vuex";
  138. export default {
  139. props: ["form", "getExamCondition"],
  140. data() {
  141. return {
  142. examList: [],
  143. courseList: [],
  144. orgList: [],
  145. courseLevels: COURSE_LEVELS,
  146. currentPagePrivileges: {
  147. ORG_FIND_ALL: false //查询所有学习中心
  148. },
  149. orgName: ""
  150. };
  151. },
  152. computed: {
  153. ...mapState({ user: state => state.user })
  154. },
  155. methods: {
  156. getExams(examName) {
  157. if (!examName) {
  158. examName = "";
  159. }
  160. this.getExamCondition.params.name = examName;
  161. this.getExamCondition.params.enable = true;
  162. this.$http
  163. .get("/api/ecs_exam_work/exam/queryByNameLike", {
  164. params: this.getExamCondition.params
  165. })
  166. .then(response => {
  167. var examList = response.data;
  168. if (this.getExamCondition.filterCondition == "IS_FACE_ENABLE") {
  169. examList = examList.filter(function(e) {
  170. //查询开启人脸识别的
  171. return e.properties["IS_FACE_ENABLE"] == "true";
  172. });
  173. } else if (this.getExamCondition.filterCondition == "OVERDUE") {
  174. //缺考登记
  175. examList = examList.filter(function(e) {
  176. var now = new Date().getTime();
  177. var endTime = new Date(e.endTime).getTime();
  178. return now > endTime; //查询考试结束时间已过期的
  179. });
  180. }
  181. this.examList = examList;
  182. if (this.form.examId) {
  183. this.getCourses();
  184. }
  185. });
  186. },
  187. getOrgs(orgName) {
  188. if (!orgName) {
  189. orgName = "";
  190. }
  191. var rootOrgId = this.user.rootOrgId;
  192. this.$http
  193. .get("/api/ecs_core/org/query", {
  194. params: {
  195. name: orgName,
  196. rootOrgId: rootOrgId,
  197. enable: true
  198. }
  199. })
  200. .then(response => {
  201. this.orgList = response.data;
  202. });
  203. },
  204. changeExam(examId) {
  205. this.examList.forEach(exam => {
  206. if (exam.id == examId) {
  207. this.form.examType = exam.examType;
  208. }
  209. });
  210. this.getCourses();
  211. },
  212. getCourses() {
  213. //this.form.courseId = "";
  214. this.courseList = [];
  215. var examId = this.form.examId;
  216. var orgId = this.form.orgId;
  217. if (!examId) {
  218. return false;
  219. }
  220. this.$http
  221. .get("/api/ecs_oe_admin/exam/student/findCoursesByExamIdAndOrgId", {
  222. params: {
  223. examId: examId,
  224. orgId: orgId
  225. }
  226. })
  227. .then(response => {
  228. this.courseList = response.data;
  229. });
  230. }
  231. },
  232. created() {
  233. this.getExams("");
  234. let params = new URLSearchParams();
  235. params.append(
  236. "privilegeCodes",
  237. Object.keys(this.currentPagePrivileges).toString()
  238. );
  239. this.$http
  240. .post("/api/ecs_core/rolePrivilege/checkPrivileges?" + params)
  241. .then(response => {
  242. this.currentPagePrivileges = response.data;
  243. if (!this.currentPagePrivileges.ORG_FIND_ALL) {
  244. var userId = this.user.userId;
  245. this.$http.get("/api/ecs_core/user/" + userId).then(response => {
  246. this.form.orgId = response.data.orgId;
  247. this.orgName = response.data.orgName;
  248. });
  249. } else {
  250. this.getOrgs("");
  251. }
  252. });
  253. }
  254. };
  255. </script>
  256. <style scoped src="../style/common.css"></style>