streetCzfpczl.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <view class="uni-container">
  3. <my-search :queryParams="queryParams" :getData="getData" @date-change="onDateChange"></my-search>
  4. <view class="main-street" v-if="list.length>0 && isLoaded">
  5. <view v-for="(item, index) in list" :key="index">
  6. <uni-card>
  7. <view>
  8. <view class="main-item">
  9. <view>填报时间:</view>
  10. <view class="conts">{{ item.reporttime }}</view>
  11. </view>
  12. </view>
  13. <view class="">
  14. <view class="an-niu-street" @click.native="delClick(item.id)" link style="margin-left:3px">
  15. <text class="deletes">删除</text>
  16. </view>
  17. <view class="an-niu-street" @click.native="viewClick(item.id)" link>
  18. <text class="detail">查看</text>
  19. </view>
  20. <view class="an-niu-street" @click.native="editClick(item.id)" link>
  21. <text class="bianji">编辑</text>
  22. </view>
  23. </view>
  24. </uni-card>
  25. </view>
  26. </view>
  27. <!-- tableData为空时显示 -->
  28. <view v-else-if="list.length==0 && isLoaded" style="text-align: center;">
  29. <view class="text-gray" style="padding-top: 20px;">
  30. <img :src="tan90" alt="暂无数据" />
  31. </view>
  32. </view>
  33. <image :src="Group" @click="addClick" class="tiantupian-street"></image>
  34. <!-- 加载中 -->
  35. <isLodingModel></isLodingModel>
  36. </view>
  37. </template>
  38. <script>
  39. import {
  40. getCzfpczl,
  41. delCzfpczl
  42. }
  43. from '@/api/fire_inspetItem/index';
  44. import {
  45. delSure
  46. } from '@/utils/common.js'
  47. import config from '@/config'
  48. const baseUrlImg = config.baseUrlImg
  49. import mySearch from '@/pagesA/components/my-search/index'
  50. export default {
  51. components: {
  52. mySearch
  53. },
  54. data() {
  55. return {
  56. isLoaded: false,
  57. kewords: '',
  58. Group: `${baseUrlImg}/checkActive/Group.png`,
  59. tan90: `${baseUrlImg}/tan90.png`,
  60. list: [],
  61. queryParams: {
  62. pageNo: 1,
  63. pageSize: 10,
  64. reporttime: []
  65. },
  66. // 总条数
  67. total: 0,
  68. loading: false
  69. }
  70. },
  71. onShow() {
  72. this.list = []
  73. this.getData()
  74. },
  75. watch: {
  76. loading: {
  77. handler(newLength, oldLength) {
  78. this.$modal.isLoadingModel(this.loading)
  79. },
  80. immediate: true
  81. }
  82. },
  83. methods: {
  84. onDateChange(params) {
  85. this.queryParams = params
  86. this.loading = true
  87. this.isLoaded = false
  88. this.list = []
  89. this.getData()
  90. },
  91. getData() {
  92. this.loading = true
  93. getCzfpczl(this.queryParams).then(response => {
  94. this.isLoaded = true
  95. this.list = [...this.list, ...response.data.list]
  96. this.loading = false
  97. // this.list = reponse.data.list
  98. })
  99. },
  100. viewClick(item) {
  101. this.isLoaded = false
  102. uni.navigateTo({
  103. url: `/pagesA/fire/fire_inspetItem/add-street/streetCzfpczl?viewData=${item}`,
  104. })
  105. },
  106. editClick(item) {
  107. this.isLoaded = false
  108. uni.navigateTo({
  109. url: `/pagesA/fire/fire_inspetItem/add-street/streetCzfpczl?editData=${item}`,
  110. })
  111. },
  112. delClick(val) {
  113. delSure(delCzfpczl, val, this)
  114. },
  115. addClick() {
  116. this.isLoaded = false
  117. uni.navigateTo({
  118. url: '/pagesA/fire/fire_inspetItem/add-street/streetCzfpczl',
  119. })
  120. },
  121. },
  122. // 触底的事件
  123. onReachBottom() {
  124. // 判断是否还有下一页数据
  125. if (this.queryParams.pageNo * this.queryParams.pageSize >= this.total)
  126. return uni.showToast({
  127. title: `数据加载完毕`
  128. });
  129. // 判断是否正在请求其它数据,如果是,则不发起额外的请求
  130. if (this.loading) return;
  131. this.queryParams.pageNo += 1;
  132. this.getData(this.queryParams.pageNo);
  133. },
  134. }
  135. </script>
  136. <style lang="scss" scoped>
  137. body {
  138. background-color: #f5f7f9;
  139. }
  140. page {
  141. background-color: #f5f7f9 !important;
  142. }
  143. .uni-container {
  144. height: 100%
  145. }
  146. /deep/.uni-card {
  147. box-shadow: 0px 0px 3px 0px rgba(86, 165, 168, 0.63) !important;
  148. border-radius: 30rpx;
  149. }
  150. </style>