deviceType.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <view class="">
  3. <view class="cu-list menu-avatar">
  4. <!-- <view class="cu-item deviceTypeItem" :class="modalName=='move-box-'+ index?'move-cur':''" v-for="(item,index) in deviceData"
  5. :key="index" :data-target="'move-box-' + index" @tap="hrefKing(index)">
  6. <view class="cu-avatar round lg" :style="`background-image:url(${item.imgUrl})`"></view>
  7. <view class="content">
  8. <view class="">{{item.title}}</view>
  9. </view>
  10. <view class="nav-right num">
  11. <view class="text-grey">
  12. 共{{item.num}}个设备
  13. <text class="icon iconfont margin-right-xs margin-left-lg">&#xe629;</text>
  14. </view>
  15. </view>
  16. </view> -->
  17. <view class="cu-item deviceTypeItem" @tap="goVideoList()">
  18. <view class="cu-avatar round lg" style="background-image:url(../../static/square-video.png)"></view>
  19. <view class="content">
  20. <view class="">视频</view>
  21. </view>
  22. <view class="nav-right num">
  23. <view class="text-grey">
  24. 共{{videoDeviceCount}}个设备
  25. <text class="icon iconfont margin-right-xs margin-left-lg">&#xe629;</text>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="cu-item deviceTypeItem" @tap="goDeviceManage()">
  30. <view class="cu-avatar round lg" style="background-image:url(../../static/square-dl.png)"></view>
  31. <view class="content">
  32. <view class="">电力监测</view>
  33. </view>
  34. <view class="nav-right num">
  35. <view class="text-grey">
  36. 共{{powerDeviceCount}}个设备
  37. <text class="icon iconfont margin-right-xs margin-left-lg">&#xe629;</text>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. export default {
  46. data() {
  47. return {
  48. powerDeviceCount:'',
  49. videoDeviceCount:'',
  50. companyCode:'',
  51. // deviceData: [{
  52. // imgUrl: '../../static/square-video.png',
  53. // title: '视频',
  54. // num: 6
  55. // }, {
  56. // imgUrl: '../../static/square-dl.png',
  57. // title: '电力监测',
  58. // num: 11
  59. // }
  60. // ],
  61. modalName: null,
  62. };
  63. },
  64. onLoad:function(option){
  65. console.log(111)
  66. console.log(option.companyCode)
  67. this.companyCode=option.companyCode
  68. this.getSiteType(option.companyCode)
  69. },
  70. methods: {
  71. async getSiteType(ming) {
  72. const res= await this.$myRequest({
  73. url:'OperationMonitoring/getDeviceStatistics',
  74. data:{
  75. "companyCode": ming,
  76. }
  77. })
  78. console.log(res.data.data[0])
  79. this.powerDeviceCount= res.data.data[0].powerDeviceCount
  80. this.videoDeviceCount= res.data.data[0].videoDeviceCount
  81. },
  82. goDeviceManage(item){
  83. if(this.powerDeviceCount){
  84. uni.navigateTo({
  85. url: '/pages/device-Manage/device-Manage?deviceType=1&companyCode='+this.companyCode+'',
  86. success: res => {},
  87. fail: () => {},
  88. complete: () => {}
  89. });
  90. }
  91. },
  92. goVideoList(item){
  93. if(this.videoDeviceCount){
  94. uni.navigateTo({
  95. url: '/pages/videoList/videoList?deviceType=2&companyCode='+this.companyCode+'',
  96. success: res => {},
  97. fail: () => {},
  98. complete: () => {}
  99. });
  100. }
  101. },
  102. hrefKing(index) {
  103. // log(index)
  104. let url = "";
  105. switch (index) {
  106. case 0:
  107. url = "/pages/videoList/videoList" //进口水果
  108. break;
  109. case 1:
  110. url = "/pages/device-Manage/device-Manage" //热门品种
  111. break;
  112. default:
  113. break;
  114. }
  115. if (url) {
  116. uni.navigateTo({
  117. url: url
  118. })
  119. } else {
  120. uni.showToast({
  121. title: '功能未完成~',
  122. icon: 'none'
  123. })
  124. }
  125. },
  126. }
  127. }
  128. </script>
  129. <style lang="scss">
  130. .cu-list.menu-avatar>.cu-item .content>uni-view:first-child {
  131. font-size: 32rpx;
  132. }
  133. .num {
  134. font-size: 30rpx;
  135. color: #666;
  136. }
  137. </style>