deviceType.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <view class="">
  3. <view class="cu-list menu-avatar">
  4. <view class="cu-item deviceTypeItem" v-for="(item,index) in deviceType" :key="index" @tap="goDeviceType(item)">
  5. <view class="cu-avatar round" :style="`background-image:url(${item.imgUrl})`"></view>
  6. <view class="content">
  7. <view class="title">{{item.title}}</view>
  8. </view>
  9. <view class="nav-right num">
  10. <view>
  11. 共{{item.num}}个设备
  12. <text class="icon iconfont margin-right-xs margin-left-lg">&#xe629;</text>
  13. </view>
  14. </view>
  15. </view>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. import json from '../../data/json.js';
  21. export default {
  22. data() {
  23. return {
  24. deviceType: json.deviceType,
  25. getData:{}
  26. };
  27. },
  28. onLoad: function(option) {
  29. this.getDeviceData({'company_code':uni.getStorageSync('selectedCode')})
  30. },
  31. methods: {
  32. goDeviceType(item) {
  33. uni.navigateTo({
  34. url: '/pages/device-Manage/device-Manage?dwtype='+item.dwtype,
  35. });
  36. },
  37. // 设备类型数据请求
  38. async getDeviceData(params = {}) {
  39. const res = await this.$myRequest({
  40. url: 'DeviceManagement/getDeviceCount',
  41. data:params,
  42. showLoading: true
  43. })
  44. this.getData=res.data.data[0];
  45. console.log(this.getData);
  46. this.deviceType[0].num=this.getData.access_control_device_count;
  47. this.deviceType[1].num=this.getData.water_meter_device_count
  48. this.deviceType[2].num=this.getData.electrical_fire_device_count
  49. this.deviceType[3].num=this.getData.rtu_device_count
  50. this.deviceType[4].num=this.getData.smoke_sensation_device_count
  51. this.deviceType[5].num=this.getData.video_device_count
  52. this.deviceType[6].num=this.getData.manhole_cover_device_count
  53. this.deviceType[6].num=this.getData.fire_hydrant_device_count
  54. },
  55. }
  56. }
  57. </script>
  58. <style lang="scss">
  59. </style>