index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <template>
  2. <view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title='设备异常'></cus-header>
  4. <div class="top" @tap="placeShow = true;">
  5. <div class="left">
  6. <image :src="imgBase+'inspection/record_location.png'"></image>
  7. <text>{{location}}</text>
  8. </div>
  9. <div class="right">
  10. <u-icon name="arrow-right" color="#FFFFFF" size="32"></u-icon>
  11. </div>
  12. </div>
  13. <div class="title">共有<span>{{list.length}}</span>条记录</div>
  14. <div class="boxs" v-if="list.length">
  15. <div class="box" v-for="(item,index) in list" :key="index">
  16. <div class="place">{{item.deviceName||''}}</div>
  17. <!-- <div class="pre">安装位置<span>{{item.time}}</span></div> -->
  18. <div class="pre">设备编号<span>{{item.deviceId||''}}</span></div>
  19. <div class="pre">告警原因<span class="red">{{item.alertConfigName||''}}</span></div>
  20. <div class="pre">告警内容<span>{{item.content||''}}</span></div>
  21. <div class="pre">告警时间<span>{{item.alertTime||''}}</span></div>
  22. </div>
  23. </div>
  24. <template v-else>
  25. <page-empty :height="'calc(100vh - 110px)'"></page-empty>
  26. </template>
  27. <u-picker :show="placeShow" :columns="placeColumns" keyName="orgName" @cancel="placeShow=false" @change="changeHandler" @confirm="placeConfirm" ref="uPicker"></u-picker>
  28. </view>
  29. </template>
  30. <script>
  31. import pageEmpty from '@/components/pageEmpty/index.vue'
  32. export default {
  33. components:{
  34. pageEmpty
  35. },
  36. data(){
  37. return {
  38. location:'',
  39. placeShow:false,
  40. placeColumns:[],
  41. placeColumnData: [],
  42. isOver:false,
  43. params:{
  44. buildingId:'',
  45. storeyId:''
  46. },
  47. list:[],
  48. }
  49. },
  50. async onLoad() {
  51. this.getFloorInfo();
  52. this.getList();
  53. },
  54. methods:{
  55. getFloorInfo(){
  56. this.$api.get('/control/getOrgStructureTree/').then(res=>{
  57. if(res.data.code===0){
  58. this.location = res.data.data[0].orgName;
  59. this.placeColumns = [
  60. res.data.data[0].childrenList,
  61. res.data.data[0].childrenList[0].childrenList
  62. ]
  63. let allfloor = [];
  64. for (let i = 0; i < res.data.data[0].childrenList.length; i++) {
  65. allfloor.push(res.data.data[0].childrenList[i].childrenList)
  66. }
  67. this.placeColumnData = allfloor;
  68. }else this.$showToast(res.data.msg)
  69. })
  70. },
  71. getList(){
  72. this.$api.get('/home/actualAlertList',this.params).then(res=>{
  73. if(res.data.code===0){
  74. this.list = res.data.data;
  75. }else this.$showModal(res.data.msg)
  76. });
  77. },
  78. changeHandler(e) {
  79. const {
  80. columnIndex,
  81. value,
  82. values, // values为当前变化列的数组内容
  83. index,
  84. // 微信小程序无法将picker实例传出来,只能通过ref操作
  85. picker = this.$refs.uPicker
  86. } = e
  87. // 当第一列值发生变化时,变化第二列(后一列)对应的选项
  88. if (columnIndex === 0) {
  89. // picker为选择器this实例,变化第二列对应的选项
  90. picker.setColumnValues(1, this.placeColumnData[index])
  91. }
  92. },
  93. placeConfirm(e){
  94. this.params.buildingId = e.value[0].orgId;
  95. this.params.storeyId = e.value[1].orgId;
  96. this.placeShow = false;
  97. this.init()
  98. },
  99. init(){
  100. this.params.page = 1;
  101. this.isOver = false;
  102. this.list = [];
  103. this.getList();
  104. }
  105. }
  106. }
  107. </script>
  108. <style scoped lang="less">
  109. .page{
  110. padding-bottom: 20rpx;
  111. background: #F4F8FB;
  112. box-sizing: border-box;
  113. .top{
  114. width: 100%;
  115. height: 102rpx;
  116. background: #198CFF;
  117. padding: 0 30rpx;
  118. box-sizing: border-box;
  119. display: flex;
  120. align-items: center;
  121. justify-content: space-between;
  122. .left{
  123. display: flex;
  124. align-items: center;
  125. image{
  126. width: 36rpx;
  127. height: 36rpx;
  128. }
  129. text{
  130. font-family: PingFangSC, PingFang SC;
  131. font-weight: 400;
  132. font-size: 30rpx;
  133. color: #FFFFFF;
  134. line-height: 42rpx;
  135. margin-left: 10rpx;
  136. }
  137. }
  138. }
  139. .filtrate{
  140. width: 100%;
  141. height: 90rpx;
  142. background: #FFFFFF;
  143. display: flex;
  144. .pre{
  145. width: calc(100% / 3);
  146. height: 100%;
  147. display: flex;
  148. align-items: center;
  149. justify-content: center;
  150. text{
  151. font-family: PingFangSC, PingFang SC;
  152. font-weight: 400;
  153. font-size: 28rpx;
  154. color: #4E5969;
  155. line-height: 40rpx;
  156. margin-right: 12rpx;
  157. }
  158. }
  159. }
  160. .title{
  161. font-family: PingFang-SC, PingFang-SC;
  162. font-weight: bold;
  163. font-size: 32rpx;
  164. color: #1D2129;
  165. line-height: 32rpx;
  166. margin-top: 36rpx;
  167. padding-left: 24rpx;
  168. span{
  169. color: #198CFF;
  170. margin: 0 10rpx;
  171. }
  172. }
  173. .boxs{
  174. width: 100%;
  175. padding: 0 24rpx;
  176. box-sizing: border-box;
  177. margin-top: 16rpx;
  178. overflow: hidden;
  179. .box{
  180. margin-top: 20rpx;
  181. background: #FFFFFF;
  182. border-radius: 16rpx;
  183. padding: 36rpx 24rpx;
  184. .place{
  185. font-family: PingFang-SC, PingFang-SC;
  186. font-weight: bold;
  187. font-size: 32rpx;
  188. color: #1D2129;
  189. line-height: 36rpx;
  190. white-space: nowrap;
  191. overflow: hidden;
  192. text-overflow: ellipsis;
  193. }
  194. .pre{
  195. font-family: PingFangSC, PingFang SC;
  196. font-weight: 400;
  197. font-size: 24rpx;
  198. color: #86909C;
  199. line-height: 24rpx;
  200. margin-top: 26rpx;
  201. span{
  202. font-family: PingFangSC, PingFang SC;
  203. font-weight: 400;
  204. font-size: 26rpx;
  205. color: #1D2129;
  206. line-height: 26rpx;
  207. margin-left: 20rpx;
  208. &.red{
  209. color: #F95050;
  210. }
  211. }
  212. }
  213. }
  214. }
  215. }
  216. </style>