index.vue 2.9 KB

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