details.vue 5.1 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">
  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: 50% auto;">
  11. <text>暂无周转到该工段批次</text>
  12. </view>
  13. <view class="uni-column" v-else >
  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. 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: calc(100% - 40rpx);
  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>