infoMsg.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <div>
  3. <el-collapse v-model="activeName"
  4. v-if="dataList.length > 0"
  5. accordion>
  6. <el-collapse-item v-for="
  7. (item,index)
  8. in
  9. dataList"
  10. :key="index"
  11. :title="getTitle(item)"
  12. :name="index">
  13. <template slot="title">
  14. <header class="header">
  15. {{item.operatorName}} <span>在</span> {{item.createTime}} <span>修改了</span>
  16. </header>
  17. </template>
  18. <infoMsgContent
  19. :before="item.previousCourseSchedule"
  20. :after="item.currentCourseSchedule"
  21. />
  22. </el-collapse-item>
  23. </el-collapse>
  24. <div v-if="dataList.length <= 0"
  25. class="noBox">
  26. <p>暂无调整记录</p>
  27. </div>
  28. </div>
  29. </template>
  30. <script>
  31. import { diffTimerFormMinute, addTimerFormMinute } from '@/utils/date'
  32. import dayjs from 'dayjs';
  33. import {
  34. queryCourseAdjustDetail,
  35. } from "@/api/buildTeam";
  36. import infoMsgContent from './infoMsgContent'
  37. export default {
  38. props: ['courseScheduleId'],
  39. data () {
  40. return {
  41. activeName: 0,
  42. dataList: [],
  43. }
  44. },
  45. components: { infoMsgContent },
  46. mounted () {
  47. queryCourseAdjustDetail({ courseScheduleId: this.courseScheduleId }).then(res => {
  48. if (res.code == 200) {
  49. if (res.data) {
  50. this.dataList = res.data.map(item => {
  51. const parsecurrent = JSON.parse(item.currentCourseSchedule)
  52. const currentCourseSchedule = this.filterKeys(parsecurrent)
  53. const previousCourseSchedule = this.filterKeys(JSON.parse(item.previousCourseSchedule))
  54. return {
  55. ...item,
  56. operatorName: parsecurrent.operatorName,
  57. currentCourseSchedule,
  58. previousCourseSchedule,
  59. }
  60. })
  61. }
  62. }
  63. })
  64. },
  65. methods: {
  66. filterKeys(item) {
  67. return {
  68. name: item.name,
  69. actualTeacherName: item.actualTeacherName,
  70. teacherName: item.teacherName,
  71. startClassTime: item.startClassTime,
  72. classDate: item.classDate,
  73. endClassTime: item.endClassTime,
  74. teachMode: item.teachMode,
  75. schoolName: item.schoolName,
  76. timers: this.getTimers(item)
  77. }
  78. },
  79. getTitle (item) {
  80. return item.operatorName + ' 在 ' + item.createTime + ' 修改了'
  81. },
  82. getTimers (item) {
  83. return diffTimerFormMinute(dayjs(item.classDate).format('YYYY-MM-DD'), dayjs(item.startClassTime).format('HH:mm'), dayjs(item.endClassTime).format('HH:mm'))
  84. }
  85. },
  86. computed: {
  87. }
  88. }
  89. </script>
  90. <style lang="scss" scoped>
  91. .noBox {
  92. min-height: 200px;
  93. p {
  94. text-align: center;
  95. margin-top: 120px;
  96. }
  97. }
  98. .header{
  99. >span{
  100. color: rgba($color: #000000, $alpha: .6);
  101. display: inline-block;
  102. margin: 0 6px;
  103. }
  104. }
  105. </style>