index.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <div class="StandardTable">
  3. <Page
  4. v-if="showPage"
  5. class="page"
  6. :total="total"
  7. show-total
  8. show-sizer
  9. show-elevator
  10. transfer
  11. :page-size="pageSize"
  12. :current="currentPage"
  13. :page-size-opts="pageSizeOpts"
  14. v-on="standardTableEvent"
  15. />
  16. <div
  17. class="table"
  18. v-if="showTable"
  19. >
  20. <Table
  21. ref="table"
  22. class="table"
  23. :total="total"
  24. :columns="columns"
  25. :height = true
  26. :data="data"
  27. :border="border"
  28. highlight-row
  29. v-on="standardTableEvent"
  30. >
  31. </Table>
  32. </div>
  33. </div>
  34. </template>
  35. <script>
  36. export default {
  37. name:'StandardTable',
  38. props:{
  39. //事件回调
  40. standardTableEvent:{
  41. type:Object,
  42. default() {
  43. return {}
  44. }
  45. },
  46. //分页属性
  47. showPage:{ //控制分页是否展示
  48. type:Boolean,
  49. default:true
  50. },
  51. total:{
  52. type:Number,
  53. default:0
  54. },
  55. currentPage:{
  56. type:Number,
  57. default:1
  58. },
  59. pageSize:{
  60. type:Number,
  61. default:10
  62. },
  63. pageSizeOpts:{
  64. type:Array,
  65. default () {
  66. return [10,20,30,40]
  67. }
  68. },
  69. //表格属性
  70. showTable:{ //控制表格是否展示
  71. type:Boolean,
  72. default:true
  73. },
  74. columns:{
  75. type:Array,
  76. default() {
  77. return [];
  78. }
  79. },
  80. data:{
  81. type:Array,
  82. default() {
  83. return [];
  84. }
  85. },
  86. border:{
  87. type: Boolean,
  88. default: false
  89. }
  90. },
  91. watch:{
  92. data () {
  93. this.$refs.table.$el.getElementsByClassName('burgeon-table-body')[0].scrollTop = 0
  94. }
  95. },
  96. methods:{
  97. }
  98. }
  99. </script>
  100. <style lang="scss" scoped>
  101. .StandardTable{
  102. display: flex;
  103. overflow: hidden;
  104. flex-direction: column;
  105. .page{
  106. margin-bottom: 8px;
  107. }
  108. .table{
  109. flex: 1;
  110. overflow: hidden;
  111. position: relative;
  112. .noData{
  113. position:absolute;
  114. height: 200px;
  115. top: 50%;
  116. left: 50%;
  117. margin-top: -90px;
  118. margin-left: -80px;
  119. }
  120. }
  121. }
  122. </style>