index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <u-sticky class="shadow-default" bgColor="#fff" style="top: 0">
  3. <u-tabs :list="tabsList" :current="tabsCurrent" @click="tabsClick" lineColor="#333" :activeStyle="{ color: '#333' }" :inactiveStyle="{ color: '#909399' }" :scrollable="false"></u-tabs>
  4. </u-sticky>
  5. <oa-scroll
  6. customClass=" scroll-height"
  7. :pageSize="pageSize"
  8. :total="total"
  9. :refresherLoad="true"
  10. :refresherEnabled="true"
  11. :refresherDefaultStyle="'none'"
  12. :refresherThreshold="44"
  13. :refresherBackground="'#f5f6f7'"
  14. @load="load"
  15. @refresh="refresh"
  16. :data-theme="'theme-' + proxy.$settingStore.themeColor.name"
  17. >
  18. <template #default>
  19. <view class="alarmDetailsList-container">
  20. <view class="menu-list margin-0">
  21. <view class="list-cell list-cell-arrow" v-for="(base, index) in dataList" :key="index" @click="handleToDetails(base)">
  22. <view class="menu-item-box" style="font-size: 13px; flex-flow: row wrap">
  23. <view style="min-width: 80%; margin-bottom: 5px; color: #909399"> {{ base.alarmTime }}</view>
  24. <view style="min-width: 20%; margin-bottom: 5px; color: #909399; text-align: right; padding-right: 15px"> {{ base.alarmGrade }}级</view>
  25. <view style="min-width: 80%; margin-bottom: 5px; color: #909399">{{ base.deviceName }}</view>
  26. <view style="min-width: 20%; margin-bottom: 5px; text-align: right; padding-right: 15px" :style="`color:${base.handleStatus == 1 ? '#16bf00' : 'red'}`">
  27. {{ base.handleStatus == 1 ? "已处理" : "未处理" }}
  28. </view>
  29. <view style="min-width: 50%; padding-right: 15px">{{ base.alarmContent }}</view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. </oa-scroll>
  36. </template>
  37. <script setup>
  38. import { onLoad, onShow, onReady, onHide, onLaunch, onNavigationBarButtonTap, onPageScroll } from "@dcloudio/uni-app";
  39. import { ref, reactive, computed, getCurrentInstance, toRefs, inject } from "vue";
  40. import { publicStores, useStores } from "@/store/modules/index";
  41. import { baseAlarmList } from "@/api/business/fireIot/alarmManage.js";
  42. const { proxy } = getCurrentInstance();
  43. const publicStore = publicStores();
  44. const tabsList = ref([
  45. {
  46. name: "全部",
  47. value: "",
  48. },
  49. {
  50. name: "未处理",
  51. value: 0,
  52. },
  53. {
  54. name: "已处理",
  55. value: 1,
  56. },
  57. ]);
  58. const tabsCurrent = ref(0);
  59. const dataList = ref([]);
  60. const productCode = ref("");
  61. const productName = ref("");
  62. const pageSize = ref(20);
  63. const current = ref(1);
  64. const total = ref(0);
  65. /**
  66. * @页面初始化
  67. */
  68. function init() {
  69. selectListApi();
  70. }
  71. /**
  72. * @列表查询
  73. * @api接口查询
  74. */
  75. function selectListApi() {
  76. baseAlarmList({
  77. productCode: productCode.value,
  78. handleStatus: tabsList.value[tabsCurrent.value].value,
  79. current: current.value,
  80. size: pageSize.value,
  81. }).then((requset) => {
  82. if (requset.status === "SUCCESS") {
  83. dataList.value = requset.data.records;
  84. total.value = requset.data.total;
  85. uni.setNavigationBarTitle({
  86. title: `${productName.value}(${total.value})`,
  87. });
  88. }
  89. });
  90. }
  91. /**
  92. * @跳转详情事件
  93. */
  94. function handleToDetails(e) {
  95. proxy.$tab.navigateTo(`/pages/business/fireIot/alarmManage/alarmDetails/index?deviceName=${e.deviceName}&alarmTime=${e.alarmTime}`);
  96. }
  97. /**
  98. * @scrollView加载数据
  99. */
  100. function load() {
  101. pageSize.value += 10;
  102. init();
  103. }
  104. /**
  105. * @scrollView刷新数据
  106. */
  107. function refresh() {
  108. pageSize.value = 20;
  109. total.value = 0;
  110. init();
  111. }
  112. /**
  113. * @tabs点击事件
  114. */
  115. function tabsClick(e) {
  116. tabsCurrent.value = e.index;
  117. init();
  118. }
  119. onReady(() => {});
  120. onShow(() => {
  121. //调用系统主题颜色
  122. proxy.$settingStore.systemThemeColor([1]);
  123. });
  124. onLoad((options) => {
  125. if ("productName" in options) {
  126. productName.value = options.productName;
  127. }
  128. if ("productCode" in options) {
  129. productCode.value = options.productCode;
  130. init();
  131. }
  132. });
  133. </script>
  134. <style lang="scss" scoped>
  135. .alarmDetailsList-container {
  136. }
  137. </style>