firstmodel.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <view class="container">
  3. <!-- 建议放在外层 -->
  4. <u-navbar title="设备监测" @leftClick="devicemenuShow" :safeAreaInsetTop="false">
  5. <view class="u-nav-slot" slot="left">
  6. <u-icon name="list" size="20">
  7. </u-icon>
  8. </view>
  9. </u-navbar>
  10. <view v-show="menushow" class="menupage">
  11. <DeviceMenu @menuClick="menuClick"></DeviceMenu>
  12. </view>
  13. <view v-show="!menushow" class="main">
  14. <view class="u-page">
  15. <u-list
  16. >
  17. <u-list-item
  18. class="itemback"
  19. v-for="(item, index) in curlist"
  20. :key="index"
  21. >
  22. <u-row gutter="5" customStyle="margin-bottom: 10px">
  23. <u-col span="24">
  24. <u--text :text="item.strinstallpos"></u--text>
  25. </u-col>
  26. </u-row>
  27. <u-row gutter="5" customStyle="margin-bottom: 10px">
  28. <u-col span="2">
  29. <u-tag text="断开" v-if="item.netStatus==0" type="error"></u-tag>
  30. <u-tag text="连接" v-else type="success"></u-tag>
  31. </u-col>
  32. <u-col span="2">
  33. <u-tag text="正常" v-if="item.warnFlag==0" type="success"></u-tag>
  34. <u-tag :text="item.warnLevel_str" v-else type="error"></u-tag>
  35. </u-col>
  36. <u-col span="4">
  37. </u-col>
  38. <u-col span="4">
  39. <u--text class="timetext" :text="item.readTime"></u--text>
  40. </u-col>
  41. </u-row>
  42. <view v-if="colums[TabCur+'_monitor']!=null">
  43. <view class="datacard" v-for="(showitem,index) in colums[TabCur+'_monitor']" v-show="showitem.appShow == 1 ">
  44. <view v-show="showitem.monitorcode != 'strinstallpos' && showitem.monitorcode != 'netStatus' && showitem.monitorcode != 'warnFlag' && showitem.monitorcode != 'readTime'">
  45. <view class="demo-layout bg-purple-light">{{showitem.des}}</view>
  46. <view v-if="showitem.datatype==1" class="demo-layout bg-purple-light">{{item[showitem.monitorcode]}}</view>
  47. <view v-if="showitem.datatype==2" class="demo-layout bg-purple-light">{{item.readData[showitem.monitorcode]}}</view>
  48. </view>
  49. </view>
  50. </view>
  51. </u-list-item>
  52. </u-list>
  53. </view>
  54. <!-- <view class="card" v-for="(item,index) in 4" :key="index">
  55. <H1>Tab{{index}}</H1>
  56. </view> -->
  57. </view>
  58. </view>
  59. </template>
  60. <script>
  61. import DeviceMenu from './devicemenu/devicemenu.vue'
  62. import api from "@/api/api";
  63. export default {
  64. data() {
  65. return {
  66. menushow:false,
  67. TabCur: "gate",
  68. curlist: [],
  69. deviceList:{},
  70. scrollLeft: 0,
  71. currentTab:0,
  72. colums:{},
  73. tab0data:[
  74. {name:"测风装置",id:0},
  75. {name:"对射测风",id:1},
  76. {name:"单点测风",id:2},
  77. {name:"九点测风",id:3},
  78. ]
  79. };
  80. },
  81. components: {
  82. DeviceMenu,
  83. },
  84. props:['showColum'],
  85. watch:{
  86. showColum(data){
  87. this.colums = data;
  88. }
  89. },
  90. created() {
  91. this.loadData(this.TabCur);
  92. this.colums = this.showColum;
  93. },
  94. methods: {
  95. loadData(type){
  96. new Promise((resolve, reject) => {
  97. api.getDeviceMonitor({devicetype: type, pagetype: "normal", filterParams: {}}).then(response => {
  98. if(response.data.code ==200){
  99. this.deviceList[type] = response.data.result.msgTxt[0].datalist
  100. this.curlist = this.deviceList[type]
  101. }else{
  102. resolve(response)
  103. }
  104. }).catch(error => {
  105. console.log("catch===>response",response)
  106. reject(error)
  107. })
  108. })
  109. },
  110. tabSelect(e) {
  111. this.currentTab = e.currentTarget.dataset.id;
  112. this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
  113. },
  114. devicemenuShow(e){
  115. this.menushow = true;
  116. },
  117. menuClick(id){
  118. this.TabCur = id;
  119. // 显示该分类的数据
  120. this.curlist = this.deviceList[this.TabCur];
  121. if(this.curlist == null){
  122. this.curlist = [];
  123. }
  124. // 选择设备分类,重新获取数据
  125. this.loadData(this.TabCur);
  126. this.menushow = false;
  127. }
  128. }
  129. }
  130. </script>
  131. <style>
  132. .top-nav{
  133. height: 100rpx;
  134. line-height: 100rpx;
  135. background-color: #2aa9f3;
  136. color: #daaaa;
  137. }
  138. .top-nav2{
  139. background-color:#ffffff
  140. }
  141. .main{
  142. margin-top: 100rpx;
  143. display: flex;
  144. flex-direction: column;
  145. }
  146. .card{
  147. background-color: #ffffff;
  148. margin: auto;
  149. margin-top: 20rpx;
  150. width: 90%;
  151. height: 280rpx;
  152. border:1rpx solid #000000;
  153. border-radius: 20rpx;
  154. }
  155. .menupage{
  156. position: absolute;
  157. z-index: 2;
  158. top:40rpx;
  159. height: calc(100% - 40rpx);
  160. width: 100%;
  161. }
  162. .timetext{
  163. text-align: right;
  164. float: right;
  165. }
  166. .itemback{
  167. padding: 20rpx;
  168. background-color: #ffffff;
  169. margin-bottom: 5rpx;
  170. }
  171. .datacard{
  172. width: 23%;
  173. margin: 1%;
  174. float: left;
  175. height: 70rpx;
  176. }
  177. </style>