standTable.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  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='pageChanged(1)'
  9. @blur='pageChanged(1)'
  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='pageChanged(1)'
  20. @blur='pageChanged(1)'
  21. prefix-icon='el-icon-search'
  22. v-model='keyword'
  23. style='width:192px;margin-right:12px'
  24. ></el-input>
  25. <Select
  26. @change='pageChanged(1)'
  27. @cancel='pageChanged(1)'
  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='pageChanged(1)'
  40. @blur='pageChanged(1)'
  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. :current-page='currentPage'
  77. @prev-click='pageChanged'
  78. @next-click='pageChanged'
  79. @current-change='pageChanged'
  80. ></el-pagination>
  81. </div>
  82. <!-- 标准表格详情钻取表 -->
  83. <!-- <el-dialog width='90%' style='height:900px;overflow: hidden;' :title='`${InfoName}-${type_name}`' :visible.sync='innerVisible' append-to-body>
  84. <eq-detail ref='qdDialog' :row='row' :major='major' :smsxt='smsxt' :diff='diff' :sign='sign'></eq-detail>
  85. </el-dialog>-->
  86. <!-- 标准表格详情钻取表,使用全屏弹窗 -->
  87. <!-- 弹窗添加class -->
  88. <el-dialog
  89. custom-class='stand-dialog'
  90. width='100%'
  91. :title='`${type_name}设备清单`'
  92. :visible.sync='innerVisible'
  93. append-to-body
  94. :fullscreen='true'
  95. >
  96. <eq-detail :key='`eqDetail${key}`' ref='qdDialog' :row='row' :major='major' :smsxt='smsxt' :diff='diff' :sign='sign'></eq-detail>
  97. </el-dialog>
  98. </div>
  99. </template>
  100. <script>
  101. import { queryEquipmentList } from '@/api/equipmentList.js'
  102. // import EqDetail from './eqDetaileDialog'
  103. import EqDetail from './eqDetaileDialog'
  104. import { mapGetters } from 'vuex'
  105. import { Select } from 'meri-design'
  106. import store from '../../../store/index'
  107. export default {
  108. data() {
  109. return {
  110. innerVisible: false,
  111. tableData: [],
  112. total: 0,
  113. currentPage: 1,
  114. size: 10,
  115. keyword: '',
  116. floor: '1',
  117. row: {},
  118. sbjc: '',
  119. manufacturer: '',
  120. type_name: '',
  121. floorAllSelect: [],
  122. sign: 1,
  123. key: 1,
  124. }
  125. },
  126. props: ['major', 'param', 'InfoName', 'smsxt', 'diff'],
  127. components: { EqDetail, Select },
  128. computed: {
  129. ...mapGetters(['floorSelect']),
  130. },
  131. methods: {
  132. indexMethod(index) {
  133. return (this.currentPage - 1) * this.size + index + 1
  134. },
  135. rowHandle(row) {
  136. this.type_name = row.type_name
  137. this.row = row
  138. this.sign = 1
  139. this.$nextTick(() => {
  140. this.key++
  141. this.innerVisible = true
  142. })
  143. },
  144. pageChanged(page) {
  145. this.currentPage = page
  146. this.getList()
  147. },
  148. getList() {
  149. let postParams = {
  150. tab_code: this.param,
  151. }
  152. let major
  153. if (this.major.slice(0, 2) == 'GD') {
  154. major = '供电'
  155. } else if (this.major.slice(0, 2) == 'XF') {
  156. major = '消防'
  157. } else if (this.major.slice(0, 2) == 'GPS') {
  158. major = '给排水'
  159. } else if (this.major.slice(0, 2) == 'DT') {
  160. major = '电梯'
  161. } else if (this.major.slice(0, 2) == 'RQ') {
  162. major = '燃气'
  163. }
  164. let data = {
  165. page: this.currentPage,
  166. size: this.size,
  167. plazaId: this.$store.state.plazaId,
  168. major: major,
  169. // floor:this.floor
  170. }
  171. //区分土建主要设备
  172. if (this.smsxt != '1008') {
  173. data.onlyMainAsset = true
  174. }
  175. //下拉
  176. if (this.floor && this.floor != 1) {
  177. postParams.gname = this.floor
  178. }
  179. //输入框搜索
  180. data.keyword = ''
  181. if (this.keyword) {
  182. data.keyword += `${this.keyword}:brand,sbxh;`
  183. }
  184. if (this.sbjc) {
  185. data.keyword += `${this.sbjc}:type_name;`
  186. }
  187. if (this.manufacturer) {
  188. data.keyword += `${this.manufacturer}:manufacturer;`
  189. }
  190. if (data.keyword == '') {
  191. delete data.keyword
  192. }
  193. queryEquipmentList({ data, postParams }).then((res) => {
  194. this.tableData = res.data.data
  195. this.total = res.data.count
  196. })
  197. },
  198. getFloorAllSelect() {
  199. this.floorAllSelect = []
  200. this.floorAllSelect.push({
  201. name: '全部',
  202. id: '1',
  203. })
  204. this.floorSelect.forEach((el) => {
  205. this.floorAllSelect.push(el)
  206. })
  207. console.log(this.floorAllSelect)
  208. },
  209. },
  210. watch: {
  211. param(newV, oldV) {
  212. if (newV !== oldV) {
  213. this.getList()
  214. this.getFloorAllSelect()
  215. }
  216. },
  217. /* floor(newV, oldV) {
  218. this.getList()
  219. }, */
  220. // 监听 vuex 中currentFloor的变化,切换楼层后,更新下拉菜单
  221. '$store.state.currentFloor': {
  222. handler(newV, oldV) {
  223. if (newV.gcname !== oldV.gcname) {
  224. this.floor = newV.gcname
  225. this.getList()
  226. }
  227. },
  228. deep: true,
  229. },
  230. },
  231. mounted() {
  232. // this.floor = this.$cookie.get('floorMapId')
  233. this.getList()
  234. this.getFloorAllSelect()
  235. },
  236. }
  237. </script>
  238. <style lang="less" scoped>
  239. .stand-list {
  240. height: 100%;
  241. .eq-list-top {
  242. display: flex;
  243. margin-bottom: 12px;
  244. }
  245. td {
  246. overflow: hidden;
  247. text-overflow: ellipsis;
  248. white-space: nowrap;
  249. }
  250. .foot {
  251. height: 32px;
  252. display: flex;
  253. justify-content: flex-end;
  254. margin-top: 28px;
  255. }
  256. }
  257. /deep/ .el-dialog__body {
  258. padding: 0;
  259. }
  260. @media screen and (max-width: 1600px) {
  261. /deep/ .el-dialog__body {
  262. padding: 0;
  263. }
  264. /deep/ .el-table td {
  265. padding: 4px 0;
  266. }
  267. /deep/ .el-dialog {
  268. // margin-top: 5vh !important;
  269. margin-top: 0 !important;
  270. }
  271. }
  272. </style>
  273. <style lang="less">
  274. .stand-list {
  275. /deep/.el-table td {
  276. cursor: pointer;
  277. }
  278. }
  279. .stand-dialog {
  280. // 弹窗头部样式修改
  281. .el-dialog__header {
  282. padding: 16px 24px;
  283. background: linear-gradient(180deg, rgba(54, 156, 247, 1) 0%, rgba(2, 91, 170, 1) 100%);
  284. }
  285. .el-dialog__headerbtn .el-dialog__close {
  286. color: #fff;
  287. }
  288. .el-dialog__title {
  289. font-size: 16px;
  290. padding-right: 6px;
  291. padding-left: 24px;
  292. font-weight: bold;
  293. color: #fff;
  294. font-weight: normal;
  295. }
  296. }
  297. </style>