tjTable.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <!-- 土建清单 -->
  3. <div class='tj-list'>
  4. <div class='eq-list-top'>
  5. <el-input
  6. clearable
  7. placeholder='搜索类别'
  8. size='small'
  9. @blur='getList'
  10. prefix-icon='el-icon-search'
  11. v-model='lb'
  12. style='width:192px;margin-right:12px'
  13. ></el-input>
  14. <el-input clearable placeholder='搜索品牌' size='small' @blur='getList' prefix-icon='el-icon-search' v-model='brand' style='width:192px'></el-input>
  15. </div>
  16. <el-table :data='tableData' style='width: 100%' :border='true'>
  17. <el-table-column type='index' label='序号' width='80'></el-table-column>
  18. <el-table-column prop='category' label='类别' show-overflow-tooltip resizable>
  19. <template slot-scope='{row}'>{{row.category || '--'}}</template>
  20. </el-table-column>
  21. <el-table-column prop='sl' label='数量' >
  22. <template slot-scope='{row}'>{{row.sl>=0?row.sl:'--'}}</template>
  23. </el-table-column>
  24. <el-table-column prop='brand' label='品牌'>
  25. <template slot-scope='{row}'>{{row.brand || '--'}}</template>
  26. </el-table-column>
  27. <el-table-column prop='unit' label='单位'>
  28. <template slot-scope='{row}'>{{row.unit || '--'}}</template>
  29. </el-table-column>
  30. </el-table>
  31. <div class='foot'>
  32. <el-pagination
  33. background
  34. layout='prev, pager, next'
  35. :total='total'
  36. :page-size='size'
  37. @prev-click='pageChanged'
  38. @next-click='pageChanged'
  39. @current-change='pageChanged'
  40. ></el-pagination>
  41. </div>
  42. </div>
  43. </template>
  44. <script>
  45. import { queryMaterialList } from '@/api/equipmentList.js'
  46. import { mapGetters } from 'vuex'
  47. export default {
  48. data() {
  49. return {
  50. pageSize: 10,
  51. tableData: [],
  52. total: 0,
  53. currentPage: 1,
  54. size: 13,
  55. lb: '',
  56. brand: ''
  57. }
  58. },
  59. props: ['param'],
  60. computed: {
  61. ...mapGetters(['floorSelect'])
  62. },
  63. methods: {
  64. pageChanged(page, size) {
  65. this.currentPage = page
  66. this.getList()
  67. },
  68. getList() {
  69. let getParams = {
  70. page: this.currentPage,
  71. size: this.size,
  72. plazaId: this.$store.state.plazaId
  73. // major: this.major,
  74. }
  75. getParams.keyword = ''
  76. if (this.lb) {
  77. getParams.keyword += `${this.lb}:category;`
  78. }
  79. if (this.brand) {
  80. getParams.keyword += `${this.brand}:brand;`
  81. }
  82. if (getParams.keyword == '') {
  83. delete getParams.keyword
  84. }
  85. queryMaterialList({ getParams }).then(res => {
  86. this.tableData = res.data
  87. this.total = res.count
  88. })
  89. }
  90. },
  91. watch: {
  92. param(newV, oldV) {
  93. if (newV !== oldV) {
  94. this.getList()
  95. }
  96. }
  97. },
  98. mounted() {
  99. this.getList()
  100. }
  101. }
  102. </script>
  103. <style lang="less" scoped>
  104. .tj-list {
  105. .eq-list-top {
  106. display: flex;
  107. margin-bottom: 12px;
  108. }
  109. td {
  110. overflow: hidden;
  111. text-overflow: ellipsis;
  112. white-space: nowrap;
  113. }
  114. .foot {
  115. height: 32px;
  116. display: flex;
  117. justify-content: flex-end;
  118. margin-top: 28px;
  119. }
  120. }
  121. </style>