index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <div>
  3. <basic-container v-if="show">
  4. <avue-crud
  5. :table-loading="loading"
  6. :data="dataList"
  7. :page.sync="page"
  8. ref="crud"
  9. :option="option"
  10. @on-load="onLoad"
  11. @row-del="rowDel"
  12. @search-change="searchChange">
  13. <template slot="menuLeft" slot-scope="{size}">
  14. <el-button type="primary" :size="size" @click="rowSave">新增</el-button>
  15. </template>
  16. <template slot-scope="{row,index}" slot="menu">
  17. <el-button type="text"
  18. icon="el-icon-edit"
  19. size="small"
  20. @click.stop="rowCell(row,index)">编辑</el-button>
  21. <el-button type="text"
  22. icon="el-icon-delete"
  23. size="small"
  24. @click.stop="$refs.crud.rowDel(row,index)">删除</el-button>
  25. </template>
  26. </avue-crud>
  27. </basic-container>
  28. <detail-page v-else @backToList="backToList" :id="id"></detail-page>
  29. </div>
  30. </template>
  31. <script>
  32. import detailPage from './detailPage'
  33. import {removeDelegationList, selectInvoiceList} from "@/api/landTransportation";
  34. export default {
  35. name: "index",
  36. components: {
  37. detailPage
  38. },
  39. data(){
  40. return{
  41. id:'',
  42. show:true,
  43. loading:false,
  44. dataList:[],
  45. page: {
  46. pageSize: 10,
  47. currentPage: 1,
  48. total: 0,
  49. pageSizes: [10,50,100,200,300]
  50. },
  51. option:{
  52. align:'center',
  53. index: true,
  54. addBtn: false,
  55. editBtn: false,
  56. delBtn:false,
  57. height:"auto",
  58. column:[{
  59. label: '订单号',
  60. prop: 'id',
  61. index: 1,
  62. width: 140,
  63. cell: true,
  64. overHidden: true,
  65. search:true,
  66. }]
  67. }
  68. }
  69. },
  70. methods:{
  71. onLoad(page, params) {
  72. let queryParams = {
  73. size: page.pageSize,
  74. current: page.currentPage,
  75. kind: '2',
  76. ...params
  77. }
  78. this.loading = true;
  79. selectInvoiceList(queryParams).then(res => {
  80. this.dataList = res.data.data.records
  81. this.page.total = res.data.data.total
  82. }).finally(() => {
  83. this.loading = false;
  84. })
  85. },
  86. //搜索
  87. searchChange(params,done) {
  88. this.onLoad(this.page,params)
  89. done();
  90. },
  91. //列表删除
  92. rowDel(row){
  93. this.$confirm('此操作将永久删除该单据, 是否继续?', '提示', {
  94. confirmButtonText: '确定',
  95. cancelButtonText: '取消',
  96. type: 'warning'
  97. }).then(() => {
  98. removeDelegationList({ids:row.id}).then(res=>{
  99. this.$message.success('删除成功');
  100. this.onLoad(this.page)
  101. })
  102. }).catch(() => {
  103. this.$message({
  104. type: 'info',
  105. message: '已取消删除'
  106. });
  107. });
  108. },
  109. //行编辑
  110. rowCell(row,index){
  111. console.log(row.id)
  112. this.id = row.id
  113. this.show = false
  114. },
  115. rowSave(){
  116. this.show = false
  117. },
  118. backToList(){
  119. this.show = true
  120. }
  121. }
  122. }
  123. </script>
  124. <style scoped>
  125. </style>