teacherRecord.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <template>
  2. <div class="tr-cotainer">
  3. <!-- 搜索标题 -->
  4. <save-form
  5. :inline="true"
  6. save-key="teacherDetail-record"
  7. class="searchForm"
  8. :model="searchForm"
  9. @submit="search"
  10. @reset="onReSet"
  11. >
  12. <el-form-item>
  13. <el-date-picker
  14. style="width: 400px"
  15. v-model.trim="searchForm.courseDate"
  16. type="daterange"
  17. value-format="yyyy-MM-dd"
  18. range-separator="至"
  19. start-placeholder="课程开始日期"
  20. end-placeholder="课程结束日期"
  21. :picker-options="{
  22. firstDayOfWeek: 1,
  23. }"
  24. ></el-date-picker>
  25. </el-form-item>
  26. <el-form-item>
  27. <el-select
  28. v-model.trim="searchForm.courseScheduleType"
  29. clearable
  30. filterable
  31. placeholder="课程类型"
  32. >
  33. <el-option
  34. v-for="(item, index) in courseType"
  35. :key="index"
  36. :label="item.label"
  37. :value="item.value"
  38. ></el-option>
  39. </el-select>
  40. </el-form-item>
  41. <el-form-item>
  42. <el-input
  43. placeholder="课程名称"
  44. @keyup.enter.native="search"
  45. v-model.trim="searchForm.classGroupName"
  46. clearable
  47. ></el-input>
  48. </el-form-item>
  49. <el-form-item>
  50. <el-select
  51. v-model.trim="searchForm.signInStatus"
  52. filterable
  53. clearable
  54. placeholder="签到状态"
  55. >
  56. <el-option :value="1" label="正常签到"></el-option>
  57. <el-option :value="0" label="异常签到"></el-option>
  58. <el-option :value="3" label="未签到"></el-option>
  59. <!-- <el-option
  60. v-for="(item, index) in attendance"
  61. :key="index"
  62. :label="item.label"
  63. :value="item.value"
  64. ></el-option> -->
  65. </el-select>
  66. </el-form-item>
  67. <el-form-item>
  68. <el-select
  69. v-model.trim="searchForm.signOutStatus"
  70. filterable
  71. clearable
  72. placeholder="签退状态"
  73. >
  74. <!-- <el-option
  75. v-for="(item, index) in attendance"
  76. :key="index"
  77. :label="item.label"
  78. :value="item.value"
  79. ></el-option> -->
  80. <el-option :value="1" label="正常签退"></el-option>
  81. <el-option :value="0" label="异常签退"></el-option>
  82. <el-option :value="3" label="未签退"></el-option>
  83. </el-select>
  84. </el-form-item>
  85. <el-form-item>
  86. <el-button native-type="search" type="danger">搜索</el-button>
  87. <el-button native-type="reset" type="primary">重置</el-button>
  88. </el-form-item>
  89. </save-form>
  90. <!-- 列表 -->
  91. <div class="tableWrap">
  92. <div class="tableWrap">
  93. <el-table
  94. :data="tableList"
  95. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  96. >
  97. <el-table-column
  98. align="center"
  99. prop="courseScheduleId"
  100. label="课程编号"
  101. >
  102. <template slot-scope="scope">
  103. <copy-text>
  104. {{ scope.row.courseScheduleId }}
  105. </copy-text>
  106. </template>
  107. </el-table-column>
  108. <el-table-column align="center" prop="name" label="课程名称">
  109. <template slot-scope="scope">
  110. <copy-text>
  111. {{ scope.row.name }}
  112. </copy-text>
  113. </template>
  114. </el-table-column>
  115. <el-table-column align="center" label="上课时间" width="150">
  116. <template slot-scope="scope"
  117. >{{ scope.row.classDate }}
  118. {{ scope.row.startClassTime.substring(0, 5) }}</template
  119. >
  120. </el-table-column>
  121. <el-table-column align="center" label="下课时间" width="150">
  122. <template slot-scope="scope"
  123. >{{ scope.row.classDate }}
  124. {{ scope.row.endClassTime.substring(0, 5) }}</template
  125. >
  126. </el-table-column>
  127. <el-table-column align="center" label="课程类型">
  128. <template slot-scope="scope">{{
  129. scope.row.type | coursesType
  130. }}</template>
  131. </el-table-column>
  132. <el-table-column align="center" label="签到状态">
  133. <template slot-scope="scope">
  134. <div v-if="scope.row.courseStatus != 'NOT_START'">{{
  135. scope.row.signInStatus | attendanceType
  136. }}</div>
  137. </template>
  138. </el-table-column>
  139. <el-table-column align="center" label="签退状态">
  140. <template slot-scope="scope">
  141. <div v-if="scope.row.courseStatus != 'NOT_START'">{{
  142. scope.row.signOutStatus | attendanceOutType
  143. }}</div>
  144. </template>
  145. </el-table-column>
  146. <el-table-column
  147. align="center"
  148. prop="remark"
  149. label="备注"
  150. ></el-table-column>
  151. </el-table>
  152. <pagination
  153. save-key="teacherDetail-record"
  154. sync
  155. :total.sync="pageInfo.total"
  156. :page.sync="pageInfo.page"
  157. :limit.sync="pageInfo.limit"
  158. :page-sizes="pageInfo.page_size"
  159. @pagination="getList"
  160. />
  161. </div>
  162. </div>
  163. </div>
  164. </template>
  165. <script>
  166. import { getTeacherPersonalAttendances } from "@/api/teacherManager";
  167. import pagination from "@/components/Pagination/index";
  168. import store from "@/store";
  169. import { courseType, attendance } from "@/utils/searchArray";
  170. import { getTimes } from "@/utils";
  171. export default {
  172. name: "teacherRecord",
  173. components: {
  174. pagination,
  175. },
  176. data() {
  177. return {
  178. courseType: courseType, // 课程类型
  179. attendance: attendance, // 考勤状态
  180. searchForm: {
  181. courseStartDate: null,
  182. courseEndDate: null,
  183. classGroupName: null,
  184. courseScheduleType: null,
  185. signInStatus: null,
  186. signOutStatus: null,
  187. courseDate:[]
  188. },
  189. tableList: [],
  190. organId: null,
  191. teacherId: this.$route.query.teacherId,
  192. pageInfo: {
  193. // 分页规则
  194. limit: 10, // 限制显示条数
  195. page: 1, // 当前页
  196. total: 1, // 总条数
  197. page_size: [10, 20, 40, 50], // 选择限制显示条数
  198. },
  199. };
  200. },
  201. mounted() {
  202. this.getList();
  203. },
  204. activated() {
  205. this.getList();
  206. },
  207. methods: {
  208. search() {
  209. this.pageInfo.page = 1;
  210. this.getList();
  211. },
  212. getList() {
  213. const { courseDate, ...rest } = this.searchForm;
  214. let params = {
  215. ...rest,
  216. ...getTimes(courseDate, ["courseStartDate", "courseEndDate"]),
  217. page: this.pageInfo.page,
  218. rows: this.pageInfo.limit,
  219. teacherId: this.teacherId
  220. };
  221. // let params = this.searchForm;
  222. // params.rows = this.pageInfo.limit;
  223. // (params.page = this.pageInfo.page), (params.teacherId = this.teacherId);
  224. getTeacherPersonalAttendances(params).then((res) => {
  225. if (res.code == 200) {
  226. this.tableList = res.data.rows;
  227. this.pageInfo.total = res.data.total;
  228. }
  229. });
  230. },
  231. searchCourseDate(value) {
  232. if (value) {
  233. this.searchForm.courseStartDate = value[0];
  234. this.searchForm.courseEndDate = value[1];
  235. } else {
  236. this.searchForm.courseStartDate = null;
  237. this.searchForm.courseEndDate = null;
  238. }
  239. },
  240. onReSet() {
  241. this.courseDate = null;
  242. this.searchForm = {
  243. courseStartDate: null,
  244. courseEndDate: null,
  245. classGroupName: null,
  246. courseScheduleType: null,
  247. signInStatus: null,
  248. signOutStatus: null
  249. };
  250. this.getList()
  251. },
  252. },
  253. };
  254. </script>
  255. <style lang="scss" scope>
  256. .tr-cotainer {
  257. // margin-top: 20px;
  258. }
  259. </style>