ysy 2 år sedan
förälder
incheckning
001ef9ab41
3 ändrade filer med 92 tillägg och 48 borttagningar
  1. 14 0
      api/pda/feeding.js
  2. 44 16
      pages/pda/workOrder/search/index.vue
  3. 34 32
      pages/pda/workOrder/search/matterPop.vue

+ 14 - 0
api/pda/feeding.js

@@ -24,3 +24,17 @@ export async function feedByOrderIds(params) {
   }
   return Promise.reject(data.message);
 }
+
+
+// 库存明细
+export async function getInventoryDetails(params) {
+  const data = await get(
+   Vue.prototype.apiUrl  + `/wms/outin/getInventoryDetails`, params, true,
+  );
+  if (data.code == 0) {
+    return data.data;
+  }
+  return Promise.reject(data.message);
+}
+
+

+ 44 - 16
pages/pda/workOrder/search/index.vue

@@ -90,7 +90,8 @@
 		<ba-tree-picker ref="treePicker" key="verify" :multiple="false" @select-change="confirm" title="选择分类"
 			:localdata="classificationList" valueKey="id" textKey="name" childrenKey="children" />
 
-		<matterPop v-if='matterShow' :matterId='matterId' :DTOList='DTOList' :mattList='mattList' @close='close' @mattSave='mattSave'>
+		<matterPop v-if='matterShow' :matterId='matterId' :categoryId='categoryId' :mattList='mattList' @close='close'
+			@mattSave='mattSave'>
 		</matterPop>
 
 	</view>
@@ -132,7 +133,7 @@
 
 				matterShow: false, //物料 左弹框
 				matterId: null,
-				DTOList: [],
+				categoryId: null,
 				mattList: []
 			}
 		},
@@ -270,7 +271,7 @@
 									warehouseId,
 									...i,
 									instanceId: i.id,
-									categoryId: i.assetId,
+								
 
 								}
 							})
@@ -283,11 +284,24 @@
 
 			//勾选
 			selectVal(e, val, index) {
-				if (this.isType == 'pick') {
+				if (this.isType == 'feed' && val.rootCategoryLevelId == 1) {
+					this.$set(this.list[index], 'checked', false)
+					if( val.mattList.length > 0) {
+						this.mattList = val.mattList
+					} else {
+						this.memoList.forEach(m => {
+							if(m.rootCategoryLevelId == 1) {
+								 this.mattList = this.mattList.concat(m.mattList)
+							}
+						})
+					}
+					
+					this.categoryId = val.categoryId
+					this.matterId = val.id
+					this.matterShow = true
+				} else {
 					this.list[index].checked = !this.list[index].checked
-
 					this.seletedAll = !this.list.some(item => !item.checked)
-
 					const idx = this.memoList.findIndex(
 						item => item.id === this.list[index].id
 					)
@@ -301,17 +315,9 @@
 							this.memoList.splice(idx, 1)
 						}
 					}
-				} else if (this.isType == 'feed') {
-					this.$set(this.list[index], 'checked', false)
-                    this.mattList = val.mattList
-					this.DTOList = val.inventoryDetailsDTOList
-					this.matterId = val.id
-					this.matterShow = true
 				}
 
 
-
-
 			},
 
 			close() {
@@ -325,6 +331,23 @@
 						this.$set(e, 'checked', maList.length == 0 ? false : true)
 						e.mattList = maList
 						this.matterShow = false
+
+						const idx = this.memoList.findIndex(
+							item => item.id === id
+						)
+
+						this.list.forEach(e => {
+							if (e.id == id) {
+								if (e.checked && idx === -1) {
+									this.memoList.push(e)
+								} else if (!e.checked && idx > -1) {
+									this.memoList.splice(idx, 1)
+								}
+							}
+						})
+
+
+
 					}
 				})
 
@@ -332,8 +355,13 @@
 
 			//跳转回添加页面
 			jumpAdd() {
-				uni.$emit('setSelectList', this.memoList, this.pid)
-				uni.navigateBack()
+				if(this.isType == 'pick') {
+					uni.$emit('setSelectList', this.memoList, this.pid)
+					uni.navigateBack()
+				} else if(this.isType == 'feed') {
+					 console.log(this.memoList)
+				}
+			
 			},
 		}
 	}

+ 34 - 32
pages/pda/workOrder/search/matterPop.vue

@@ -7,7 +7,7 @@
 
 					<u-list @scrolltolower="scrolltolower">
 
-						<checkbox-group v-for="(item, index) in ListData" :key="index"
+						<checkbox-group v-for="(item, index) in list" :key="index"
 							@change="e => selectVal(e, item, index)">
 							<label class="listBox rx-bs">
 
@@ -37,7 +37,7 @@
 
 						</checkbox-group>
 
-						<view style='margin-top: 20vh;' v-if='DTOList.length == 0'>
+						<view style='margin-top: 20vh;' v-if='list.length == 0'>
 							<u-empty iconSize='150' textSize='32' text='暂无数据'>
 							</u-empty>
 						</view>
@@ -60,14 +60,12 @@
 	import {
 		tableHeader
 	} from '../../common.js'
+	import { getInventoryDetails } from '@/api/pda/feeding.js'
 	export default {
 		props: {
 			matterId: [String, Number],
 
-			DTOList: {
-				type: Array,
-				default: () => {}
-			},
+			categoryId: [String, Number],
 
 			mattList: {
 				type: Array,
@@ -83,38 +81,42 @@
 
 			}
 		},
-		computed: {
-			ListData() {
-				console.log(this.mattList)
-				let list = []
-
-				list.push(
-
-					...this.DTOList.map(i => {
-						const checked =
-							this.mattList.findIndex(itm => itm.id == i.id) > -1
-							console.log(checked)
-							return {
-								checked,
-								...i
-							}
-					})
-				)
-
-
 
-
-
-				this.list = list
-
-				return list
-			}
+		created() {
+			this.getList()
 		},
 		methods: {
+			getList() {
+				let param = {
+					pageNum: 1,
+					size: -1,
+					categoryId: this.categoryId
+				}
+				getInventoryDetails(param).then(res => {
+							let list = []
+					
+							list.push(
+								...res.list.map(i => {
+									const checked =
+										this.mattList.findIndex(itm => itm.id == i.id) > -1
+									return {
+										checked,
+										...i
+									}
+								})
+							)
+					
+					
+					
+							this.list = list
+				})
+			},
 			scrolltolower() {},
 
 			save() {
-				this.$emit('mattSave', this.memoList, this.matterId)
+				let _arr = []
+				_arr = this.list.filter(f => f.checked)
+				this.$emit('mattSave', _arr, this.matterId)
 			},
 
 			//勾选