index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  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-button
  119. @click="onExport"
  120. type="primary"
  121. v-permission="'export/queryTeacherAttendances'"
  122. style="background-color: #14928a; border: 1px solid #14928a"
  123. >导出</el-button> -->
  124. </el-form-item>
  125. </save-form>
  126. <div class="tableWrap">
  127. <el-table
  128. style="width: 100%"
  129. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  130. :data="tableList"
  131. >
  132. <el-table-column
  133. align="center"
  134. prop="courseSchedule.organization.name"
  135. label="分部"
  136. ></el-table-column>
  137. <el-table-column
  138. align="center"
  139. prop="username"
  140. label="学生姓名"
  141. width="110px"
  142. >
  143. <template slot-scope="scope">
  144. <div>
  145. {{ scope.row.username }}
  146. <p style="color: #f56c6c">
  147. (<copy-text>{{ scope.row.userId }}</copy-text
  148. >)
  149. </p>
  150. </div>
  151. </template>
  152. </el-table-column>
  153. <el-table-column
  154. align="center"
  155. prop="courseSchedule.teacherName"
  156. width="120px"
  157. label="老师姓名"
  158. >
  159. <template slot-scope="scope">
  160. {{ scope.row.courseSchedule.teacherName }}
  161. <p style="color: #f56c6c" v-if="scope.row.teacherId">
  162. (<copy-text>{{ scope.row.teacherId }}</copy-text
  163. >)
  164. </p>
  165. </template>
  166. </el-table-column>
  167. <el-table-column align="center" prop="musicGroupId" label="乐团编号">
  168. <template slot-scope="scope">
  169. <div>
  170. <copy-text>{{ scope.row.musicGroupId }}</copy-text>
  171. </div>
  172. </template>
  173. </el-table-column>
  174. <el-table-column
  175. align="center"
  176. prop="courseScheduleId"
  177. label="课程编号"
  178. >
  179. <template slot-scope="scope">
  180. <div>
  181. <copy-text>{{ scope.row.courseScheduleId }}</copy-text>
  182. </div>
  183. </template>
  184. </el-table-column>
  185. <el-table-column
  186. align="center"
  187. prop="courseSchedule.name"
  188. label="课程名称"
  189. ></el-table-column>
  190. <!-- <el-table-column
  191. align="center"
  192. prop="courseSchedule.classDate"
  193. label="上课日期"
  194. >
  195. <template slot-scope="scope">
  196. <div>
  197. </div>
  198. </template>
  199. </el-table-column> -->
  200. <el-table-column
  201. width="180px"
  202. align="center"
  203. prop="startClassTime"
  204. label="上课时间"
  205. >
  206. <template slot-scope="scope">
  207. <div>
  208. {{ scope.row.courseSchedule.classDate | dayjsFormat }}
  209. {{
  210. scope.row.courseSchedule.startClassTime | dayjsFormatMinute
  211. }}-{{
  212. scope.row.courseSchedule.endClassTime | dayjsFormatMinute
  213. }}
  214. </div>
  215. </template>
  216. </el-table-column>
  217. <el-table-column
  218. align="center"
  219. prop="startClassTime"
  220. label="课程组类型"
  221. >
  222. <template slot-scope="scope">
  223. <div>
  224. {{ scope.row.groupType | coursesType }}
  225. </div>
  226. </template>
  227. </el-table-column>
  228. <el-table-column
  229. align="center"
  230. prop="startClassTime"
  231. label="课程类型"
  232. >
  233. <template slot-scope="scope">
  234. <div>
  235. {{ scope.row.courseSchedule.type | coursesType }}
  236. </div>
  237. </template>
  238. </el-table-column>
  239. <el-table-column align="center" label="签到时间" width="180px">
  240. <template slot-scope="scope">
  241. <div>
  242. {{ scope.row.signInTime }}
  243. </div>
  244. </template>
  245. </el-table-column>
  246. <el-table-column align="center" label="合并类型">
  247. <template slot-scope="scope">
  248. <div>
  249. <!-- {{ scope.row.courseSchedule.newCourseId > 0 ? "是" : "否" }} -->
  250. {{ scope.row.courseSchedule.newCourseId > 0 && scope.row.courseSchedule.newCourseId == scope.row.courseScheduleId ? '合并课' : null }}
  251. {{ scope.row.courseSchedule.newCourseId > 0 && scope.row.courseSchedule.newCourseId != scope.row.courseScheduleId ? '被合并课' : null }}
  252. </div>
  253. </template>
  254. </el-table-column>
  255. <el-table-column
  256. align="center"
  257. prop="startClassTime"
  258. width="180px"
  259. label="签退时间"
  260. >
  261. <template slot-scope="scope">
  262. <div>
  263. {{ scope.row.signOutTime }}
  264. </div>
  265. </template>
  266. </el-table-column>
  267. <el-table-column align="center" label="考勤状态">
  268. <template slot-scope="scope">
  269. <div>
  270. {{ scope.row.status | clockingIn }}
  271. </div>
  272. </template>
  273. </el-table-column>
  274. </el-table>
  275. <pagination
  276. sync
  277. :total.sync="rules.total"
  278. :page.sync="rules.page"
  279. :limit.sync="rules.limit"
  280. :page-sizes="rules.page_size"
  281. @pagination="getList"
  282. />
  283. </div>
  284. </div>
  285. </div>
  286. </template>
  287. <script>
  288. import axios from "axios";
  289. import { getToken } from "@/utils/auth";
  290. import pagination from "@/components/Pagination/index";
  291. import load from "@/utils/loading";
  292. import { getTimes } from "@/utils";
  293. import qs from 'qs';
  294. import { findStudentAttendance } from "@/api/buildTeam";
  295. import { Export } from '@/utils/downLoadFile'
  296. import cleanDeep from 'clean-deep'
  297. // import { queryTeacherAttendances } from "@/api/recodeManager";
  298. import { courseType, courseListType, stuAttendance } from "@/utils/searchArray";
  299. export default {
  300. components: { pagination },
  301. data() {
  302. return {
  303. searchForm: {
  304. studentID: "",
  305. groupType: "MUSIC",
  306. musicGroupId: "",
  307. courseScheduleId: "",
  308. status: "",
  309. teacherId: "",
  310. courseScheduleType: "",
  311. organId: "",
  312. dates: [],
  313. },
  314. courseType,
  315. courseListType,
  316. attendanceStatus: stuAttendance,
  317. // teacherList: [],
  318. tableList: [],
  319. organList: [],
  320. rules: {
  321. // 分页规则
  322. limit: 10, // 限制显示条数
  323. page: 1, // 当前页
  324. total: 0, // 总条数
  325. page_size: [10, 20, 40, 50], // 选择限制显示条数
  326. },
  327. };
  328. },
  329. //生命周期 - 创建完成(可以访问当前this实例)
  330. created() {},
  331. //生命周期 - 挂载完成(可以访问DOM元素)
  332. mounted() {
  333. if (this.searchForm.dates?.length < 1) {
  334. this.searchForm.dates = [new Date(),new Date()]
  335. }
  336. this.init();
  337. },
  338. methods: {
  339. async init() {
  340. await this.$store.dispatch("setBranchs");
  341. this.getList();
  342. },
  343. // 导出
  344. async onExport () {
  345. const { dates, ...rest } = this.searchForm;
  346. let obj = {
  347. ...rest,
  348. page: this.rules.page,
  349. rows: this.rules.limit,
  350. ...getTimes(dates, ["classStartDate", "classEndDate"], "YYYY-MM-DD"),
  351. };
  352. await Export(this, {
  353. url: '/api-web/export/exportStudentAttendances',
  354. fileName: '考勤列表.xlsx',
  355. method: 'post',
  356. params: qs.stringify(cleanDeep(obj))
  357. }, '您确定考勤列表?')
  358. },
  359. getList() {
  360. const { dates, ...rest } = this.searchForm;
  361. let obj = {
  362. ...rest,
  363. page: this.rules.page,
  364. rows: this.rules.limit,
  365. ...getTimes(dates, ["startDateOfCourse", "endDateOfCourse"], "YYYY-MM-DD"),
  366. };
  367. // let obj = {
  368. // page: this.rules.page,
  369. // rows: this.rules.limit,
  370. // ...this.searchForm,
  371. // ...getTimes(
  372. // this.dates,
  373. // ["startDateOfCourse", "endDateOfCourse"],
  374. // "YYYY-MM-DD"
  375. // ),
  376. // };
  377. findStudentAttendance(obj).then((res) => {
  378. if (res.code == 200) {
  379. this.tableList = res.data.rows;
  380. this.rules.total = res.data.total;
  381. }
  382. });
  383. },
  384. search() {
  385. this.rules.page = 1;
  386. this.getList();
  387. },
  388. onReSet() {
  389. this.$refs["searchForm"].resetFields();
  390. this.search();
  391. },
  392. },
  393. };
  394. </script>
  395. <style lang='scss' scoped>
  396. </style>