single.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  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="top-wrapper">
  6. <view class="searchBox rx-bc">
  7. <input v-model="keyWord" placeholder="请输入关键字搜索" class="searchInput" />
  8. <view class="rx-sc">
  9. <u-button @click="doSearch" type="success" size="small" class="u-reset-button" text="搜索">
  10. </u-button>
  11. </view>
  12. </view>
  13. </view>
  14. <view class="list_box">
  15. <u-list @scrolltolower="scrolltolower">
  16. <checkbox-group v-for="(item, index) in list" :key="index" @change="e => selectVal(e, item, index)">
  17. <label class="listBox rx-bs">
  18. <view class="listBox-sel">
  19. <checkbox :value="item.code" color="#fff" :disabled="item.disabled"
  20. :checked="item.checked" />
  21. </view>
  22. <view class="listBox-con">
  23. <view class="listBox-top rx-bc">
  24. <view> {{ item.name }}</view>
  25. <view class="code">{{ item.code}}</view>
  26. </view>
  27. <view class="listBox-bottom rx">
  28. <view v-for="(itm, index) in tableH(item.rootCategoryLevelId)" :key="index"
  29. class="items" v-if="!itm.formatter">
  30. <text>{{ itm.label }}</text>{{ item[itm.prop] }}
  31. </view>
  32. <view
  33. v-if="[1,2, 9].includes(item.rootCategoryLevelId)"
  34. class="items">
  35. <text>物料代号</text> {{item.extInfo.materielCode }}
  36. </view>
  37. <view
  38. v-if="[1,2, 9].includes(item.rootCategoryLevelId)"
  39. class="items">
  40. <text>刻码</text> {{item.extInfo.engrave }}
  41. </view>
  42. </view>
  43. </view>
  44. </label>
  45. </checkbox-group>
  46. <!-- -->
  47. </u-list>
  48. </view>
  49. <view class="bottom-wrapper rx-bc">
  50. <view>
  51. </view>
  52. <view>
  53. <u-button type="success" size="small" class="u-reset-button" @click="jumpAdd">
  54. <view> 选择 </view>
  55. </u-button>
  56. </view>
  57. </view>
  58. </view>
  59. </template>
  60. <script>
  61. import {
  62. tableHeader
  63. } from './single.js'
  64. import {
  65. feedOutInOrder
  66. } from '@/api/pda/workOrder.js'
  67. export default {
  68. data() {
  69. return {
  70. taskId: null,
  71. id: null,
  72. list: [],
  73. memoList: [],
  74. storageKey: null,
  75. keyWord: ''
  76. }
  77. },
  78. onLoad(option) {
  79. this.id = option.id
  80. if (option.taskId == 'undefined') {
  81. this.taskId = null
  82. } else {
  83. this.taskId = option.taskId || null
  84. }
  85. if (option.storageKey) {
  86. this.storageKey = option.storageKey
  87. this.memoList = []
  88. let _arr = (this.storageKey && uni.getStorageSync(this.storageKey)) || []
  89. this.memoList = [..._arr[0].modelList, ..._arr[0].equipmentList, ..._arr[0].instanceList, ..._arr[0]
  90. .aridRegionList, ..._arr[0].turnover, ..._arr[0].palletList, ..._arr[0].revolvingDiskList, ..._arr[
  91. 0].semiProductList
  92. ]
  93. }
  94. this.getList()
  95. },
  96. onUnload() {
  97. if (this.storageKey) {
  98. uni.removeStorage(this.storageKey)
  99. }
  100. },
  101. methods: {
  102. scrolltolower() {},
  103. getList() {
  104. let param = {
  105. workOrderId: this.id,
  106. taskId: this.taskId
  107. }
  108. feedOutInOrder(param).then(res => {
  109. this.list.push(
  110. ...res.map(i => {
  111. const checked =
  112. this.memoList.findIndex(itm => itm.id === i.id) > -1
  113. return {
  114. checked,
  115. ...i,
  116. }
  117. })
  118. )
  119. })
  120. },
  121. doSearch() {
  122. console.log(this.list)
  123. },
  124. tableH(type) {
  125. return tableHeader(type)
  126. },
  127. selectVal(e, val, index) {
  128. this.list[index].checked = !this.list[index].checked
  129. const idx = this.memoList.findIndex(
  130. item => item.id === this.list[index].id
  131. )
  132. if (this.list[index].checked) {
  133. if (idx === -1) {
  134. this.memoList.push(this.list[index])
  135. }
  136. } else {
  137. if (idx > -1) {
  138. this.memoList.splice(idx, 1)
  139. }
  140. }
  141. },
  142. jumpAdd() {
  143. uni.$emit('setSelectList', this.memoList, this.id)
  144. uni.navigateBack()
  145. }
  146. }
  147. }
  148. </script>
  149. <style lang="scss" scoped>
  150. .content-box {
  151. height: 100vh;
  152. overflow: hidden;
  153. display: flex;
  154. flex-direction: column;
  155. background-color: $page-bg;
  156. }
  157. .searchBox {
  158. background-color: #dedede;
  159. height: 90rpx;
  160. padding: 0 20rpx;
  161. .menu_icon {
  162. width: 60rpx;
  163. height: 60rpx;
  164. margin-right: 20rpx;
  165. }
  166. input {
  167. height: 70rpx;
  168. width: 480rpx;
  169. background: #f9f9f9 !important;
  170. padding-left: 10rpx;
  171. border-radius: 5rpx;
  172. }
  173. }
  174. .list_box {
  175. flex: 1;
  176. overflow: hidden;
  177. padding: 4rpx 0;
  178. .u-list {
  179. height: 100% !important;
  180. }
  181. }
  182. .listBox {
  183. margin-top: 8rpx;
  184. padding: 8rpx 24rpx;
  185. background: #fff;
  186. /deep/ .uni-checkbox-input-checked {
  187. background-color: $theme-color !important;
  188. border-color: $theme-color !important;
  189. }
  190. .listBox-con {
  191. width: 650rpx;
  192. font-weight: 400;
  193. }
  194. .listBox-top {
  195. margin-top: 6rpx;
  196. color: #090A0A;
  197. font-size: 28rpx;
  198. font-style: normal;
  199. font-weight: 800;
  200. }
  201. .listBox-bottom {
  202. color: #090A0A;
  203. font-size: 24rpx;
  204. font-style: normal;
  205. flex-wrap: wrap;
  206. .items {
  207. width: calc(50% - 1px);
  208. border-left: 1rpx solid #E3E5E5;
  209. border-right: 1rpx solid #E3E5E5;
  210. border-bottom: 1rpx solid #E3E5E5;
  211. box-sizing: border-box;
  212. word-break: break-all;
  213. text {
  214. display: inline-block;
  215. background: #F7F9FA;
  216. padding: 8rpx 10rpx;
  217. color: #157A2C;
  218. }
  219. &:nth-child(1),
  220. &:nth-child(2) {
  221. border-top: 1rpx solid #E3E5E5;
  222. margin-top: 8rpx;
  223. }
  224. }
  225. }
  226. }
  227. .bottom-wrapper {
  228. height: 80rpx;
  229. background: #fff;
  230. padding: 0 32rpx;
  231. /deep/ .uni-checkbox-input-checked {
  232. background-color: $theme-color !important;
  233. border-color: $theme-color !important;
  234. }
  235. }
  236. </style>