details.vue 5.2 KB

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