outInStorageDetail.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" :title="type + '单号 ' + form.outInId" @clickLeft="back"></uni-nav-bar>
  4. <view class="search-bar">
  5. <uni-search-bar class="uni-search-bar" @confirm="search" v-model="form.keyWord" @input="inputChange" cancelButton="none" placeholder="编码/名称"></uni-search-bar>
  6. </view>
  7. <view class="list-wrap">
  8. <view class="item" v-for="(item, index) in listData" :key="index">
  9. <view class="title">
  10. <view class="s1">{{ item.categoryCode }} ({{ item.categoryName }})</view>
  11. <view class="s2">{{ item.measureQuantity }} {{ item.measureUnit }}</view>
  12. <uni-icons v-if="item.open" type="up" size="20" @click="expand(index, false)"></uni-icons>
  13. <uni-icons v-else type="down" size="20" @click="expand(index, true)"></uni-icons>
  14. </view>
  15. <view class="main" :class="[item.open ? 'open' : 'close']">
  16. <view class="main-item" v-for="(itm, index) in tableHeader" :key="index">
  17. <view class="s1">{{ itm.label }}</view>
  18. <view class="s2" v-if="itm.formatter">{{ itm.formatter(item) }}</view>
  19. <view class="s2" v-else>{{ item[itm.prop] }}</view>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. <u-loadmore fontSize="32" iconSize="36" :status="status" style="margin-top: 20rpx" />
  25. </view>
  26. </template>
  27. <script>
  28. import { outInRecordsPage } from '@/api/warehouseManagement'
  29. let [page, size, isEnd] = [1, 20, true]
  30. export default {
  31. data() {
  32. return {
  33. type: '', // 出入库类型
  34. listData: [],
  35. form: {
  36. keyWord: '',
  37. outInId: '' // 出入库表单
  38. },
  39. timerId: null,
  40. dict: {
  41. code: {
  42. 1: '生产设备',
  43. 2: '舟皿',
  44. 3: '物料',
  45. 5: '周转车',
  46. 6: '模具',
  47. 7: '备品备件'
  48. }
  49. },
  50. status: 'loading'
  51. }
  52. },
  53. onLoad() {},
  54. onShow() {},
  55. //加载更多
  56. onReachBottom() {
  57. console.log('加载更多')
  58. if (isEnd) {
  59. return
  60. }
  61. this.getMoreLists()
  62. },
  63. onLoad(option) {
  64. this.form.outInId = option.bizNo
  65. this.type = option.type
  66. },
  67. created() {
  68. this.getData()
  69. },
  70. computed: {
  71. tableHeader() {
  72. return [
  73. {
  74. label: '牌号',
  75. prop: 'brandNum'
  76. },
  77. {
  78. label: '型号',
  79. prop: 'categoryModel'
  80. },
  81. {
  82. label: '规格',
  83. prop: 'specification'
  84. },
  85. {
  86. label: '批次号',
  87. prop: 'batchNo'
  88. },
  89. {
  90. label: '重量',
  91. prop: 'weight'
  92. },
  93. {
  94. label: '重量单位',
  95. prop: 'weightUnit'
  96. },
  97. {
  98. label: '包装编码',
  99. prop: 'packageNo'
  100. },
  101. {
  102. label: '包装数量',
  103. prop: 'packingQuantity'
  104. },
  105. {
  106. label: '包装单位',
  107. prop: 'packingUnit'
  108. },
  109. {
  110. label: '仓库',
  111. prop: 'warehouseName'
  112. }
  113. ]
  114. }
  115. },
  116. methods: {
  117. expand(index, isOpen) {
  118. this.$set(this.listData[index], 'open', isOpen)
  119. },
  120. //筛选
  121. getData() {
  122. let par = JSON.parse(JSON.stringify(this.form))
  123. par.pageNum = page
  124. par.size = size
  125. outInRecordsPage(par).then(res => {
  126. this.listData = [...this.listData, ...res.list]
  127. let pages = res.count
  128. if (this.listData.length < pages) {
  129. isEnd = false
  130. this.status = 'loading'
  131. } else {
  132. isEnd = true
  133. this.status = 'nomore'
  134. }
  135. })
  136. },
  137. inputChange() {
  138. // 清除timer对应的延时器
  139. clearTimeout(this.timerId)
  140. // 重新启动一个延时器,并把timerId赋值给this.timer
  141. this.timerId = setTimeout(() => {
  142. // 如果500毫秒内,没有触发新的输入事件,则为搜索关键词赋值
  143. this.search()
  144. }, 500)
  145. },
  146. search() {
  147. this.listData = []
  148. this.getData()
  149. },
  150. getMoreLists() {
  151. page++
  152. this.getData()
  153. }
  154. }
  155. }
  156. </script>
  157. <style lang="scss" scoped>
  158. .search-bar {
  159. display: flex;
  160. align-items: center;
  161. justify-content: space-between;
  162. .screen {
  163. display: flex;
  164. align-items: center;
  165. margin-right: 20rpx;
  166. .text {
  167. line-height: 1;
  168. }
  169. .image {
  170. width: 40rpx;
  171. height: 40rpx;
  172. }
  173. }
  174. .uni-search-bar {
  175. flex: 1;
  176. }
  177. }
  178. .list-wrap {
  179. .item {
  180. .title {
  181. display: flex;
  182. align-items: center;
  183. padding: 20rpx;
  184. border-bottom: 1px solid #333333;
  185. font-size: 28rpx;
  186. .s1 {
  187. flex: 1;
  188. }
  189. }
  190. .main {
  191. padding: 0 50rpx;
  192. background-color: #fcfcfc;
  193. transition: all 0.3s linear;
  194. overflow: hidden;
  195. .main-item {
  196. display: flex;
  197. justify-content: space-between;
  198. font-size: 28rpx;
  199. color: #aaaaaa;
  200. padding: 20rpx 0;
  201. & + .main-item {
  202. border-top: 1px dashed #aaaaaa;
  203. }
  204. }
  205. }
  206. .open {
  207. height: auto;
  208. }
  209. .close {
  210. height: 0;
  211. }
  212. .ckxq {
  213. font-size: 28rpx;
  214. color: #70b603;
  215. background-color: #f1fbe2;
  216. padding: 20rpx;
  217. text-align: center;
  218. }
  219. }
  220. }
  221. </style>