historyList.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <view class="content">
  3. <u-navbar back-text="返回" title="历史记录" back-icon-color="#ffffff" :back-text-style="{color: '#ffffff'}" title-color="#ffffff"
  4. :background="{backgroundColor: mainColor}"></u-navbar>
  5. <scroll-view scroll-y class="scroll-box" @scrolltolower="handleLoadMore" :refresher-enabled="true"
  6. :refresher-triggered="triggered" :refresher-threshold="100" refresher-background="white" @refresherrefresh="onRefresh"
  7. @refresherrestore="onRestore">
  8. <u-cell-group>
  9. <u-cell-item :title="'《安全隐患整改建议书》' + item.completeTime" :title-style="titleStyle" v-for="(item, index) in tableList"
  10. :key="index" @click="goToRectifyInfo(item)">
  11. <view :style="item.signState == 2 ? '' : valueStyle" style="font-size: 12px;">{{item.signState == 2 ? '已签阅' : '未签阅'}}</view>
  12. <view>{{item.signDate}}</view>
  13. </u-cell-item>
  14. </u-cell-group>
  15. <u-divider v-if="isOver" bg-color="transparent" margin-top="20">没有更多了</u-divider>
  16. </scroll-view>
  17. <u-top-tips ref="uTips" :navbar-height="statusBarHeight + navbarHeight"></u-top-tips>
  18. </view>
  19. </template>
  20. <script>
  21. import {
  22. mapGetters
  23. } from 'vuex'
  24. const NET = require('@/utils/request')
  25. const API = require('@/config/api')
  26. export default {
  27. computed: {
  28. ...mapGetters([
  29. 'mainColor',
  30. 'handleDefaultCustomStyle',
  31. ])
  32. },
  33. data() {
  34. return {
  35. statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
  36. navbarHeight: 44,
  37. form: {
  38. tenantId: '',
  39. assetId: '',
  40. },
  41. titleStyle: {
  42. fontSize: '14px',
  43. flex: 3,
  44. },
  45. valueStyle: {
  46. color: '#fa3534'
  47. },
  48. triggered: false,
  49. isOver: false,
  50. pageIndex: 1,
  51. tableList: [],
  52. }
  53. },
  54. onLoad(options) {
  55. this.form.tenantId = options.tenantId
  56. this.form.assetId = options.assetId
  57. this.getTableList()
  58. },
  59. onReady() {},
  60. methods: {
  61. // 下拉刷新
  62. onRefresh() {
  63. this.triggered = true
  64. this.isOver = false
  65. this.pageIndex = 1
  66. this.tableList = []
  67. this.getTableList()
  68. },
  69. // 重置下拉刷新状态
  70. onRestore() {
  71. this.triggered = 'restore'
  72. this.triggered = false
  73. },
  74. // 懒加载
  75. handleLoadMore() {
  76. if (!this.isOver) {
  77. this.pageIndex++
  78. this.getTableList()
  79. }
  80. },
  81. // 获取列表数据
  82. getTableList() {
  83. NET.request(API.getHistoryList, {
  84. ...this.form,
  85. pageIndex: this.pageIndex,
  86. pageSize: 10,
  87. }, 'GET').then(res => {
  88. this.triggered = false
  89. this.tableList = this.tableList.concat(res.data.records)
  90. this.isOver = res.data.records.length != 10
  91. }).catch(error => {
  92. this.triggered = false
  93. this.$refs.uTips.show({
  94. title: error.message,
  95. type: 'warning',
  96. })
  97. })
  98. },
  99. // 跳转隐患整改清单
  100. goToRectifyInfo(item) {
  101. uni.navigateTo({
  102. url: '/pagesHandle/rectifyInfo?taskId=' + item.taskId + '&tenantId=' + this.form.tenantId + '&assetId=' + this.form
  103. .assetId + '&signState=' + item.signState
  104. });
  105. },
  106. },
  107. }
  108. </script>
  109. <style>
  110. page {
  111. width: 100%;
  112. height: 100%;
  113. background-color: #f7f7f7;
  114. }
  115. </style>
  116. <style lang="scss" scoped>
  117. @import "@/static/css/themes.scss";
  118. .content {
  119. width: 100%;
  120. float: left;
  121. .scroll-box {
  122. width: 100%;
  123. height: 100vh;
  124. padding-bottom: 10px;
  125. box-sizing: border-box;
  126. }
  127. }
  128. </style>