index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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,'1')">
  17. <view class="title">
  18. <text class="tv">{{item.items.__yZMMXcXNnmKq5pTTfPH.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.__BFdnHQXCEaXwAC4nryK.value}}</view>
  26. </view>
  27. <view class="it">
  28. <view class="label">申请单位:</view>
  29. <view class="name">{{item.items.__VP07fdxAVMa7bSHb8ZU.value}}</view>
  30. </view>
  31. <view class="it">
  32. <view class="label">试验部门:</view>
  33. <view class="name">{{item.items.__DVAKyCmSOS9bvFpome2.value}}</view>
  34. </view>
  35. <view class="it">
  36. <view class="label">当前审批人:</view>
  37. <view class="name">{{item.items.__hInQ1R0YkMQNrgTq3q0.value}}</view>
  38. </view>
  39. <view class="tag" v-if="item.items.__oUywWKvn4BhpnBmxqYT.value !=''">{{item.items.__oUywWKvn4BhpnBmxqYT.value}}</view>
  40. </view>
  41. </view>
  42. <view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
  43. <u-empty v-if="!loadMore && list.length == 0"></u-empty>
  44. </view>
  45. <view class="footer"><button class="btn" style="width: 30%;border-radius: 25px;" @click="detail('0',2)">新建</button></view>
  46. </view>
  47. </template>
  48. <script>
  49. export default {
  50. data() {
  51. return {
  52. param: {appId:"__gAPYBW4YxB3UePM3lqO",containTitle:"申请单",opentarget:"detail",viewId:"__km3aURKW95BHxp12XVt" },
  53. list: [],
  54. show: false,
  55. loadMore: true,
  56. pageNum:1
  57. };
  58. },
  59. onLoad(e) {
  60. //this.getaccessToken();
  61. this.getData();
  62. },
  63. methods: {
  64. getaccessToken() {
  65. this.http.request({
  66. url: this.http.urls.accessToken,
  67. data: this.param,
  68. loading: 'false',
  69. success: res => {
  70. //console.log("gfgh==="+JSON.stringify(res));
  71. if(res.data.errcode==0){
  72. uni.removeStorageSync('user');
  73. uni.setStorageSync('user', res.data.data);
  74. this.getData();
  75. console.log("res.data.resultCode==="+res.data.errcode);
  76. }
  77. }
  78. });
  79. }, getData() {
  80. this.http.request({
  81. url: this.http.urls.wt_list+'&_currpage='+this.pageNum,
  82. data: this.param,
  83. method:'POST',
  84. loading: 'false',
  85. success: res => {
  86. console.log("this.list==="+JSON.stringify(res));
  87. this.loadMore = res.data.data.page > this.pageNum-1? true : false;
  88. res.data.data.data.forEach(item => {
  89. this.list.push(item);
  90. });
  91. //console.log("this.list==="+JSON.stringify(this.list));
  92. }
  93. });
  94. },
  95. //刷新数据
  96. refresh() {
  97. this.loadMore = true;
  98. this.pageNum = 1;
  99. this.list = [];
  100. this.getData();
  101. },
  102. //跳转到详情
  103. detail(id,ste) {
  104. uni.navigateTo({
  105. url: '/pages/index/detail?id=' + id+"&ste="+ ste
  106. });
  107. },
  108. //跳转到详情
  109. add() {
  110. uni.navigateTo({
  111. url: '/pages/index/addwt'
  112. });
  113. }
  114. },
  115. //下拉刷新
  116. onPullDownRefresh() {
  117. console.log("222===");
  118. setTimeout(() => {
  119. this.refresh();
  120. uni.stopPullDownRefresh();
  121. }, 1000);
  122. },
  123. //上拉加载
  124. onReachBottom() {
  125. if (this.loadMore) {
  126. this.pageNum++;
  127. this.getData();
  128. }
  129. },
  130. //展开搜索
  131. onNavigationBarButtonTap() {
  132. this.show = !this.show;
  133. }
  134. };
  135. </script>
  136. <style lang="scss">
  137. page {
  138. background-color: #f2f3f5;
  139. }
  140. .search {
  141. background-color: white;
  142. padding: 5px 15px;
  143. .input {
  144. margin-bottom: 10px;
  145. }
  146. .f {
  147. padding: 5px;
  148. background-color: white;
  149. }
  150. .c {
  151. background-color: #f44336;
  152. }
  153. }
  154. .list {
  155. padding: 0px 15px;
  156. .item {
  157. margin-top: 10px;
  158. background-color: white;
  159. border-radius: 5px;
  160. overflow: hidden;
  161. padding-bottom: 5px;
  162. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  163. .title {
  164. border-bottom: 1px solid #efefef;
  165. padding: 12px;
  166. .tv {
  167. float: left;
  168. width: 90%;
  169. }
  170. }
  171. .con {
  172. position: relative;
  173. .it {
  174. font-size: 14px;
  175. padding: 5px 12px 5px 12px;
  176. .label {
  177. float: left;
  178. color: #969696;
  179. }
  180. }
  181. .tag {
  182. position: absolute;
  183. top: 10%;
  184. right: 0px;
  185. padding: 3px 10px;
  186. background-color: red;
  187. color: white;
  188. border-radius: 15px 0px 0px 15px;
  189. }
  190. }
  191. }
  192. }
  193. </style>