single.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <view class="content-box">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="出库单" background-color="#F7F9FA"
  4. color="#404446" @clickLeft="back"></uni-nav-bar>
  5. <view class="list_box">
  6. <u-list @scrolltolower="scrolltolower">
  7. <checkbox-group v-for="(item, index) in list" :key="index" @change="e => selectVal(e, item, index)">
  8. <label class="listBox rx-bs">
  9. <view class="listBox-sel">
  10. <checkbox :value="item.code" color="#fff" :disabled="item.disabled"
  11. :checked="item.checked" />
  12. </view>
  13. <view class="listBox-con">
  14. <view class="listBox-top rx-bc">
  15. <view> {{ item.name }}</view>
  16. <view class="code">{{ item.code}}</view>
  17. </view>
  18. <view class="listBox-bottom rx">
  19. <view v-for="(itm, index) in tableH(item.rootCategoryLevelId)" :key="index"
  20. class="items" v-if="!itm.formatter">
  21. <text>{{ itm.label }}</text>{{ item[itm.prop] }}
  22. </view>
  23. </view>
  24. </view>
  25. </label>
  26. </checkbox-group>
  27. <!-- -->
  28. </u-list>
  29. </view>
  30. <view class="bottom-wrapper rx-bc">
  31. <view>
  32. </view>
  33. <view>
  34. <u-button type="success" size="small" class="u-reset-button" @click="jumpAdd">
  35. <view> 选择 </view>
  36. </u-button>
  37. </view>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. import {
  43. tableHeader
  44. } from './single.js'
  45. import {
  46. feedOutInOrder
  47. } from '@/api/pda/workOrder.js'
  48. export default {
  49. data() {
  50. return {
  51. taskId: null,
  52. id: null,
  53. list: [],
  54. memoList: [],
  55. storageKey: null,
  56. }
  57. },
  58. onLoad(option) {
  59. this.id = option.id
  60. if (option.taskId == 'undefined') {
  61. this.taskId = null
  62. } else {
  63. this.taskId = option.taskId || null
  64. }
  65. if (option.storageKey) {
  66. this.storageKey = option.storageKey
  67. this.memoList = []
  68. let _arr = (this.storageKey && uni.getStorageSync(this.storageKey)) || []
  69. this.memoList = [..._arr[0].modelList, ..._arr[0].equipmentList, ..._arr[0].instanceList, ..._arr[0]
  70. .aridRegionList, ..._arr[0].turnover, ..._arr[0].palletList, ..._arr[0].revolvingDiskList, ..._arr[0].semiProductList
  71. ]
  72. }
  73. this.getList()
  74. },
  75. onUnload() {
  76. if (this.storageKey) {
  77. uni.removeStorage(this.storageKey)
  78. }
  79. },
  80. methods: {
  81. scrolltolower() {},
  82. getList() {
  83. let param = {
  84. workOrderId: this.id,
  85. taskId: this.taskId
  86. }
  87. feedOutInOrder(param).then(res => {
  88. this.list.push(
  89. ...res.map(i => {
  90. const checked =
  91. this.memoList.findIndex(itm => itm.id === i.id) > -1
  92. return {
  93. checked,
  94. ...i,
  95. }
  96. })
  97. )
  98. })
  99. },
  100. tableH(type) {
  101. return tableHeader(type)
  102. },
  103. selectVal(e, val, index) {
  104. this.list[index].checked = !this.list[index].checked
  105. const idx = this.memoList.findIndex(
  106. item => item.id === this.list[index].id
  107. )
  108. if (this.list[index].checked) {
  109. if (idx === -1) {
  110. this.memoList.push(this.list[index])
  111. }
  112. } else {
  113. if (idx > -1) {
  114. this.memoList.splice(idx, 1)
  115. }
  116. }
  117. },
  118. jumpAdd() {
  119. uni.$emit('setSelectList', this.memoList, this.id)
  120. uni.navigateBack()
  121. }
  122. }
  123. }
  124. </script>
  125. <style lang="scss" scoped>
  126. .content-box {
  127. height: 100vh;
  128. overflow: hidden;
  129. display: flex;
  130. flex-direction: column;
  131. background-color: $page-bg;
  132. }
  133. .list_box {
  134. flex: 1;
  135. overflow: hidden;
  136. padding: 4rpx 0;
  137. .u-list {
  138. height: 100% !important;
  139. }
  140. }
  141. .listBox {
  142. margin-top: 8rpx;
  143. padding: 8rpx 24rpx;
  144. background: #fff;
  145. /deep/ .uni-checkbox-input-checked {
  146. background-color: $theme-color !important;
  147. border-color: $theme-color !important;
  148. }
  149. .listBox-con {
  150. width: 650rpx;
  151. font-weight: 400;
  152. }
  153. .listBox-top {
  154. margin-top: 6rpx;
  155. color: #090A0A;
  156. font-size: 28rpx;
  157. font-style: normal;
  158. font-weight: 800;
  159. }
  160. .listBox-bottom {
  161. color: #090A0A;
  162. font-size: 24rpx;
  163. font-style: normal;
  164. flex-wrap: wrap;
  165. .items {
  166. width: calc(50% - 1px);
  167. border-left: 1rpx solid #E3E5E5;
  168. border-right: 1rpx solid #E3E5E5;
  169. border-bottom: 1rpx solid #E3E5E5;
  170. box-sizing: border-box;
  171. text {
  172. display: inline-block;
  173. background: #F7F9FA;
  174. padding: 8rpx 10rpx;
  175. color: #157A2C;
  176. }
  177. &:nth-child(1),
  178. &:nth-child(2) {
  179. border-top: 1rpx solid #E3E5E5;
  180. margin-top: 8rpx;
  181. }
  182. }
  183. }
  184. }
  185. .bottom-wrapper {
  186. height: 80rpx;
  187. background: #fff;
  188. padding: 0 32rpx;
  189. /deep/ .uni-checkbox-input-checked {
  190. background-color: $theme-color !important;
  191. border-color: $theme-color !important;
  192. }
  193. }
  194. </style>