standTable.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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='floorSelect'
  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: '',
  103. row: {},
  104. sbjc: '',
  105. manufacturer: '',
  106. type_name: '',
  107. tableMaxHeight: 0
  108. }
  109. },
  110. props: ['major', 'param', 'InfoName'],
  111. components: { EqDetail, Select },
  112. computed: {
  113. ...mapGetters(['floorSelect'])
  114. },
  115. methods: {
  116. indexMethod(index) {
  117. return (this.currentPage - 1) * this.size + index + 1
  118. },
  119. rowHandle(row) {
  120. this.type_name = row.type_name
  121. this.innerVisible = true
  122. this.row = row
  123. },
  124. pageChanged(page, size) {
  125. this.currentPage = page
  126. this.getList()
  127. },
  128. getList() {
  129. let postParams = {
  130. tab_code: this.param
  131. }
  132. let major
  133. if (this.major.slice(0, 2) == 'GD') {
  134. major = '供电'
  135. } else if (this.major.slice(0, 2) == 'XF') {
  136. major = '消防'
  137. } else if (this.major.slice(0, 2) == 'GPS') {
  138. major = '给排水'
  139. } else if (this.major.slice(0, 2) == 'DT') {
  140. major = '电梯'
  141. } else if (this.major.slice(0, 2) == 'RQ') {
  142. major = '燃气'
  143. }
  144. let data = {
  145. page: this.currentPage,
  146. size: this.size,
  147. plazaId: this.$store.state.plazaId,
  148. major: major
  149. // floor:this.floor
  150. }
  151. //下拉
  152. if (this.floor) {
  153. postParams.gname = this.floor
  154. }
  155. //输入框搜索
  156. data.keyword = ''
  157. if (this.keyword) {
  158. data.keyword += `${this.keyword}:brand,sbxh;`
  159. }
  160. if (this.sbjc) {
  161. data.keyword += `${this.sbjc}:type_name;`
  162. }
  163. if (this.manufacturer) {
  164. data.keyword += `${this.manufacturer}:manufacturer;`
  165. }
  166. if (data.keyword == '') {
  167. delete data.keyword
  168. }
  169. queryEquipmentList({ data, postParams }).then(res => {
  170. this.tableData = res.data.data
  171. this.total = res.data.count
  172. })
  173. }
  174. },
  175. watch: {
  176. param(newV, oldV) {
  177. if (newV !== oldV) {
  178. this.getList()
  179. this.$nextTick(() => {
  180. // 页面渲染完成后的回调
  181. this.tableMaxHeight = this.$refs.tableBox.offsetHeight
  182. })
  183. }
  184. },
  185. /* floor(newV, oldV) {
  186. this.getList()
  187. }, */
  188. // 监听 vuex 中currentFloor的变化,切换楼层后,更新下拉菜单
  189. '$store.state.currentFloor': {
  190. handler(newV, oldV) {
  191. if (newV.gname !== oldV.gname) {
  192. this.floor = newV.gname
  193. this.getList()
  194. }
  195. },
  196. deep: true
  197. }
  198. },
  199. mounted() {
  200. this.floor = this.$cookie.get('floorMapId')
  201. this.getList()
  202. this.$nextTick(() => {
  203. // 页面渲染完成后的回调
  204. this.tableMaxHeight = this.$refs.tableBox.offsetHeight
  205. })
  206. }
  207. }
  208. </script>
  209. <style lang="less" scoped>
  210. .stand-list {
  211. height: 100%;
  212. .eq-list-top {
  213. display: flex;
  214. margin-bottom: 12px;
  215. }
  216. td {
  217. overflow: hidden;
  218. text-overflow: ellipsis;
  219. white-space: nowrap;
  220. }
  221. .foot {
  222. height: 32px;
  223. display: flex;
  224. justify-content: flex-end;
  225. margin-top: 28px;
  226. }
  227. }
  228. @media screen and (max-width: 1600px) {
  229. /deep/ .el-dialog__body {
  230. padding: 0;
  231. }
  232. /deep/ .el-table td {
  233. padding: 4px 0;
  234. }
  235. /deep/ .el-dialog {
  236. margin-top: 5vh !important;
  237. }
  238. }
  239. </style>