deviceType.vue 2.2 KB

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