index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. <!-- -->
  2. <template>
  3. <div class="m-container">
  4. <h2>
  5. <div class="squrt"></div>
  6. 学生考勤列表
  7. </h2>
  8. <div class="m-core">
  9. <save-form
  10. :inline="true"
  11. ref="searchForm"
  12. :model="searchForm"
  13. @submit="search"
  14. @reset="onReSet"
  15. >
  16. <el-form-item prop="studentID">
  17. <el-input
  18. v-model.trim="searchForm.studentID"
  19. clearable
  20. @keyup.enter.native="search"
  21. placeholder="学生编号"
  22. ></el-input>
  23. </el-form-item>
  24. <el-form-item prop="teacherId">
  25. <remote-search
  26. :commit="'setTeachers'"
  27. v-model="searchForm.teacherId"
  28. />
  29. </el-form-item>
  30. <el-form-item prop="organId">
  31. <el-select
  32. class="multiple"
  33. filterable
  34. style="width: 180px !important"
  35. v-model.trim="searchForm.organId"
  36. clearable
  37. placeholder="请选择分部"
  38. >
  39. <el-option
  40. v-for="(item, index) in selects.branchs"
  41. :key="index"
  42. :label="item.name"
  43. :value="item.id"
  44. ></el-option>
  45. </el-select>
  46. </el-form-item>
  47. <el-form-item prop="musicGroupId">
  48. <el-input
  49. v-model.trim="searchForm.musicGroupId"
  50. clearable
  51. @keyup.enter.native="search"
  52. placeholder="乐团编号"
  53. ></el-input>
  54. </el-form-item>
  55. <el-form-item prop="courseScheduleId">
  56. <el-input
  57. v-model.trim="searchForm.courseScheduleId"
  58. clearable
  59. @keyup.enter.native="search"
  60. placeholder="课程编号"
  61. ></el-input>
  62. </el-form-item>
  63. <el-form-item prop="groupType">
  64. <el-select
  65. v-model.trim="searchForm.groupType"
  66. placeholder="请选择课程组类型"
  67. >
  68. <el-option
  69. v-for="(item, index) in courseListType"
  70. :key="index"
  71. :value="item.value"
  72. :label="item.label"
  73. ></el-option>
  74. </el-select>
  75. </el-form-item>
  76. <el-form-item prop="courseScheduleType">
  77. <el-select
  78. v-model.trim="searchForm.courseScheduleType"
  79. clearable
  80. placeholder="请选择课程类型"
  81. >
  82. <el-option
  83. v-for="(item, index) in courseType"
  84. :key="index"
  85. :value="item.value"
  86. :label="item.label"
  87. ></el-option>
  88. </el-select>
  89. </el-form-item>
  90. <el-form-item prop="status">
  91. <el-select
  92. v-model.trim="searchForm.status"
  93. placeholder="请选择考勤状态"
  94. clearable
  95. >
  96. <el-option
  97. v-for="(item, index) in attendanceStatus"
  98. :key="index"
  99. :value="item.value"
  100. :label="item.label"
  101. ></el-option>
  102. </el-select>
  103. </el-form-item>
  104. <el-form-item prop="dates">
  105. <el-date-picker
  106. v-model="searchForm.dates"
  107. type="daterange"
  108. style="width: 405px"
  109. range-separator="至"
  110. start-placeholder="课程开始日期"
  111. end-placeholder="课程结束日期"
  112. >
  113. </el-date-picker>
  114. </el-form-item>
  115. <el-form-item>
  116. <el-button native-type="submit" type="danger">搜索</el-button>
  117. <el-button native-type="reset" type="primary">重置</el-button>
  118. </el-form-item>
  119. </save-form>
  120. <div class="tableWrap">
  121. <el-table
  122. style="width: 100%"
  123. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  124. :data="tableList"
  125. >
  126. <el-table-column
  127. align="center"
  128. prop="courseSchedule.organization.name"
  129. label="分部"
  130. ></el-table-column>
  131. <el-table-column
  132. align="center"
  133. prop="username"
  134. label="学生姓名"
  135. width="110px"
  136. >
  137. <template slot-scope="scope">
  138. <div>
  139. {{ scope.row.username }}
  140. <p style="color: #f56c6c">
  141. (<copy-text>{{ scope.row.userId }}</copy-text
  142. >)
  143. </p>
  144. </div>
  145. </template>
  146. </el-table-column>
  147. <el-table-column
  148. align="center"
  149. prop="courseSchedule.teacherName"
  150. width="120px"
  151. label="老师姓名"
  152. >
  153. <template slot-scope="scope">
  154. {{ scope.row.courseSchedule.teacherName }}
  155. <p style="color: #f56c6c" v-if="scope.row.teacherId">
  156. (<copy-text>{{ scope.row.teacherId }}</copy-text
  157. >)
  158. </p>
  159. </template>
  160. </el-table-column>
  161. <el-table-column align="center" prop="musicGroupId" label="乐团编号">
  162. <template slot-scope="scope">
  163. <div>
  164. <copy-text>{{ scope.row.musicGroupId }}</copy-text>
  165. </div>
  166. </template>
  167. </el-table-column>
  168. <el-table-column
  169. align="center"
  170. prop="courseScheduleId"
  171. label="课程编号"
  172. >
  173. <template slot-scope="scope">
  174. <div>
  175. <copy-text>{{ scope.row.courseScheduleId }}</copy-text>
  176. </div>
  177. </template>
  178. </el-table-column>
  179. <el-table-column
  180. align="center"
  181. prop="courseSchedule.name"
  182. label="课程名称"
  183. ></el-table-column>
  184. <!-- <el-table-column
  185. align="center"
  186. prop="courseSchedule.classDate"
  187. label="上课日期"
  188. >
  189. <template slot-scope="scope">
  190. <div>
  191. </div>
  192. </template>
  193. </el-table-column> -->
  194. <el-table-column
  195. width="180px"
  196. align="center"
  197. prop="startClassTime"
  198. label="上课时间"
  199. >
  200. <template slot-scope="scope">
  201. <div>
  202. {{ scope.row.courseSchedule.classDate | dayjsFormat }}
  203. {{
  204. scope.row.courseSchedule.startClassTime | dayjsFormatMinute
  205. }}-{{
  206. scope.row.courseSchedule.endClassTime | dayjsFormatMinute
  207. }}
  208. </div>
  209. </template>
  210. </el-table-column>
  211. <el-table-column
  212. align="center"
  213. prop="startClassTime"
  214. label="课程组类型"
  215. >
  216. <template slot-scope="scope">
  217. <div>
  218. {{ scope.row.groupType | coursesType }}
  219. </div>
  220. </template>
  221. </el-table-column>
  222. <el-table-column
  223. align="center"
  224. prop="startClassTime"
  225. label="课程类型"
  226. >
  227. <template slot-scope="scope">
  228. <div>
  229. {{ scope.row.courseSchedule.type | coursesType }}
  230. </div>
  231. </template>
  232. </el-table-column>
  233. <el-table-column align="center" label="签到时间" width="180px">
  234. <template slot-scope="scope">
  235. <div>
  236. {{ scope.row.signInTime }}
  237. </div>
  238. </template>
  239. </el-table-column>
  240. <el-table-column align="center" label="是否被合并">
  241. <template slot-scope="scope">
  242. <div>
  243. {{ scope.row.courseSchedule.newCourseId > 0 ? "是" : "否" }}
  244. </div>
  245. </template>
  246. </el-table-column>
  247. <el-table-column
  248. align="center"
  249. prop="startClassTime"
  250. width="180px"
  251. label="签退时间"
  252. >
  253. <template slot-scope="scope">
  254. <div>
  255. {{ scope.row.signOutTime }}
  256. </div>
  257. </template>
  258. </el-table-column>
  259. <el-table-column align="center" label="考勤状态">
  260. <template slot-scope="scope">
  261. <div>
  262. {{ scope.row.status | clockingIn }}
  263. </div>
  264. </template>
  265. </el-table-column>
  266. </el-table>
  267. <pagination
  268. sync
  269. :total.sync="rules.total"
  270. :page.sync="rules.page"
  271. :limit.sync="rules.limit"
  272. :page-sizes="rules.page_size"
  273. @pagination="getList"
  274. />
  275. </div>
  276. </div>
  277. </div>
  278. </template>
  279. <script>
  280. import axios from "axios";
  281. import { getToken } from "@/utils/auth";
  282. import pagination from "@/components/Pagination/index";
  283. import load from "@/utils/loading";
  284. import { getTimes } from "@/utils";
  285. import qs from "qs";
  286. import { findStudentAttendance } from "@/api/buildTeam";
  287. // import { queryTeacherAttendances } from "@/api/recodeManager";
  288. import { courseType, courseListType, stuAttendance } from "@/utils/searchArray";
  289. export default {
  290. components: { pagination },
  291. data() {
  292. return {
  293. searchForm: {
  294. studentID: "",
  295. groupType: "MUSIC",
  296. musicGroupId: "",
  297. courseScheduleId: "",
  298. status: "",
  299. teacherId: "",
  300. courseScheduleType: "",
  301. organId: "",
  302. dates: [],
  303. },
  304. courseType,
  305. courseListType,
  306. attendanceStatus: stuAttendance,
  307. // teacherList: [],
  308. tableList: [],
  309. organList: [],
  310. rules: {
  311. // 分页规则
  312. limit: 10, // 限制显示条数
  313. page: 1, // 当前页
  314. total: 0, // 总条数
  315. page_size: [10, 20, 40, 50], // 选择限制显示条数
  316. },
  317. };
  318. },
  319. //生命周期 - 创建完成(可以访问当前this实例)
  320. created() {},
  321. //生命周期 - 挂载完成(可以访问DOM元素)
  322. mounted() {
  323. if (this.searchForm.dates?.length < 1) {
  324. this.searchForm.dates = [new Date(),new Date()]
  325. }
  326. this.init();
  327. },
  328. methods: {
  329. async init() {
  330. await this.$store.dispatch("setBranchs");
  331. this.getList();
  332. },
  333. getList() {
  334. const { dates, ...rest } = this.searchForm;
  335. let obj = {
  336. ...rest,
  337. page: this.rules.page,
  338. rows: this.rules.limit,
  339. ...getTimes(dates, ["startDateOfCourse", "endDateOfCourse"], "YYYY-MM-DD"),
  340. };
  341. findStudentAttendance(obj).then((res) => {
  342. if (res.code == 200) {
  343. this.tableList = res.data.rows;
  344. this.rules.total = res.data.total;
  345. }
  346. });
  347. },
  348. search() {
  349. this.rules.page = 1;
  350. this.getList();
  351. },
  352. onReSet() {
  353. this.$refs["searchForm"].resetFields();
  354. this.search();
  355. },
  356. },
  357. };
  358. </script>
  359. <style lang='scss' scoped>
  360. </style>