index.vue 16 KB

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