index.vue 17 KB

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