index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  1. <!-- -->
  2. <template>
  3. <div class="m-container">
  4. <h2>
  5. <div class="squrt"></div>
  6. 学生考勤列表 <filter-search @reload="getList" searchKey="ids"/>
  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="visitFlag">
  91. <el-select
  92. v-model.trim="searchForm.visitFlag"
  93. placeholder="请选择是否回访"
  94. clearable
  95. >
  96. <el-option label="否" value="0"></el-option>
  97. <el-option label="是" value="1"></el-option>
  98. </el-select>
  99. </el-form-item>
  100. <el-form-item prop="status">
  101. <el-select
  102. v-model.trim="searchForm.status"
  103. placeholder="请选择考勤状态"
  104. clearable
  105. >
  106. <el-option
  107. v-for="(item, index) in attendanceStatus"
  108. :key="index"
  109. :value="item.value"
  110. :label="item.label"
  111. ></el-option>
  112. </el-select>
  113. </el-form-item>
  114. <el-form-item prop="dates">
  115. <el-date-picker
  116. v-model="searchForm.dates"
  117. type="daterange"
  118. style="width: 405px"
  119. range-separator="至"
  120. start-placeholder="课程开始日期"
  121. end-placeholder="课程结束日期"
  122. >
  123. </el-date-picker>
  124. </el-form-item>
  125. <el-form-item>
  126. <el-button native-type="submit" type="danger">搜索</el-button>
  127. <el-button native-type="reset" type="primary">重置</el-button>
  128. <!-- <el-button
  129. @click="onExport"
  130. type="primary"
  131. v-permission="'export/queryTeacherAttendances'"
  132. style="background-color: #14928a; border: 1px solid #14928a"
  133. >导出</el-button> -->
  134. </el-form-item>
  135. </save-form>
  136. <div class="tableWrap">
  137. <el-table
  138. style="width: 100%"
  139. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  140. :data="tableList"
  141. >
  142. <el-table-column
  143. align="center"
  144. prop="courseSchedule.organization.name"
  145. label="分部"
  146. ></el-table-column>
  147. <el-table-column
  148. align="center"
  149. prop="username"
  150. label="学生姓名"
  151. width="110px"
  152. >
  153. <template slot-scope="scope">
  154. <div>
  155. {{ scope.row.username }}
  156. <p style="color: #f56c6c">
  157. (<copy-text>{{ scope.row.userId }}</copy-text
  158. >)
  159. </p>
  160. </div>
  161. </template>
  162. </el-table-column>
  163. <el-table-column
  164. align="center"
  165. prop="courseSchedule.teacherName"
  166. width="120px"
  167. label="老师姓名"
  168. >
  169. <template slot-scope="scope">
  170. {{ scope.row.courseSchedule.teacherName }}
  171. <p style="color: #f56c6c" v-if="scope.row.teacherId">
  172. (<copy-text>{{ scope.row.teacherId }}</copy-text
  173. >)
  174. </p>
  175. </template>
  176. </el-table-column>
  177. <el-table-column align="center" prop="musicGroupId" label="乐团编号">
  178. <template slot-scope="scope">
  179. <div>
  180. <copy-text>{{ scope.row.musicGroupId }}</copy-text>
  181. </div>
  182. </template>
  183. </el-table-column>
  184. <el-table-column
  185. align="center"
  186. prop="courseScheduleId"
  187. label="课程编号"
  188. >
  189. <template slot-scope="scope">
  190. <div>
  191. <copy-text>{{ scope.row.courseScheduleId }}</copy-text>
  192. </div>
  193. </template>
  194. </el-table-column>
  195. <el-table-column
  196. align="center"
  197. prop="courseSchedule.name"
  198. label="课程名称"
  199. ></el-table-column>
  200. <!-- <el-table-column
  201. align="center"
  202. prop="courseSchedule.classDate"
  203. label="上课日期"
  204. >
  205. <template slot-scope="scope">
  206. <div>
  207. </div>
  208. </template>
  209. </el-table-column> -->
  210. <el-table-column
  211. align="center"
  212. prop="startClassTime"
  213. label="课程组类型"
  214. >
  215. <template slot-scope="scope">
  216. <div>
  217. {{ scope.row.groupType | coursesType }}
  218. </div>
  219. </template>
  220. </el-table-column>
  221. <el-table-column
  222. align="center"
  223. prop="startClassTime"
  224. label="课程类型"
  225. >
  226. <template slot-scope="scope">
  227. <div>
  228. {{ scope.row.courseSchedule.type | coursesType }}
  229. </div>
  230. </template>
  231. </el-table-column>
  232. <el-table-column align="center" label="合并类型">
  233. <template slot-scope="scope">
  234. <div>
  235. <!-- {{ scope.row.courseSchedule.newCourseId > 0 ? "是" : "否" }} -->
  236. {{ scope.row.courseSchedule.newCourseId > 0 && scope.row.courseSchedule.newCourseId == scope.row.courseScheduleId ? '合并课' : null }}
  237. {{ scope.row.courseSchedule.newCourseId > 0 && scope.row.courseSchedule.newCourseId != scope.row.courseScheduleId ? '被合并课' : null }}
  238. </div>
  239. </template>
  240. </el-table-column>
  241. <el-table-column
  242. width="180px"
  243. align="center"
  244. prop="startClassTime"
  245. label="上课时间"
  246. >
  247. <template slot-scope="scope">
  248. <div>
  249. {{ scope.row.courseSchedule.classDate | dayjsFormat }}
  250. {{
  251. scope.row.courseSchedule.startClassTime | dayjsFormatMinute
  252. }}-{{
  253. scope.row.courseSchedule.endClassTime | dayjsFormatMinute
  254. }}
  255. </div>
  256. </template>
  257. </el-table-column>
  258. <el-table-column align="center" label="签到时间" width="180px">
  259. <template slot-scope="scope">
  260. <div>
  261. {{ scope.row.signInTime }}
  262. </div>
  263. </template>
  264. </el-table-column>
  265. <el-table-column
  266. align="center"
  267. prop="startClassTime"
  268. width="180px"
  269. label="签退时间"
  270. >
  271. <template slot-scope="scope">
  272. <div>
  273. {{ scope.row.signOutTime }}
  274. </div>
  275. </template>
  276. </el-table-column>
  277. <el-table-column align="center" label="考勤回访">
  278. <template slot-scope="scope">
  279. <div>{{ scope.row.visitFlag | yesOrNo }}</div>
  280. </template>
  281. </el-table-column>
  282. <el-table-column align="center" label="考勤状态">
  283. <template slot-scope="scope">
  284. <div v-if="scope.row.courseSchedule && scope.row.courseSchedule.status != 'NOT_START'">
  285. {{ scope.row.status | clockingIn }}
  286. </div>
  287. </template>
  288. </el-table-column>
  289. <el-table-column
  290. align="center"
  291. fixed="right"
  292. label="操作"
  293. v-if="permission('visit/add')"
  294. >
  295. <template slot-scope="scope">
  296. <el-button
  297. type="text"
  298. v-if="permission('visit/add')"
  299. @click="addVisit(scope.row)"
  300. >新增回访</el-button>
  301. </template>
  302. </el-table-column>
  303. </el-table>
  304. <pagination
  305. sync
  306. :total.sync="rules.total"
  307. :page.sync="rules.page"
  308. :limit.sync="rules.limit"
  309. :page-sizes="rules.page_size"
  310. @pagination="getList"
  311. />
  312. <el-dialog title="新增回访" width="500px" :visible.sync="visitVisible">
  313. <visit
  314. v-if="visitVisible && detail"
  315. :detail="detail"
  316. :username="detail.username"
  317. @close="visitVisible = false"
  318. @submited="getList"
  319. :isMainGo="true"
  320. />
  321. </el-dialog>
  322. </div>
  323. </div>
  324. </div>
  325. </template>
  326. <script>
  327. import axios from "axios";
  328. import { getToken } from "@/utils/auth";
  329. import pagination from "@/components/Pagination/index";
  330. import load from "@/utils/loading";
  331. import { getTimes } from "@/utils";
  332. import qs from 'qs';
  333. import { permission } from '@/utils/directivePage'
  334. import { findStudentAttendance } from "@/api/buildTeam";
  335. import { Export } from '@/utils/downLoadFile'
  336. import cleanDeep from 'clean-deep'
  337. // import { queryTeacherAttendances } from "@/api/recodeManager";
  338. import { courseType, courseListType, stuAttendance } from "@/utils/searchArray";
  339. import visit from '@/views/withdrawal-application/modals/visit'
  340. export default {
  341. components: { pagination, visit },
  342. data() {
  343. return {
  344. visitVisible: false,
  345. detail: null,
  346. searchForm: {
  347. studentID: "",
  348. groupType: "MUSIC",
  349. musicGroupId: "",
  350. courseScheduleId: "",
  351. status: "",
  352. teacherId: "",
  353. courseScheduleType: "",
  354. organId: "",
  355. visitFlag: '',
  356. dates: [],
  357. },
  358. courseType,
  359. courseListType,
  360. attendanceStatus: stuAttendance,
  361. // teacherList: [],
  362. tableList: [],
  363. organList: [],
  364. rules: {
  365. // 分页规则
  366. limit: 10, // 限制显示条数
  367. page: 1, // 当前页
  368. total: 0, // 总条数
  369. page_size: [10, 20, 40, 50], // 选择限制显示条数
  370. },
  371. };
  372. },
  373. //生命周期 - 创建完成(可以访问当前this实例)
  374. created() {
  375. const { query } = this.$route
  376. if (this.searchForm.dates?.length < 1) {
  377. const start = query.start || new Date()
  378. const end = query.end || new Date()
  379. this.searchForm.dates = [start, end]
  380. }
  381. },
  382. //生命周期 - 挂载完成(可以访问DOM元素)
  383. mounted() {
  384. const { query } = this.$route
  385. if (query.visitFlag == 1 || query.visitFlag == 0) {
  386. this.searchForm.visitFlag = String(query.visitFlag)
  387. }
  388. if (query.status) {
  389. this.searchForm.status = query.status
  390. }
  391. this.init();
  392. },
  393. methods: {
  394. permission,
  395. async init() {
  396. await this.$store.dispatch("setBranchs");
  397. this.getList();
  398. },
  399. addVisit(row) {
  400. this.visitVisible = true
  401. this.detail = row
  402. },
  403. // 导出
  404. async onExport () {
  405. const { dates, ...rest } = this.searchForm;
  406. let obj = {
  407. ...rest,
  408. page: this.rules.page,
  409. rows: this.rules.limit,
  410. ids: this.$route.query.ids,
  411. ...getTimes(dates, ["classStartDate", "classEndDate"], "YYYY-MM-DD"),
  412. };
  413. await Export(this, {
  414. url: '/api-web/export/exportStudentAttendances',
  415. fileName: '考勤列表.xlsx',
  416. method: 'post',
  417. params: qs.stringify(cleanDeep(obj))
  418. }, '您确定考勤列表?')
  419. },
  420. getList() {
  421. const { dates, ...rest } = this.searchForm;
  422. let obj = {
  423. ...rest,
  424. page: this.rules.page,
  425. rows: this.rules.limit,
  426. ...getTimes(dates, ["startDateOfCourse", "endDateOfCourse"], "YYYY-MM-DD"),
  427. };
  428. // let obj = {
  429. // page: this.rules.page,
  430. // rows: this.rules.limit,
  431. // ...this.searchForm,
  432. // ...getTimes(
  433. // this.dates,
  434. // ["startDateOfCourse", "endDateOfCourse"],
  435. // "YYYY-MM-DD"
  436. // ),
  437. // };
  438. findStudentAttendance(obj, {
  439. ids: this.$route.query.ids,
  440. }).then((res) => {
  441. if (res.code == 200) {
  442. this.tableList = res.data.rows;
  443. this.rules.total = res.data.total;
  444. }
  445. });
  446. },
  447. clearSearchUrl() {
  448. const { query } = this.$route
  449. if (query.status || (query.visitFlag == 0 || query.visitFlag == 1) || query.start || query.end) {
  450. this.$router.replace({
  451. status: undefined,
  452. visitFlag: undefined,
  453. start: undefined,
  454. end: undefined,
  455. })
  456. }
  457. },
  458. search() {
  459. this.rules.page = 1;
  460. this.clearSearchUrl()
  461. this.getList();
  462. },
  463. onReSet() {
  464. this.$refs["searchForm"].resetFields();
  465. this.clearSearchUrl()
  466. this.search();
  467. },
  468. },
  469. };
  470. </script>
  471. <style lang='scss' scoped>
  472. </style>