CalculateDetail.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <div>
  3. <van-nav-bar title="请假明细" left-text="返回" left-arrow @click-left="$route_back" />
  4. <scroller>
  5. <div class="calculateDetail">
  6. <div class="header">
  7. 将在出勤统计中计为
  8. <div class="detail">共请假 {{ absent_time }} 小时</div>
  9. </div>
  10. <div class="timeLine">
  11. <div class="item" v-for="(item, idx) of day_list" :key="idx">
  12. <div class="hour">{{ item.hour }}小时</div>
  13. <div class="date">{{ item.day }} {{ item.day_week }}</div>
  14. <div class="progross">
  15. <div :style="{ width: (item.hour / 24) * 6.52 + 'rem', left: calculateRangeLeft(item.start_time) + 'rem' }" class="range">
  16. 请假{{ item.start_time }}~{{ item.end_time }}
  17. </div>
  18. </div>
  19. <div class="bottom">
  20. <div class="start">00:00</div>
  21. <div class="end">24:00</div>
  22. </div>
  23. </div>
  24. </div>
  25. </div>
  26. </scroller>
  27. </div>
  28. </template>
  29. <script>
  30. export default {
  31. data() {
  32. return {
  33. absent_time: 0,
  34. day_list: [],
  35. rangeWidth: 0, // 6.52
  36. rangeLeft: 0 // 6.52
  37. };
  38. },
  39. computed: {
  40. // rangeWidth () {
  41. // return (2 / 9) * 6.52
  42. // }
  43. },
  44. created() {
  45. this.calculateHolidayTime();
  46. },
  47. methods: {
  48. calculateRangeLeft(startTime) {
  49. let hour = Number(startTime.split(':')[0]);
  50. let minute = startTime.split(':')[1] / 60;
  51. return ((hour + minute) / 24) * 6.52;
  52. },
  53. calculateHolidayTime() {
  54. // 获取假期余额
  55. this.$axiosKq('get', '/ad/review/calculate', {
  56. rule_id: this.$route.query.vacation,
  57. start_time: this.$route.query.startTime,
  58. end_time: this.$route.query.endTime
  59. })
  60. .then(res => {
  61. if (res.data.code == 1) {
  62. this.day_list = res.data.data.day_list;
  63. this.absent_time = res.data.data.absent_time;
  64. // this.vacationType = res.data.data.list
  65. } else {
  66. this.$toast(res.data.msg);
  67. }
  68. })
  69. .catch(e => {
  70. console.log(e);
  71. });
  72. }
  73. }
  74. };
  75. </script>
  76. <style lang="scss" scoped>
  77. $fontColor: #909399;
  78. .calculateDetail {
  79. margin-top: 1rem;
  80. padding: 0.34rem 0.24rem 1.5rem;
  81. }
  82. .header {
  83. padding: 0.3rem 0.5rem;
  84. border-radius: 0.12rem;
  85. background-color: rgb(51, 150, 251);
  86. color: #fff;
  87. font-size: 0.28rem;
  88. & .detail {
  89. font-size: 0.4rem;
  90. }
  91. }
  92. .timeLine {
  93. margin-top: 0.4rem;
  94. .item {
  95. padding-left: 0.5rem;
  96. padding-bottom: 0.8rem;
  97. position: relative;
  98. &::after {
  99. content: '';
  100. position: absolute;
  101. top: 0.1rem;
  102. left: 0;
  103. width: 0.26rem;
  104. height: 0.26rem;
  105. border-radius: 50%;
  106. border: 0.04rem solid rgb(51, 150, 251);
  107. }
  108. &::before {
  109. content: '';
  110. position: absolute;
  111. top: 0.35rem;
  112. left: 0.12rem;
  113. width: 0.02rem;
  114. height: 92%;
  115. border-radius: 50%;
  116. background-color: #eee;
  117. }
  118. &:last-child::before {
  119. content: '';
  120. height: 0;
  121. }
  122. &.rest::after {
  123. border: 0.04rem solid rgb(177, 177, 177);
  124. }
  125. .hour {
  126. color: rgb(51, 150, 251);
  127. &.rest {
  128. color: #909399;
  129. }
  130. }
  131. .date {
  132. font-size: 0.26rem;
  133. line-height: 0.48rem;
  134. &.rest {
  135. color: #909399;
  136. }
  137. }
  138. .progross {
  139. border-bottom: 0.06rem solid rgb(241, 225, 138);
  140. .range {
  141. background-color: rgb(234, 247, 255);
  142. height: 0.5rem;
  143. line-height: 0.5rem;
  144. font-size: 0.22rem;
  145. color: rgb(70, 150, 209);
  146. border-top-right-radius: 0.1rem;
  147. border-top-left-radius: 0.1rem;
  148. text-align: center;
  149. white-space: nowrap;
  150. position: relative;
  151. }
  152. }
  153. .bottom {
  154. display: flex;
  155. justify-content: space-between;
  156. font-size: 0.22rem;
  157. color: $fontColor;
  158. margin-top: 0.04rem;
  159. }
  160. }
  161. }
  162. </style>