index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. <!-- <filter-search @reload="reloadSearch" searchKey="ids" /> -->
  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. type="number"
  21. @keydown.enter.native="
  22. (e) => {
  23. e.target.blur();
  24. $refs.searchForm.save();
  25. search();
  26. }
  27. "
  28. placeholder="学生编号"
  29. ></el-input>
  30. </el-form-item>
  31. <el-form-item prop="teacherId">
  32. <remote-search
  33. :commit="'setTeachers'"
  34. v-model="searchForm.teacherId"
  35. />
  36. </el-form-item>
  37. <el-form-item prop="organId">
  38. <el-select
  39. class="multiple"
  40. filterable
  41. style="width: 180px !important"
  42. v-model.trim="searchForm.organId"
  43. clearable
  44. placeholder="请选择分部"
  45. >
  46. <el-option
  47. v-for="(item, index) in selects.branchs"
  48. :key="index"
  49. :label="item.name"
  50. :value="item.id"
  51. ></el-option>
  52. </el-select>
  53. </el-form-item>
  54. <el-form-item prop="musicGroupId">
  55. <el-input
  56. v-model.trim="searchForm.musicGroupId"
  57. type="number"
  58. clearable
  59. @keydown.enter.native="
  60. (e) => {
  61. e.target.blur();
  62. $refs.searchForm.save();
  63. search();
  64. }
  65. "
  66. placeholder="乐团编号"
  67. ></el-input>
  68. </el-form-item>
  69. <el-form-item prop="courseScheduleId">
  70. <el-input
  71. v-model.trim="searchForm.courseScheduleId"
  72. clearable
  73. @keydown.enter.native="
  74. (e) => {
  75. e.target.blur();
  76. $refs.searchForm.save();
  77. search();
  78. }
  79. "
  80. type="number"
  81. placeholder="课程编号"
  82. ></el-input>
  83. </el-form-item>
  84. <el-form-item prop="groupType">
  85. <el-select
  86. v-model.trim="searchForm.groupType"
  87. placeholder="请选择课程组类型"
  88. >
  89. <el-option
  90. v-for="(item, index) in courseListType"
  91. :key="index"
  92. :value="item.value"
  93. :label="item.label"
  94. ></el-option>
  95. </el-select>
  96. </el-form-item>
  97. <el-form-item prop="courseScheduleType">
  98. <el-select
  99. v-model.trim="searchForm.courseScheduleType"
  100. clearable
  101. placeholder="请选择课程类型"
  102. >
  103. <el-option
  104. v-for="(item, index) in courseType"
  105. :key="index"
  106. :value="item.value"
  107. :label="item.label"
  108. ></el-option>
  109. </el-select>
  110. </el-form-item>
  111. <el-form-item prop="visitFlag">
  112. <el-select
  113. v-model.trim="searchForm.visitFlag"
  114. placeholder="请选择是否回访"
  115. clearable
  116. >
  117. <el-option label="否" value="0"></el-option>
  118. <el-option label="是" value="1"></el-option>
  119. </el-select>
  120. </el-form-item>
  121. <el-form-item prop="status">
  122. <el-select
  123. v-model.trim="searchForm.status"
  124. placeholder="请选择考勤状态"
  125. clearable
  126. >
  127. <el-option
  128. v-for="(item, index) in attendanceStatus"
  129. :key="index"
  130. :value="item.value"
  131. :label="item.label"
  132. ></el-option>
  133. </el-select>
  134. </el-form-item>
  135. <el-form-item prop="dates">
  136. <el-date-picker
  137. v-model="searchForm.dates"
  138. type="daterange"
  139. style="width: 405px"
  140. range-separator="至"
  141. start-placeholder="课程开始日期"
  142. end-placeholder="课程结束日期"
  143. >
  144. </el-date-picker>
  145. </el-form-item>
  146. <el-form-item>
  147. <el-button native-type="submit" type="danger">搜索</el-button>
  148. <el-button native-type="reset" type="primary">重置</el-button>
  149. <!-- <el-button
  150. @click="onExport"
  151. type="primary"
  152. v-permission="'export/queryTeacherAttendances'"
  153. >导出</el-button> -->
  154. </el-form-item>
  155. </save-form>
  156. <div class="tableWrap">
  157. <el-table
  158. style="width: 100%"
  159. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  160. :data="tableList"
  161. >
  162. <el-table-column
  163. align="center"
  164. prop="courseSchedule.organization.name"
  165. label="分部"
  166. ></el-table-column>
  167. <el-table-column
  168. align="center"
  169. prop="username"
  170. label="学生姓名"
  171. width="110px"
  172. >
  173. <template slot-scope="scope">
  174. <div>
  175. {{ scope.row.username }}
  176. <p style="color: #f56c6c">
  177. (<copy-text>{{ scope.row.userId }}</copy-text>)
  178. </p>
  179. </div>
  180. </template>
  181. </el-table-column>
  182. <el-table-column
  183. align="center"
  184. prop="courseSchedule.teacherName"
  185. width="120px"
  186. label="老师姓名"
  187. >
  188. <template slot-scope="scope">
  189. {{ scope.row.courseSchedule.teacherName }}
  190. <p style="color: #f56c6c" v-if="scope.row.teacherId">
  191. (<copy-text>{{ scope.row.teacherId }}</copy-text
  192. >)
  193. </p>
  194. </template>
  195. </el-table-column>
  196. <el-table-column align="center" prop="musicGroupId" label="乐团编号">
  197. <template slot-scope="scope">
  198. <div>
  199. <copy-text>{{ scope.row.musicGroupId }}</copy-text>
  200. </div>
  201. </template>
  202. </el-table-column>
  203. <el-table-column
  204. align="center"
  205. prop="courseScheduleId"
  206. label="课程编号"
  207. >
  208. <template slot-scope="scope">
  209. <div>
  210. <copy-text>{{ scope.row.courseScheduleId }}</copy-text>
  211. </div>
  212. </template>
  213. </el-table-column>
  214. <el-table-column
  215. align="center"
  216. prop="courseSchedule.name"
  217. label="课程名称"
  218. ></el-table-column>
  219. <!-- <el-table-column
  220. align="center"
  221. prop="courseSchedule.classDate"
  222. label="上课日期"
  223. >
  224. <template slot-scope="scope">
  225. <div>
  226. </div>
  227. </template>
  228. </el-table-column> -->
  229. <el-table-column
  230. align="center"
  231. prop="startClassTime"
  232. label="课程组类型"
  233. >
  234. <template slot-scope="scope">
  235. <div>
  236. {{ scope.row.groupType | coursesType }}
  237. </div>
  238. </template>
  239. </el-table-column>
  240. <el-table-column
  241. align="center"
  242. prop="startClassTime"
  243. label="课程类型"
  244. >
  245. <template slot-scope="scope">
  246. <div>
  247. {{ scope.row.courseSchedule.type | coursesType }}
  248. </div>
  249. </template>
  250. </el-table-column>
  251. <el-table-column align="center" label="合并类型">
  252. <template slot-scope="scope">
  253. <div>
  254. <!-- {{ scope.row.courseSchedule.newCourseId > 0 ? "是" : "否" }} -->
  255. {{
  256. scope.row.courseSchedule.newCourseId > 0 &&
  257. scope.row.courseSchedule.newCourseId ==
  258. scope.row.courseScheduleId
  259. ? "合并课"
  260. : null
  261. }}
  262. {{
  263. scope.row.courseSchedule.newCourseId > 0 &&
  264. scope.row.courseSchedule.newCourseId !=
  265. scope.row.courseScheduleId
  266. ? "被合并课"
  267. : null
  268. }}
  269. </div>
  270. </template>
  271. </el-table-column>
  272. <el-table-column
  273. width="180px"
  274. align="center"
  275. prop="startClassTime"
  276. label="上课时间"
  277. >
  278. <template slot-scope="scope">
  279. <div>
  280. {{ scope.row.courseSchedule.classDate | dayjsFormat }}
  281. {{
  282. scope.row.courseSchedule.startClassTime | dayjsFormatMinute
  283. }}-{{
  284. scope.row.courseSchedule.endClassTime | dayjsFormatMinute
  285. }}
  286. </div>
  287. </template>
  288. </el-table-column>
  289. <el-table-column align="center" label="签到时间" width="180px">
  290. <template slot-scope="scope">
  291. <div>
  292. {{ scope.row.signInTime }}
  293. </div>
  294. </template>
  295. </el-table-column>
  296. <el-table-column
  297. align="center"
  298. prop="startClassTime"
  299. width="180px"
  300. label="签退时间"
  301. >
  302. <template slot-scope="scope">
  303. <div>
  304. {{ scope.row.signOutTime }}
  305. </div>
  306. </template>
  307. </el-table-column>
  308. <el-table-column align="center" label="考勤回访">
  309. <template slot-scope="scope">
  310. <div>{{ scope.row.visitFlag | yesOrNo }}</div>
  311. </template>
  312. </el-table-column>
  313. <el-table-column align="center" label="考勤状态">
  314. <template slot-scope="scope">
  315. <div
  316. v-if="
  317. scope.row.courseSchedule &&
  318. scope.row.courseSchedule.status != 'NOT_START'
  319. "
  320. >
  321. {{ scope.row.status | clockingIn }}
  322. </div>
  323. </template>
  324. </el-table-column>
  325. <el-table-column
  326. align="center"
  327. fixed="right"
  328. label="操作"
  329. v-if="permission(getFullPermission('visit/add'))"
  330. >
  331. <template slot-scope="scope">
  332. <div>
  333. <el-button
  334. type="text"
  335. v-if="
  336. permission(getFullPermission('visit/add')) &&
  337. !scope.row.visitFlag
  338. "
  339. @click="addVisit(scope.row)"
  340. >新增回访</el-button
  341. >
  342. <el-button
  343. type="text"
  344. @click="lookVisit(scope.row)"
  345. v-if="
  346. scope.row.visitFlag &&
  347. permission(getFullPermission('visit/queryPage'))
  348. "
  349. >查看回访</el-button
  350. >
  351. </div>
  352. </template>
  353. </el-table-column>
  354. </el-table>
  355. <pagination
  356. sync
  357. :total.sync="rules.total"
  358. :page.sync="rules.page"
  359. :limit.sync="rules.limit"
  360. :page-sizes="rules.page_size"
  361. @pagination="getList"
  362. />
  363. <el-dialog title="新增回访" width="760px" :visible.sync="visitVisible">
  364. <visit
  365. v-if="visitVisible && detail"
  366. :detail="detail"
  367. :username="detail.username"
  368. @close="visitVisible = false"
  369. @submited="getList"
  370. :isMainGo="true"
  371. />
  372. </el-dialog>
  373. </div>
  374. </div>
  375. </div>
  376. </template>
  377. <script>
  378. import axios from "axios";
  379. import { getToken } from "@/utils/auth";
  380. import pagination from "@/components/Pagination/index";
  381. import load from "@/utils/loading";
  382. import { getTimes } from "@/utils";
  383. import qs from "qs";
  384. import { permission } from "@/utils/directivePage";
  385. import { findStudentAttendance } from "@/api/buildTeam";
  386. import { Export } from "@/utils/downLoadFile";
  387. import cleanDeep from "clean-deep";
  388. // import { queryTeacherAttendances } from "@/api/recodeManager";
  389. import { courseType, courseListType, stuAttendance } from "@/utils/searchArray";
  390. import visit from "@/views/withdrawal-application/modals/visit";
  391. export default {
  392. components: { pagination, visit },
  393. data() {
  394. return {
  395. visitVisible: false,
  396. detail: null,
  397. searchForm: {
  398. studentID: "",
  399. groupType: "MUSIC",
  400. musicGroupId: "",
  401. courseScheduleId: "",
  402. status: "",
  403. teacherId: "",
  404. courseScheduleType: "",
  405. organId: "",
  406. visitFlag: "",
  407. dates: [],
  408. },
  409. courseType,
  410. courseListType,
  411. attendanceStatus: stuAttendance,
  412. // teacherList: [],
  413. tableList: [],
  414. organList: [],
  415. rules: {
  416. // 分页规则
  417. limit: 10, // 限制显示条数
  418. page: 1, // 当前页
  419. total: 0, // 总条数
  420. page_size: [10, 20, 40, 50], // 选择限制显示条数
  421. },
  422. };
  423. },
  424. //生命周期 - 创建完成(可以访问当前this实例)
  425. created() {
  426. const { query } = this.$route;
  427. if (this.searchForm.dates?.length < 1) {
  428. const start = query.start || new Date();
  429. const end = query.end || new Date();
  430. this.searchForm.dates = [start, end];
  431. }
  432. },
  433. //生命周期 - 挂载完成(可以访问DOM元素)
  434. mounted() {
  435. const { query } = this.$route;
  436. if (query.visitFlag == 1 || query.visitFlag == 0) {
  437. this.searchForm.visitFlag = String(query.visitFlag);
  438. }
  439. if (query.status) {
  440. this.searchForm.status = query.status;
  441. }
  442. this.init();
  443. },
  444. methods: {
  445. permission,
  446. reloadSearch() {
  447. this.rules.page = 1;
  448. this.getList();
  449. },
  450. async init() {
  451. await this.$store.dispatch("setBranchs");
  452. this.getList();
  453. },
  454. addVisit(row) {
  455. this.visitVisible = true;
  456. this.detail = row;
  457. },
  458. // 导出
  459. async onExport() {
  460. const { dates, ...rest } = this.searchForm;
  461. let obj = {
  462. ...rest,
  463. page: this.rules.page,
  464. rows: this.rules.limit,
  465. ids: this.$route.query.ids,
  466. ...getTimes(dates, ["classStartDate", "classEndDate"], "YYYY-MM-DD"),
  467. };
  468. await Export(
  469. this,
  470. {
  471. url: "/api-web/export/exportStudentAttendances",
  472. fileName: "考勤列表.xls",
  473. method: "post",
  474. params: qs.stringify(cleanDeep(obj)),
  475. },
  476. "您确定考勤列表?"
  477. );
  478. },
  479. getList() {
  480. const { dates, ...rest } = this.searchForm;
  481. let obj = {
  482. ...rest,
  483. page: this.rules.page,
  484. rows: this.rules.limit,
  485. ...getTimes(
  486. dates,
  487. ["startDateOfCourse", "endDateOfCourse"],
  488. "YYYY-MM-DD"
  489. ),
  490. };
  491. // let obj = {
  492. // page: this.rules.page,
  493. // rows: this.rules.limit,
  494. // ...this.searchForm,
  495. // ...getTimes(
  496. // this.dates,
  497. // ["startDateOfCourse", "endDateOfCourse"],
  498. // "YYYY-MM-DD"
  499. // ),
  500. // };
  501. findStudentAttendance(obj, {
  502. ids: this.$route.query.ids,
  503. }).then((res) => {
  504. if (res.code == 200) {
  505. this.tableList = res.data.rows;
  506. this.rules.total = res.data.total;
  507. }
  508. });
  509. },
  510. clearSearchUrl() {
  511. const { query } = this.$route;
  512. if (
  513. query.status ||
  514. query.visitFlag == 0 ||
  515. query.visitFlag == 1 ||
  516. query.start ||
  517. query.end
  518. ) {
  519. this.$router.replace({
  520. status: undefined,
  521. visitFlag: undefined,
  522. start: undefined,
  523. end: undefined,
  524. });
  525. }
  526. },
  527. search() {
  528. this.rules.page = 1;
  529. this.clearSearchUrl();
  530. this.getList();
  531. },
  532. onReSet() {
  533. this.$refs["searchForm"].resetFields();
  534. this.clearSearchUrl();
  535. this.search();
  536. },
  537. lookVisit(row) {
  538. this.$router.push({
  539. path: "/studentManager/returnVisitList",
  540. query: { search: row.id },
  541. });
  542. },
  543. },
  544. };
  545. </script>
  546. <style lang='scss' scoped>
  547. </style>