Blame view

src/utils/mixin/table.js 2.07 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: {
yuanbo committed
24 25 26 27 28
    /**
     * @description: handkeyCode
     * @param {*} e
     * @author: renchao
     */
xiaomiao committed
29 30 31 32 33 34
    handkeyCode(e) {
      if(e.keyCode === 13){
        console.log("安");
        this.handleSearch()
      }
   },
yuanbo committed
35 36 37 38
    /**
     * @description: handleSearch
     * @author: renchao
     */
yangwei committed
39 40 41 42 43 44 45 46 47
    handleSearch(){
      this.pageData.currentPage = 1
      if (this.fetchData) {
        this.fetchData()
      }
      if (this.queryClick) {
        this.queryClick()
      }
    },
yuanbo committed
48 49 50 51 52
    /**
     * @description: handleSizeChange
     * @param {*} val
     * @author: renchao
     */
任超 committed
53
    handleSizeChange (val) {
任超 committed
54
      this.pageData.currentPage = 1
任超 committed
55
      this.pageData.pageSize = val
任超 committed
56
      this.queryClick()
任超 committed
57
    },
yuanbo committed
58 59 60 61 62
    /**
     * @description: handleCurrentChange
     * @param {*} val
     * @author: renchao
     */
任超 committed
63
    handleCurrentChange (val) {
任超 committed
64
      this.pageData.currentPage = val
任超 committed
65 66 67
      if (this.queryClick) {
        this.queryClick()
      }
任超 committed
68
    },
yuanbo committed
69 70 71 72
    /**
     * @description: handleDel
     * @author: renchao
     */
任超 committed
73 74 75 76
    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
77
    },
yuanbo committed
78 79 80 81 82
    /**
     * @description: resetForm
     * @param {*} isYwbl
     * @author: renchao
     */
83 84 85 86 87 88
    resetForm(isYwbl){
      if (isYwbl) {
        this.queryForm = defaultParameters.defaultParameters();
        this.pageData.currentPage = 1;
        this.queryClick()
      }
任超 committed
89
    }
任超 committed
90 91
  }
}