searchSub.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <view id="searchSub">
  3. <view class="top-max-big-box">
  4. <view class="search-box">
  5. <img class="img-view" :src="imagesUrl('commonality/icon_aqjc_ss.png')">
  6. <input type="text" v-model="data1" placeholder="姓名/学工号" maxlength="20">
  7. <view class="button-view" @click="searchButton()">搜索</view>
  8. </view>
  9. </view>
  10. <scroll-view scroll-y @scrolltolower="scrollGet" class="list">
  11. <view class="for-sub-box" v-for="(item,index) in dataList" :key="index">
  12. <view class="for-text-box">{{item.subName}}{{item.room?'('+item.room+')':''}}</view>
  13. <view class="for-right-button" @click="checkSub(item)">
  14. <view></view>
  15. <view>选择</view>
  16. <view></view>
  17. </view>
  18. </view>
  19. <view class="get-data-null-p" v-if="getDataType">- 没有更多数据 -</view>
  20. <view class="get-data-null-p" v-else="getDataType">- 滑动加载更多 -</view>
  21. </scroll-view>
  22. </view>
  23. </template>
  24. <script>
  25. export default {
  26. data() {
  27. return {
  28. data1:'',
  29. getDataType: false,
  30. getData: {
  31. page: 1,
  32. pageSize: 20,
  33. },
  34. dataList: [
  35. {subName:'实验室测试',room:'102',subId:'1'},
  36. {subName:'实验室测试实验室测试实验室测试',room:'102',subId:'12'},
  37. {subName:'实验室测试实验室测试实验室测试实验室测试实验室测试实验室测试',room:'102',subId:'13'},
  38. ],
  39. total: 0,
  40. }
  41. },
  42. onLoad(option) {
  43. // if(option.subName){
  44. // //有查询过
  45. // this.$set(this,'data1',option.subName);
  46. // this.scrollGet();
  47. // }else{
  48. // //无查询过
  49. // this.scrollGet();
  50. // }
  51. },
  52. onShow() {
  53. },
  54. mounted() {
  55. },
  56. methods: {
  57. //选择实验室
  58. checkSub(item){
  59. uni.redirectTo({
  60. url: '/pages_manage/views/accessControl/authorizationRecord?item=' + encodeURIComponent(JSON.stringify(item))
  61. });
  62. },
  63. //滚动加载事件
  64. scrollGet() {
  65. let self = this;
  66. if (self.total / self.getData.pageSize <= self.getData.page) {
  67. this.$set(this, 'getDataType', true);
  68. } else {
  69. this.getData.page += 1;
  70. this.$nextTick(() => {
  71. this.getList();
  72. })
  73. }
  74. },
  75. //获取实验室
  76. async getList() {
  77. let self = this;
  78. let obj = JSON.parse(JSON.stringify(this.getData))
  79. const {
  80. data
  81. } = await systemSubjectGetAppSubject(obj);
  82. if (data.code == 200) {
  83. if (self.getData.page == 1) {
  84. this.dataList = data.data.records;
  85. this.total = data.data.total;
  86. if (data.data.total / self.getData.pageSize <= self.getData.page) {
  87. this.$set(this, 'getDataType', true);
  88. }
  89. } else {
  90. this.dataList = [...this.dataList, ...data.data.records]
  91. this.total = data.data.total;
  92. if (data.data.total / self.getData.pageSize <= self.getData.page) {
  93. this.$set(this, 'getDataType', true);
  94. }
  95. }
  96. }
  97. },
  98. // 搜索按钮
  99. searchButton() {
  100. },
  101. },
  102. }
  103. </script>
  104. <style lang="stylus" scoped>
  105. #searchSub {
  106. height: 100%;
  107. display flex;
  108. flex-direction column;
  109. .top-max-big-box {
  110. width: 750rpx;
  111. height: 120rpx;
  112. background: #FFFFFF;
  113. padding: 20rpx 30rpx;
  114. box-sizing: border-box;
  115. .search-box {
  116. width: 690rpx;
  117. height: 78rpx;
  118. border: 1rpx solid #E0E0E0;
  119. border-radius: 50rpx;
  120. display: flex;
  121. .img-view {
  122. display: inline-block;
  123. margin: 27rpx 17rpx 0 37rpx;
  124. width: 26rpx;
  125. height: 26rpx;
  126. }
  127. input {
  128. height: 78rpx;
  129. line-height: 78rpx;
  130. flex: 1;
  131. font-size: 24rpx;
  132. }
  133. .button-view {
  134. width: 100rpx;
  135. line-height: 78rpx;
  136. text-align: center;
  137. font-size: 24rpx;
  138. color: #0183FA;
  139. }
  140. }
  141. }
  142. .list {
  143. flex: 1;
  144. overflow-y scroll;
  145. padding: 0 30rpx;
  146. box-sizing: border-box;
  147. padding-bottom: 160rpx;
  148. margin-top:20rpx;
  149. background-color: #fff;
  150. .for-sub-box{
  151. display: flex;
  152. border-bottom: 1rpx dashed #E0E0E0;
  153. .for-text-box{
  154. flex:1;
  155. line-height:42rpx;
  156. padding:40rpx 0 40rpx 0;
  157. }
  158. .for-right-button{
  159. width:100rpx;
  160. display: flex;
  161. flex-direction: column;
  162. view:nth-child(1){
  163. flex:1;
  164. }
  165. view:nth-child(2){
  166. line-height:42rpx;
  167. text-align: right;
  168. color:#0183FA;
  169. font-size:28rpx;
  170. }
  171. view:nth-child(3){
  172. flex:1;
  173. }
  174. }
  175. }
  176. .get-data-null-p {
  177. text-align: center;
  178. line-height: 100rpx;
  179. padding-bottom: 80px;
  180. color: #999;
  181. }
  182. }
  183. }
  184. </style>