facilitiesDetailsList.vue 3.8 KB

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