123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- <template>
- <div>
- <common @asynCallBack="asynCallBack"></common>
- <top-header :pageTitle="pageTitle" :rightLink="rightLink" :doRightLink="doRightLink"></top-header>
- <div class="mui-content">
- <div class="mui-content-padded vongi-work">
- <!-- <h5>2020-09-28</h5> -->
- <ul class="mui-table-view">
- <li v-for="(item,index) in recordList" class="mui-table-view-cell">
- {{item.recordTime}}
- <div class="mui-media-body">
- <button type="button" class="mui-btn mui-btn-primary" v-if="item.result=='1' && item.status=='1'" @click="goToInfo(item.supplementWorkId)">{{item.type=='1'?'已外勤打卡':'已补卡'}}</button>
- <button type="button" class="mui-btn mui-btn-primary" v-if="item.result=='0' && item.status=='3'" @click="goToInfo(item.supplementWorkId)">已拒绝</button>
- <button type="button" class="mui-btn mui-btn-primary" v-if="item.result=='0' && item.status=='0'" @click="goToInfo(item.supplementWorkId)">审核中</button>
- <button type="button" class="mui-btn mui-btn-primary" v-if="item.result=='0' && item.status===null" @click="applybk(item.id,item.recordTime)">申请补卡</button>
- <button type="button" class="mui-btn mui-btn-primary" v-if="item.result=='0' && item.status==='6'" @click="applybk(item.id,item.recordTime)">申请补卡</button>
- <button type="button" class="mui-btn mui-btn-primary" v-if="item.result=='0' && item.status==='-99'" @click="applybk2(item.id,item.recordTime,item.supplementWorkId)">草稿中</button>
-
- <span :style="'color:'+statusColor[item.result]" v-text="status[item.result]">缺卡</span>
- </div>
- </li>
- </ul>
- </div>
- </div>
- <NullList :remark="'暂无考勤记录'" v-if="!recordList.length"></NullList>
- <!--弹窗-->
- <loading :visible="isLoading"></loading>
- </div>
- </template>
- <script>
- import * as API_Attendance from '@/apis/Master/annual'
- import Common from '$project/components/Common.vue'
- import Loading from '$project/components/Loading.vue'
- import TopHeader from '$project/components/TopHeader.vue'
- import isReachBottom from '$project/utils/isReachBottom'
- import NullList from '$project/components/NullList.vue'
- import {
- mapGetters,
- mapMutations
- } from 'vuex'
- export default {
- name: 'MasterAnnualList',
- components: {
- Common,
- Loading,
- TopHeader,
- NullList
- },
- data() {
- return {
- //pageTitle: '考勤记录',
- isLoading: false,
- listForm: {
- pageIndex: 1,
- pageSize: 20,
- totalPage: 1,
- result: 0,
- },
- recordList: [],
- status: ['缺卡', '正常', '迟到', '早退', '请假','出差'],
- statusColor: ['#fe616c', '#05c8af', '#f6f448', '#f6f448', '#f6f448', '#f6f448'],
- rightLink: {
- show: true,
- icon: 'icon-shijian',
- style: 'font-size:14px;color:#000;',
- title: '缺卡记录'
- },
- }
- },
- created() {
- this.listForm.openId = this.openId;
- this.listForm.result = this.$route.query.result != null ? this.$route.query.result : 0;
- },
- methods: {
- //申请补卡
- applybk(id,time) {
- this.$router.push({
- name: 'MasterAnnualApply',
- query: {
- id: id,
- time:time,
-
- }
- })
- },
- //申请补卡
- applybk2(id,time,sid) {
- this.$router.push({
- name: 'MasterAnnualApply',
- query: {
- id: id,
- time:time,
- sid:sid
- }
- })
- },
- //跳转申请补卡详情
- goToInfo(id) {
- this.$router.push({
- name: 'XsyApprovalInfo',
- query: {
- id: id,
- formId:'applyWork'
- }
- })
- },
- //获取列表
- getList() {
- this.isLoading = true;
- API_Attendance.pageList(this.listForm).then(response => {
- if (response) {
- if (this.listForm.pageIndex == 1) {
- this.recordList = response.data;
- this.listForm.pageIndex = response.pageNumber;
- this.listForm.totalPage = response.totalPage;
- } else {
- this.recordList = [
- ...this.recordList,
- ...response.data
- ];
- }
- }
- this.listForm.pageIndex++;
- this.isLoading = false;
- }).catch(error => {
- this.isLoading = false;
- mui.toast(error);
- })
- },
- //下拉事件
- handleScrool() {
- if (isReachBottom()) {
- console.log('到达底部')
- if (this.listForm.pageIndex <= this.listForm.totalPage && this.isLoading == false) {
- this.getList();
- } else {
- return;
- }
- }
- },
- //右上角点击事件
- doRightLink() {
- this.listForm.pageIndex = 1;
- this.listForm.result = this.listForm.result == 1 ? 0 : 1;
- this.getList();
- },
- asynCallBack() {
- },
- },
- mounted() {
- this.getList();
- //监控下拉加载事件
- var _this = this;
- window.addEventListener('scroll', _this.handleScrool);
- },
- destroyed() {
- //销毁监听事件
- var _this = this;
- window.removeEventListener('scroll', _this.handleScrool);
- },
- computed: {
- pageTitle: {
- // getter
- get: function() {
- if (this.listForm.result) {
- return '缺卡记录';
- } else {
- return '考勤记录';
- }
- },
- // setter
- set: function(newValue) {
- console.log(newValue)
- }
- },
- ...mapGetters({
- openId: 'wx_openid',
- token: 'token',
- })
- },
- watch: {
- 'listForm.result': function(newVal, oldVal) {
- if (newVal == 0) {
- this.rightLink.title = '缺卡记录';
- } else {
- this.rightLink.title = '考勤记录';
- }
- }
- },
- //keepalive监控判断
- beforeRouteLeave(to, from, next) {
- console.log(to.name);
- if (['MasterAnnualInfo', 'MasterAnnualApply'].indexOf(to.name) > -1) {
- this.$store.commit('SET_KEEP_ALIVE_COMPONENTS', ['MasterAnnualList'])
- } else {
- this.$store.commit('SET_KEEP_ALIVE_COMPONENTS', [])
- }
- next()
- },
- }
- </script>
- <style scoped src="$project/assets/css/xpwyfyy.css"></style>
- <style src="$project/assets/css/iconfont.css"></style>
- <style scoped>
- </style>
|