eqListTable.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <!-- 设备清单的有tab的表格 -->
  2. <template>
  3. <div class='eq-list'>
  4. <div class='eq-list-top'>
  5. <el-input
  6. placeholder='请输入设备简称、品牌、型号、生产厂商搜索'
  7. size='small'
  8. @change='getList'
  9. prefix-icon='el-icon-search'
  10. v-model='input'
  11. style='width:310px;margin-right:12px'
  12. ></el-input>
  13. <Select @change='getList' width='120' tipPlace='top' caption='楼层 :' :selectdata='floorSelect'></Select>
  14. </div>
  15. <el-table :data='tableData' style='width: 100%' @row-click='innerVisible = true'>
  16. <el-table-column prop='sbxh' label='序号' width='120'></el-table-column>
  17. <el-table-column prop='sbjbm' label='设备编号' width='160'></el-table-column>
  18. <el-table-column prop='sl' label='数量'></el-table-column>
  19. <el-table-column prop='brand' label='品牌'></el-table-column>
  20. <el-table-column prop='sbxh' label='型号'></el-table-column>
  21. <el-table-column prop='floor' label='楼层'></el-table-column>
  22. <el-table-column prop='wzjc' label='安装位置' width='240'></el-table-column>
  23. <el-table-column prop='manufacturer' label='生产厂商' width='240'></el-table-column>
  24. </el-table>
  25. <div class='foot'>
  26. <el-pagination
  27. background
  28. layout='prev, pager, next'
  29. :total='total'
  30. :page-size='size'
  31. @prev-click='pageChanged'
  32. @next-click='pageChanged'
  33. @current-change='pageChanged'
  34. ></el-pagination>
  35. </div>
  36. <el-dialog width='1200px' style='height:80%' title='设备清单' :visible.sync='innerVisible' append-to-body>
  37. <eq-detail ref='qdDialog'></eq-detail>
  38. </el-dialog>
  39. </div>
  40. </template>
  41. <script>
  42. import Select from '@/components/Select/Select.vue'
  43. import EqDetail from './eqDetaileDialog'
  44. import { queryEquipmentList } from '@/api/equipmentList.js'
  45. import { mapGetters } from 'vuex'
  46. export default {
  47. components: { Select, EqDetail },
  48. data() {
  49. return {
  50. dataSelect2: [
  51. { id: 'test1', name: '选择项' },
  52. { id: 'test2', name: '单平米' },
  53. { id: 'test3', name: '下级分项' },
  54. { id: 'test4', name: '滑动平均滑动平均' }
  55. ],
  56. tableData: [],
  57. total: 0,
  58. currentPage: 1,
  59. size: 10,
  60. floorSelect: [],
  61. innerVisible: false //详情弹框
  62. }
  63. },
  64. computed: {
  65. ...mapGetters(['floorsArr'])
  66. },
  67. props: ['param', 'major'],
  68. methods: {
  69. pageChanged(page) {
  70. this.currentPage = page
  71. this.getList()
  72. },
  73. init() {
  74. this.floorSelect = []
  75. if (this.floorsArr.length > 0) {
  76. this.floorsArr.forEach(e => {
  77. let obj = {
  78. id: e,
  79. name: e
  80. }
  81. this.floorSelect.push(obj)
  82. })
  83. }
  84. },
  85. getList() {
  86. let postParams = {
  87. tab_code: this.param
  88. }
  89. let data = {
  90. page: this.currentPage,
  91. size: this.size,
  92. plazaId: this.$store.state.plazaId,
  93. major: this.major
  94. }
  95. queryEquipmentList({ data, postParams }).then(res => {
  96. console.log(res)
  97. this.tableData = res.data.data
  98. this.total = res.data.count
  99. })
  100. }
  101. },
  102. watch: {
  103. param(newV, oldV) {
  104. if (newV !== oldV) {
  105. this.getList()
  106. }
  107. }
  108. },
  109. mounted() {
  110. this.init()
  111. this.getList()
  112. }
  113. }
  114. </script>
  115. <style lang="less" scoped>
  116. .eq-list {
  117. .eq-list-top {
  118. display: flex;
  119. }
  120. .foot {
  121. position: absolute;
  122. height: 32px;
  123. right: 26px;
  124. bottom: 20px;
  125. }
  126. td {
  127. overflow: hidden;
  128. text-overflow: ellipsis;
  129. white-space: nowrap;
  130. }
  131. }
  132. </style>