eqListTable.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <!-- 设备清单的有tab的表格 -->
  2. <template>
  3. <div class='eq-list'>
  4. <div class='eq-list-top'>
  5. <el-input
  6. placeholder='搜索设备名称'
  7. size='small'
  8. @keyup.enter.native='getList'
  9. @blur='getList'
  10. prefix-icon='el-icon-search'
  11. v-model='sbjc'
  12. clearable
  13. style='width:192px;margin-right:12px'
  14. ></el-input>
  15. <el-input
  16. placeholder='搜索品牌型号'
  17. size='small'
  18. @keyup.enter.native='getList'
  19. @blur='getList'
  20. clearable
  21. prefix-icon='el-icon-search'
  22. v-model='keyword'
  23. style='width:192px;margin-right:12px'
  24. ></el-input>
  25. <Select
  26. @change='getList'
  27. @cancel='getList'
  28. v-model='floor'
  29. style='margin-right:12px;'
  30. width='160'
  31. tipPlace='top'
  32. caption='楼层 :'
  33. :selectdata='floorAllSelect'
  34. ></Select>
  35. <el-input
  36. placeholder='搜索生产厂商'
  37. clearable
  38. size='small'
  39. @keyup.enter.native='getList'
  40. @blur='getList'
  41. prefix-icon='el-icon-search'
  42. v-model='manufacturer'
  43. style='width:192px;'
  44. ></el-input>
  45. </div>
  46. <div ref='tableBox' style='height: calc(100% - 115px);'>
  47. <el-table :data='tableData' :max-height='tableMaxHeight' style='width: 100%' :border='true' @row-click='rowHandle'>
  48. <el-table-column type='index' label='序号' width='60' :index='indexMethod'></el-table-column>
  49. <el-table-column prop='type_name' label='设备名称' show-overflow-tooltip resizable width='250'>
  50. <template slot-scope='{row}'>{{row.type_name || '--'}}</template>
  51. </el-table-column>
  52. <el-table-column prop='sl' label='数量' width='100'>
  53. <template slot-scope='{row}'>{{row.sl>=0?row.sl:'--'}}</template>
  54. </el-table-column>
  55. <el-table-column prop='brand' label='品牌' width='120'>
  56. <template slot-scope='{row}'>{{row.brand || '--'}}</template>
  57. </el-table-column>
  58. <el-table-column prop='sbxh' label='型号' show-overflow-tooltip resizable width='150'>
  59. <template slot-scope='{row}'>{{row.sbxh || '--'}}</template>
  60. </el-table-column>
  61. <el-table-column prop='floorcode' label='楼层' width='240' show-overflow-tooltip resizable>
  62. <template slot-scope='{row}'>{{row.floorcode || '--'}}</template>
  63. </el-table-column>
  64. <!-- <el-table-column prop='wzjc' label='安装位置' show-overflow-tooltip resizable>
  65. <template slot-scope='{row}'>{{row.wzjc || '--'}}</template>
  66. </el-table-column>-->
  67. <el-table-column prop='manufacturer' label='生产厂商' show-overflow-tooltip resizable min-width='300'>
  68. <template slot-scope='{row}'>{{row.manufacturer || '--'}}</template>
  69. </el-table-column>
  70. </el-table>
  71. </div>
  72. <div class='foot'>
  73. <el-pagination
  74. background
  75. layout='prev, pager, next'
  76. :total='total'
  77. :page-size='size'
  78. @prev-click='pageChanged'
  79. @next-click='pageChanged'
  80. @current-change='pageChanged'
  81. ></el-pagination>
  82. </div>
  83. <!-- 标准表格详情钻取表 -->
  84. <el-dialog
  85. width='1260px'
  86. :title='`${InfoName}-${type_name}`'
  87. style='height:900px!important;overflow: hidden;'
  88. :visible.sync='innerVisible'
  89. append-to-body
  90. >
  91. <eq-detail ref='qdDialog' :row='row' :major='major'></eq-detail>
  92. </el-dialog>
  93. </div>
  94. </template>
  95. <script>
  96. import { Select } from 'meri-design'
  97. import EqDetail from './eqDetaileDialog'
  98. import { queryEquipmentList } from '@/api/equipmentList.js'
  99. import { mapGetters } from 'vuex'
  100. import store from '../../../store/index'
  101. export default {
  102. components: { Select, EqDetail },
  103. data() {
  104. return {
  105. tableData: [],
  106. total: 0,
  107. currentPage: 1,
  108. size: 10,
  109. innerVisible: false, //详情弹框
  110. keyword: '',
  111. manufacturer: '',
  112. sbjc: '',
  113. row: {},
  114. floor: '1',
  115. tableMaxHeight: 0,
  116. type_name: '',
  117. floorAllSelect: [],
  118. }
  119. },
  120. computed: {
  121. ...mapGetters(['floorSelect']),
  122. },
  123. props: ['param', 'major', 'systemName', 'InfoName'],
  124. methods: {
  125. indexMethod(index) {
  126. return (this.currentPage - 1) * this.size + index + 1
  127. },
  128. rowHandle(row) {
  129. this.type_name = row.type_name
  130. this.innerVisible = true
  131. this.row = row
  132. },
  133. pageChanged(page) {
  134. this.currentPage = page
  135. this.getList()
  136. },
  137. getList() {
  138. let postParams = {
  139. tab_code: this.param,
  140. }
  141. let data = {
  142. page: this.currentPage,
  143. size: this.size,
  144. plazaId: this.$store.state.plazaId,
  145. major: this.major,
  146. }
  147. //下拉
  148. if (this.floor && this.floor != 1) {
  149. postParams.gname = this.floor
  150. }
  151. //输入框搜索
  152. data.keyword = ''
  153. if (this.keyword) {
  154. data.keyword += `${this.keyword}:brand,sbxh;`
  155. }
  156. if (this.sbjc) {
  157. data.keyword += `${this.sbjc}:type_name;`
  158. }
  159. if (this.manufacturer) {
  160. data.keyword += `${this.manufacturer}:manufacturer;`
  161. }
  162. if (data.keyword == '') {
  163. delete data.keyword
  164. }
  165. queryEquipmentList({ data, postParams }).then((res) => {
  166. //console.log(res)
  167. this.tableData = res.data.data
  168. this.total = res.data.count
  169. })
  170. },
  171. getFloorAllSelect() {
  172. this.floorAllSelect = []
  173. this.floorAllSelect.push({
  174. name: '全部',
  175. id: '1',
  176. })
  177. this.floorSelect.forEach((el) => {
  178. this.floorAllSelect.push(el)
  179. })
  180. },
  181. },
  182. watch: {
  183. param(newV, oldV) {
  184. console.log(newV, oldV)
  185. if (newV !== oldV) {
  186. this.getList()
  187. this.$nextTick(() => {
  188. // 页面渲染完成后的回调
  189. this.tableMaxHeight = this.$refs.tableBox.offsetHeight
  190. })
  191. this.getFloorAllSelect()
  192. }
  193. },
  194. /* floor(newV, oldV) {
  195. console.log(newV, oldV)
  196. this.getList()
  197. }, */
  198. // 监听 vuex 中currentFloor的变化,切换楼层后,更新下拉菜单
  199. '$store.state.currentFloor': {
  200. handler(newV, oldV) {
  201. if (newV.gname !== oldV.gname) {
  202. this.floor = newV.gname
  203. this.getList()
  204. }
  205. },
  206. deep: true,
  207. },
  208. },
  209. mounted() {
  210. // this.floor = this.$cookie.get('floorMapId')
  211. this.getList()
  212. this.$nextTick(() => {
  213. // 页面渲染完成后的回调
  214. this.tableMaxHeight = this.$refs.tableBox.offsetHeight
  215. })
  216. this.getFloorAllSelect()
  217. },
  218. }
  219. </script>
  220. <style lang="less" scoped>
  221. .eq-list {
  222. .eq-list-top {
  223. display: flex;
  224. margin-bottom: 12px;
  225. }
  226. td {
  227. overflow: hidden;
  228. white-space: nowrap;
  229. text-overflow: ellipsis;
  230. }
  231. .foot {
  232. height: 32px;
  233. display: flex;
  234. justify-content: flex-end;
  235. margin-top: 28px;
  236. }
  237. }
  238. @media screen and (max-width: 1600px) {
  239. /deep/ .el-dialog__body {
  240. padding: 0;
  241. }
  242. /deep/ .el-table td {
  243. padding: 4px 0;
  244. }
  245. /deep/ .el-dialog {
  246. margin-top: 5vh !important;
  247. }
  248. }
  249. </style>
  250. <style lang="less">
  251. .eq-list {
  252. /deep/.el-table td {
  253. cursor: pointer;
  254. }
  255. }
  256. </style>