standTable.vue 9.3 KB

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