import { mapGetters } from 'vuex';

export default {
  data() {
    return {
      filters: {},
      selected: {},
      selectedList: [],
      editType: 0,
      dialogEditVisible: false,
    };
  },
  computed: {
    ...mapGetters(['loading']),
  },
  created() {
    this.fetchList({
      pageNum: 1,
    });
  },
  methods: {
    fetchList() {},
    searchList() {
      this.changePage(1);
    },
    getFilters() {
      let filters = this.$getFilters(this.filters);
      return filters;
    },
    changePage(index) {
      const filters = this.getFilters();
      this.fetchList({
        ...filters,
        pageNum: index,
      });
    },
    handleSelectionChange(val) {
      this.selectedList = val;
    },
    resetEditDialog(done) {
      this.selected = {};
      done && typeof done == 'function'
        ? done()
        : (this.dialogEditVisible = false);
    },
  },
};
