facilitiesDetailsList.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <scroll-view class="scroll-height" :scroll-y="true" :data-theme="'theme-' + proxy.$settingStore.themeColor.name">
  3. <u-sticky class="example-body" style="top: 0px">
  4. <view class="padding-sm padding-tb-10" :class="'bg-' + proxy.$settingStore.themeColor.name">
  5. <u--input
  6. v-model="facilityName"
  7. placeholder="搜索"
  8. prefixIcon="search"
  9. prefixIconStyle="font-size: 22px;color: #909399"
  10. customStyle="height:35px;background-color:#f5f6fa;"
  11. @confirm="init()"
  12. clearable
  13. ></u--input>
  14. </view>
  15. </u-sticky>
  16. <view class="facilitiesDetailsList-container">
  17. <view class="menu-list margin-0">
  18. <view class="list-cell list-cell-arrow" v-for="(base, index) in dataList" :key="index" @click="handleToDevice(base.id)">
  19. <view class="menu-item-box">
  20. <view class="title">{{ base.facilityName }}</view>
  21. </view>
  22. </view>
  23. </view>
  24. <uni-pagination class="block app-pagination bg-white" :current="current" :total="total" :pageSize="pageSize" prev-text="上一页" next-text="下一页" @change="paginationChange" />
  25. </view>
  26. </scroll-view>
  27. </template>
  28. <script setup>
  29. import { onLoad, onShow, onReady, onHide, onLaunch, onNavigationBarButtonTap, onPageScroll } from "@dcloudio/uni-app";
  30. import { ref, reactive, computed, getCurrentInstance, toRefs, inject } from "vue";
  31. import { publicStores, useStores } from "@/store/modules/index";
  32. import { baseGgpFacility } from "@/api/business/fireIot/facilitiesView/index";
  33. const { proxy } = getCurrentInstance();
  34. const dataList = ref([]);
  35. const facilityType = ref(undefined);
  36. const facilityName = ref("");
  37. const facilityTypeName = ref("");
  38. const pageSize = ref(20);
  39. const current = ref(1);
  40. const total = ref(0);
  41. /**
  42. * @页面初始化
  43. */
  44. function init() {
  45. baseGgpFacility({ facilityType: facilityType.value, facilityName: facilityName.value, current: current.value, size: pageSize.value }).then((requset) => {
  46. if (requset.status === "SUCCESS") {
  47. if (requset.data.records.length > 0) {
  48. uni.setNavigationBarTitle({
  49. title: `${facilityTypeName.value}(${requset.data.total})`,
  50. });
  51. }
  52. dataList.value = requset.data.records;
  53. total.value = requset.data.total;
  54. }
  55. });
  56. }
  57. /**
  58. * @分页chage事件
  59. */
  60. function paginationChange(e) {
  61. current.value = e.current;
  62. init();
  63. }
  64. /**
  65. * @设备详情跳转点击事件
  66. */
  67. function handleToDevice(id) {
  68. proxy.$tab.navigateTo(`/pages/business/fireIot/facilitiesView/facilitiesDetails?id=${id}&typeName=${facilityTypeName.value}`);
  69. }
  70. onReady(() => {});
  71. onShow(() => {
  72. //调用系统主题颜色
  73. proxy.$settingStore.systemThemeColor([1]);
  74. });
  75. onLoad((options) => {
  76. if ("typeName" in options) {
  77. facilityTypeName.value = options.typeName;
  78. }
  79. if ("id" in options) {
  80. facilityType.value = parseInt(options.id);
  81. init();
  82. }
  83. });
  84. // 自定义导航事件
  85. onNavigationBarButtonTap((e) => {
  86. if (e.float == "right") {
  87. } else {
  88. }
  89. });
  90. </script>
  91. <style lang="scss" scoped>
  92. .facilitiesDetailsList-container {
  93. }
  94. </style>