nGroupStep.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <template>
  2. <!-- 不在在考勤组 -->
  3. <view class="steps">
  4. <!--未打上班卡,在地点和时间范围内,可打卡-->
  5. <clockableView
  6. class="clock-in"
  7. v-if="showViewUp"
  8. :currentTime="currentTime"
  9. @punchClock="punchClock"
  10. />
  11. <!--未打上班卡,在时间范围,不在地点范围内,不可打卡-->
  12. <cannotClockIn
  13. class="clock-in"
  14. v-else-if="showClockInUp"
  15. :currentTime="currentTime"
  16. @reloadLocation="$emit('reloadLocation')"
  17. />
  18. <!-- 不在考勤组的打卡放在外面-->
  19. <u-steps
  20. v-else
  21. :key="enterRangeCode"
  22. dot
  23. :current="current"
  24. direction="column"
  25. >
  26. <u-steps-item>
  27. <view class="go-work-content" slot="desc">
  28. <!--title-->
  29. <view class="step-item-title">
  30. 上班 {{ detailsInfo.clockInTime }}
  31. </view>
  32. <!--content-->
  33. <view class="step-item-content">
  34. <!--已打上班卡(正常、迟到、旷工)-->
  35. <checkedInWork
  36. :detailsInfo="detailsInfo"
  37. v-if="
  38. [
  39. statusKeys.CHECK_IN,
  40. statusKeys.BE_LATE,
  41. statusKeys.ABSENTEEISM,
  42. ].includes(clockStatus)
  43. "
  44. />
  45. <!--未打上班卡,但是已过打卡时间(缺卡)-->
  46. <clockInTimeout
  47. :clockStatus="clockStatus"
  48. v-if="[statusKeys.CHECK_NO].includes(clockStatus)"
  49. />
  50. </view>
  51. </view>
  52. </u-steps-item>
  53. <u-steps-item>
  54. <view class="off-work-content" slot="desc">
  55. <view class="step-item-title-ash">
  56. 下班 {{ detailsInfo.clockOutTime }}
  57. </view>
  58. <view class="step-item-content">
  59. <!--下班为空-还没有到打卡时间-->
  60. <view v-if="notClockingIn" style="color: #8c8c8c">
  61. 未打卡
  62. </view>
  63. <!--已打下班卡(正常、加班、早退、旷工)-->
  64. <checkedInWork
  65. :detailsInfo="detailsInfo"
  66. @punchClock="punchClock"
  67. type="1"
  68. v-if="
  69. [
  70. statusKeys.CHECK_OUT,
  71. statusKeys.OVERTIME,
  72. statusKeys.LEAVE_EARLY,
  73. statusKeys.ABSENTEEISM,
  74. ].includes(clockStatusDown)
  75. "
  76. />
  77. <!--未打下班卡,在地点和时间范围内,可打卡-->
  78. <clockableView
  79. v-else-if="showViewDown"
  80. type="1"
  81. :currentTime="currentTime"
  82. @punchClock="punchClock"
  83. />
  84. <!--未打下班卡,在时间范围,不在地点范围内,不可打卡-->
  85. <cannotClockIn
  86. v-else-if="showClockInDown"
  87. type="1"
  88. :clockAddr="clockAddr"
  89. :currentTime="currentTime"
  90. @reloadLocation="$emit('reloadLocation')"
  91. />
  92. <!--未打下班卡,但是已过打卡时间(缺卡)-->
  93. <clockInTimeout
  94. type="1"
  95. :clockStatus="clockStatusDown"
  96. v-if="[statusKeys.CHECK_NO].includes(clockStatusDown)"
  97. />
  98. </view>
  99. </view>
  100. </u-steps-item>
  101. </u-steps>
  102. </view>
  103. </template>
  104. <script>
  105. import cannotClockIn from '@/pages/attendanceClock/workContent/cannotClockIn.vue'; // 不在打卡范围内,不可打卡
  106. import checkedInWork from '@/pages/attendanceClock/workContent/checkedInWork.vue'; // 已打上班卡
  107. import clockInTimeout from '@/pages/attendanceClock/workContent/clockInTimeout.vue'; // 未打卡(缺卡)
  108. import clockableView from '@/pages/attendanceClock/workContent/clockableView.vue'; // 在打卡范围内,可打卡状态
  109. import { statusKeys } from '@/pages/attendanceClock/com/allCheckData.js';
  110. export default {
  111. name: 'nGroupStep',
  112. components: {
  113. cannotClockIn,
  114. checkedInWork,
  115. clockInTimeout,
  116. clockableView,
  117. },
  118. props: {
  119. enterRangeCode: String, // 0不在范围内 1在范围内
  120. clockAddr: String, // 地点名,不在考勤范围内需显示
  121. detailsInfo: {
  122. // 打卡详情
  123. default: () => ({}),
  124. type: Object,
  125. },
  126. current: Number, // 当前steps
  127. currentTime: String, // hh:MM:ss 本机时间
  128. },
  129. computed: {
  130. // 上班---
  131. clockStatus() {
  132. // 上班status
  133. const detailVO = this.detailsInfo?.clockInDetailVO || {};
  134. return detailVO.status;
  135. },
  136. showViewUp() {
  137. // enterRangeCode在打卡范围 并且 步骤为0 并且上班打卡状态为null
  138. const { enterRangeCode, current, clockStatus } = this;
  139. return enterRangeCode === '1' && current === 0 && !clockStatus;
  140. },
  141. showClockInUp() {
  142. // enterRangeCode不在在打卡范围 并且 步骤为0 并且上班打卡状态为null
  143. const { enterRangeCode, current, clockStatus } = this;
  144. return enterRangeCode === '0' && current === 0 && !clockStatus;
  145. },
  146. // 下班---
  147. notClockingIn() {
  148. // 步骤为0 并且 下班打卡的状态为空
  149. return this.current === 0 && !this.clockStatusDown;
  150. },
  151. clockStatusDown() {
  152. // 下班status
  153. const detailVO = this.detailsInfo?.clockOutDetailVO || {};
  154. return detailVO.status;
  155. },
  156. showViewDown() {
  157. // 在打卡范围 并且 步骤为1 并且 下班打卡的状态为null
  158. const { enterRangeCode, current, clockStatusDown } = this;
  159. return (
  160. enterRangeCode === '1' && current === 1 && clockStatusDown
  161. );
  162. },
  163. showClockInDown() {
  164. // 不在在打卡范围 并且 步骤为1
  165. const { enterRangeCode, current, clockStatusDown } = this;
  166. return (
  167. enterRangeCode === '0' && current === 1 && !clockStatusDown
  168. );
  169. },
  170. // com
  171. },
  172. data() {
  173. return {
  174. statusKeys,
  175. };
  176. },
  177. methods: {
  178. punchClock(type) {
  179. this.$emit('punchClock', type); //0上班,1下班,2更新打卡
  180. },
  181. },
  182. };
  183. </script>
  184. <style scoped lang="scss">
  185. .steps {
  186. /deep/.u-steps-item__wrapper__dot {
  187. width: 8px;
  188. height: 8px;
  189. }
  190. /deep/ .u-steps-item__wrapper {
  191. background-color: #f8f8f8;
  192. }
  193. .clock-in {
  194. background-color: #fff;
  195. border-radius: $bd-radius;
  196. padding: 40rpx;
  197. }
  198. .step-item-title {
  199. color: #152f62;
  200. font-size: 14px;
  201. }
  202. .step-item-title-ash {
  203. font-size: 14px;
  204. color: #656972;
  205. }
  206. .step-item-content {
  207. position: relative;
  208. padding: 40rpx;
  209. background-color: #fff;
  210. border-radius: 4px;
  211. margin-top: 8rpx;
  212. }
  213. }
  214. </style>