index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template>
  2. <u-sticky class="shadow-default" bgColor="#fff" style="top: 0">
  3. <u-tabs
  4. :list="state.tabsList"
  5. :current="state.tabsCurrent"
  6. @click="tabsClick"
  7. lineColor="#333"
  8. :activeStyle="{ color: '#333', fontSize: '14px' }"
  9. :inactiveStyle="{ color: '#909399', fontSize: '14px' }"
  10. :scrollable="false"
  11. ></u-tabs>
  12. </u-sticky>
  13. <oa-scroll
  14. customClass="scroll-height"
  15. :pageSize="state.pageSize"
  16. :total="state.total"
  17. :isSticky="true"
  18. :refresherLoad="true"
  19. :refresherEnabled="true"
  20. :refresherDefaultStyle="'none'"
  21. :refresherThreshold="44"
  22. :refresherBackground="'#f5f6f7'"
  23. @load="load"
  24. @refresh="refresh"
  25. :data-theme="'theme-' + proxy.$settingStore.themeColor.name"
  26. >
  27. <template #default>
  28. <view class="menu-list m0">
  29. <view class="list-cell list-cell-arrow" style="line-height: 25px" v-for="(base, index) in state.dataList" :key="index" @click="handleToDetails(base)">
  30. <view class="menu-item">
  31. <image
  32. class="image-bg"
  33. style="width: 80rpx; height: 80rpx; margin: auto 10px auto 0"
  34. :src="base.handleStatus == 1 ? '/static/images/fireInspect/processed-icon.png' : '/static/images/fireInspect/process-icon.png'"
  35. >
  36. </image>
  37. <view style="width: calc(100% - 51px); display: flex; justify-content: space-between; align-items: center; padding-right: 10px">
  38. <view class="deviceHeader">
  39. <view class="deviceName text-ellipsis">{{ base.superviseCode }}</view>
  40. <view class="deviceName text-ellipsis"> {{ base.content }}</view>
  41. <view class="deviceName text-ellipsis">{{ base.timestamp ? base.timestamp.replace("T", " ") : "" }}</view>
  42. </view>
  43. <view class="" v-if="base.handleStatus == 1" style="color: #16bf00; margin-right: 10px"> 已处理 </view>
  44. <view class="" v-if="base.handleStatus == 0" style="color: red; margin-right: 10px"> 未处理 </view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </template>
  50. </oa-scroll>
  51. </template>
  52. <script setup>
  53. /*----------------------------------依赖引入-----------------------------------*/
  54. import { onLoad, onShow, onReady, onHide, onLaunch, onNavigationBarButtonTap, onPageScroll } from "@dcloudio/uni-app";
  55. import { ref, reactive, computed, getCurrentInstance, toRefs, inject } from "vue";
  56. /*----------------------------------接口引入-----------------------------------*/
  57. import { eleInspectList, persInspectList } from "@/api/business/zhxf/fireInspect/index.js";
  58. /*----------------------------------组件引入-----------------------------------*/
  59. /*----------------------------------store引入-----------------------------------*/
  60. /*----------------------------------公共方法引入-----------------------------------*/
  61. /*----------------------------------公共变量-----------------------------------*/
  62. const { proxy } = getCurrentInstance();
  63. /*----------------------------------变量声明-----------------------------------*/
  64. const state = reactive({
  65. tabsList: [
  66. { name: "全部", value: "" },
  67. { name: "未处理", value: 0 },
  68. { name: "已处理", value: 1 },
  69. ],
  70. tabsCurrent: 0,
  71. dataList: [],
  72. productCode: "",
  73. productName: "",
  74. pageSize: 20,
  75. current: 1,
  76. total: 0,
  77. });
  78. /**
  79. * @页面初始化
  80. */
  81. function init() {
  82. selectListApi();
  83. }
  84. /**
  85. * @列表查询
  86. * @api接口查询
  87. */
  88. function selectListApi() {
  89. if (state.productName == "电子督察单") {
  90. getList(eleInspectList);
  91. } else {
  92. getList(persInspectList);
  93. }
  94. function getList(param) {
  95. param({
  96. handleStatus: state.tabsList[state.tabsCurrent].value,
  97. pageNum: state.current,
  98. pageSize: state.pageSize,
  99. }).then((requset) => {
  100. if (requset.status === "SUCCESS") {
  101. state.dataList = requset.data.records;
  102. state.total = requset.data.total;
  103. uni.setNavigationBarTitle({
  104. title: `${state.productName}(${state.total})`,
  105. });
  106. }
  107. });
  108. }
  109. }
  110. /**
  111. * @跳转详情事件
  112. */
  113. function handleToDetails(e) {
  114. console.log(e);
  115. proxy.$tab.navigateTo(`/pages/business/zhxf/fireInspect/inspectDetails/index?id=${e.id}&productName=${state.productName}`);
  116. }
  117. /**
  118. * @scrollView加载数据
  119. */
  120. function load() {
  121. state.pageSize += 10;
  122. init();
  123. }
  124. /**
  125. * @scrollView刷新数据
  126. */
  127. function refresh() {
  128. state.pageSize = 20;
  129. init();
  130. }
  131. /**
  132. * @tabs点击事件
  133. */
  134. function tabsClick(e) {
  135. state.tabsCurrent = e.index;
  136. init();
  137. }
  138. onReady(() => {});
  139. onShow(() => {
  140. init();
  141. //调用系统主题颜色
  142. proxy.$settingStore.systemThemeColor([1]);
  143. });
  144. onLoad((options) => {
  145. if ("productName" in options) {
  146. state.productName = options.productName;
  147. }
  148. if ("productCode" in options) {
  149. state.productCode = options.productCode;
  150. init();
  151. }
  152. });
  153. </script>
  154. <style lang="scss" scoped>
  155. .alarmDetailsList-container {
  156. }
  157. </style>