zouyu
2023-11-16 a4add192450f06f9e4748e6513234510f431b21e
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
<template>
  <basic-container>
    <avue-crud ref="crud"
               :page="page"
               :data="tableData"
               :table-loading="tableLoading"
               :option="tableOption"
               @on-load="getList"
               @refresh-change="refreshChange"
               @size-change="sizeChange"
               @current-change="currentChange">
    </avue-crud>
  </basic-container>
 
</template>
<script>
  import {getGenTable} from '@/api/gen/gen'
  import {tableColumnOption} from '@/const/crud/gen/gen'
 
  export default {
    name: "GenEdit",
    props: {
      queryData: {}
    },
    data() {
      return {
        tableData: [],
        page: {
          total: 0, // 总页数
          currentPage: 1, // 当前页数
          pageSize: 20 // 每页显示多少条
        },
        tableLoading: false,
        tableOption: tableColumnOption
      };
    },
    methods: {
      getList(page) {
        this.tableLoading = true
        getGenTable(Object.assign({
          current: page.currentPage,
          size: page.pageSize
        }, this.queryData)).then(response => {
          this.tableData = response.data.data.records
          this.page.total = response.data.data.total
          this.tableLoading = false
        }).catch(() => {
          this.tableLoading = false
        })
      },
      sizeChange(pageSize) {
        this.page.pageSize = pageSize
      },
      currentChange(current) {
        this.page.currentPage = current
      },
      refreshChange() {
        this.getList(this.page)
      }
    }
  };
</script>