index.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <oa-scroll
  3. customClass="bg-white scroll-height"
  4. :pageSize="pageSize"
  5. :total="total"
  6. :isSticky="false"
  7. :refresherLoad="true"
  8. :refresherLoadTitle="true"
  9. :refresherEnabled="true"
  10. :refresherDefaultStyle="'none'"
  11. :refresherThreshold="44"
  12. :refresherBackground="'#f5f6f7'"
  13. @load="load"
  14. @refresh="refresh"
  15. :data-theme="'theme-' + proxy.$settingStore.themeColor.type"
  16. >
  17. <template #default>
  18. <view class="deviceManage" style="border-top:1px solid rgba(0,0,0,.1)">
  19. <u-grid :border="true" >
  20. <u-grid-item v-for="(base, index) in dataList" :key="index" @click="handleToDevice(base.id, base.productName,base.deviceCount)">
  21. <!-- <u-badge type="primary" max="9999" :value="base.deviceCount" :showZero="true" :absolute="true" :offset="[10, 10, 0, 0]"></u-badge> -->
  22. <image class="mb15 mt35" style="width: 40px; height: 40px" :src="base.typeImg" mode="aspectFill"></image>
  23. <view class="mb15 text-ellipsis" style="width: 100%; text-align: center">{{ base.productName }}</view>
  24. </u-grid-item>
  25. </u-grid>
  26. </view>
  27. </template>
  28. </oa-scroll>
  29. </template>
  30. <script setup>
  31. import { onReady, onLoad, onShow, onNavigationBarButtonTap, onPullDownRefresh, onReachBottom } from "@dcloudio/uni-app";
  32. import { ref, onMounted, inject, shallowRef, reactive, getCurrentInstance } from "vue";
  33. import { useStores, commonStores } from "@/store/modules/index";
  34. import { dmpProductInfo } from "@/api/business/fireIot/deviceManage.js";
  35. const { proxy } = getCurrentInstance();
  36. const dataList = ref([]);
  37. const pageSize = ref(21);
  38. const current = ref(1);
  39. const total = ref(0);
  40. /**
  41. * @页面初始化
  42. */
  43. function init() {
  44. dmpProductInfo({ productName: "", current: current.value, size: pageSize.value }).then((requset) => {
  45. if (requset.status === "SUCCESS") {
  46. requset.data.records.forEach((el) => {
  47. if (!el.typeImg) {
  48. el.typeImg = "/static/images/404.png";
  49. }
  50. if (el.deviceCount == null) {
  51. el.deviceCount = 0;
  52. }
  53. });
  54. dataList.value = requset.data.records;
  55. total.value = requset.data.total;
  56. }
  57. });
  58. }
  59. function handleToDevice(id, productName,total) {
  60. proxy.$tab.navigateTo(`/pages/business/fireIot/deviceManage/components/deviceDetailsList?id=${id}&productName=${productName}`);
  61. }
  62. /**
  63. * @scrollView加载数据
  64. */
  65. function load() {
  66. pageSize.value += 10;
  67. init();
  68. }
  69. /**
  70. * @scrollView刷新数据
  71. */
  72. function refresh() {
  73. pageSize.value = 20;
  74. init();
  75. }
  76. onShow(() => {
  77. //调用系统主题颜色
  78. proxy.$settingStore.systemThemeColor([1]);
  79. init();
  80. });
  81. </script>