index.vue 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <div>
  3. <basic-container v-if="show">
  4. <avue-crud :table-loading="loading" :data="dataList" :page.sync="page" ref="crud" :option="option" @on-load="onLoad" @search-change="searchChange">
  5. <template slot="menuLeft" slot-scope="{size}">
  6. <el-button type="primary" :size="size" @click="rowSave">新增</el-button>
  7. </template>
  8. <template slot-scope="{row,index}" slot="menu">
  9. <el-button type="text"
  10. icon="el-icon-edit"
  11. size="small"
  12. @click.stop="$refs.crud.rowEdit(row,index)">编辑</el-button>
  13. <el-button type="text"
  14. icon="el-icon-delete"
  15. size="small"
  16. @click.stop="$refs.crud.rowDelete(row,index)">删除</el-button>
  17. </template>
  18. </avue-crud>
  19. </basic-container>
  20. <detail-page v-else @backToList="backToList"></detail-page>
  21. </div>
  22. </template>
  23. <script>
  24. import detailPage from './detailPage'
  25. import {selectInvoiceList} from "@/api/landTransportation";
  26. export default {
  27. name: "index",
  28. components: {
  29. detailPage
  30. },
  31. data(){
  32. return{
  33. show:true,
  34. loading:false,
  35. dataList:[],
  36. page: {
  37. pageSize: 10,
  38. currentPage: 1,
  39. total: 0,
  40. pageSizes: [10,50,100,200,300]
  41. },
  42. option:{
  43. align:'center',
  44. index: true,
  45. addBtn: false,
  46. editBtn: false,
  47. delBtn:false,
  48. height:"auto",
  49. column:[{
  50. label: '订单号',
  51. prop: 'id',
  52. index: 1,
  53. width: 140,
  54. cell: true,
  55. overHidden: true,
  56. search:true,
  57. }]
  58. }
  59. }
  60. },
  61. methods:{
  62. onLoad(page, params) {
  63. let queryParams = {
  64. size: page.pageSize,
  65. current: page.currentPage,
  66. ...params
  67. }
  68. this.loading = true;
  69. selectInvoiceList(queryParams).then(res => {
  70. this.dataList = res.data.data.records
  71. this.page.total = res.data.data.total
  72. }).finally(() => {
  73. this.loading = false;
  74. })
  75. },
  76. //搜索
  77. searchChange(params,done) {
  78. this.onLoad(this.page,params)
  79. done();
  80. },
  81. rowSave(){
  82. this.show = false
  83. },
  84. backToList(){
  85. this.show = true
  86. }
  87. }
  88. }
  89. </script>
  90. <style scoped>
  91. </style>