index.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. ></avue-crud>
  19. </basic-container>
  20. </div>
  21. </template>
  22. <script>
  23. import option from './config/mainList.json';
  24. export default {
  25. name: "index",
  26. data() {
  27. return {
  28. option: {},
  29. dataList: [],
  30. form: {},
  31. page: {
  32. pageSize: 10,
  33. pagerCount: 5,
  34. total: 0,
  35. },
  36. search: {},
  37. loading: false,
  38. }
  39. },
  40. created() {
  41. this.option = option
  42. let i = 0;
  43. this.option.column.forEach(item => {
  44. if (item.search) i++
  45. })
  46. if (i % 3 !== 0){
  47. const num = 3 - Number(i % 3)
  48. this.option.searchMenuSpan = num * 8;
  49. this.option.searchMenuPosition = "right";
  50. }
  51. },
  52. methods: {
  53. searchChange(params, done) {
  54. done();
  55. },
  56. currentChange(val) {
  57. this.page.currentPage = val;
  58. },
  59. sizeChange(val) {
  60. this.page.currentPage = 1;
  61. this.page.pageSize = val;
  62. },
  63. refreshChange() {
  64. this.onLoad(this.page, this.search);
  65. },
  66. onLoad(page, params) {},
  67. async saveColumn() {},
  68. },
  69. }
  70. </script>
  71. <style scoped>
  72. </style>