storageRetrieval.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template>
  2. <view class="page-container uni-column" >
  3. <!-- 零存库部分 -->
  4. <view class="title unfit-title uni-row">
  5. <view class="title">零取</view>
  6. </view>
  7. <view class="consultation-container uni-column" style="margin-bottom: 200rpx;padding-bottom: 140rpx">
  8. <view style="width: 100%;">
  9. <zb-table
  10. :columns="column1"
  11. :stripe="true"
  12. :fit="true"
  13. @toggleRowSelection="selectionChange"
  14. @toggleAllSelection="toggleAllSelection"
  15. :data="listData"></zb-table>
  16. <!-- <uni-table ref="table" :loading="loading" border stripe type="selection" emptyText="暂无更多数据"
  17. @selection-change="selectionChange">
  18. <uni-tr>
  19. <uni-th style="font-size: 25rpx;" width="100" align="center">批次号</uni-th>
  20. <uni-th style="font-size: 25rpx;" width="100" align="center">操作者</uni-th>
  21. <uni-th style="font-size: 25rpx;" width="80" align="center">数量</uni-th>
  22. </uni-tr>
  23. <uni-tr v-for="(item, index) in listData" :key="index">
  24. <uni-th style="font-size: 24rpx;" width="100" align="center">{{ item.lotCode }}</uni-th>
  25. <uni-th style="font-size: 24rpx;" width="100" align="center">{{ item.storagerName }}</uni-th>
  26. <uni-th style="font-size: 24rpx;" width="80" align="center">{{ item.storageNum }}</uni-th>
  27. </uni-tr>
  28. </uni-table> -->
  29. </view>
  30. </view>
  31. <view class="bottom uni-row">
  32. <button class="start-batch-btn" style="margin-right: 10rpx;" type="primary"
  33. :disabled="selections.length == 0" @click="handleAdd">确认取出</button>
  34. </view>
  35. </view>
  36. </template>
  37. <script setup>
  38. import {
  39. ref
  40. } from 'vue'
  41. import {
  42. onMounted,
  43. getCurrentInstance
  44. } from 'vue';
  45. import {
  46. getStorageRetrievalList
  47. } from '@/api/business/storageRetrieval.js'
  48. import {
  49. onLoad,
  50. onReady,
  51. onUnload,
  52. onShow
  53. } from '@dcloudio/uni-app'
  54. import {
  55. store
  56. } from '@/store/index.js'
  57. const selections = ref([])
  58. const listData = ref([])
  59. const column1 = [
  60. { type:'selection', width:50 },
  61. { name: 'lotCode', label: '批次号',align:'center'},
  62. { name: 'storagerName', label: '操作者',align:'center' },
  63. { name: 'storageNum', label: '数量',align:'center' },
  64. ]
  65. /***************************** 页面生命周期函数 *****************************/
  66. onLoad((options) => {
  67. const data = decodeURIComponent(options.data);
  68. // 将解码后的字符串转换回对象
  69. const lotInfo = JSON.parse(data);
  70. console.log(lotInfo)
  71. init(lotInfo)
  72. })
  73. /***************************** 定义了一些方法 *****************************/
  74. const init = (data) => {
  75. console.log(data)
  76. getStorageRetrievalList(data).then(res =>{
  77. listData.value = res.rows
  78. })
  79. }
  80. function selectionChange(checked,arr) {
  81. console.log(checked,arr)
  82. getSelectionList(arr)
  83. }
  84. function getSelectionList(data) {
  85. selections.value = data
  86. console.log(selections.value)
  87. }
  88. function toggleAllSelection(checked,arr) {
  89. getSelectionList(arr)
  90. }
  91. //选择带回
  92. function handleAdd() {
  93. uni.$emit('addInfoEvent', {
  94. data:selections.value
  95. })
  96. uni.navigateBack()
  97. }
  98. </script>
  99. <style lang="scss">
  100. .unfit-title{
  101. height: 30rpx;
  102. position: fixed;
  103. top: 30rpx;
  104. }
  105. .page-container {
  106. height: 90%;
  107. background-color: #ffffff;
  108. font-size: 28rpx;
  109. >.title {
  110. position: relative;
  111. top: 0;
  112. font-weight: 700;
  113. margin: 24rpx 16rpx;
  114. }
  115. }
  116. .unfit-title {
  117. margin-bottom: 24rpx;
  118. justify-content: space-between;
  119. align-items: center;
  120. text {
  121. font-size: 28rpx;
  122. font-weight: 700;
  123. }
  124. }
  125. .bottom {
  126. height: 10%;
  127. position: fixed;
  128. right: 0;
  129. bottom: 0;
  130. left: 0;
  131. height: 100rpx;
  132. border-top: 1px solid #999999;
  133. padding: 16rpx 32rpx;
  134. align-items: center;
  135. background-color: #fff;
  136. justify-content: space-evenly;
  137. z-index: 99;
  138. .start-batch-btn {
  139. flex: 1;
  140. height: 80rpx;
  141. line-height: 80rpx;
  142. border-radius: 8rpx;
  143. color: #FFFFFF;
  144. font-size: 28rpx;
  145. }
  146. }
  147. .consultation-container {
  148. margin: 0 16rpx;
  149. padding: 24rpx;
  150. background-color: #ffffff;
  151. border-radius: 8rpx;
  152. }
  153. .zb-table .item-tr {
  154. flex-direction: row;
  155. }
  156. </style>