list.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <div>
  3. <search @searchActive="searchActive" :placeholder="placeholder"></search>
  4. <tableLayout :layout="tablecols" :data="list" :opwidth="200" :custom="true" :height="tableHieght">
  5. <template v-slot:customcol="scope">
  6. <p>{{scope.column.data[scope.column.columnname]}}</p>
  7. </template>
  8. <template v-slot:opreation="scope">
  9. <slot name="edit" :data="scope.data"></slot>
  10. <slot name="del" :data="scope.data"></slot>
  11. <slot name="bind" :data="scope.data"></slot>
  12. </template>
  13. </tableLayout>
  14. <div style="margin-top:16px;text-align:right">
  15. <el-pagination
  16. background
  17. small
  18. @size-change="handleSizeChange"
  19. @current-change="handleCurrentChange"
  20. :current-page="currentPage"
  21. :page-size="params.content.pageSize"
  22. layout="total, prev, pager, next, jumper"
  23. :total="total">
  24. </el-pagination>
  25. </div>
  26. </div>
  27. </template>
  28. <script>
  29. import search from '../components/search'
  30. export default {
  31. name: "list",
  32. data(){
  33. return {
  34. tableHieght:420,
  35. tablecols:[],
  36. list:[],
  37. total:0,
  38. currentPage:0,
  39. placeholder:'档案名称',
  40. params:{
  41. "id": "20220926095803",
  42. "version":1,
  43. "content": {
  44. pageSize:10,
  45. pageNumber:1,
  46. "where":{
  47. "condition":""
  48. }
  49. }
  50. },
  51. }
  52. },
  53. components:{
  54. search
  55. },
  56. mounted() {
  57. this.listData()
  58. },
  59. methods: {
  60. async listData(){
  61. const res = await this.$api.requested(this.params)
  62. console.log(res)
  63. this.list = res.data
  64. this.total = res.total
  65. this.currentPage = res.pageTotal
  66. },
  67. handleSizeChange(val) {
  68. // console.log(`每页 ${val} 条`);
  69. this.params.content.pageSize = val
  70. this.listData()
  71. },
  72. handleCurrentChange(val) {
  73. // console.log(`当前页: ${val}`);
  74. this.params.content.pageNumber = val
  75. this.listData()
  76. },
  77. searchActive(data){
  78. this.params.content.where.condition = data
  79. this.listData()
  80. }
  81. },
  82. created() {
  83. this.tablecols = this.tool.tabelCol(this.$route.name).prodectFileTable.tablecols
  84. }
  85. }
  86. </script>
  87. <style scoped>
  88. </style>