standTable.vue 8.6 KB

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