<template>
|
<div
|
class="flex-row-between calendarIteam"
|
:class="isDisabled?'paIteam':''"
|
@click="$emit('checkDayFn')"
|
>
|
<div class="pt-2 pl-2 record-info" v-if="!isDisabled" @click="$emit('recordFn')">
|
<!-- @click="repairFn('attendance:repair')" -->
|
<p class="mb-2 tl">
|
首次:{{data&&data.inTime?data.inTime.slice(11,19):''}}
|
<br>
|
位置:{{data&&data.inDeviceName?data.inDeviceName:''}}
|
</p>
|
<p class="mb-1 tl">
|
末次:{{data&&data.outTime?data.outTime.slice(11,19):''}}
|
<br>
|
位置:{{data&&data.outDeviceName?data.outDeviceName:''}}
|
</p>
|
</div>
|
<div class="pl-1 pr-1">
|
<div v-if="!isDisabled" class="mb-1 pt-1">
|
<!-- <b-button @click="leaveFn('attendance:leave')" size="sm" :variant="data && data.isLeave === 1?'warning':'bg-light'" class="leave-btn">假</b-button> -->
|
<b-button
|
@click="$emit('recordFn')"
|
size="sm"
|
variant="link"
|
class="record-btn text-info"
|
block
|
>
|
<i class="ion d-block ion-ios-pin f25"></i>
|
</b-button>
|
</div>
|
<div class="dayNum" :class="dayCalsss">
|
<slot></slot>
|
</div>
|
</div>
|
</div>
|
</template>
|
<script>
|
export default {
|
name: 'calendarIteam',
|
props: {
|
isDisabled: {
|
type: Boolean,
|
default: false
|
},
|
className: {
|
default: '',
|
type: String
|
},
|
data: {
|
type: Object,
|
default: null
|
}
|
},
|
data() {
|
return {
|
buttonAuthority: sessionStorage.getItem('buttonAuthoritys') || []
|
}
|
},
|
computed: {
|
dayCalsss() {
|
if (!this.data) {
|
return ''
|
}
|
if (this.data.isNotSign === 0) {
|
// 已经签到
|
if (this.data.isRepair === 1) {
|
// return 'repairSign'
|
return 'sign'
|
}
|
return 'sign'
|
} else {
|
// 未签
|
return 'notSign'
|
}
|
},
|
isAdmin() {
|
if (
|
sessionStorage.getItem('userInfo') &&
|
sessionStorage.getItem('userInfo') !== ''
|
) {
|
let loginName = JSON.parse(sessionStorage.getItem('userInfo')).username
|
return loginName === 'admin' || loginName === 'basic'
|
}
|
return false
|
}
|
},
|
methods: {
|
isAuthority(str) {
|
if (this.isAdmin) {
|
return true
|
} else if (this.buttonAuthority.indexOf(',' + str + ',') > -1) {
|
return true
|
} else {
|
return false
|
}
|
},
|
leaveFn() {
|
if (this.isAuthority()) {
|
this.$emit('leaveFn')
|
} else {
|
this.$toast({ message: '抱歉!您没有此权限', type: 'warning' })
|
}
|
},
|
repairFn() {
|
if (this.isAuthority()) {
|
this.$emit('repairFn')
|
} else {
|
this.$toast({ message: '抱歉!您没有此权限', type: 'warning' })
|
}
|
}
|
}
|
}
|
</script>
|
<style lang="scss" scoped>
|
$yellow: #ffa509;
|
// $green: #075a00;
|
|
.paIteam {
|
position: absolute;
|
right: 8px;
|
bottom: 8px;
|
}
|
.leave-btn {
|
padding: 0px 4px;
|
color: #fff;
|
font-size: 16px;
|
}
|
.record-info {
|
font-size: 12px;
|
span {
|
font-size: 13px;
|
}
|
}
|
.dayNum {
|
// border-radius: 25px;
|
margin: 0 5px;
|
}
|
.sign {
|
background: #26b4ff;
|
span,
|
span.weekday {
|
color: #fff !important;
|
}
|
}
|
.notSign {
|
background: $yellow;
|
span,
|
span.weekday {
|
color: #fff !important;
|
}
|
}
|
.repairSign {
|
// background: #d9534f;
|
// background: $green;
|
span,
|
span.weekday {
|
color: #fff !important;
|
}
|
}
|
</style>
|