index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <template>
  2. <view>
  3. <view class="search" v-if="show">
  4. <u-divider text="展开搜索"></u-divider>
  5. <u--input v-model="param.xx" placeholder="输入条件" class="input" clearable></u--input>
  6. <u--input v-model="param.xx" placeholder="输入条件" class="input" clearable></u--input>
  7. <u--input v-model="param.xx" placeholder="输入条件" class="input" clearable></u--input>
  8. <u--input v-model="param.xx" placeholder="输入条件" class="input" clearable></u--input>
  9. <u--input v-model="param.xx" placeholder="输入条件" class="input" clearable></u--input>
  10. <view class="flex">
  11. <view class="f"><button class="btn c" @click="clear()">重置</button></view>
  12. <view class="f"><button class="btn" @click="search()">搜索</button></view>
  13. </view>
  14. </view>
  15. <view class="list">
  16. <view class="item" v-for="(item, index) in list" :key="index" @click="detail(item.id)">
  17. <view class="title">
  18. <text class="tv">{{ item.items.__DkLB41tkDZoSeXdzjNd.value }}</text>
  19. <text class="icon">&#xe631;</text>
  20. <view class="clear"></view>
  21. </view>
  22. <view class="con">
  23. <view class="it">
  24. <view class="label">计量编号:</view>
  25. <view class="name">{{ item.items.__To3ldfLqdpnLNUIjGvb.value }}</view>
  26. </view>
  27. <view class="it">
  28. <view class="label">借用人部门:</view>
  29. <view class="name">{{ item.items.__ISOkPJeTwFomTO3JEFR.value }}</view>
  30. </view>
  31. <view class="it">
  32. <view class="label">借用人:</view>
  33. <view class="name">{{ item.items.__UAsr8UEjHBujd7oCVfb.value }}</view>
  34. </view>
  35. <view class="tag" v-if="item.items.__2ryB7XjxtrdtU40P48c.value==0">借用待审</view>
  36. <view class="tag" v-else-if="item.items.__2ryB7XjxtrdtU40P48c.value==1">借用中</view>
  37. <view class="tag" v-else-if="item.items.__2ryB7XjxtrdtU40P48c.value==2">已归还</view>
  38. <view class="tag" v-else-if="item.items.__2ryB7XjxtrdtU40P48c.value==-1">归还待审</view>
  39. <view class="tag" v-else-if="item.items.__2ryB7XjxtrdtU40P48c.value==3">驳回</view>
  40. <view class="tag" v-else-if="item.items.__2ryB7XjxtrdtU40P48c.value==81">终止</view>
  41. <view class="tag" v-else></view>
  42. </view>
  43. </view>
  44. <view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
  45. <u-empty v-if="!loadMore && list.length == 0"></u-empty>
  46. </view>
  47. <view class="footer">
  48. <view class="flex">
  49. <view class="f"><button class="btn br" @click="go('/pages/model/return?op=设备归还')">归还设备</button></view>
  50. <view class="f"><button class="btn br" @click="go('/pages/model/borrowing?op=设备借用')">借用设备</button></view>
  51. </view>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. export default {
  57. data() {
  58. return {
  59. param: { appId: '__gAPYBW4YxB3UePM3lqO', containTitle: '设备借还台账', opentarget: 'detail', viewId: '__NOtUm3wgeNBBmv8mhK3', _currpage: 1 },
  60. list: [],
  61. show: false,
  62. loadMore: true
  63. };
  64. },
  65. onLoad(e) {
  66. this.getData();
  67. },
  68. methods: {
  69. getData() {
  70. this.http.request({
  71. url: this.http.urls.borrowing_list,
  72. data: this.param,
  73. method: 'POST',
  74. loading: 'false',
  75. success: res => {
  76. console.log('gfgh===1111' + JSON.stringify(res));
  77. let totalPage = res.data.data.row_count < 10 ? 1 : res.data.data.row_count / 10;
  78. this.loadMore = totalPage > this.param._currpage ? true : false;
  79. res.data.data.data.forEach(item => {
  80. this.list.push(item);
  81. });
  82. }
  83. });
  84. },
  85. //刷新数据
  86. refresh() {
  87. this.loadMore = true;
  88. this.param.pageNum = 1;
  89. this.list = [];
  90. this.getData();
  91. },
  92. //跳转到详情
  93. detail(id) {
  94. uni.navigateTo({
  95. url: '/pages/model/detail?ste=1&id=' + id
  96. });
  97. },
  98. go(url) {
  99. uni.navigateTo({
  100. url: url
  101. });
  102. }
  103. },
  104. //下拉刷新
  105. onPullDownRefresh() {
  106. setTimeout(() => {
  107. this.refresh();
  108. uni.stopPullDownRefresh();
  109. }, 1000);
  110. },
  111. //上拉加载
  112. onReachBottom() {
  113. if (this.loadMore) {
  114. this.param.pageNum++;
  115. this.getData();
  116. }
  117. },
  118. //展开搜索
  119. onNavigationBarButtonTap() {
  120. this.show = !this.show;
  121. }
  122. };
  123. </script>
  124. <style lang="scss">
  125. page {
  126. background-color: #f2f3f5;
  127. }
  128. .list {
  129. padding: 0px 15px 80px 15px;
  130. .item {
  131. margin-top: 10px;
  132. background-color: white;
  133. border-radius: 5px;
  134. overflow: hidden;
  135. padding-bottom: 5px;
  136. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  137. .title {
  138. border-bottom: 1px solid #efefef;
  139. padding: 12px;
  140. color: $font-c1;
  141. .tv {
  142. float: left;
  143. width: 90%;
  144. }
  145. }
  146. .con {
  147. position: relative;
  148. .it {
  149. font-size: 14px;
  150. padding: 5px 12px 5px 12px;
  151. .label {
  152. float: left;
  153. color: #969696;
  154. width: 90px;
  155. text-align: right;
  156. }
  157. .name{
  158. color: $font-c;
  159. }
  160. }
  161. .tag {
  162. position: absolute;
  163. top: 10%;
  164. right: 0px;
  165. padding: 3px 10px;
  166. background-color: #F44336;
  167. color: white;
  168. font-size: 14px;
  169. border-radius: 15px 0px 0px 15px;
  170. }
  171. }
  172. }
  173. }
  174. .br {
  175. border-radius: 25px;
  176. }
  177. </style>