Blame view

src/utils/mixin/table.js 1.55 KB
xiaomiao committed
1
import { log } from 'bpmn-js-token-simulation';
任超 committed
2
import { mapGetters } from 'vuex'
3
import { defaultParameters } from "../../views/ywbl/ywsq/javascript/publicDefaultPar";
任超 committed
4
export default {
任超 committed
5 6 7 8 9 10 11 12
  data () {
    return {
      pageData: {
        currentPage: 1,
        pageSize: 10
      }
    }
  },
xiaomiao committed
13 14 15
  created() {

},
任超 committed
16 17 18
  computed: {
    ...mapGetters(['dictData']),
  },
任超 committed
19
  mounted () {
xiaomiao committed
20
    window.addEventListener('keydown', this.handkeyCode, true)//开启监听键盘按下事件
yangwei committed
21
    this.handleSearch()
任超 committed
22
  },
任超 committed
23
  methods: {
xiaomiao committed
24 25 26 27 28 29
    handkeyCode(e) {
      if(e.keyCode === 13){
        console.log("安");
        this.handleSearch()
      }
   },
yangwei committed
30 31 32 33 34 35 36 37 38
    handleSearch(){
      this.pageData.currentPage = 1
      if (this.fetchData) {
        this.fetchData()
      }
      if (this.queryClick) {
        this.queryClick()
      }
    },
任超 committed
39
    handleSizeChange (val) {
任超 committed
40
      this.pageData.currentPage = 1
任超 committed
41
      this.pageData.pageSize = val
任超 committed
42
      this.queryClick()
任超 committed
43 44
    },
    handleCurrentChange (val) {
任超 committed
45
      this.pageData.currentPage = val
任超 committed
46 47 48
      if (this.queryClick) {
        this.queryClick()
      }
任超 committed
49 50 51 52 53
    },
    handleDel () {
      let deleteAfterPage = Math.ceil((this.tableData.total - 1) / this.pageData.pageSize)
      let currentPage = this.pageData.currentPage > deleteAfterPage ? deleteAfterPage : this.pageData.currentPage
      this.pageData.currentPage = currentPage < 1 ? 1 : currentPage
54 55 56 57 58 59 60
    },
    resetForm(isYwbl){
      if (isYwbl) {
        this.queryForm = defaultParameters.defaultParameters();
        this.pageData.currentPage = 1;
        this.queryClick()
      }
任超 committed
61
    }
任超 committed
62 63
  }
}