index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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', _currpage: 1 },
  53. list: [],
  54. show: false,
  55. loadMore: true
  56. };
  57. },
  58. onLoad(e) {
  59. //this.getaccessToken();
  60. this.getData();
  61. },
  62. methods: {
  63. getaccessToken() {
  64. this.http.request({
  65. url: this.http.urls.accessToken,
  66. data: this.param,
  67. loading: 'false',
  68. success: res => {
  69. console.log('gfgh===1111' + JSON.stringify(res));
  70. if (res.data.errcode == 0) {
  71. uni.removeStorageSync('user');
  72. uni.setStorageSync('user', res.data.data);
  73. this.getData();
  74. console.log('res.data.resultCode===' + res.data.errcode);
  75. }
  76. }
  77. });
  78. },
  79. getData() {
  80. this.http.request({
  81. url: this.http.urls.wt_list,
  82. data: this.param,
  83. method: 'POST',
  84. loading: 'false',
  85. success: res => {
  86. let totalPage = res.data.data.row_count < 10 ? 1 : res.data.data.row_count / 10;
  87. this.loadMore = totalPage > this.param._currpage ? true : false;
  88. res.data.data.data.forEach(item => {
  89. this.list.push(item);
  90. });
  91. }
  92. });
  93. },
  94. //刷新数据
  95. refresh() {
  96. this.loadMore = true;
  97. this.param._currpage = 1;
  98. this.list = [];
  99. this.getData();
  100. },
  101. //跳转到详情
  102. detail(id, ste) {
  103. uni.navigateTo({
  104. url: '/pages/index/detail?id=' + id + '&ste=' + ste
  105. });
  106. },
  107. //跳转到详情
  108. add() {
  109. uni.navigateTo({
  110. url: '/pages/index/addwt'
  111. });
  112. }
  113. },
  114. //下拉刷新
  115. onPullDownRefresh() {
  116. setTimeout(() => {
  117. this.refresh();
  118. uni.stopPullDownRefresh();
  119. }, 1000);
  120. },
  121. //上拉加载
  122. onReachBottom() {
  123. if (this.loadMore) {
  124. this.param._currpage++;
  125. this.getData();
  126. }
  127. },
  128. //展开搜索
  129. onNavigationBarButtonTap() {
  130. this.show = !this.show;
  131. }
  132. };
  133. </script>
  134. <style lang="scss">
  135. page {
  136. background-color: #f2f3f5;
  137. }
  138. .list {
  139. padding: 10px 15px 80px 15px;
  140. .item {
  141. margin-bottom: 10px;
  142. background-color: white;
  143. border-radius: 5px;
  144. overflow: hidden;
  145. padding-bottom: 5px;
  146. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  147. .title {
  148. border-bottom: 1px solid #efefef;
  149. padding: 12px;
  150. .tv {
  151. float: left;
  152. width: 90%;
  153. }
  154. .icon {
  155. float: right;
  156. }
  157. }
  158. .con {
  159. position: relative;
  160. .it {
  161. font-size: 14px;
  162. padding: 5px 12px 5px 12px;
  163. .label {
  164. float: left;
  165. color: #969696;
  166. }
  167. .name {
  168. color: $font-c;
  169. }
  170. }
  171. .tag {
  172. position: absolute;
  173. top: 10%;
  174. right: 0px;
  175. padding: 3px 10px;
  176. background-color: #e64340;
  177. color: white;
  178. border-radius: 15px 0px 0px 15px;
  179. }
  180. }
  181. }
  182. }
  183. </style>