checkWorkAttendance.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <!-- 考勤统计 -->
  2. <template>
  3. <view class="container">
  4. <view class="table">
  5. <view class="table-date" v-if="currentDate">{{ currentDate.join(' 至 ') }}</view>
  6. <view class="table-search">
  7. <view class="table-search-item">
  8. <u--input class="input" placeholder="请输入工号" v-model="payeeNo"></u--input>
  9. </view>
  10. <view class="table-search-item">
  11. <u--input class="input" placeholder="请输入姓名" v-model="payeeName"></u--input>
  12. </view>
  13. <view class="table-search-item">
  14. <u-button class="btn" text="确认"
  15. color="linear-gradient(157deg, #FECF4C 4%, #FECF4B 5%, #FCA225 100%)" :loading="loading" @click="confirm"></u-button>
  16. </view>
  17. </view>
  18. <view class="table-box">
  19. <TableRanking :loading="loading" :padding="'0'" :tableTh="tableTh" :tableData="tableData"
  20. @pageChange="pageChange" />
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. import TableRanking from '@/components/tableRanking.vue'
  27. export default {
  28. components: {
  29. TableRanking
  30. },
  31. props: {
  32. tableTh: {
  33. type: Array,
  34. default: () => {
  35. return [{
  36. field: '工号',
  37. width: 80,
  38. key: 'payeeNo'
  39. },
  40. {
  41. field: '姓名',
  42. width: 90,
  43. key: 'payeeName'
  44. },
  45. {
  46. field: '实出勤(天)',
  47. width: 70,
  48. key: 'realDays'
  49. },
  50. {
  51. field: '缺勤(天)',
  52. width: 70,
  53. key: 'missDays'
  54. },
  55. {
  56. field: '缺卡(次)',
  57. width: 70,
  58. key: 'missPunchCount'
  59. },
  60. {
  61. field: '早退(次)',
  62. width: 70,
  63. key: 'leavePunchCount'
  64. },
  65. ]
  66. }
  67. }
  68. },
  69. data() {
  70. return {
  71. loading: false,
  72. tableData: {
  73. current: 1,
  74. total: 0,
  75. list: []
  76. },
  77. currentDate: [],
  78. beginTime: undefined,
  79. endTime: undefined,
  80. payeeNo: undefined,
  81. payeeName: undefined
  82. }
  83. },
  84. methods: {
  85. getData(data) {
  86. if (data.length) {
  87. this.beginTime = data[0]
  88. this.endTime = data[1]
  89. } else {
  90. this.beginTime = undefined
  91. this.endTime = undefined
  92. }
  93. this.currentDate = data
  94. this.tableData.current = 1
  95. this.getPunchList()
  96. },
  97. getPunchList() {
  98. this.loading = true
  99. uni.$u.api.statisticalReportApi.getPunchListApi({
  100. beginTime: this.beginTime,
  101. endTime: this.endTime,
  102. payeeNo: this.payeeNo,
  103. payeeName: this.payeeName,
  104. pageNum: this.tableData.current,
  105. pageSize: 10
  106. }).then(res => {
  107. if (res.code === 200) {
  108. this.tableData.list = res.rows
  109. this.tableData.total = res.total
  110. }
  111. this.loading = false
  112. })
  113. },
  114. pageChange(cur) {
  115. this.tableData.current = cur
  116. this.getPunchList()
  117. },
  118. confirm() {
  119. this.tableData.current = 1
  120. this.getPunchList()
  121. }
  122. }
  123. }
  124. </script>
  125. <style lang="scss" scoped>
  126. @import './report.scss';
  127. </style>