ysy 2 年 前
コミット
9f03a54011
2 ファイル変更22 行追加20 行削除
  1. 16 15
      pages/pda/sample/components/sampleBom.vue
  2. 6 5
      pages/pda/sample/index/index.vue

+ 16 - 15
pages/pda/sample/components/sampleBom.vue

@@ -104,7 +104,7 @@
 
 							<view class="item ww25 content_num cx-cc" v-for="(p, i) in it.paramList" :key="index + i">
 								<view class="name">{{p.name}}</view>
-								 <input v-model="p.value" style="width: 168rpx ;"></input>
+								<input v-model="p.value" style="width: 168rpx ;"></input>
 							</view>
 
 						</view>
@@ -233,7 +233,7 @@
 										// 创建对象的副本,以避免引用相同的对象
 										const objCopy = {
 											...obj,
-										paramList: JSON.parse(JSON.stringify(this.paramList)) 
+											paramList: JSON.parse(JSON.stringify(this.paramList))
 										};
 										// 可以选择删除 num 属性,如果不需要在最终结果中保留它
 										delete objCopy.sampleNum;
@@ -243,7 +243,7 @@
 									// 如果 sampleNum 等于 1,直接推入数组(可以选择删除 sampleNum 属性)
 									const objCopy = {
 										...obj,
-										paramList: JSON.parse(JSON.stringify(this.paramList)) 
+										paramList: JSON.parse(JSON.stringify(this.paramList))
 									};
 
 									this.mergedArray.push(objCopy);
@@ -310,7 +310,7 @@
 					})
 					return false
 				}
-				this.item.sampleList = JSON.parse(JSON.stringify(this.mergedArray))   
+				this.item.sampleList = JSON.parse(JSON.stringify(this.mergedArray))
 				this.$forceUpdate()
 
 
@@ -323,20 +323,21 @@
 
 			hendleReuseNum() {
 				let count = 0
-                 if(this.item.sampleList.length > 0) {
-					 this.item.sampleList.forEach(f=> {
+				if (this.item.sampleList.length > 0) {
+					this.item.sampleList.forEach(f => {
 						if (Object.prototype.hasOwnProperty.call(f, 'selectType') && f.selectType == 1) {
 							count = count + 1
 						}
-						 
-					 })
-				 }
-				   if(count > 0) {
-					   	this.$set(this.item, 'reuseNum', count)
-					
-							
-				   }
-			
+
+					})
+				}
+				if (count > 0) {
+					this.$set(this.item, 'reuseNum', count)
+					this.$emit('showReuseTurnover', true)
+					this.$forceUpdate()
+
+				}
+
 			},
 
 

+ 6 - 5
pages/pda/sample/index/index.vue

@@ -21,10 +21,10 @@
 
 
 					<sampleBom :item='item.quality' v-if='item.quality' :isDetails='false'
-						:turnoverList='item.turnover' :paramList='paramList'></sampleBom>
+						:turnoverList='item.turnover' :paramList='paramList' @showReuseTurnover='showReuseTurnover = true'></sampleBom>
 
-
-					<reuseTurnoverBom v-if='item.quality && item.quality.showReuseTurnover' :list='item.turnover' :wordItem='item'
+                  
+					<reuseTurnoverBom v-if='showReuseTurnover' :list='item.turnover' :wordItem='item'
 						:reuseNum='item.quality.reuseNum'>
 					</reuseTurnoverBom>
 
@@ -76,7 +76,9 @@
 
 				isLastJob: true,
 				
-				paramList: []
+				paramList: [],
+				showReuseTurnover: false
+				
 			}
 		},
 
@@ -124,7 +126,6 @@
 						if (m.quality) {
 							m.quality['sampleList'] = []
 							m['reuseTurnover'] = [],
-								m.quality['showReuseTurnover'] = false,
 								m.quality['reuseNum'] = 0
 						} else {
 							this.isLastJob = false