From 3739a47340c8d8b6edf5fdcbb0534f5fc8d96530 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 29 一月 2026 15:02:38 +0800
Subject: [PATCH] Merge branch 'dev_New' of http://114.132.189.42:9002/r/product-inventory-management into dev_New

---
 src/views/qualityManagement/processInspection/components/formDia.vue |  107 +++++++++++++++++++----------------------------------
 1 files changed, 38 insertions(+), 69 deletions(-)

diff --git a/src/views/qualityManagement/processInspection/components/formDia.vue b/src/views/qualityManagement/processInspection/components/formDia.vue
index 4821db2..852df9e 100644
--- a/src/views/qualityManagement/processInspection/components/formDia.vue
+++ b/src/views/qualityManagement/processInspection/components/formDia.vue
@@ -9,21 +9,8 @@
       <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
         <el-row :gutter="30">
           <el-col :span="12">
-            <el-form-item label="宸ュ簭锛�" prop="processId">
-              <el-select 
-                v-model="form.processId" 
-                placeholder="璇烽�夋嫨宸ュ簭" 
-                clearable 
-                @change="handleProcessChange"
-                style="width: 100%"
-              >
-                <el-option
-                  v-for="item in processOptions"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value"
-                />
-              </el-select>
+            <el-form-item label="宸ュ簭锛�" prop="process">
+              <el-input v-model="form.process" placeholder="璇疯緭鍏ュ伐搴�" clearable />
             </el-form-item>
           </el-col>
           <el-col :span="12">
@@ -36,6 +23,7 @@
                   @change="getModels"
                   :data="productOptions"
                   :render-after-expand="false"
+                  :disabled="operationType === 'edit'"
                   style="width: 100%"
               />
             </el-form-item>
@@ -43,8 +31,11 @@
         </el-row>
         <el-row :gutter="30">
           <el-col :span="12">
-            <el-form-item label="瑙勬牸鍨嬪彿锛�" prop="model">
-              <el-input v-model="form.model" placeholder="璇疯緭鍏�" clearable/>
+            <el-form-item label="瑙勬牸鍨嬪彿锛�" prop="productModelId">
+              <el-select v-model="form.productModelId" placeholder="璇烽�夋嫨" clearable :disabled="operationType === 'edit'"
+                         filterable readonly @change="handleChangeModel">
+                <el-option v-for="item in modelOptions" :key="item.id" :label="item.model" :value="item.id" />
+              </el-select>
             </el-form-item>
           </el-col>
           <el-col :span="12">
@@ -69,7 +60,7 @@
         <el-row :gutter="30">
           <el-col :span="12">
             <el-form-item label="鍗曚綅锛�" prop="unit">
-              <el-input v-model="form.unit" placeholder="璇疯緭鍏�" clearable/>
+              <el-input v-model="form.unit" placeholder="璇疯緭鍏�" disabled/>
             </el-form-item>
           </el-col>
           <el-col :span="12">
@@ -141,8 +132,7 @@
 <script setup>
 import {ref, reactive, toRefs, getCurrentInstance, nextTick} from "vue";
 import {getOptions} from "@/api/procurementManagement/procurementLedger.js";
-import {productTreeList} from "@/api/basicData/product.js";
-import {productProcessListPage} from "@/api/basicData/productProcess.js";
+import {modelList, productTreeList} from "@/api/basicData/product.js";
 import {qualityInspectAdd, qualityInspectUpdate} from "@/api/qualityManagement/rawMaterialInspection.js";
 import {qualityInspectDetailByProductId, getQualityTestStandardParamByTestStandardId} from "@/api/qualityManagement/metricMaintenance.js";
 import {userListNoPage} from "@/api/system/user.js";
