standTable.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  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'>
  47. <el-table :data='tableData' :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='300'>
  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='300'>
  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='300'>
  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='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' :smsxt='smsxt' :diff='diff' :sign='sign'></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. floorAllSelect: [],
  108. sign: 1,
  109. }
  110. },
  111. props: ['major', 'param', 'InfoName', 'smsxt', 'diff'],
  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. this.sign = 1
  125. },
  126. pageChanged(page) {
  127. this.currentPage = page
  128. this.getList()
  129. },
  130. getList() {
  131. let postParams = {
  132. tab_code: this.param,
  133. }
  134. let major
  135. if (this.major.slice(0, 2) == 'GD') {
  136. major = '供电'
  137. } else if (this.major.slice(0, 2) == 'XF') {
  138. major = '消防'
  139. } else if (this.major.slice(0, 2) == 'GPS') {
  140. major = '给排水'
  141. } else if (this.major.slice(0, 2) == 'DT') {
  142. major = '电梯'
  143. } else if (this.major.slice(0, 2) == 'RQ') {
  144. major = '燃气'
  145. }
  146. let data = {
  147. page: this.currentPage,
  148. size: this.size,
  149. plazaId: this.$store.state.plazaId,
  150. major: major,
  151. // floor:this.floor
  152. }
  153. //区分土建主要设备
  154. if (this.smsxt != '1008') {
  155. data.onlyMainAsset = true
  156. }
  157. //下拉
  158. if (this.floor && this.floor != 1) {
  159. postParams.gname = this.floor
  160. }
  161. //输入框搜索
  162. data.keyword = ''
  163. if (this.keyword) {
  164. data.keyword += `${this.keyword}:brand,sbxh;`
  165. }
  166. if (this.sbjc) {
  167. data.keyword += `${this.sbjc}:type_name;`
  168. }
  169. if (this.manufacturer) {
  170. data.keyword += `${this.manufacturer}:manufacturer;`
  171. }
  172. if (data.keyword == '') {
  173. delete data.keyword
  174. }
  175. queryEquipmentList({ data, postParams }).then((res) => {
  176. this.tableData = res.data.data
  177. this.total = res.data.count
  178. })
  179. },
  180. getFloorAllSelect() {
  181. this.floorAllSelect = []
  182. this.floorAllSelect.push({
  183. name: '全部',
  184. id: '1',
  185. })
  186. this.floorSelect.forEach((el) => {
  187. this.floorAllSelect.push(el)
  188. })
  189. console.log(this.floorAllSelect)
  190. },
  191. },
  192. watch: {
  193. param(newV, oldV) {
  194. if (newV !== oldV) {
  195. this.getList()
  196. this.getFloorAllSelect()
  197. }
  198. },
  199. /* floor(newV, oldV) {
  200. this.getList()
  201. }, */
  202. // 监听 vuex 中currentFloor的变化,切换楼层后,更新下拉菜单
  203. '$store.state.currentFloor': {
  204. handler(newV, oldV) {
  205. if (newV.gcname !== oldV.gcname) {
  206. this.floor = newV.gcname
  207. this.getList()
  208. }
  209. },
  210. deep: true,
  211. },
  212. },
  213. mounted() {
  214. // this.floor = this.$cookie.get('floorMapId')
  215. this.getList()
  216. this.getFloorAllSelect()
  217. },
  218. }
  219. </script>
  220. <style lang="less" scoped>
  221. .stand-list {
  222. height: 100%;
  223. .eq-list-top {
  224. display: flex;
  225. margin-bottom: 12px;
  226. }
  227. td {
  228. overflow: hidden;
  229. text-overflow: ellipsis;
  230. white-space: nowrap;
  231. }
  232. .foot {
  233. height: 32px;
  234. display: flex;
  235. justify-content: flex-end;
  236. margin-top: 28px;
  237. }
  238. }
  239. /deep/ .el-dialog__body {
  240. padding: 0;
  241. }
  242. /deep/.el-dialog {
  243. margin-top: 5vh !important;
  244. }
  245. @media screen and (max-width: 1600px) {
  246. /deep/ .el-dialog__body {
  247. padding: 0;
  248. }
  249. /deep/ .el-table td {
  250. padding: 4px 0;
  251. }
  252. /deep/ .el-dialog {
  253. margin-top: 5vh !important;
  254. }
  255. }
  256. </style>
  257. <style lang="less">
  258. .stand-list {
  259. /deep/.el-table td {
  260. cursor: pointer;
  261. }
  262. }
  263. </style>