streetXfxcjypxyl.vue 3.6 KB

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