single.vue 7.0 KB

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