ysy 2 лет назад
Родитель
Сommit
747056feb0
2 измененных файлов с 23 добавлено и 13 удалено
  1. 3 3
      pages/pda/jobBooking/components/turnoverBom.vue
  2. 20 10
      pages/pda/jobBooking/index/index.vue

+ 3 - 3
pages/pda/jobBooking/components/turnoverBom.vue

@@ -1,6 +1,6 @@
 <template>
 	<view>
-		<view class="title_box rx-bc" v-if='list.length > 0'>
+		<view class="title_box rx-bc" >
 			<view class="name">周转车</view>
 		</view>
 
@@ -112,8 +112,8 @@
 			},
 
 			getDelete(index) {
-				this.list.splice(index, 1)
-				this.$forceUpdate()
+				 this.$emit('handleDel', index, 'turnover')
+			
 			
 			},
 		}

+ 20 - 10
pages/pda/jobBooking/index/index.vue

@@ -20,7 +20,8 @@
 					<byProductBom v-if='objData.productRecycleList.length != 0 ' :list='objData.productRecycleList'>
 					</byProductBom>
 
-					<turnoverBom v-if='objData.turnover.length != 0' :list='objData.turnover' :wordItem='objData' @handleScan='handleScan' >
+					<turnoverBom v-if='objData.turnover.length != 0' :list='objData.turnover' :wordItem='objData'
+						@handleScan='handleScan' @handleDel='handleDel'>
 					</turnoverBom>
 
 
@@ -102,17 +103,19 @@
 			uni.$off("setSelectList");
 
 			uni.$on("setSelectList", (selectList, id) => {
-				console.log(selectList)
+
 
 				selectList.forEach(f => {
 					if (f.rootCategoryLevelId == 7) { // 周转车
+						this.objData.turnover.forEach(e => {
+							if (e.code != f.code) {
+								this.objData.turnover.push(f)
+								this.$forceUpdate()
+							}
+						})
+						console.log(this.objData.turnover)
+						
 
-						let isFals = this.objData.turnover.some(m => m.code == f.code)
-						if (isFals) {
-							return false
-						}
-						this.objData.turnover.push(f)
-						this.$forceUpdate()
 					}
 
 				})
@@ -160,6 +163,13 @@
 				})
 			},
 
+			handleDel(idx, type) {
+				if (type == 'turnover') {
+					this.objData.turnover.splice(idx, 1)
+					this.$forceUpdate()
+				}
+			},
+
 			handleScan(id, type) {
 
 
@@ -183,7 +193,7 @@
 
 					})
 				} else if (type == 'turnover') {
-					
+
 					let isFals = this.objData.turnover.some(m => m.code == result)
 					if (isFals) {
 						uni.showToast({
@@ -200,7 +210,7 @@
 				}
 
 			},
-			
+
 
 
 			getList() {