leaveRecord.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <div>
  3. <!-- 头部展示 -->
  4. <!-- <div class="headWrap">
  5. <div class="left">
  6. <div class="headItem">
  7. <p>本月请假:<span>12345</span></p>
  8. </div>
  9. </div>
  10. <div class="right">
  11. </div>
  12. </div> -->
  13. <!-- 搜索标题 -->
  14. <el-form :inline="true"
  15. class="searchForm"
  16. v-model.trim="searchForm">
  17. <el-form-item>
  18. <el-date-picker style="width: 400px;"
  19. v-model.trim="courseDate"
  20. type="daterange"
  21. value-format="yyyy-MM-dd"
  22. @change="searchCourseDate"
  23. range-separator="至"
  24. start-placeholder="开始日期"
  25. end-placeholder="结束日期">
  26. </el-date-picker>
  27. </el-form-item>
  28. <el-form-item>
  29. <el-button @click="search"
  30. type="danger">搜索</el-button>
  31. <el-button @click="onReSet"
  32. type="primary">重置</el-button>
  33. </el-form-item>
  34. </el-form>
  35. <!-- 列表 -->
  36. <div class="tableWrap">
  37. <el-table :data='tableList'
  38. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  39. <el-table-column align='center'
  40. prop="createTime"
  41. label="请假发起时间">
  42. <template slot-scope="scope">
  43. <div>
  44. {{ scope.row.createTime |dateForMinFormat}}
  45. </div>
  46. </template>
  47. </el-table-column>
  48. <el-table-column align='center'
  49. label="请假时间">
  50. <template slot-scope="scope">
  51. {{ scope.row.startTime |dateForMinFormat}} - {{ scope.row.endTime |dateForMinFormat}}
  52. </template>
  53. </el-table-column>
  54. <el-table-column align='center'
  55. prop="remark"
  56. label="请假说明">
  57. </el-table-column>
  58. </el-table>
  59. <pagination :total="pageInfo.total"
  60. :page.sync="pageInfo.page"
  61. :limit.sync="pageInfo.limit"
  62. :page-sizes="pageInfo.page_size"
  63. @pagination="getList" />
  64. </div>
  65. </div>
  66. </template>
  67. <script>
  68. import { teacherLeaveRecordQuery } from '@/api/teacherManager'
  69. import pagination from '@/components/Pagination/index'
  70. import store from '@/store'
  71. import { attendance } from '@/utils/searchArray'
  72. export default {
  73. name: 'leaveRecord',
  74. components: {
  75. pagination
  76. },
  77. data () {
  78. return {
  79. attendance: attendance,
  80. courseDate: null,
  81. searchForm: {
  82. startTime: null,
  83. endTime: null,
  84. status: 'PASS'
  85. },
  86. tableList: [],
  87. tableList: [],
  88. organId: null,
  89. teacherId: this.$route.query.teacherId,
  90. pageInfo: {
  91. // 分页规则
  92. limit: 10, // 限制显示条数
  93. page: 1, // 当前页
  94. total: 1, // 总条数
  95. page_size: [10, 20, 40, 50] // 选择限制显示条数
  96. }
  97. }
  98. },
  99. mounted () {
  100. this.getList()
  101. },
  102. activated () {
  103. this.teacherId = this.$route.query.teacherId
  104. this.getList()
  105. },
  106. methods: {
  107. search () {
  108. this.pageInfo.page = 1
  109. this.getList()
  110. },
  111. getList () {
  112. let params = this.searchForm
  113. params.rows = this.pageInfo.limit
  114. params.page = this.pageInfo.page,
  115. params.teacherId = this.teacherId
  116. teacherLeaveRecordQuery(params).then(res => {
  117. if (res.code == 200) {
  118. this.tableList = res.data.rows
  119. this.pageInfo.total = res.data.total
  120. }
  121. })
  122. },
  123. searchCourseDate (value) {
  124. if (value) {
  125. this.searchForm.startTime = value[0]
  126. this.searchForm.endTime = value[1]
  127. } else {
  128. this.searchForm.startTime = null
  129. this.searchForm.endTime = null
  130. }
  131. },
  132. onReSet () {
  133. this.courseDate = null
  134. this.searchForm = {
  135. startTime: null,
  136. endTime: null,
  137. }
  138. }
  139. }
  140. }
  141. </script>
  142. <style lang="scss">
  143. </style>