facilitiesDetailsList.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <oa-scroll
  3. customClass="scroll-height"
  4. :pageSize="pageSize"
  5. :total="total"
  6. :refresherLoad="true"
  7. :refresherEnabled="true"
  8. :refresherDefaultStyle="'none'"
  9. :refresherThreshold="44"
  10. :refresherBackground="'#f5f6f7'"
  11. @load="load"
  12. @refresh="refresh"
  13. :data-theme="'theme-' + proxy.$settingStore.themeColor.name"
  14. >
  15. <template #default>
  16. <view class="facilitiesDetailsList-container">
  17. <view class="flex bg-white p10" style="position: relative">
  18. <u--input
  19. style="width: 100%"
  20. v-model="facilityName"
  21. placeholder="请输入设施名称"
  22. prefixIcon="search"
  23. prefixIconStyle="font-size: 22px;color: #909399"
  24. customStyle="height:30px;background-color:#f5f6fa;"
  25. @confirm="init()"
  26. clearable
  27. ></u--input>
  28. <view class="ml10" style="margin-top: auto; margin-bottom: auto; white-space: nowrap" @click="init()">筛选</view>
  29. </view>
  30. <view class="menu-list margin-0">
  31. <view class="list-cell list-cell-arrow" v-for="(base, index) in dataList" :key="index" @click="handleToDevice(base.id)">
  32. <view class="menu-item-box">
  33. <view class="title">{{ base.facilityName }}</view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </template>
  39. </oa-scroll>
  40. </template>
  41. <script setup>
  42. import { onLoad, onShow, onReady, onHide, onLaunch, onNavigationBarButtonTap, onPageScroll } from "@dcloudio/uni-app";
  43. import { ref, reactive, computed, getCurrentInstance, toRefs, inject } from "vue";
  44. import { publicStores, useStores } from "@/store/modules/index";
  45. import { baseGgpFacility } from "@/api/business/fireIot/facilitiesManage.js";
  46. const { proxy } = getCurrentInstance();
  47. const dataList = ref([]);
  48. const facilityType = ref(undefined);
  49. const facilityName = ref("");
  50. const facilityTypeName = ref("");
  51. const pageSize = ref(20);
  52. const current = ref(1);
  53. const total = ref(0);
  54. /**
  55. * @页面初始化
  56. */
  57. function init() {
  58. selectListApi();
  59. }
  60. /**
  61. * @列表查询
  62. * @api接口查询
  63. */
  64. function selectListApi() {
  65. baseGgpFacility({ facilityType: facilityType.value, facilityName: facilityName.value, current: current.value, size: pageSize.value }).then((requset) => {
  66. if (requset.status === "SUCCESS") {
  67. if (requset.data.records.length > 0) {
  68. uni.setNavigationBarTitle({
  69. title: `${facilityTypeName.value}(${requset.data.total})`,
  70. });
  71. }
  72. dataList.value = requset.data.records;
  73. total.value = requset.data.total;
  74. }
  75. });
  76. }
  77. /**
  78. * @设备详情跳转点击事件
  79. */
  80. function handleToDevice(id) {
  81. proxy.$tab.navigateTo(`/pages/business/fireIot/facilitiesManage/facilitiesDetails?id=${id}&typeName=${facilityTypeName.value}`);
  82. }
  83. /**
  84. * @scrollView加载数据
  85. */
  86. function load() {
  87. pageSize.value += 10;
  88. init();
  89. }
  90. /**
  91. * @scrollView刷新数据
  92. */
  93. function refresh() {
  94. facilityName.value = "";
  95. pageSize.value = 20;
  96. total.value = 0;
  97. init();
  98. }
  99. onReady(() => {});
  100. onShow(() => {
  101. //调用系统主题颜色
  102. proxy.$settingStore.systemThemeColor([1]);
  103. });
  104. onLoad((options) => {
  105. if ("typeName" in options) {
  106. facilityTypeName.value = options.typeName;
  107. }
  108. if ("id" in options) {
  109. facilityType.value = parseInt(options.id);
  110. init();
  111. }
  112. });
  113. // 自定义导航事件
  114. onNavigationBarButtonTap((e) => {
  115. if (e.float == "right") {
  116. } else {
  117. }
  118. });
  119. </script>
  120. <style lang="scss" scoped>
  121. .facilitiesDetailsList-container {
  122. }
  123. </style>