RoomEq.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <div class="room-eq">
  3. <div v-if="content.length!=0">
  4. <div class="eq-box" v-for="(item,index) in content" :key='index'>
  5. <div class="box-left">
  6. <p class="eq-name">{{item.equipLocalName}}-{{item.equipLocalID}}</p>
  7. <p class="eq-type">设备类型: <span v-if="$store.state.equipmentAll.length > 0">{{formatCodetoClass($store.state.equipmentAll, item.category)}}{{facility}}</span></p>
  8. <p class="eq-type">设备型号: <span>{{item.specification}}</span></p>
  9. </div>
  10. <div class="box-right">
  11. <img :src="`/dp-auxiliary/image-service/common/file_get?systemId=dataPlatform&key=${item.equipQRCode}`">
  12. </div>
  13. <div class="box-bottom">
  14. <p class="eq-type" >设备图片: </p>
  15. <div class="pic-box" v-if="item.pic">
  16. <ex-swipe :list="item.pic"></ex-swipe>
  17. </div>
  18. <div class="no-box" v-else>
  19. <img src="/static/img/noimg.png" alt="">
  20. </div>
  21. <p v-if="item.alarmList"><img src="/static/img/prompt.png" alt=""> 当前 {{item.alarmList.length}} 条报警未恢复:
  22. <span v-for="(ele,index) in item.alarmList" :key="index">{{ele.alarmName}} </span>
  23. </p>
  24. </div>
  25. </div>
  26. <p class="other-alarm">另有 {{count}} 个设备未报警</p>
  27. </div>
  28. <div class="noEq" v-else>
  29. 空间内设备未发生报警,请继续保持!
  30. </div>
  31. </div>
  32. </template>
  33. <script>
  34. import {formatCodetoClass} from '../../tools/formatData.js'
  35. import Swipe from '../../common/swipe'
  36. // import {mapActions, mapMutations, mapGetters, mapState} from 'vuex'
  37. import axios from 'axios'
  38. export default {
  39. components: {
  40. 'ex-swipe': Swipe
  41. },
  42. mixins: [],
  43. props: {
  44. },
  45. data () {
  46. return {
  47. formatCodetoClass,
  48. content: [
  49. // {
  50. // equipLocalName :"" , //设备本地名称
  51. // equipLocalID:"" , //设备本地编码
  52. // specification:" ", //设备型号
  53. // equipQRCode:"", //设备二维码
  54. // category:"" //设备类型编码
  55. // }
  56. ],
  57. equipmentAll: [],
  58. facility: '',
  59. count: ''
  60. }
  61. },
  62. computed: {
  63. },
  64. mounted () {
  65. this.queryEquipmentInSpace()
  66. },
  67. methods: {
  68. // 查询设备中空间报警
  69. queryEquipmentInSpace () {
  70. let params = {
  71. spaceId: 'Sp1101080001dbba0f04aa8b11e8bd139b854ebc9e7b' // 空间id
  72. }
  73. axios.post(`/dp-auxiliary/alarm-system/alarm/equipInSpace/query?projectId=${this.$store.state.projId}&secret=${this.$store.state.secret}`, params).then(res => {
  74. let data = res.data
  75. if (data.Result == 'success') {
  76. this.content = data.Content
  77. this.count = data.EquipCount - data.Count
  78. }
  79. })
  80. }
  81. // 所有的设备类型编码和对应的设备类型
  82. // getEquipmentAll(){
  83. // axios.get(`/data-platform-3/dict/query/equipment_all`).then(res=>{
  84. // let data = res.data;
  85. // if(data.Result=='success'){
  86. // this.equipmentAll = data.Content;
  87. // this.queryEquipmentInSpace();
  88. // }
  89. // })
  90. // },
  91. // 将设备类型编码转换成对应的设备类型
  92. // formatCodetoClass(this, str){
  93. // let code = str.slice(2,str.length)
  94. // this.equipmentAll.forEach(i=>{
  95. // if(i.code == str.slice(0,2)){
  96. // i.content.forEach(j=>{
  97. // let item = j.content.find(k=>k.code == code)
  98. // if(item){
  99. // this.facility = item.facility
  100. // }
  101. // })
  102. // }
  103. // })
  104. // }
  105. }
  106. }
  107. </script>
  108. <style scoped lang="less" >
  109. .room-eq {
  110. margin:0 20px 0 20px;
  111. .noEq{
  112. padding-bottom: 40px;
  113. }
  114. .eq-box {
  115. background: #FAFAFA;
  116. border: 1px solid #E0E0E0;
  117. border-radius: 2px;
  118. display: inline-block;
  119. margin-right: 18px;
  120. //min-width: 380px;
  121. width: 560px;
  122. padding: 20px 20px 20px 20px;
  123. margin-bottom: 30px;
  124. .box-left {
  125. float: left;
  126. .eq-name {
  127. font-size: 18px;
  128. color: #728DEE;
  129. font-weight: bold;
  130. }
  131. .eq-type{
  132. font-size: 14px;
  133. color: #6D747C;
  134. line-height: 16px;
  135. padding:9px 0;
  136. >span{
  137. color: #212830;
  138. padding-left: 14px;
  139. }
  140. }
  141. }
  142. .box-right{
  143. float: right;
  144. margin-right: 45px;
  145. >img{
  146. width:91px;
  147. height: 90px;
  148. }
  149. }
  150. .box-bottom {
  151. clear: both;
  152. color: #F08378;
  153. font-weight: bold;
  154. .pic-box {
  155. height: 100px;
  156. //width: 500px;
  157. margin: 20px 0 20px 20px;
  158. }
  159. .no-box{
  160. height: 100px;
  161. //width: 500px;
  162. margin: 20px 0 20px 20px;
  163. img {
  164. width:96px;
  165. height: 95px;
  166. }
  167. }
  168. }
  169. }
  170. .other-alarm {
  171. padding-bottom: 40px;
  172. }
  173. .removeClass{
  174. transform: translateX(-100px);
  175. }
  176. }
  177. </style>