index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  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. @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. {{
  237. scope.row.courseSchedule.newCourseId > 0 &&
  238. scope.row.courseSchedule.newCourseId ==
  239. scope.row.courseScheduleId
  240. ? "合并课"
  241. : null
  242. }}
  243. {{
  244. scope.row.courseSchedule.newCourseId > 0 &&
  245. scope.row.courseSchedule.newCourseId !=
  246. scope.row.courseScheduleId
  247. ? "被合并课"
  248. : null
  249. }}
  250. </div>
  251. </template>
  252. </el-table-column>
  253. <el-table-column
  254. width="180px"
  255. align="center"
  256. prop="startClassTime"
  257. label="上课时间"
  258. >
  259. <template slot-scope="scope">
  260. <div>
  261. {{ scope.row.courseSchedule.classDate | dayjsFormat }}
  262. {{
  263. scope.row.courseSchedule.startClassTime | dayjsFormatMinute
  264. }}-{{
  265. scope.row.courseSchedule.endClassTime | dayjsFormatMinute
  266. }}
  267. </div>
  268. </template>
  269. </el-table-column>
  270. <el-table-column align="center" label="签到时间" width="180px">
  271. <template slot-scope="scope">
  272. <div>
  273. {{ scope.row.signInTime }}
  274. </div>
  275. </template>
  276. </el-table-column>
  277. <el-table-column
  278. align="center"
  279. prop="startClassTime"
  280. width="180px"
  281. label="签退时间"
  282. >
  283. <template slot-scope="scope">
  284. <div>
  285. {{ scope.row.signOutTime }}
  286. </div>
  287. </template>
  288. </el-table-column>
  289. <el-table-column align="center" label="考勤回访">
  290. <template slot-scope="scope">
  291. <div>{{ scope.row.visitFlag | yesOrNo }}</div>
  292. </template>
  293. </el-table-column>
  294. <el-table-column align="center" label="考勤状态">
  295. <template slot-scope="scope">
  296. <div
  297. v-if="
  298. scope.row.courseSchedule &&
  299. scope.row.courseSchedule.status != 'NOT_START'
  300. "
  301. >
  302. {{ scope.row.status | clockingIn }}
  303. </div>
  304. </template>
  305. </el-table-column>
  306. <el-table-column
  307. align="center"
  308. fixed="right"
  309. label="操作"
  310. v-if="permission(getFullPermission('visit/add'))"
  311. >
  312. <template slot-scope="scope">
  313. <div>
  314. <el-button
  315. type="text"
  316. v-if="
  317. permission(getFullPermission('visit/add')) &&
  318. !scope.row.visitFlag
  319. "
  320. @click="addVisit(scope.row)"
  321. >新增回访</el-button
  322. >
  323. <el-button
  324. type="text"
  325. @click="lookVisit(scope.row)"
  326. v-if="
  327. scope.row.visitFlag &&
  328. permission(getFullPermission('visit/queryPage'))
  329. "
  330. >查看回访</el-button
  331. >
  332. </div>
  333. </template>
  334. </el-table-column>
  335. </el-table>
  336. <pagination
  337. sync
  338. :total.sync="rules.total"
  339. :page.sync="rules.page"
  340. :limit.sync="rules.limit"
  341. :page-sizes="rules.page_size"
  342. @pagination="getList"
  343. />
  344. <el-dialog title="新增回访" width="500px" :visible.sync="visitVisible">
  345. <visit
  346. v-if="visitVisible && detail"
  347. :detail="detail"
  348. :username="detail.username"
  349. @close="visitVisible = false"
  350. @submited="getList"
  351. :isMainGo="true"
  352. />
  353. </el-dialog>
  354. </div>
  355. </div>
  356. </div>
  357. </template>
  358. <script>
  359. import axios from "axios";
  360. import { getToken } from "@/utils/auth";
  361. import pagination from "@/components/Pagination/index";
  362. import load from "@/utils/loading";
  363. import { getTimes } from "@/utils";
  364. import qs from "qs";
  365. import { permission } from "@/utils/directivePage";
  366. import { findStudentAttendance } from "@/api/buildTeam";
  367. import { Export } from "@/utils/downLoadFile";
  368. import cleanDeep from "clean-deep";
  369. // import { queryTeacherAttendances } from "@/api/recodeManager";
  370. import { courseType, courseListType, stuAttendance } from "@/utils/searchArray";
  371. import visit from "@/views/withdrawal-application/modals/visit";
  372. export default {
  373. components: { pagination, visit },
  374. data() {
  375. return {
  376. visitVisible: false,
  377. detail: null,
  378. searchForm: {
  379. studentID: "",
  380. groupType: "MUSIC",
  381. musicGroupId: "",
  382. courseScheduleId: "",
  383. status: "",
  384. teacherId: "",
  385. courseScheduleType: "",
  386. organId: "",
  387. visitFlag: "",
  388. dates: [],
  389. },
  390. courseType,
  391. courseListType,
  392. attendanceStatus: stuAttendance,
  393. // teacherList: [],
  394. tableList: [],
  395. organList: [],
  396. rules: {
  397. // 分页规则
  398. limit: 10, // 限制显示条数
  399. page: 1, // 当前页
  400. total: 0, // 总条数
  401. page_size: [10, 20, 40, 50], // 选择限制显示条数
  402. },
  403. };
  404. },
  405. //生命周期 - 创建完成(可以访问当前this实例)
  406. created() {
  407. const { query } = this.$route;
  408. if (this.searchForm.dates?.length < 1) {
  409. const start = query.start || new Date();
  410. const end = query.end || new Date();
  411. this.searchForm.dates = [start, end];
  412. }
  413. },
  414. //生命周期 - 挂载完成(可以访问DOM元素)
  415. mounted() {
  416. const { query } = this.$route;
  417. if (query.visitFlag == 1 || query.visitFlag == 0) {
  418. this.searchForm.visitFlag = String(query.visitFlag);
  419. }
  420. if (query.status) {
  421. this.searchForm.status = query.status;
  422. }
  423. this.init();
  424. },
  425. methods: {
  426. permission,
  427. reloadSearch() {
  428. this.rules.page = 1;
  429. this.getList();
  430. },
  431. async init() {
  432. await this.$store.dispatch("setBranchs");
  433. this.getList();
  434. },
  435. addVisit(row) {
  436. this.visitVisible = true;
  437. this.detail = row;
  438. },
  439. // 导出
  440. async onExport() {
  441. const { dates, ...rest } = this.searchForm;
  442. let obj = {
  443. ...rest,
  444. page: this.rules.page,
  445. rows: this.rules.limit,
  446. ids: this.$route.query.ids,
  447. ...getTimes(dates, ["classStartDate", "classEndDate"], "YYYY-MM-DD"),
  448. };
  449. await Export(
  450. this,
  451. {
  452. url: "/api-web/export/exportStudentAttendances",
  453. fileName: "考勤列表.xls",
  454. method: "post",
  455. params: qs.stringify(cleanDeep(obj)),
  456. },
  457. "您确定考勤列表?"
  458. );
  459. },
  460. getList() {
  461. const { dates, ...rest } = this.searchForm;
  462. let obj = {
  463. ...rest,
  464. page: this.rules.page,
  465. rows: this.rules.limit,
  466. ...getTimes(
  467. dates,
  468. ["startDateOfCourse", "endDateOfCourse"],
  469. "YYYY-MM-DD"
  470. ),
  471. };
  472. // let obj = {
  473. // page: this.rules.page,
  474. // rows: this.rules.limit,
  475. // ...this.searchForm,
  476. // ...getTimes(
  477. // this.dates,
  478. // ["startDateOfCourse", "endDateOfCourse"],
  479. // "YYYY-MM-DD"
  480. // ),
  481. // };
  482. findStudentAttendance(obj, {
  483. ids: this.$route.query.ids,
  484. }).then((res) => {
  485. if (res.code == 200) {
  486. this.tableList = res.data.rows;
  487. this.rules.total = res.data.total;
  488. }
  489. });
  490. },
  491. clearSearchUrl() {
  492. const { query } = this.$route;
  493. if (
  494. query.status ||
  495. query.visitFlag == 0 ||
  496. query.visitFlag == 1 ||
  497. query.start ||
  498. query.end
  499. ) {
  500. this.$router.replace({
  501. status: undefined,
  502. visitFlag: undefined,
  503. start: undefined,
  504. end: undefined,
  505. });
  506. }
  507. },
  508. search() {
  509. this.rules.page = 1;
  510. this.clearSearchUrl();
  511. this.getList();
  512. },
  513. onReSet() {
  514. this.$refs["searchForm"].resetFields();
  515. this.clearSearchUrl();
  516. this.search();
  517. },
  518. lookVisit(row) {
  519. this.$router.push({
  520. path: "/studentManager/returnVisitList",
  521. query: { search: row.id },
  522. });
  523. },
  524. },
  525. };
  526. </script>
  527. <style lang='scss' scoped>
  528. </style>