index.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <template>
  2. <div>
  3. <basic-container>
  4. <avue-crud
  5. :option="option"
  6. :data="dataList"
  7. ref="crud"
  8. v-model="form"
  9. :page.sync="page"
  10. :search.sync="search"
  11. @search-change="searchChange"
  12. @current-change="currentChange"
  13. @size-change="sizeChange"
  14. @refresh-change="refreshChange"
  15. @on-load="onLoad"
  16. :table-loading="loading"
  17. @saveColumn="saveColumn"
  18. >
  19. <template slot="corpIdSearch">
  20. <crop-select
  21. v-model="search.corpId"
  22. corpType="KH"
  23. ></crop-select>
  24. </template>
  25. <template slot-scope="scope" slot="corpId">
  26. {{ scope.row.corpName }}
  27. </template>
  28. </avue-crud>
  29. </basic-container>
  30. </div>
  31. </template>
  32. <script>
  33. import option from './config/mainList.json';
  34. import {getList} from '@/api/maintenance/overpayment';
  35. export default {
  36. name: "index",
  37. data() {
  38. return {
  39. option: {},
  40. dataList: [],
  41. form: {},
  42. page: {
  43. pageSize: 10,
  44. pagerCount: 5,
  45. total: 0,
  46. },
  47. search: {},
  48. loading: false,
  49. }
  50. },
  51. created() {
  52. this.option = option
  53. let i = 0;
  54. this.option.column.forEach(item => {
  55. if (item.search) i++
  56. })
  57. if (i % 3 !== 0){
  58. const num = 3 - Number(i % 3)
  59. this.option.searchMenuSpan = num * 8;
  60. this.option.searchMenuPosition = "right";
  61. }
  62. },
  63. methods: {
  64. searchChange(params, done) {
  65. this.onLoad(this.page, params);
  66. done();
  67. },
  68. currentChange(val) {
  69. this.page.currentPage = val;
  70. },
  71. sizeChange(val) {
  72. this.page.currentPage = 1;
  73. this.page.pageSize = val;
  74. },
  75. refreshChange() {
  76. this.onLoad(this.page, this.search);
  77. },
  78. onLoad(page, params) {
  79. this.loading = true;
  80. getList(page.currentPage, page.pageSize, params)
  81. .then(res => {
  82. this.dataList = res.data.data.records ? res.data.data.records : [];
  83. this.page.total = res.data.data.total;
  84. if (this.page.total) {
  85. this.option.height = window.innerHeight - 260;
  86. }
  87. })
  88. .finally(() => {
  89. this.loading = false;
  90. });
  91. },
  92. async saveColumn() {},
  93. },
  94. }
  95. </script>
  96. <style scoped>
  97. </style>