record.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <div>
  3. <el-form :inline="true" ref="searchForm" :model="searchForm">
  4. <el-form-item prop="dates">
  5. <el-date-picker
  6. v-model="searchForm.dates"
  7. type="daterange"
  8. style="width: 405px"
  9. range-separator="至"
  10. start-placeholder="课程开始日期"
  11. end-placeholder="课程结束日期"
  12. >
  13. </el-date-picker>
  14. </el-form-item>
  15. <el-form-item prop="groupType">
  16. <el-select
  17. v-model.trim="searchForm.groupType"
  18. placeholder="请选择课程组类型"
  19. >
  20. <el-option
  21. v-for="(item, index) in courseListType"
  22. :key="index"
  23. :value="item.value"
  24. :label="item.label"
  25. ></el-option>
  26. </el-select>
  27. </el-form-item>
  28. <el-form-item prop="status">
  29. <el-select
  30. v-model.trim="searchForm.status"
  31. placeholder="请选择考勤状态"
  32. clearable
  33. >
  34. <el-option
  35. v-for="(item, index) in attendanceStatus"
  36. :key="index"
  37. :value="item.value"
  38. :label="item.label"
  39. ></el-option>
  40. </el-select>
  41. </el-form-item>
  42. <el-form-item>
  43. <el-button @click="search" type="danger">搜索</el-button>
  44. <el-button @click="onReSet" type="primary">重置</el-button>
  45. </el-form-item>
  46. </el-form>
  47. <el-table
  48. style="width: 100%"
  49. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  50. :data="tableList"
  51. >
  52. <el-table-column align="center" prop="courseScheduleId" label="课程编号">
  53. <template slot-scope="scope">
  54. <div>
  55. <copy-text>{{ scope.row.courseScheduleId }}</copy-text>
  56. </div>
  57. </template>
  58. </el-table-column>
  59. <el-table-column
  60. align="center"
  61. prop="courseSchedule.name"
  62. label="课程名称"
  63. ></el-table-column>
  64. <el-table-column
  65. width="180px"
  66. align="center"
  67. prop="startClassTime"
  68. label="上课时间"
  69. >
  70. <template slot-scope="scope">
  71. <div>
  72. {{ scope.row.courseSchedule.classDate | dayjsFormat }}
  73. {{ scope.row.courseSchedule.startClassTime | dayjsFormatMinute }}-{{
  74. scope.row.courseSchedule.endClassTime | dayjsFormatMinute
  75. }}
  76. </div>
  77. </template>
  78. </el-table-column>
  79. <el-table-column align="center" prop="startClassTime" label="课程组类型">
  80. <template slot-scope="scope">
  81. <div>
  82. {{ scope.row.groupType | coursesType }}
  83. </div>
  84. </template>
  85. </el-table-column>
  86. <el-table-column align="center" prop="startClassTime" label="课程类型">
  87. <template slot-scope="scope">
  88. <div>
  89. {{ scope.row.courseSchedule.type | coursesType }}
  90. </div>
  91. </template>
  92. </el-table-column>
  93. <el-table-column align="center" label="考勤状态">
  94. <template slot-scope="scope">
  95. <div>
  96. {{ scope.row.status | clockingIn }}
  97. </div>
  98. </template>
  99. </el-table-column>
  100. </el-table>
  101. <pagination
  102. :total.sync="rules.total"
  103. :page.sync="rules.page"
  104. :limit.sync="rules.limit"
  105. :page-sizes="rules.page_size"
  106. @pagination="getList"
  107. />
  108. </div>
  109. </template>
  110. <script>
  111. import { courseListType, stuAttendance } from "@/utils/searchArray";
  112. import pagination from "@/components/Pagination/index";
  113. import { findStudentAttendance } from "@/api/buildTeam";
  114. import { getTimes } from "@/utils";
  115. export default {
  116. components: { pagination },
  117. props:['studentId'],
  118. data() {
  119. return {
  120. searchForm: {
  121. studentID: "",
  122. groupType: "",
  123. status: "",
  124. dates: [],
  125. },
  126. courseListType,
  127. attendanceStatus: stuAttendance,
  128. rules: {
  129. // 分页规则
  130. limit: 10, // 限制显示条数
  131. page: 1, // 当前页
  132. total: 0, // 总条数
  133. page_size: [10, 20, 40, 50], // 选择限制显示条数
  134. },
  135. tableList: [],
  136. };
  137. },
  138. mounted() {
  139. this.searchForm.studentID = this.studentId
  140. if (this.searchForm.dates?.length < 1) {
  141. this.searchForm.dates = [new Date().setDate(1), new Date()];
  142. }
  143. this.init();
  144. },
  145. methods: {
  146. init(){
  147. this.getList()
  148. },
  149. search() {
  150. this.rules.page =1;
  151. this.getList()
  152. },
  153. onReSet() {
  154. this.$refs["searchForm"].resetFields();
  155. this.search();
  156. },
  157. getList() {
  158. const { dates, ...rest } = this.searchForm;
  159. let obj = {
  160. ...rest,
  161. page: this.rules.page,
  162. rows: this.rules.limit,
  163. ...getTimes(dates, ["startDateOfCourse", "endDateOfCourse"], "YYYY-MM-DD"),
  164. }
  165. findStudentAttendance(obj).then((res) => {
  166. if (res.code == 200) {
  167. this.tableList = res.data.rows;
  168. this.rules.total = res.data.total;
  169. }
  170. });
  171. },
  172. },
  173. };
  174. </script>
  175. <style lang="scss" scoped>
  176. </style>