campusListPage.js 1.49 KB
Newer Older
姜雷 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
import { mapGetters, mapActions } from 'vuex';

export default {
  data() {
    return {
      filters: {},
      selected: {},
      selectedList: [],
      editType: 0,
      dialogEditVisible: false,
    };
  },
  computed: {
    ...mapGetters(['loading', 'campusList']),
  },
  created() {
    let campusPromise = null;
    if (this.campusList && this.campusList.length) {
      campusPromise = new Promise(resolve => resolve());
    } else {
      campusPromise = this.fetchCampusList();
    }
    campusPromise.then(() => {
      if (this.campusId) {
        this.filters.campusId = this.campusId;
      } else if (this.campusList.length === 1) {
        this.filters.campusId = this.campusList[0].oldCampusid;
      }
    });
  },
  methods: {
    ...mapActions(['fetchCampusList']), //权限校区
    fetchList() {},
    searchList() {
      this.changePage(1);
    },
    refreshList() {
      this.changePage(1);
    },
    getFilters() {
      let filters = this.$getFilters(this.filters);
      return filters;
    },
    changePage(index) {
      const filters = this.getFilters();
      this.fetchList({
        ...filters,
        pageNum: index,
      });
    },
    changeSizeHandle(pageSize) {
      const filters = this.getFilters();
      this.fetchList({
        ...filters,
        pageNum: 1,
        pageSize: pageSize,
      });
      this.updatePagination({
        pageNum: 1,
        pageSize: pageSize,
      });
    },
    handleSelectionChange(val) {
      this.selectedList = val;
    },
  },
};