123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- <template>
- <div>
- <van-nav-bar title="请假明细" left-text="返回" left-arrow @click-left="$route_back" />
- <scroller>
- <div class="calculateDetail">
- <div class="header">
- 将在出勤统计中计为
- <div class="detail">共请假 {{ absent_time }} 小时</div>
- </div>
- <div class="timeLine">
- <div class="item" v-for="(item, idx) of day_list" :key="idx">
- <div class="hour">{{ item.hour }}小时</div>
- <div class="date">{{ item.day }} {{ item.day_week }}</div>
- <div class="progross">
- <div :style="{ width: (item.hour / 24) * 6.52 + 'rem', left: calculateRangeLeft(item.start_time) + 'rem' }" class="range">
- 请假{{ item.start_time }}~{{ item.end_time }}
- </div>
- </div>
- <div class="bottom">
- <div class="start">00:00</div>
- <div class="end">24:00</div>
- </div>
- </div>
- </div>
- </div>
- </scroller>
- </div>
- </template>
- <script>
- export default {
- data() {
- return {
- absent_time: 0,
- day_list: [],
- rangeWidth: 0, // 6.52
- rangeLeft: 0 // 6.52
- };
- },
- computed: {
- // rangeWidth () {
- // return (2 / 9) * 6.52
- // }
- },
- created() {
- this.calculateHolidayTime();
- },
- methods: {
- calculateRangeLeft(startTime) {
- let hour = Number(startTime.split(':')[0]);
- let minute = startTime.split(':')[1] / 60;
- return ((hour + minute) / 24) * 6.52;
- },
- calculateHolidayTime() {
- // 获取假期余额
- this.$axiosKq('get', '/ad/review/calculate', {
- rule_id: this.$route.query.vacation,
- start_time: this.$route.query.startTime,
- end_time: this.$route.query.endTime
- })
- .then(res => {
- if (res.data.code == 1) {
- this.day_list = res.data.data.day_list;
- this.absent_time = res.data.data.absent_time;
- // this.vacationType = res.data.data.list
- } else {
- this.$toast(res.data.msg);
- }
- })
- .catch(e => {
- console.log(e);
- });
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- $fontColor: #909399;
- .calculateDetail {
- margin-top: 1rem;
- padding: 0.34rem 0.24rem 1.5rem;
- }
- .header {
- padding: 0.3rem 0.5rem;
- border-radius: 0.12rem;
- background-color: rgb(51, 150, 251);
- color: #fff;
- font-size: 0.28rem;
- & .detail {
- font-size: 0.4rem;
- }
- }
- .timeLine {
- margin-top: 0.4rem;
- .item {
- padding-left: 0.5rem;
- padding-bottom: 0.8rem;
- position: relative;
- &::after {
- content: '';
- position: absolute;
- top: 0.1rem;
- left: 0;
- width: 0.26rem;
- height: 0.26rem;
- border-radius: 50%;
- border: 0.04rem solid rgb(51, 150, 251);
- }
- &::before {
- content: '';
- position: absolute;
- top: 0.35rem;
- left: 0.12rem;
- width: 0.02rem;
- height: 92%;
- border-radius: 50%;
- background-color: #eee;
- }
- &:last-child::before {
- content: '';
- height: 0;
- }
- &.rest::after {
- border: 0.04rem solid rgb(177, 177, 177);
- }
- .hour {
- color: rgb(51, 150, 251);
- &.rest {
- color: #909399;
- }
- }
- .date {
- font-size: 0.26rem;
- line-height: 0.48rem;
- &.rest {
- color: #909399;
- }
- }
- .progross {
- border-bottom: 0.06rem solid rgb(241, 225, 138);
- .range {
- background-color: rgb(234, 247, 255);
- height: 0.5rem;
- line-height: 0.5rem;
- font-size: 0.22rem;
- color: rgb(70, 150, 209);
- border-top-right-radius: 0.1rem;
- border-top-left-radius: 0.1rem;
- text-align: center;
- white-space: nowrap;
- position: relative;
- }
- }
- .bottom {
- display: flex;
- justify-content: space-between;
- font-size: 0.22rem;
- color: $fontColor;
- margin-top: 0.04rem;
- }
- }
- }
- </style>
|