firstmodel.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <view class="container">
  3. <!-- 建议放在外层 -->
  4. <u-navbar title="设备监测" @leftClick="devicemenuShow" :bgImage="backPic" :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. backPic:"url(../../../../static/topnavbar.png)",
  72. };
  73. },
  74. components: {
  75. DeviceMenu,
  76. },
  77. props:['showColum'],
  78. watch:{
  79. showColum(data){
  80. this.colums = data;
  81. console.log(this.colums)
  82. }
  83. },
  84. created() {
  85. this.loadData(this.TabCur);
  86. this.colums = this.showColum;
  87. },
  88. methods: {
  89. loadData(type){
  90. new Promise((resolve, reject) => {
  91. api.getDeviceMonitor({devicetype: type, pagetype: "normal", filterParams: {}}).then(response => {
  92. if(response.data.code ==200){
  93. this.deviceList[type] = response.data.result.msgTxt[0].datalist
  94. this.curlist = this.deviceList[type]
  95. console.log(this.curlist,'aaaaaaaaaaaaaaaaaaaa')
  96. }else{
  97. resolve(response)
  98. }
  99. }).catch(error => {
  100. console.log("catch===>response",response)
  101. reject(error)
  102. })
  103. })
  104. },
  105. tabSelect(e) {
  106. this.currentTab = e.currentTarget.dataset.id;
  107. this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
  108. },
  109. devicemenuShow(e){
  110. this.menushow = true;
  111. },
  112. menuClick(id){
  113. this.TabCur = id;
  114. // 显示该分类的数据
  115. this.curlist = this.deviceList[this.TabCur];
  116. if(this.curlist == null){
  117. this.curlist = [];
  118. }
  119. // 选择设备分类,重新获取数据
  120. this.loadData(this.TabCur);
  121. this.menushow = false;
  122. },
  123. openNewPage(params) {
  124. uni.navigateTo({
  125. url: `/pages/home/detail/autodoor/autodoor?id=${params.deviceID}&name=${params.strinstallpos}`
  126. })
  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. cursor: pointer; /* 设置鼠标指针为手指状 */
  168. padding: 20rpx;
  169. background-color: #ffffff;
  170. margin-bottom: 5rpx;
  171. }
  172. .datacard{
  173. width: 23%;
  174. margin: 1%;
  175. float: left;
  176. height: 70rpx;
  177. text-align: center;
  178. background: linear-gradient(to right, rgba(55, 135, 254, 0.08), rgba(4, 184, 255, 0.08), rgba(60, 161, 237, 0.08));
  179. }
  180. .error-tag {
  181. background-image: url('../../static/model/9432.png');
  182. background-color: #ff0000;
  183. }
  184. .success-tag {
  185. background-image: url('../../static/model/9431.png');
  186. background-color: #00ff00;
  187. }
  188. </style>