<template>
  <el-card class="box">
    <content-box :loading="loading" :tableData="tableData" :pagination="pagination" @getData="getData" />
  </el-card>
</template>
<script>
import contentBox from "./components/content";
import { mapState } from "vuex";
export default {
  data() {
    return {
      params: {}
    };
  },
  computed: {
    ...mapState({
      tableData: state => state.myApply.tableData,
      pagination: state => state.myApply.pagination
    }),
    loading: {
      get() {
        return this.$store.state.myApply.loading;
      },
      set(val) {
        this.$store.state.myApply.loading = val;
      }
    }
  },
  components: {
    contentBox
  },
  methods: {
    getData() {
      this.loading = true;
      this.params = {
        page: this.pagination.pageNum,
        limit: this.pagination.pageSize,
        userId: sessionStorage.getItem("userid")
      };
      this.$store.dispatch("myApply/getData", this.params).catch(err => {
        this.loading = false;
      });
    }
  },
  created() {
    this.getData();
  }
};
</script>
<style lang="scss" scoped>
.box {
  background: #f6f8fc;
  height: 1000px;
}
</style>
