index.vue 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <view>
  3. <view class=""v-if="list.length > 0">
  4. <view class="Inspection" @click="todetails(item)" v-for="(item,index) in list">
  5. <view class='Inspection_name'>{{item.project_name ? item.project_name : ''}}</view>
  6. <view class="Inspection_time">{{formatDate(item.inspect_date,'yyyy-MM-dd hh:mm:ss') !='' ? formatDate(item.inspect_date,'yyyy-MM-dd hh:mm:ss') : ''}}</view>
  7. </view>
  8. </view>
  9. <emptyPage v-else></emptyPage>
  10. <!-- <view class="red" v-if='page>1' @click="dainji_top">
  11. 返回上页
  12. </view> -->
  13. <!-- <view class="gengduo" v-if='wenzishow'>
  14. 无更多数据
  15. </view> -->
  16. <van-toast id="van-toast" />
  17. </view>
  18. </template>
  19. <script>
  20. // import movableRefresh from '@/components/zyq-movableRefresh/zyq-movableRefresh.vue'
  21. import {getInspection} from '@/api/api.js'
  22. import {formatDate} from "@/utils/formatDate.js"
  23. import emptyPage from '@/components/emptyPage.vue'
  24. import Toast from '@/wxcomponents/vant/toast/toast';
  25. // import icon from '@/wxcomponents/vant/icon/index'
  26. export default {
  27. components: {
  28. // movableRefresh,
  29. emptyPage
  30. },
  31. data() {
  32. return {
  33. list: [],
  34. contune:[],
  35. page: 1,
  36. number:10,
  37. patient_id:0,
  38. org_id:0,
  39. scrollHeight: 300,
  40. noMore: false,
  41. total:null,
  42. wenzishow:false,
  43. }
  44. },
  45. onLoad() {
  46. console.log('this.$store.state.data',this.page);
  47. this.patient_id = this.$store.state.data.userInfo.id
  48. this.org_id = this.$store.state.data.userInfo.user_org_id
  49. console.log('00000',this.patient_id);
  50. this.getInspection()
  51. let system = uni.getSystemInfoSync()
  52. this.scrollHeight = system.windowHeight - system.statusBarHeight - 50
  53. console.log('system.windowHeight',system.windowHeight,system.statusBarHeight);
  54. // this.refresh()
  55. },
  56. methods: {
  57. async getInspection(){
  58. const toast = Toast.loading({
  59. message: '加载中...',
  60. forbidClick: true,
  61. });
  62. let params={
  63. page: this.page,
  64. number:this.number,
  65. patient_id:this.patient_id,
  66. // patient_id:20214,
  67. org_id:this.org_id,
  68. }
  69. let res=await getInspection(params)
  70. let list=[]
  71. console.log('asdfsgertqewr',res);
  72. if(res.data.state==1){
  73. list =res.data.data.list
  74. // this.list=list
  75. this.list =this.list.concat(list)
  76. // console.log('');
  77. // if(this.page>1){
  78. // list =list.concat(list)
  79. // this.list=list
  80. // }
  81. console.log('mmmmm',this.list);
  82. this.total=list.length
  83. // console.log('contune',contune);
  84. }
  85. toast.clear()
  86. },
  87. formatDate(value, fmt) {
  88. return formatDate(new Date(value * 1000), fmt)
  89. },
  90. todetails(item){
  91. console.log(item,'item,idx')
  92. uni.navigateTo({
  93. // url: '/pages/inspection_new/detail?project_id='
  94. url:`/pages/inspection_new/detail?project_id=${item.project_id}&inspect_date=${item.inspect_date}`
  95. })
  96. },
  97. // refresh() {
  98. // this.page = 1
  99. // this.noMore = false
  100. // let list = []
  101. // for (let i = 0; i < 15; i++) {
  102. // list.push(i)
  103. // }
  104. // this.list = list
  105. // this.page++
  106. // if (this.$refs.movableRefresh) {
  107. // let that = this
  108. // setTimeout(function() {
  109. // that.$refs.movableRefresh.endLoad() //刷新结束
  110. // }, 500)
  111. // }
  112. // },
  113. // loadMore() {
  114. // if (this.noMore) {
  115. // return
  116. // }
  117. // let list = this.list
  118. // let page = this.page
  119. // let that = this
  120. // let start = (page - 1) * 15
  121. // setTimeout(function() {
  122. // for (let i = 0; i < 15; i++) {
  123. // list.push(start + i)
  124. // }
  125. // that.page++
  126. // that.list = list
  127. // that.$refs.movableRefresh.endLoad() //刷新结束
  128. // if (that.page > 2) {
  129. // that.noMore = true
  130. // }
  131. // }, 500)
  132. // },
  133. dainji_top(){
  134. console.log('yyyyy',this.page);
  135. this.page--;
  136. console.log('uuuuu',this.page);
  137. this.getInspection()
  138. }
  139. },
  140. onReachBottom(){
  141. console.log('已加载全部数据',this.page)
  142. // let allTotal = (this.page+1) * this.number
  143. // if(allTotal < this.total){
  144. //当前条数小于总条数 则增加请求页数
  145. this.page ++;
  146. this.getInspection() //调用加载数据方法
  147. // }else{
  148. // this.wenzishow=true
  149. // console.log('已加载全部数据')
  150. // }
  151. },
  152. }
  153. </script>
  154. <style>
  155. @import url(./Inspection.css);
  156. </style>
  157. <style>
  158. .red{
  159. background: #03a9f461;
  160. position: fixed;
  161. right: 0;
  162. bottom: 30px;
  163. height: 40px;
  164. width: 40px;
  165. border-radius: 25px;
  166. font-size: 14px;
  167. text-align: center;
  168. }
  169. </style>