liuhairui 1 year ago
parent
commit
cdd4f9799f
1 changed files with 100 additions and 91 deletions
  1. 100 91
      src/view/performance/Manualdocuments.vue

+ 100 - 91
src/view/performance/Manualdocuments.vue

@@ -449,15 +449,15 @@
 		sczl_废品率系数: '',
 		sczl_jsss: '',
 		sczl_冲定额: '',
-		流程单号1: '',
-		流程单号2: '',
-		流程单号3: '',
-		流程单号4: '',
-		流程单号5: '',
-		流程单号6: '',
-		流程单号7: '',
-		流程单号8: '',
-		流程单号9: '',
+		流程单号1: '0',
+		流程单号2: '0',
+		流程单号3: '0',
+		流程单号4: '0',
+		流程单号5: '0',
+		流程单号6: '0',
+		流程单号7: '0',
+		流程单号8: '0',
+		流程单号9: '0',
 		qczl_NumDesc: '',
 		sczl_desc: '',
 		sczl_bh1: '',
@@ -711,88 +711,97 @@
 		console.log(id3)
 		
 	if (event.keyCode === 13 && id3 === '流程单号') {
-		 console.log(id3);
-			// 获取所有相关的输入框值
-		  const allValues = [
-			  formData.value.流程单号1,
-			  formData.value.流程单号2,
-			  formData.value.流程单号3,
-			  formData.value.流程单号4,
-			  formData.value.流程单号5,
-			  formData.value.流程单号6,
-			  formData.value.流程单号7,
-			  formData.value.流程单号8,
-			  formData.value.流程单号9,
-			  formData.value.流程单号10,
-		  ];
-		  // 获取当前输入框的值
-		  const currentValue = event.target.value;
-
-		  // 如果当前值为 0,不进行校验,直接跳转到下一个输入框
-		  if (currentValue === "0") {
-			console.log("输入值为 0,无需校验");
-
-			// 跳转到下一个输入框
-			let nextIndex = currentIndex + 1;
-			let foundNext = false; // 标记是否找到下一个可用输入框
-			while (nextIndex < inputs.length) {
-			  if (inputs[nextIndex].disabled) {
-				console.log("当前输入框为 disabled,跳过");
-				nextIndex++; // 跳过 disabled 的输入框
-				continue;
-			  }
-			  if (!inputs[nextIndex].readOnly) {
-				nextTick(() => {
-				  inputs[nextIndex].focus();
-				  inputs[nextIndex].select();
-				});
-				foundNext = true; // 找到下一个可用输入框
-				break;
-			  }
-			  nextIndex++;
-			}
-			if (!foundNext) {
-			  console.log("没有更多可用的输入框");
-			}
-			return;
-		  }
-
-		  // 检查是否有重复的值
-		  const isDuplicate = allValues.filter((val) => val === currentValue).length > 1;
-
-		  if (isDuplicate) {
-			// 如果有重复值,提示用户并清空当前输入框
-			event.target.value = 0;
-			ElMessage({
-			  type: 'error',
-			  message: '输入的值已存在,请重新输入'
-			});
-		  } else {
-			console.log('输入值无重复');
-			// 跳转到下一个输入框
-			let nextIndex = currentIndex + 1;
-			let foundNext = false; // 标记是否找到下一个可用输入框
-			while (nextIndex < inputs.length) {
-			  if (inputs[nextIndex].disabled) {
-				console.log("当前输入框为 disabled,跳过");
-				nextIndex++; // 跳过 disabled 的输入框
-				continue;
-			  }
-			  if (!inputs[nextIndex].readOnly) {
-				nextTick(() => {
-				  inputs[nextIndex].focus();
-				  inputs[nextIndex].select();
-				});
-				foundNext = true; // 找到下一个可用输入框
-				break;
-			  }
-			  nextIndex++;
-			}
-			if (!foundNext) {
-			  console.log("没有更多可用的输入框");
-			}
-		  }
-	}else if (event.keyCode === 13 && id3 === '定额代号') { 
+	  console.log(id3);
+	
+	  // 获取所有相关的输入框值
+	  const allValues = [
+	    formData.value.流程单号1,
+	    formData.value.流程单号2,
+	    formData.value.流程单号3,
+	    formData.value.流程单号4,
+	    formData.value.流程单号5,
+	    formData.value.流程单号6,
+	    formData.value.流程单号7,
+	    formData.value.流程单号8,
+	    formData.value.流程单号9,
+	    formData.value.流程单号10,
+	  ];
+	
+	  // 获取当前输入框的值
+	  const currentValue = event.target.value;
+	
+	  // 如果输入值为 0,跳过重复校验,直接跳转到下一个输入框
+	  if (currentValue === "0") {
+	    console.log("输入值为 0,无需校验");
+	
+	    // 跳转到下一个输入框
+	    let nextIndex = currentIndex + 1; // 从当前输入框的下一个开始查找
+	    let foundNext = false; // 标记是否找到下一个可用输入框
+	
+	    while (nextIndex < inputs.length) {
+	      if (inputs[nextIndex].disabled) {
+	        console.log("当前输入框为 disabled,跳过");
+	        nextIndex++; // 跳过 disabled 的输入框
+	        continue;
+	      }
+	      if (!inputs[nextIndex].readOnly) {
+	        nextTick(() => {
+	          inputs[nextIndex].focus(); // 聚焦到下一个输入框
+	          inputs[nextIndex].select(); // 选中下一个输入框的内容
+	        });
+	        foundNext = true; // 标记已找到下一个输入框
+	        break;
+	      }
+	      nextIndex++;
+	    }
+	
+	    if (!foundNext) {
+	      console.log("没有更多可用的输入框");
+	    }
+	
+	    return; // 直接返回,不再执行后续校验逻辑
+	  }
+	
+	  // 检查当前值是否重复(值为 0 不算重复)
+	  const isDuplicate = allValues.filter((val) => val === currentValue && val !== "0").length > 0;
+	
+	  if (isDuplicate) {
+	    // 如果输入值重复(0 除外),清空当前输入框并提示错误信息
+	    event.target.value = 0;
+	    ElMessage({
+	      type: 'error',
+	      message: '输入的值已存在,请重新输入',
+	    });
+	  } else {
+	    console.log('输入值无重复');
+	
+	    // 跳转到下一个输入框
+	    let nextIndex = currentIndex + 1; // 从当前输入框的下一个开始查找
+	    let foundNext = false; // 标记是否找到下一个可用输入框
+	
+	    while (nextIndex < inputs.length) {
+	      if (inputs[nextIndex].disabled) {
+	        console.log("当前输入框为 disabled,跳过");
+	        nextIndex++; // 跳过 disabled 的输入框
+	        continue;
+	      }
+	      if (!inputs[nextIndex].readOnly) {
+	        nextTick(() => {
+	          inputs[nextIndex].focus(); // 聚焦到下一个输入框
+	          inputs[nextIndex].select(); // 选中下一个输入框的内容
+	        });
+	        foundNext = true; // 标记已找到下一个输入框
+	        break;
+	      }
+	      nextIndex++;
+	    }
+	
+	    if (!foundNext) {
+	      console.log("没有更多可用的输入框");
+	    }
+	  }
+	}
+else if (event.keyCode === 13 && id3 === '定额代号') { 
 		console.log("定额代号");
 		GetDedh()
 		// getDedhsubmit(event,id1,id2,id3)