standTable.vue 8.7 KB

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