zlgztzs.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <view>
  3. <view class="main" v-if="list.length>0 && isLoaded">
  4. <view v-for="(item, index) in list" :key="index">
  5. <uni-card>
  6. <view>
  7. <view class="main-item">
  8. <view class="name-align-zlzgtzs">单位名称:</view>
  9. <view class="conts">{{ item.dwmc }}</view>
  10. </view>
  11. <view class="main-item">
  12. <view class="name-align-zlzgtzs">被检查单位:</view>
  13. <view class="conts">{{ item.bjcdw }}</view>
  14. </view>
  15. <view class="main-item">
  16. <view class="name-align-zlzgtzs">检查日期:</view>
  17. <view class="conts">{{ item.jcrq }}</view>
  18. </view>
  19. <view class="an-niu" @click.native="onClick(item.id)" link>
  20. <text class="detail">查看</text>
  21. </view>
  22. </view>
  23. </uni-card>
  24. </view>
  25. </view>
  26. <view v-else-if="list.length==0 && isLoaded" style="text-align: center;">
  27. <view class="text-gray" style="padding-top: 20px;">
  28. <img :src="tan90" alt="暂无数据" />
  29. </view>
  30. </view>
  31. <!-- 加载中 -->
  32. <isLodingModel></isLodingModel>
  33. </view>
  34. </template>
  35. <script>
  36. import {
  37. getZlgztzsPage
  38. } from '@/api/zlgztzs';
  39. import config from '@/config'
  40. const baseUrlImg = config.baseUrlImg
  41. export default {
  42. data() {
  43. return {
  44. tan90: `${baseUrlImg}/tan90.png`,
  45. list: [],
  46. isLoaded:false,
  47. loading:false,
  48. queryParams: {
  49. pageNo: 1,
  50. pageSize: 10
  51. },
  52. // 总条数
  53. total: 0,
  54. }
  55. },
  56. onShow() {
  57. this.list=[]
  58. this.getData()
  59. },
  60. watch: {
  61. loading: {
  62. handler(newLength, oldLength) {
  63. this.$modal.isLoadingModel(this.loading)
  64. },
  65. immediate: true
  66. }
  67. },
  68. methods: {
  69. getData() {
  70. this.loading = true
  71. getZlgztzsPage(this.queryParams).then(response => {
  72. this.isLoaded = true;
  73. this.list = [...this.list, ...response.data.list]
  74. this.loading = false
  75. // this.list = reponse.data.list
  76. })
  77. },
  78. onClick(val){
  79. this.isLoaded = false
  80. uni.navigateTo({
  81. url: `/pagesA/fire/zlgztzs/see_zlgztzs/see_zlgztzs?id=${val}`
  82. });
  83. }
  84. },
  85. // 触底的事件
  86. onReachBottom() {
  87. // 判断是否还有下一页数据
  88. if (this.queryParams.pageNo * this.queryParams.pageSize >= this.total)
  89. return uni.showToast({
  90. title: `数据加载完毕`
  91. });
  92. // 判断是否正在请求其它数据,如果是,则不发起额外的请求
  93. if (this.loading) return;
  94. this.queryParams.pageNo += 1;
  95. this.getData(this.queryParams.pageNo);
  96. },
  97. }
  98. </script>
  99. <style lang="scss" scope>
  100. body {
  101. background-color: #f5f7f9;
  102. }
  103. page {
  104. background-color: #f5f7f9 !important;
  105. }
  106. .uni-container {
  107. height: 100%;
  108. }
  109. /deep/.uni-card {
  110. box-shadow: 0px 0px 3px 0px rgba(86, 165, 168, 0.63) !important;
  111. border-radius: 30rpx;
  112. }
  113. .main {
  114. margin-left: 5%;
  115. margin-top: 30rpx;
  116. width: 90%;
  117. .main-item {
  118. display: flex;
  119. margin-bottom: 15rpx;
  120. color: #728f90;
  121. }
  122. }
  123. .an-niu {
  124. float: right;
  125. font-size: 10px;
  126. text-align: center;
  127. display: flex;
  128. color: #fff;
  129. margin-bottom:20rpx;
  130. .detail {
  131. width: 72px;
  132. height: 60rpx;
  133. border-radius: 30px;
  134. background-color: #f7c41e;
  135. margin-right: 20rpx;
  136. text-align: center;
  137. line-height: 60rpx;
  138. }
  139. }
  140. </style>