123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320 |
- <template>
- <view class="tabPage" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
- <cus-header title='统计' :showback="false"></cus-header>
- <div class="card">
- <div class="c_top">
- <div class="ct_left" @tap="show=true">{{currentDay}}</div>
- <div class="ct_right">统计截至{{currentTime}}</div>
- </div>
- <div class="c_nums">
- <div class="cn_pre">
- <p>{{clockDays}}</p>
- <p class="text">出勤天数</p>
- </div>
- <div class="cn_pre">
- <p>{{workHours}}</p>
- <p class="text">总工时</p>
- </div>
- <div class="cn_pre">
- <p>{{mealTimes}}</p>
- <p class="text">餐补次数</p>
- </div>
- </div>
- <div class="c_calendar">
- <Calendar ref="calendarRef" @selectDay="selectDay" @selectInfo="selectInfo"></Calendar>
- </div>
- <div class="c_tip" v-if="info.iswd">当日班次:{{'固定上下班'}} 班次 {{workingTime||'08:30'}}-{{offWorkTime||'17:30'}}</div>
- <div class="c_tip" v-else>当日班次:{{info.iswd===undefined?'- -':'休息'}}</div>
- <div class="c_tip" v-if="info.iswd!==undefined">出勤统计:打卡{{info.clockTimes||0}}次,工时{{info.workHours||0}}小时</div>
- <div class="c_tip" v-else>出勤统计:- -</div>
- <div class="c_time" v-if="info&&info.status==1">
- <image :src="imgBase+'clockingin/time_line.png'"></image>
- <div class="ct_info">
- <div class="cti_pre" v-if="info.sbTime">
- <div class="ctip_left">
- <div class="text">
- 上班 {{info.sbTime}}
- <div class="wc">外出</div>
- </div>
- <div class="addr">
- <image :src="imgBase+'clockingin/location_inactive.png'"></image>
- <span>{{info.position||'谷锐特设备自动化有限公司'}}</span>
- </div>
- </div>
- <div class="ctip_right" v-if="info.file">
- <image :src="info.file"></image>
- </div>
- </div>
- <div class="cti_pre" v-else>
- <div class="ctip_left">
- <div class="text">未打卡</div>
- </div>
- </div>
- <div class="cti_pre" v-if="info.xbTime">
- <div class="ctip_left">
- <div class="text">
- 下班 {{info.xbTime}}
- <div class="wc">外出</div>
- </div>
- <div class="addr">
- <image :src="imgBase+'clockingin/location_inactive.png'"></image>
- <span>{{info.position||'谷锐特设备自动化有限公司'}}</span>
- </div>
- </div>
- <div class="ctip_right" v-if="info.file">
- <image :src="info.file"></image>
- </div>
- </div>
- <div class="cti_pre" v-else>
- <div class="ctip_left">
- <div class="text">未打卡</div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <u-datetime-picker :itemHeight="88" :show="show" v-model="yearMonth" mode="year-month" @confirm="confirm" @cancel="show=false" :immediateChange="true" :minDate="minDate" :maxDate="maxDate"></u-datetime-picker>
- <Tabbar :tabbarIndex="1"></Tabbar>
- </view>
- </template>
- <script>
- import Calendar from './components/CusCalendar/index.vue'
- import Tabbar from '@/components/CusTabbar/clock.vue'
- export default {
- components:{ Calendar,Tabbar },
- data(){
- return {
- workingTime:'',
- offWorkTime:'',
- currentDay:'',
- currentTime:'',
- clockDays:'',
- workHours:'',
- mealTimes:'',
- show:false,
- yearMonth:new Date().Format('yyyy-MM'),
- minDate:'',
- maxDate:'',
- userInfo:null,
- list:[],
- info:null,
- ruleWeeks:[],
- }
- },
- async onLoad() {
- this.currentDay = new Date().Format('yyyy MM.dd');
- this.currentTime = new Date().Format('yyyy-MM-dd hh:mm');
- if(uni.getStorageSync('userInfo')){
- this.userInfo = JSON.parse(uni.getStorageSync('userInfo'));
- }
- await this.getRules();
- this.getUserMonthClock(new Date().getFullYear(),new Date().getMonth()+1);
- },
- mounted() {
- let d = new Date();
- this.minDate = new Date(d.getFullYear()-1,d.getMonth()+1,d.getDate()).getTime();
- this.maxDate = new Date().getTime();
- },
- methods:{
- getRules(){
- return new Promise((resolve,reject)=>{
- this.$api.get('/wms/outsourced/attendance/rule').then(res=>{
- if(res.data.code!==0) return this.$showToast(res.data.msg)
- this.workingTime = res.data.data.workingTime.slice(0,5);
- this.offWorkTime = res.data.data.offWorkTime.slice(0,5);
- let rw = res.data?.data?.checkInOfWeek.split(',').map(r=> Number(r) - 1);
- this.ruleWeeks = rw;
- resolve()
- })
- })
- },
- getUserMonthClock(year,month){
- this.$api.get('/wms/outsourced/attendance/listByUserId',{
- outUserId:this.userInfo.id,
- queryMoth:this.yearMonth
- }).then(res=>{
- if(res.data.code!==0) return this.$showToast(res.data.msg)
- this.clockDays = res.data.data.filter(d=>d.isLeave!=3)?.length;
- this.workHours = res.data.data.reduce((a,b)=>a+Number(b.workingHours),0);
- this.mealTimes = res.data.data.reduce((a,b)=>a+Number(b.mealTimes),0);
-
- this.$refs.calendarRef.ruleWeeks = this.ruleWeeks;
- this.$refs.calendarRef.clockList = res.data.data||[];
- this.$refs.calendarRef.getDataByMonth(year,month);
- })
- },
- async selectDay(obj){
- this.currentDay = new Date(obj.year,obj.month-1,1).Format('yyyy MM.dd');
- this.$refs.calendarRef.year = obj.year;
- this.$refs.calendarRef.month = obj.month;
- this.yearMonth = new Date(obj.year,obj.month-1,1).Format('yyyy-MM');
- this.getUserMonthClock(obj.year,obj.month);
- // let idx = this.$refs.calendarList.findIndex(c=>c.month==obj.month);
- // this.$set(this.$refs.calendarList[idx],'select',true);
- },
- selectInfo(info){
- this.info = info;
- },
- confirm(e){
- this.currentDay = new Date(e.value).Format('yyyy MM.dd');
- let year = new Date(e.value).Format('yyyy');
- let month = Number(new Date(e.value).Format('MM'));
- this.$refs.calendarRef.year = year;
- this.$refs.calendarRef.month = month;
- this.yearMonth = new Date(e.value).Format('yyyy-MM');
- this.getUserMonthClock(year,month);
- this.info = {status:0}
- this.show = false;
- },
- }
- }
- </script>
- <style scoped lang="less">
- .tabPage{
- padding: 0 24rpx 188rpx;
- background: #F4F8FB;
-
- .card{
- background: #FFFFFF;
- border-radius: 16rpx;
- padding: 40rpx 30rpx;
- margin-top: 20rpx;
-
- .c_top{
- display: flex;
- align-items: center;
- justify-content: space-between;
- .ct_left{
- font-family: PingFang-SC, PingFang-SC;
- font-weight: bold;
- font-size: 32rpx;
- color: #1D2129;
- line-height: 45rpx;
- }
- .ct_right{
- font-family: PingFangSC, PingFang SC;
- font-weight: 400;
- font-size: 24rpx;
- color: #86909C;
- line-height: 33rpx;
- text-align: right;
- }
- }
-
- .c_nums{
- display: flex;
- margin-top: 54rpx;
- .cn_pre{
- width: calc(100% / 3);
- display: flex;
- flex-direction: column;
- align-items: center;
- p{
- font-family: PingFang-SC, PingFang-SC;
- font-weight: bold;
- font-size: 36rpx;
- color: #1D2129;
- line-height: 36rpx;
- text-align: center;
- &.text{
- font-weight: 400;
- font-size: 24rpx;
- color: #86909C;
- line-height: 24rpx;
- margin-top: 16rpx;
- }
- }
- }
- }
-
- .c_calendar{
- border-top: 1rpx solid #EFEFEF;
- border-bottom: 1rpx solid #EFEFEF;
- margin-top: 36rpx;
- padding: 20rpx 0;
- }
-
- .c_tip{
- font-family: PingFangSC, PingFang SC;
- font-weight: 400;
- font-size: 24rpx;
- color: #86909C;
- line-height: 24rpx;
- text-align: left;
- margin-top: 24rpx;
- }
-
- .c_time{
- margin-top: 40rpx;
- display: flex;
- align-items: center;
- &>image{
- width: 10rpx;
- height: 155rpx;
- }
- .ct_info{
- width: 100%;
- margin-left: 10rpx;
- .cti_pre{
- display: flex;
- align-items: center;
- justify-content: space-between;
- &:last-child{
- margin-top: 48rpx;
- }
- .ctip_left{
- .text{
- font-family: PingFang-SC, PingFang-SC;
- font-weight: bold;
- font-size: 32rpx;
- color: #1D2129;
- line-height: 32rpx;
- position: relative;
- .wc{
- width: 64rpx;
- height: 42rpx;
- border: 4rpx solid #2E69EB;
- font-family: PingFang-SC, PingFang-SC;
- font-weight: bold;
- font-size: 24rpx;
- color: #2E69EB;
- line-height: 42rpx;
- text-align: center;
- position: absolute;
- left: 180rpx;
- top: 50%;
- margin-top: -21rpx;
- }
- }
- .addr{
- display: flex;
- align-items: center;
- margin-top: 27rpx;
- image{
- width: 24rpx;
- height: 24rpx;
- }
- span{
- font-family: PingFangSC, PingFang SC;
- font-weight: 400;
- font-size: 24rpx;
- color: #86909C;
- line-height: 24rpx;
- margin-left: 8rpx;
- }
- }
- }
- .ctip_right{
- image{
- width: 80rpx;
- height: 80rpx;
- }
- }
- }
- }
- }
- }
- }
- </style>
|