infoMsg.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 } from '@/utils/date'
  32. import dayjs from 'dayjs';
  33. import {
  34. queryCourseAdjustDetail,
  35. } from "@/api/buildTeam";
  36. import { teachMode } from '@/constant'
  37. import infoMsgContent from './infoMsgContent'
  38. export default {
  39. props: ['courseScheduleId'],
  40. data () {
  41. return {
  42. activeName: 0,
  43. dataList: [],
  44. }
  45. },
  46. components: { infoMsgContent },
  47. mounted () {
  48. queryCourseAdjustDetail({ courseScheduleId: this.courseScheduleId }).then(res => {
  49. if (res.code == 200) {
  50. if (res.data) {
  51. this.dataList = res.data.map(item => {
  52. const parsecurrent = JSON.parse(item.currentCourseSchedule)
  53. const currentCourseSchedule = this.filterKeys(parsecurrent)
  54. const previousCourseSchedule = this.filterKeys(JSON.parse(item.previousCourseSchedule))
  55. return {
  56. ...item,
  57. operatorName: parsecurrent.operatorName,
  58. currentCourseSchedule,
  59. previousCourseSchedule,
  60. }
  61. })
  62. }
  63. }
  64. })
  65. },
  66. methods: {
  67. getRealTime(time) {
  68. const parsenum = parseInt(time)
  69. return ('' + time).indexOf(' ') > -1 ? time : parsenum
  70. },
  71. filterKeys(item) {
  72. const teachingTeacherNames = (item.teachingTeacherNames || '').split(',').sort((a, b) => (a || '').localeCompare((b || ''), 'zh'))
  73. return {
  74. name: item.name,
  75. actualTeacherName: item.actualTeacherName,
  76. teachingTeacherNames: teachingTeacherNames.join(','),
  77. startClassTime: this.$helpers.dayjs(this.getRealTime(item.startClassTime)).format('YYYY-MM-DD HH:mm'),
  78. // classDate: item.classDate,
  79. // endClassTime: item.endClassTime,
  80. teachMode: teachMode[item.teachMode],
  81. schoolName: item.schoolName,
  82. timers: this.getTimers(item),
  83. }
  84. },
  85. getTitle (item) {
  86. return item.operatorName + ' 在 ' + item.createTime + ' 修改了'
  87. },
  88. getTimers (item) {
  89. return diffTimerFormMinute(dayjs(item.classDate).format('YYYY-MM-DD'), dayjs(this.getRealTime(item.startClassTime)).format('HH:mm'), dayjs(this.getRealTime(item.endClassTime)).format('HH:mm'))
  90. }
  91. },
  92. computed: {
  93. }
  94. }
  95. </script>
  96. <style lang="scss" scoped>
  97. .noBox {
  98. min-height: 200px;
  99. p {
  100. text-align: center;
  101. margin-top: 120px;
  102. }
  103. }
  104. .header{
  105. >span{
  106. color: rgba($color: #000000, $alpha: .6);
  107. display: inline-block;
  108. margin: 0 6px;
  109. }
  110. }
  111. </style>