index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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. let totalPage = res.data.data.row_count < 10 ? 1 : res.data.data.row_count / 10;
  77. this.loadMore = totalPage > this.param._currpage ? true : false;
  78. res.data.data.data.forEach(item => {
  79. this.list.push(item);
  80. });
  81. }
  82. });
  83. },
  84. //刷新数据
  85. refresh() {
  86. this.loadMore = true;
  87. this.param._currpage = 1;
  88. this.list = [];
  89. this.getData();
  90. },
  91. //跳转到详情
  92. detail(id) {
  93. uni.navigateTo({
  94. url: '/pages/model/detail?ste=1&id=' + id
  95. });
  96. },
  97. go(url) {
  98. uni.navigateTo({
  99. url: url
  100. });
  101. }
  102. },
  103. //下拉刷新
  104. onPullDownRefresh() {
  105. setTimeout(() => {
  106. this.refresh();
  107. uni.stopPullDownRefresh();
  108. }, 1000);
  109. },
  110. //上拉加载
  111. onReachBottom() {
  112. if (this.loadMore) {
  113. this.param._currpage++;
  114. this.getData();
  115. }
  116. },
  117. //展开搜索
  118. onNavigationBarButtonTap() {
  119. this.show = !this.show;
  120. }
  121. };
  122. </script>
  123. <style lang="scss">
  124. page {
  125. background-color: #f2f3f5;
  126. }
  127. .list {
  128. padding: 0px 15px 80px 15px;
  129. .item {
  130. margin-top: 10px;
  131. background-color: white;
  132. border-radius: 5px;
  133. overflow: hidden;
  134. padding-bottom: 5px;
  135. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  136. .title {
  137. border-bottom: 1px solid #efefef;
  138. padding: 12px;
  139. color: $font-c1;
  140. .tv {
  141. float: left;
  142. width: 90%;
  143. }
  144. }
  145. .con {
  146. position: relative;
  147. .it {
  148. font-size: 14px;
  149. padding: 5px 12px 5px 12px;
  150. .label {
  151. float: left;
  152. color: #969696;
  153. width: 90px;
  154. text-align: right;
  155. }
  156. .name {
  157. color: $font-c;
  158. }
  159. }
  160. .tag {
  161. position: absolute;
  162. top: 10%;
  163. right: 0px;
  164. padding: 3px 10px;
  165. background-color: #f44336;
  166. color: white;
  167. font-size: 14px;
  168. border-radius: 15px 0px 0px 15px;
  169. }
  170. }
  171. }
  172. }
  173. .br {
  174. border-radius: 25px;
  175. }
  176. </style>