index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  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. </div>
  251. </template>
  252. </el-table-column>
  253. <el-table-column
  254. align="center"
  255. prop="startClassTime"
  256. width="180px"
  257. label="签退时间"
  258. >
  259. <template slot-scope="scope">
  260. <div>
  261. {{ scope.row.signOutTime }}
  262. </div>
  263. </template>
  264. </el-table-column>
  265. <el-table-column align="center" label="考勤状态">
  266. <template slot-scope="scope">
  267. <div>
  268. {{ scope.row.status | clockingIn }}
  269. </div>
  270. </template>
  271. </el-table-column>
  272. </el-table>
  273. <pagination
  274. sync
  275. :total.sync="rules.total"
  276. :page.sync="rules.page"
  277. :limit.sync="rules.limit"
  278. :page-sizes="rules.page_size"
  279. @pagination="getList"
  280. />
  281. </div>
  282. </div>
  283. </div>
  284. </template>
  285. <script>
  286. import axios from "axios";
  287. import { getToken } from "@/utils/auth";
  288. import pagination from "@/components/Pagination/index";
  289. import load from "@/utils/loading";
  290. import { getTimes } from "@/utils";
  291. import qs from 'qs';
  292. import { findStudentAttendance } from "@/api/buildTeam";
  293. import { Export } from '@/utils/downLoadFile'
  294. import cleanDeep from 'clean-deep'
  295. // import { queryTeacherAttendances } from "@/api/recodeManager";
  296. import { courseType, courseListType, stuAttendance } from "@/utils/searchArray";
  297. export default {
  298. components: { pagination },
  299. data() {
  300. return {
  301. searchForm: {
  302. studentID: "",
  303. groupType: "MUSIC",
  304. musicGroupId: "",
  305. courseScheduleId: "",
  306. status: "",
  307. teacherId: "",
  308. courseScheduleType: "",
  309. organId: "",
  310. dates: [],
  311. },
  312. courseType,
  313. courseListType,
  314. attendanceStatus: stuAttendance,
  315. // teacherList: [],
  316. tableList: [],
  317. organList: [],
  318. rules: {
  319. // 分页规则
  320. limit: 10, // 限制显示条数
  321. page: 1, // 当前页
  322. total: 0, // 总条数
  323. page_size: [10, 20, 40, 50], // 选择限制显示条数
  324. },
  325. };
  326. },
  327. //生命周期 - 创建完成(可以访问当前this实例)
  328. created() {},
  329. //生命周期 - 挂载完成(可以访问DOM元素)
  330. mounted() {
  331. if (this.searchForm.dates?.length < 1) {
  332. this.searchForm.dates = [new Date(),new Date()]
  333. }
  334. this.init();
  335. },
  336. methods: {
  337. async init() {
  338. await this.$store.dispatch("setBranchs");
  339. this.getList();
  340. },
  341. // 导出
  342. async onExport () {
  343. const { dates, ...rest } = this.searchForm;
  344. let obj = {
  345. ...rest,
  346. page: this.rules.page,
  347. rows: this.rules.limit,
  348. ...getTimes(dates, ["classStartDate", "classEndDate"], "YYYY-MM-DD"),
  349. };
  350. await Export(this, {
  351. url: '/api-web/export/exportStudentAttendances',
  352. fileName: '考勤列表.xlsx',
  353. method: 'post',
  354. params: qs.stringify(cleanDeep(obj))
  355. }, '您确定考勤列表?')
  356. },
  357. getList() {
  358. const { dates, ...rest } = this.searchForm;
  359. let obj = {
  360. ...rest,
  361. page: this.rules.page,
  362. rows: this.rules.limit,
  363. ...getTimes(dates, ["startDateOfCourse", "endDateOfCourse"], "YYYY-MM-DD"),
  364. };
  365. // let obj = {
  366. // page: this.rules.page,
  367. // rows: this.rules.limit,
  368. // ...this.searchForm,
  369. // ...getTimes(
  370. // this.dates,
  371. // ["startDateOfCourse", "endDateOfCourse"],
  372. // "YYYY-MM-DD"
  373. // ),
  374. // };
  375. findStudentAttendance(obj).then((res) => {
  376. if (res.code == 200) {
  377. this.tableList = res.data.rows;
  378. this.rules.total = res.data.total;
  379. }
  380. });
  381. },
  382. search() {
  383. this.rules.page = 1;
  384. this.getList();
  385. },
  386. onReSet() {
  387. this.$refs["searchForm"].resetFields();
  388. this.search();
  389. },
  390. },
  391. };
  392. </script>
  393. <style lang='scss' scoped>
  394. </style>