index.vue 18 KB

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