standTable.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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. <el-table :data='tableData' :border='true' style='width: 100%' @row-click='rowHandle'>
  47. <el-table-column type='index' label='序号' width='60' :index='indexMethod'></el-table-column>
  48. <el-table-column prop label='设备名称' show-overflow-tooltip resizable width='300'>
  49. <template slot-scope='{row}'>{{row.type_name || '--'}}</template>
  50. </el-table-column>
  51. <!-- sbjc -->
  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='200'>
  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='floor' label='楼层' width='180'>
  62. <template slot-scope='{row}'>{{row.floorcode || '--'}}</template>
  63. </el-table-column>
  64. <el-table-column prop='manufacturer' label='生产厂商' show-overflow-tooltip resizable min-width='300'>
  65. <template slot-scope='{row}'>{{row.manufacturer || '--'}}</template>
  66. </el-table-column>
  67. </el-table>
  68. <div class='foot'>
  69. <el-pagination
  70. background
  71. layout='prev, pager, next'
  72. :total='total'
  73. :page-size='size'
  74. @prev-click='pageChanged'
  75. @next-click='pageChanged'
  76. @current-change='pageChanged'
  77. ></el-pagination>
  78. </div>
  79. <!-- 标准表格详情钻取表 -->
  80. <el-dialog width='90%' style='height:900px;overflow: hidden;' :title='`${InfoName}-${type_name}`' :visible.sync='innerVisible' append-to-body>
  81. <eq-detail ref='qdDialog' :row='row' :major='major'></eq-detail>
  82. </el-dialog>
  83. </div>
  84. </template>
  85. <script>
  86. import { queryEquipmentList } from '@/api/equipmentList.js'
  87. import EqDetail from './eqDetaileDialog'
  88. import { mapGetters } from 'vuex'
  89. import { Select } from 'meri-design'
  90. import store from '../../../store/index'
  91. export default {
  92. data() {
  93. return {
  94. innerVisible: false,
  95. tableData: [],
  96. total: 0,
  97. currentPage: 1,
  98. size: 13,
  99. keyword: '',
  100. floor: '',
  101. row: {},
  102. sbjc: '',
  103. manufacturer: '',
  104. type_name: ''
  105. }
  106. },
  107. props: ['major', 'param', 'InfoName'],
  108. components: { EqDetail, Select },
  109. computed: {
  110. ...mapGetters(['floorSelect'])
  111. },
  112. methods: {
  113. indexMethod(index) {
  114. return (this.currentPage - 1) * this.size + index + 1
  115. },
  116. rowHandle(row) {
  117. this.type_name = row.type_name
  118. this.innerVisible = true
  119. this.row = row
  120. },
  121. pageChanged(page, size) {
  122. this.currentPage = page
  123. this.getList()
  124. },
  125. getList() {
  126. let postParams = {
  127. tab_code: this.param
  128. }
  129. let major
  130. if (this.major.slice(0, 2) == 'GD') {
  131. major = '供电'
  132. } else if (this.major.slice(0, 2) == 'XF') {
  133. major = '消防'
  134. } else if (this.major.slice(0, 2) == 'GPS') {
  135. major = '给排水'
  136. } else if (this.major.slice(0, 2) == 'DT') {
  137. major = '电梯'
  138. } else if (this.major.slice(0, 2) == 'RQ') {
  139. major = '燃气'
  140. }
  141. let data = {
  142. page: this.currentPage,
  143. size: this.size,
  144. plazaId: this.$store.state.plazaId,
  145. major: major
  146. // floor:this.floor
  147. }
  148. //下拉
  149. if (this.floor) {
  150. postParams.gname = this.floor
  151. }
  152. //输入框搜索
  153. data.keyword = ''
  154. if (this.keyword) {
  155. data.keyword += `${this.keyword}:brand,sbxh;`
  156. }
  157. if (this.sbjc) {
  158. data.keyword += `${this.sbjc}:type_name;`
  159. }
  160. if (this.manufacturer) {
  161. data.keyword += `${this.manufacturer}:manufacturer;`
  162. }
  163. if (data.keyword == '') {
  164. delete data.keyword
  165. }
  166. queryEquipmentList({ data, postParams }).then(res => {
  167. this.tableData = res.data.data
  168. this.total = res.data.count
  169. })
  170. }
  171. },
  172. watch: {
  173. param(newV, oldV) {
  174. if (newV !== oldV) {
  175. this.getList()
  176. }
  177. },
  178. /* floor(newV, oldV) {
  179. this.getList()
  180. }, */
  181. // 监听 vuex 中currentFloor的变化,切换楼层后,更新下拉菜单
  182. '$store.state.currentFloor': {
  183. handler(newV, oldV) {
  184. if (newV.gname !== oldV.gname) {
  185. this.floor = newV.gname
  186. this.getList()
  187. }
  188. },
  189. deep: true
  190. }
  191. },
  192. mounted() {
  193. this.floor = this.$cookie.get('floorMapId')
  194. this.getList()
  195. }
  196. }
  197. </script>
  198. <style lang="less" scoped>
  199. .stand-list {
  200. .eq-list-top {
  201. display: flex;
  202. margin-bottom: 12px;
  203. }
  204. td {
  205. overflow: hidden;
  206. text-overflow: ellipsis;
  207. white-space: nowrap;
  208. }
  209. .foot {
  210. height: 32px;
  211. display: flex;
  212. justify-content: flex-end;
  213. margin-top: 28px;
  214. }
  215. }
  216. </style>