Browse Source

工单核验单-详细信息优化、数量流程号置空、工序固定

曹鹤洋 1 year ago
parent
commit
d2d97700b3
1 changed files with 137 additions and 83 deletions
  1. 137 83
      src/view/performance/09-workOrderVerification/index.vue

+ 137 - 83
src/view/performance/09-workOrderVerification/index.vue

@@ -535,7 +535,6 @@
 	// 批量删除控制标记
 	// 批量删除控制标记
 	const deleteVisible = ref(false)
 	const deleteVisible = ref(false)
 	const multipleSelection = ref([])
 	const multipleSelection = ref([])
-	const minUniqId = ref('')
 	const getTableData = async () => {
 	const getTableData = async () => {
 		const response = await getTable(params)
 		const response = await getTable(params)
 		if (response.code === 0) {
 		if (response.code === 0) {
@@ -543,7 +542,6 @@
 			// Object.assign(tableData, response.data.rows)
 			// Object.assign(tableData, response.data.rows)
 
 
 			tableData.splice(0, tableData.length, ...response.data.rows)
 			tableData.splice(0, tableData.length, ...response.data.rows)
-			minUniqId.value = Math.min(...tableData.map(row => row.UniqId))
 		}
 		}
 	}
 	}
 
 
@@ -616,9 +614,7 @@
 
 
 	const getDetailData = async (id) => {
 	const getDetailData = async (id) => {
 		try {
 		try {
-			const res = await getOneWorkOrder({
-				UniqId: id
-			})
+			const res = await getOneWorkOrder({ UniqId: id })
 			if (res.code === 0) {
 			if (res.code === 0) {
 				const obj = res.data
 				const obj = res.data
 				// 裁剪返回数据的前后空格
 				// 裁剪返回数据的前后空格
@@ -655,7 +651,6 @@
 				}
 				}
 				detailData.table = table
 				detailData.table = table
 				try {
 				try {
-					console.log(detailData)
 					const res = await getOrderInfo({
 					const res = await getOrderInfo({
 						order: detailData.qczl_gdbh
 						order: detailData.qczl_gdbh
 					})
 					})
@@ -1114,7 +1109,7 @@
 	// 新增数据
 	// 新增数据
 	const handleShowAdd = async () => {
 	const handleShowAdd = async () => {
 		type.value = '新增'
 		type.value = '新增'
-		if (minUniqId.value == '') {
+		if (currentRow.value == undefined) {
 			console.log('123')
 			console.log('123')
 			// 循环13行数据
 			// 循环13行数据
 			const table = []
 			const table = []
@@ -1131,7 +1126,66 @@
 			detailData.table = table
 			detailData.table = table
 			dialogFormVisible.value = true
 			dialogFormVisible.value = true
 		} else {
 		} else {
-			getDetailData(minUniqId.value)
+			getOneWorkOrder({ UniqId: currentRow.value }).then(res => {
+				if (res.code === 0) {
+					const obj = res.data
+					// 裁剪返回数据的前后空格
+					for (const key in obj) {
+						if (Object.prototype.hasOwnProperty.call(obj, key) && typeof obj[key] === 'string') {
+							obj[key] = obj[key].trim()
+						}
+					}
+					// 修改日期格式
+					if (Object.prototype.hasOwnProperty.call(obj, 'qczl_rq') && typeof obj['qczl_rq'] === 'string') {
+						obj['qczl_rq'] = obj['qczl_rq'].split(' ')[0]
+					}
+					obj['total_liucheng'] = ''
+					obj['qczl_num'] = '0'
+					obj['qczl_NumDesc1'] = '0'
+					obj['qczl_NumDesc2'] = '0'
+					obj['qczl_NumDesc3'] = '0'
+					obj['qczl_NumDesc4'] = '0'
+					obj['qczl_NumDesc5'] = '0'
+					obj['qczl_NumDesc6'] = '0'
+					obj['qczl_NumDesc7'] = '0'
+					obj['qczl_NumDesc8'] = '0'
+					Object.assign(detailData, obj)
+					const table = []
+
+					// 循环13行数据
+					for (let i = 1; i <= 13; i++) {
+						table.push({
+							fp_lb: detailData[`fp_lb${i}`] || '',
+							fp_sl: 0,
+							fp_gxmc: detailData[`fp_gxmc${i}`] || '',
+							fp_bz: detailData[`fp_bz${i}`] || '',
+							fp_bh: detailData[`fp_bh${i}`] || '',
+							fp_name: detailData[`fp_name${i}`] || '',
+						})
+						// 从原对象中删除这些属性
+						delete detailData[`fp_lb${i}`]
+						delete detailData[`fp_sl${i}`]
+						delete detailData[`fp_gxmc${i}`]
+						delete detailData[`fp_bz${i}`]
+						delete detailData[`fp_bh${i}`]
+						delete detailData[`fp_name${i}`]
+					}
+					detailData.table = table
+					getOrderInfo({ order: detailData.qczl_gdbh }).then(resposne => {
+						if (resposne.code === 0) {
+							//循环resposne.data当子项yj_Yjno的值等于obj中的qczl_yjno的值时设置detailData.Gd_cpmc的值为res.data[i].Gd_cpmc
+							for (let i = 0; i < resposne.data.length; i++) {
+								if (resposne.data[i].yj_Yjno == detailData.qczl_yjno) {
+									detailData.yj_yjmc = resposne.data[i].yj_yjmc
+									detailData.Gd_cpmc = resposne.data[i].Gd_cpmc
+								}
+							}
+							showDialog()
+						}
+					})
+				}
+			})
+			
 		}
 		}
 
 
 
 
@@ -1143,83 +1197,83 @@
 	const showDialog = () => {
 	const showDialog = () => {
 		dialogFormVisible.value = true
 		dialogFormVisible.value = true
 		// 在 setTimeout 中获取元素,确保在 DOM 渲染完毕后执行
 		// 在 setTimeout 中获取元素,确保在 DOM 渲染完毕后执行
-		setTimeout(() => {
-			formElements = document.getElementById('detail-form').elements
-			formElements[0].focus()
-		}, 0)
+		// setTimeout(() => {
+		// 	formElements = document.getElementById('detail-form').elements
+		// 	formElements[0].focus()
+		// }, 0)
 	}
 	}
 
 
- const ent1 = (event) => {
-   const inputs = document.getElementsByTagName('input');
-   const currentIndex = Array.from(inputs).indexOf(event.target);
-
-   if (event.keyCode === 13 || event.keyCode === 40) { // Enter 或向下箭头
-       let nextIndex = currentIndex + 1;
-       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();
-               });
-               break;
-           }
-
-           nextIndex++;
-       }
-   }
- else if (event.keyCode === 38) { // 向上箭头
-     for (let i = currentIndex - 1; i >= 0; i--) {
-       if (!inputs[i].readOnly) {
-         nextTick(()=>{
-         	inputs[i].focus();
- 			inputs[i].select();
-         })
-         break;
-       }
-     }
-   } else if (event.keyCode === 8) { // 删除箭头
-     if (event.target.selectionStart === 0) {
-       for (let i = currentIndex - 1; i >= 0; i--) {
-         if (!inputs[i].readOnly) {
-           nextTick(()=>{
-           	inputs[i].focus();
- 			inputs[i].setSelectionRange(0, 0);
-           })
-           break;
-         }
-       }
-     }
-   } else if (event.keyCode === 37) { // 向左箭头
-     if (event.target.selectionStart === 0) {
-       for (let i = currentIndex - 1; i >= 0; i--) {
-         if (!inputs[i].readOnly) {
-           nextTick(()=>{
-           	inputs[i].focus();
- 			inputs[i].select();
-           })
-           break;
-         }
-       }
-     }
-   } else if (event.keyCode === 39) { // 向右箭头
-     if (event.target.selectionStart === event.target.value.length) {
-       for (let i = currentIndex + 1; i < inputs.length; i++) {
-         if (!inputs[i].readOnly) {
-           nextTick(()=>{
-           	inputs[i].focus();
- 			inputs[i].select();
-           })
-           break;
-         }
-       }
-     }
-   }
+ const ent1 = (event) => {
+   const inputs = document.getElementsByTagName('input');
+   const currentIndex = Array.from(inputs).indexOf(event.target);
+
+   if (event.keyCode === 13 || event.keyCode === 40) { // Enter 或向下箭头
+       let nextIndex = currentIndex + 1;
+       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();
+               });
+               break;
+           }
+
+           nextIndex++;
+       }
+   }
+ else if (event.keyCode === 38) { // 向上箭头
+     for (let i = currentIndex - 1; i >= 0; i--) {
+       if (!inputs[i].readOnly) {
+         nextTick(()=>{
+         	inputs[i].focus();
+ 			inputs[i].select();
+         })
+         break;
+       }
+     }
+   } else if (event.keyCode === 8) { // 删除箭头
+     if (event.target.selectionStart === 0) {
+       for (let i = currentIndex - 1; i >= 0; i--) {
+         if (!inputs[i].readOnly) {
+           nextTick(()=>{
+           	inputs[i].focus();
+ 			inputs[i].setSelectionRange(0, 0);
+           })
+           break;
+         }
+       }
+     }
+   } else if (event.keyCode === 37) { // 向左箭头
+     if (event.target.selectionStart === 0) {
+       for (let i = currentIndex - 1; i >= 0; i--) {
+         if (!inputs[i].readOnly) {
+           nextTick(()=>{
+           	inputs[i].focus();
+ 			inputs[i].select();
+           })
+           break;
+         }
+       }
+     }
+   } else if (event.keyCode === 39) { // 向右箭头
+     if (event.target.selectionStart === event.target.value.length) {
+       for (let i = currentIndex + 1; i < inputs.length; i++) {
+         if (!inputs[i].readOnly) {
+           nextTick(()=>{
+           	inputs[i].focus();
+ 			inputs[i].select();
+           })
+           break;
+         }
+       }
+     }
+   }
  }
  }
 	// let formElements
 	// let formElements
 	// const moveFocus = (event) => {
 	// const moveFocus = (event) => {