firstmodel.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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. <u-list-item
  17. class="itemback"
  18. v-for="(item, index) in curlist"
  19. :key="index"
  20. >
  21. <div @tap="openNewPage(item)">
  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" class="error-tag"></u-tag>
  30. <u-tag text="连接" v-else type="success" class="success-tag"></u-tag>
  31. </u-col>
  32. <u-col span="2">
  33. <u-tag v-if="item.warnFlag==0" class="success-tag">正常</u-tag>
  34. <u-tag :text="item.warnLevel_str" v-else type="error" class="error-tag" ></u-tag>
  35. </u-col>
  36. <u-col span="3">
  37. </u-col>
  38. <u-col span="5">
  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. </div>
  52. </u-list-item>
  53. </u-list>
  54. </view>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. import DeviceMenu from './devicemenu/devicemenu.vue'
  60. import api from "@/api/api";
  61. export default {
  62. data() {
  63. return {
  64. menushow:false,
  65. TabCur: "gate",
  66. curlist: [],
  67. deviceList:{},
  68. scrollLeft: 0,
  69. currentTab:0,
  70. colums:{},
  71. };
  72. },
  73. components: {
  74. DeviceMenu,
  75. },
  76. props:['showColum'],
  77. watch:{
  78. showColum(data){
  79. this.colums = data;
  80. console.log(this.colums)
  81. }
  82. },
  83. created() {
  84. this.loadData(this.TabCur);
  85. this.colums = this.showColum;
  86. },
  87. methods: {
  88. loadData(type){
  89. new Promise((resolve, reject) => {
  90. api.getDeviceMonitor({devicetype: type, pagetype: "normal", filterParams: {}}).then(response => {
  91. if(response.data.code ==200){
  92. this.deviceList[type] = response.data.result.msgTxt[0].datalist
  93. this.curlist = this.deviceList[type]
  94. console.log(this.curlist,'aaaaaaaaaaaaaaaaaaaa')
  95. }else{
  96. resolve(response)
  97. }
  98. }).catch(error => {
  99. console.log("catch===>response",response)
  100. reject(error)
  101. })
  102. })
  103. },
  104. tabSelect(e) {
  105. this.currentTab = e.currentTarget.dataset.id;
  106. this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
  107. },
  108. devicemenuShow(e){
  109. this.menushow = true;
  110. },
  111. menuClick(id){
  112. this.TabCur = id;
  113. // 显示该分类的数据
  114. this.curlist = this.deviceList[this.TabCur];
  115. if(this.curlist == null){
  116. this.curlist = [];
  117. }
  118. // 选择设备分类,重新获取数据
  119. this.loadData(this.TabCur);
  120. this.menushow = false;
  121. },
  122. openNewPage(params) {
  123. uni.navigateTo({
  124. url: `/pages/home/detail/autodoor/autodoor?id=${params.deviceID}&name=${params.strinstallpos}`
  125. })
  126. }
  127. }
  128. }
  129. </script>
  130. <style>
  131. .top-nav{
  132. height: 100rpx;
  133. line-height: 100rpx;
  134. background-color: #2aa9f3;
  135. color: #daaaa;
  136. }
  137. .top-nav2{
  138. background-color:#ffffff
  139. }
  140. .main{
  141. margin-top: 100rpx;
  142. display: flex;
  143. flex-direction: column;
  144. }
  145. .card{
  146. background-color: #ffffff;
  147. margin: auto;
  148. margin-top: 20rpx;
  149. width: 90%;
  150. height: 280rpx;
  151. border:1rpx solid #000000;
  152. border-radius: 20rpx;
  153. }
  154. .menupage{
  155. position: absolute;
  156. z-index: 2;
  157. top:40rpx;
  158. height: calc(100% - 40rpx);
  159. width: 100%;
  160. }
  161. .timetext{
  162. text-align: right;
  163. float: right;
  164. }
  165. .itemback{
  166. cursor: pointer; /* 设置鼠标指针为手指状 */
  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. text-align: center;
  177. background: linear-gradient(to right, rgba(55, 135, 254, 0.08), rgba(4, 184, 255, 0.08), rgba(60, 161, 237, 0.08));
  178. }
  179. .error-tag {
  180. background-image: url('../../static/model/9432.png');
  181. background-color: #ff0000;
  182. }
  183. .success-tag {
  184. background-image: url('../../static/model/9431.png');
  185. background-color: #00ff00;
  186. }
  187. </style>