single.vue 6.0 KB

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