storageRetrieval.vue 4.6 KB

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