123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- <template>
- <div>
- <common @asynCallBack="asynCallBack"></common>
- <top-header :pageTitle="pageTitle" :routeName="'Master'"></top-header>
- <div class="mui-content">
- <div class="mui-content-padded vongi-work">
- <ul class="mui-table-view vongi-qingjia">
- <li class="mui-table-view-cell" v-for="mod in recordList" @click="detail(mod.id)">
- <h4>
- {{mod.title}}
- <span v-text="mod.createTime">12:00</span>
- </h4>
- <button type="button" class="mui-btn mui-btn-outlined" :class="statusColor[mod.status]" v-text="status[mod.status]">
- </button>
- </li>
- </ul>
- </div>
- <div class="fyy-footer">
- <div class="bindfyy-btn"><button type="submit" class="mui-btn mui-btn-primary " @click="save()">写请假条</button></div>
- </div>
- </div>
- <NullList :remark="'暂无请假记录'" v-if="!recordList.length"></NullList>
- <loading :visible="isLoading"></loading>
- </div>
- </template>
- <script>
- import * as API_Leave from '@/apis/Master/leave'
- 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: 'MasterAttendanceLeaveList',
- components: {
- Common,
- Loading,
- TopHeader,NullList
- },
- data() {
- return {
- pageTitle: '请假记录',
- isLoading: false,
- listForm: {
- pageIndex: 1,
- pageSize: 20,
- // token: '',
- totalPage: 1,
- result: 0,
- },
- recordList: [],
- status: ['待审核', '已批准', '已拒绝'],
- statusColor: ['', 'mui-btn-success', 'mui-btn-danger'],
- }
- },
- created() {
- //this.listForm.openId = this.openId;
- //this.listForm.result = this.$route.query.result != null ? this.$route.query.result : 0;
- },
- methods: {
- //info
- detail(id) {
- this.$router.push({
- name: 'MasterAttendanceLeaveInfo',
- query: {
- id: id
- }
- })
- },
- save() {
- this.$router.push({
- name: 'MasterAttendanceLeaveForm',
- query: {
- }
- })
- },
- //获取列表
- getList() {
- this.isLoading = true;
- API_Leave.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;
- }
- }
- },
- asynCallBack() {
- },
- },
- mounted() {
- this.getList();
- //监控下拉加载事件
- var _this = this;
- window.addEventListener('scroll', _this.handleScrool);
- },
- destroyed() {
- //销毁监听事件
- var _this = this;
- window.removeEventListener('scroll', _this.handleScrool);
- },
- computed: {
- ...mapGetters({
- openId: 'wx_openid',
- token: 'token',
- })
- },
- }
- </script>
- <style scoped src="$project/assets/css/xpwyfyy.css"></style>
- <style>
- </style>
|