checkedInWork.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template>
  2. <!--已打卡-->
  3. <view class="checked-in-work">
  4. <view class="cw-header">
  5. <view>
  6. <text class="cw-title">已打卡</text>
  7. <text
  8. :class="currentInfo.status"
  9. class="status-com-txt"
  10. v-if="isShowStatus"
  11. >
  12. {{ punchStatus }}
  13. </text>
  14. </view>
  15. <c-button
  16. type="text"
  17. v-if="type === '1' && !notShowUpdate"
  18. @click="punchClock"
  19. >
  20. 更新下班卡
  21. </c-button>
  22. </view>
  23. <view class="time-box">
  24. <text class="label">打卡时间</text>
  25. <text class="value">{{ currentInfo.clockTime }}</text>
  26. <text class="clock-in-type" v-if="currentInfo.checkAddr">{{
  27. currentInfo.checkAddr
  28. }}</text>
  29. </view>
  30. <view class="place-box">
  31. <text class="label">打卡地点</text>
  32. <text class="value">{{ currentInfo.clockAddr }}</text>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import {
  38. checkStatus,
  39. checkOutStatus,
  40. statusKeys,
  41. } from '@/pages/attendanceClock/com/allCheckData.js';
  42. export default {
  43. name: 'checkedInWork',
  44. props: {
  45. notShowUpdate: Boolean,
  46. type: {
  47. default: '0', // 0上班,1下班
  48. type: String,
  49. },
  50. detailsInfo: {
  51. // 打卡详情
  52. default: () => ({}),
  53. type: Object,
  54. },
  55. },
  56. data() {
  57. return {
  58. checkStatus,
  59. checkOutStatus,
  60. };
  61. },
  62. computed: {
  63. currentInfo() {
  64. if (this.type === '0') {
  65. // 上班info
  66. return this.clockInVO;
  67. }
  68. return this.clockOutVO;
  69. },
  70. clockInVO() {
  71. // 上班info
  72. return this.detailsInfo.clockInDetailVO || {}; // 上班info
  73. },
  74. clockOutVO() {
  75. // 下班info
  76. return this.detailsInfo.clockOutDetailVO || {}; // 下班info
  77. },
  78. isShowStatus() {
  79. const { BE_LATE, OVERTIME, LEAVE_EARLY, ABSENTEEISM } =
  80. statusKeys;
  81. const arr = [BE_LATE, OVERTIME, LEAVE_EARLY, ABSENTEEISM];
  82. const status = this.currentInfo.status;
  83. return arr.includes(status);
  84. },
  85. punchStatus() {
  86. const status = this.currentInfo.status;
  87. let statusStr = '';
  88. if (this.type === '0') {
  89. statusStr = checkStatus.find(
  90. (item) => item.value === status
  91. )?.label;
  92. }
  93. if (this.type === '1') {
  94. statusStr = checkOutStatus.find(
  95. (item) => item.value === status
  96. )?.label;
  97. }
  98. return statusStr;
  99. },
  100. },
  101. methods: {
  102. punchClock() {
  103. this.$emit('punchClock', '2'); // 2:更新打卡成功
  104. },
  105. },
  106. };
  107. </script>
  108. <style scoped lang="scss">
  109. .checked-in-work {
  110. line-height: 23px;
  111. .cw-title {
  112. color: #152f62;
  113. }
  114. .cw-header {
  115. display: flex;
  116. justify-content: space-between;
  117. }
  118. .status-com-txt {
  119. font-size: 12px;
  120. color: #fff;
  121. padding: 2px 4px;
  122. margin-left: 12px;
  123. border-radius: 4px;
  124. }
  125. .BE_LATE {
  126. background-color: #ff9935;
  127. }
  128. .LEAVE_EARLY {
  129. background-color: #ff5e59;
  130. }
  131. .OVERTIME {
  132. background-color: #436ff6;
  133. }
  134. .ABSENTEEISM {
  135. background-color: #ff5e59;
  136. }
  137. .time-box,
  138. .place-box {
  139. font-size: 12px;
  140. .label {
  141. color: #152f62;
  142. }
  143. .value {
  144. color: #697c9d;
  145. margin-left: 5px;
  146. }
  147. }
  148. .clock-in-type {
  149. color: #fff;
  150. padding: 2px 4px;
  151. background-color: #436ff6;
  152. margin-left: 24rpx;
  153. font-size: 12px;
  154. border-radius: 4px;
  155. }
  156. }
  157. </style>