@@ -155,10 +145,11 @@
 const data = reactive({
   form: {
     checkTime: "",
-    processId: "",
+    process: "",
     checkName: "",
     productName: "",
     productId: "",
+    productModelId: "",
     model: "",
     testStandardId: "",
     unit: "",
@@ -168,11 +159,11 @@
   },
   rules: {
     checkTime: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" },],
-    processId: [{ required: true, message: "璇烽�夋嫨宸ュ簭", trigger: "change" }],
+    process: [{ required: true, message: "璇疯緭鍏ュ伐搴�", trigger: "blur" }],
     checkName: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
     productId: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
-    model: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
-    testStandardId: [{required: true, message: "璇烽�夋嫨鎸囨爣", trigger: "change"}],
+    productModelId: [{ required: false, message: "璇烽�夋嫨", trigger: "change" }],
+    testStandardId: [{required: false, message: "璇烽�夋嫨鎸囨爣", trigger: "change"}],
     unit: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
     quantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
     checkCompany: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
@@ -210,24 +201,8 @@
 const tableData = ref([]);
 const tableLoading = ref(false);
 const currentProductId = ref(0);
-const processOptions = ref([]); // 宸ュ簭涓嬫媺妗嗘暟鎹�
 const testStandardOptions = ref([]); // 鎸囨爣閫夋嫨涓嬫媺妗嗘暟鎹�
-
-// 鑾峰彇宸ュ簭鍒楄〃
-const getProcessList = async () => {
-	try {
-		const res = await productProcessListPage({ current: 1, size: 1000 })
-		if (res?.code === 200) {
-			const records = res?.data?.records || []
-			processOptions.value = records.map(item => ({
-				label: item.processName || item.name || item.label,
-				value: item.id || item.processId || item.value
-			}))
-		}
-	} catch (error) {
-		console.error('鑾峰彇宸ュ簭鍒楄〃澶辫触:', error)
-	}
-}
+const modelOptions = ref([]);
 
 // 鎵撳紑寮规
 const openDialog = async (type, row) => {
@@ -242,21 +217,11 @@
 	testStandardOptions.value = [];
 	tableData.value = [];
 	getProductOptions();
-	// 鍏堝姞杞藉伐搴忓垪琛�
-	await getProcessList();
 	if (operationType.value === 'edit') {
 		// 鍏堜繚瀛� testStandardId锛岄伩鍏嶈娓呯┖
 		const savedTestStandardId = row.testStandardId;
 		// 鍏堣缃〃鍗曟暟鎹紝浣嗘殏鏃舵竻绌� testStandardId锛岀瓑閫夐」鍔犺浇瀹屾垚鍚庡啀璁剧疆
 		form.value = {...row, testStandardId: ''}
-		// 鍏煎鏃ф暟鎹細濡傛灉 row 涓湁 process 瀛楁锛岃浆鎹负 processId
-		if (row.process && !row.processId) {
-			// 灏濊瘯浠� processOptions 涓煡鎵惧尮閰嶇殑宸ュ簭
-			const processOption = processOptions.value.find(p => p.label === row.process);
-			if (processOption) {
-				form.value.processId = processOption.value;
-			}
-		}
 		currentProductId.value = row.productId || 0
 		// 缂栬緫妯″紡涓嬶紝鍏堝姞杞芥寚鏍囬�夐」锛岀劧鍚庡姞杞藉弬鏁板垪琛�
 		if (currentProductId.value) {
@@ -264,7 +229,7 @@
 			let params = {
 				productId: currentProductId.value,
 				inspectType: 1,
-				process: form.value.processId ? processOptions.value.find(p => p.value === form.value.processId)?.label : ''
+				process: form.value.process || ''
 			}
 			qualityInspectDetailByProductId(params).then(res => {
 				testStandardOptions.value = res.data || [];
@@ -280,12 +245,13 @@
 							if (matchedOption) {
 								// 纭繚浣跨敤鍖归厤椤圭殑 id锛堜繚鎸佺被鍨嬩竴鑷达級
 								form.value.testStandardId = matchedOption.id;
-								handleTestStandardChange(matchedOption.id);
+								// 缂栬緫淇濈暀鍘熸楠屽�硷紝鐩存帴鎷夊彇鍘熷弬鏁版暟鎹�
+								getQualityInspectParamList(row.id);
 							} else {
 								// 濡傛灉鎵句笉鍒板尮閰嶉」锛屽皾璇曠洿鎺ヤ娇鐢ㄥ師鍊�
 								console.warn('鏈壘鍒板尮閰嶇殑鎸囨爣閫夐」锛宼estStandardId:', savedTestStandardId, '鍙敤閫夐」:', testStandardOptions.value);
 								form.value.testStandardId = savedTestStandardId;
-								handleTestStandardChange(savedTestStandardId);
+								getQualityInspectParamList(row.id);
 							}
 						} else {
 							// 鍚﹀垯浣跨敤鏃х殑閫昏緫
@@ -305,12 +271,24 @@
   });
 };
 const getModels = (value) => {
-	currentProductId.value = value
+  form.value.productModelId = undefined;
+  form.value.unit = undefined;
+  modelOptions.value = [];
+  currentProductId.value = value
   form.value.productName = findNodeById(productOptions.value, value);
-	if (currentProductId.value) {
-		getList();
-	}
+  modelList({ id: value }).then((res) => {
+    modelOptions.value = res;
+  })
+  if (currentProductId.value) {
+    getList();
+  }
 };
+
+const handleChangeModel = (value) => {
+  form.value.model = modelOptions.value.find(item => item.id == value)?.model || '';
+  form.value.unit = modelOptions.value.find(item => item.id == value)?.unit || '';
+}
+
 const findNodeById = (nodes, productId) => {
   for (let i = 0; i < nodes.length; i++) {
     if (nodes[i].value === productId) {
@@ -340,20 +318,12 @@
   });
 }
 // 宸ュ簭鍙樺寲澶勭悊
-const handleProcessChange = () => {
-	// 宸ュ簭鍙樺寲鏃讹紝濡傛灉宸查�夋嫨浜у搧锛岄噸鏂板姞杞芥寚鏍囧垪琛�
-	if (currentProductId.value) {
-		getList();
-	}
-}
-
 // 鎻愪氦浜у搧琛ㄥ崟
 const submitForm = () => {
   proxy.$refs.formRef.validate(valid => {
     if (valid) {
       form.value.inspectType = 1
-			// 灏� processId 杞崲涓� process 鍚嶇О锛堝鏋滃悗绔渶瑕� process 瀛楁锛�
-			const processName = form.value.processId ? processOptions.value.find(p => p.value === form.value.processId)?.label : '';
+			const processName = form.value.process || '';
 			if (operationType.value === "add") {
 				tableData.value.forEach((item) => {
 					delete item.id
@@ -384,8 +354,7 @@
 		tableData.value = [];
 		return;
 	}
-	// 鑾峰彇宸ュ簭鍚嶇О
-	const processName = form.value.processId ? processOptions.value.find(p => p.value === form.value.processId)?.label : '';
+	const processName = form.value.process || '';
 	let params = {
 		productId: currentProductId.value,
 		inspectType: 1,

--
Gitblit v1.9.3