details.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <view class="page-container uni-column" style="padding: 24rpx;box-sizing: border-box;">
  3. <view class="box-bg uni-row" style="height: 9%;position: fixed;top:44px;left: 12px;right: 12px;z-index: 10;">
  4. <view class="input-view uni-row">
  5. <uni-icons class="input-uni-icon" type="search" size="18" color="#999" />
  6. <input class="nav-bar-input" type="text" v-model="keywords" placeholder="输入搜索关键词" />
  7. </view>
  8. <view class="search" @click="handleSearch">搜索</view>
  9. </view>
  10. <view v-if="listData.length == 0" style="color: #999;margin:90% auto;height: 90%;">
  11. <text>暂无周转到该工段批次</text>
  12. </view>
  13. <view class="uni-column" v-else style="overflow: scroll;margin-top: 65px;" >
  14. <view v-for="(item, index) in listData" :key="index"
  15. class="list-item">
  16. <view class="title-container uni-row">
  17. <view class="title uni-row">
  18. <text class="label">批次号</text>
  19. <text class="label code">{{ item['lotCode'] }}</text>
  20. </view>
  21. </view>
  22. <view class="item-info uni-row">
  23. <text class="label">产品描述</text>
  24. <text class="label right">{{ item['productDescription'] }}</text>
  25. </view>
  26. <view class="item-info uni-row">
  27. <text class="label">箱号</text>
  28. <text class="label right">{{ item['carrierCode'] }}</text>
  29. </view>
  30. <view class="item-info uni-row">
  31. <text class="label">所在区域</text>
  32. <text class="label right">{{ item['place'] }}</text>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <script setup>
  39. import {
  40. getCarrierTotalList
  41. } from '@/api/business/dayWork.js'
  42. import {
  43. ref
  44. } from 'vue'
  45. import {
  46. onReady,
  47. onLoad,
  48. onUnload,
  49. onReachBottom,
  50. onShow
  51. } from '@dcloudio/uni-app'
  52. import {
  53. store
  54. } from '@/store/index.js'
  55. const listData = ref([])
  56. const keywords = ref('')
  57. const pageSize = ref(10)
  58. const pageNum = ref(1)
  59. const status = ref(true)
  60. onShow(() => {
  61. reflush();
  62. })
  63. function reflush() {
  64. init();
  65. }
  66. onReachBottom(()=>{
  67. console.log(status.value)
  68. if(status.value) {
  69. pageNum.value += 1
  70. uni.showLoading({
  71. title: '加载中'
  72. });
  73. getCarrierTotalList({
  74. deptId: Number(store.curDeptDetails.deptId),
  75. keywords: keywords.value,
  76. userId:store.userInfo.userId,
  77. pageNum:pageNum.value,
  78. pageSize:pageSize.value
  79. }).then(res =>{
  80. const existingIds = new Set(listData.value.map(item => item.lotCode));
  81. // 过滤出那些不在 existingIds 中的项,即新数据
  82. const newRows = res.data.filter(row => !existingIds.has(row.lotCode));
  83. console.log(newRows)
  84. // 如果有新数据,将其添加到 listData
  85. if (newRows.length > 0) {
  86. listData.value = listData.value.concat(newRows);
  87. uni.hideLoading();
  88. } else {
  89. uni.hideLoading();
  90. // 如果没有新数据,更新状态表示没有更多数据
  91. status.value = false;
  92. }
  93. })
  94. }
  95. console.log(status.value)
  96. })
  97. function init(data) {
  98. uni.showLoading({
  99. title: '加载中'
  100. });
  101. pageNum.value = 1
  102. getCarrierTotalList({
  103. deptId: Number(store.curDeptDetails.deptId),
  104. keywords: keywords.value,
  105. userId:store.userInfo.userId,
  106. pageNum:pageNum.value,
  107. pageSize:pageSize.value
  108. }).then(res => {
  109. if (res.code == 200) {
  110. listData.value = res.data;
  111. uni.hideLoading();
  112. }
  113. uni.hideLoading();
  114. })
  115. }
  116. function handleSearch() {
  117. let reqParam = {
  118. keywords: keywords.value
  119. }
  120. reqParam.tenantId = !store.tenantId ? store.userInfo.tenantId : store.tenantId;
  121. pageNum.value = 1
  122. status.value = true
  123. init(reqParam)
  124. }
  125. </script>
  126. <style lang="scss">
  127. $nav-height: 60rpx;
  128. .box-bg {
  129. width: 100%;
  130. background-color: #F5F5F5;
  131. padding: 5rpx 0;
  132. justify-content: space-around;
  133. align-items: center;
  134. .input-view {
  135. width: 100%;
  136. flex: 4;
  137. background-color: #f8f8f8;
  138. height: $nav-height;
  139. border: 1rpx solid #999;
  140. border-radius: 15rpx;
  141. padding: 0 15rpx;
  142. flex-wrap: nowrap;
  143. margin: 0 10rpx 20rpx;
  144. line-height: $nav-height;
  145. .input-uni-icon {
  146. line-height: $nav-height;
  147. }
  148. .nav-bar-input {
  149. width: 80%;
  150. height: $nav-height;
  151. line-height: $nav-height;
  152. padding: 0 5rpx;
  153. background-color: #f8f8f8;
  154. }
  155. }
  156. .search {
  157. width: 20%;
  158. text-align: center;
  159. color: #808080;
  160. margin-top: -20rpx;
  161. }
  162. }
  163. .page-container {
  164. background-color: rgba(245, 245, 245, 1);
  165. // height: 100%;
  166. }
  167. .list-item {
  168. background-color: #fff;
  169. position: relative;
  170. padding: 16rpx;
  171. padding-bottom: 24rpx;
  172. border-radius: 24rpx;
  173. margin-bottom: 24rpx;
  174. .title-container {
  175. justify-content: space-between;
  176. margin-top: 8rpx;
  177. margin-bottom: 16rpx;
  178. .title {
  179. height: 48rpx;
  180. align-items: center;
  181. .label {
  182. font-size: 32rpx;
  183. font-weight: bold;
  184. &.code {
  185. margin-left: 8rpx;
  186. }
  187. }
  188. }
  189. .tag {
  190. border: 1px solid #1ce5b0;
  191. background-color: #f6fffd;
  192. padding: 8rpx;
  193. border-radius: 8rpx;
  194. .label {
  195. color: #1ce5b0;
  196. font-size: 24rpx;
  197. }
  198. &.not-start {
  199. border: 1px solid #bbbbbb;
  200. background-color: #f5f5f5;
  201. .label {
  202. color: #bbbbbb;
  203. }
  204. }
  205. }
  206. }
  207. .item-info {
  208. margin-bottom: 8rpx;
  209. .label {
  210. font-size: 28rpx;
  211. width: 220rpx;
  212. color: #808080;
  213. &.right {
  214. flex: 1;
  215. color: #000000;
  216. }
  217. }
  218. }
  219. }
  220. </style>