From 129bd0cd4df6f12dd576c262710b1fd9902c363e Mon Sep 17 00:00:00 2001
From: ZN <zhang_12370@163.com>
Date: 星期三, 01 四月 2026 11:08:34 +0800
Subject: [PATCH] fix(qualityManagement): 修复质检表单规格型号选择逻辑和员工列表排序问题
---
src/views/qualityManagement/processInspection/components/formDia.vue | 43 ++++++++++++++++++++++++++++++++++++++++---
1 files changed, 40 insertions(+), 3 deletions(-)
diff --git a/src/views/qualityManagement/processInspection/components/formDia.vue b/src/views/qualityManagement/processInspection/components/formDia.vue
index 4821db2..1e0f31d 100644
--- a/src/views/qualityManagement/processInspection/components/formDia.vue
+++ b/src/views/qualityManagement/processInspection/components/formDia.vue
@@ -43,8 +43,21 @@
</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
+ @change="getProductModel"
+ style="width: 100%"
+ >
+ <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">
@@ -141,7 +154,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 {modelList, productTreeList} from "@/api/basicData/product.js";
import {productProcessListPage} from "@/api/basicData/productProcess.js";
import {qualityInspectAdd, qualityInspectUpdate} from "@/api/qualityManagement/rawMaterialInspection.js";
import {qualityInspectDetailByProductId, getQualityTestStandardParamByTestStandardId} from "@/api/qualityManagement/metricMaintenance.js";
@@ -159,6 +172,7 @@
checkName: "",
productName: "",
productId: "",
+ productModelId: "",
model: "",
testStandardId: "",
unit: "",
@@ -171,6 +185,7 @@
processId: [{ required: true, message: "璇烽�夋嫨宸ュ簭", trigger: "change" }],
checkName: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
productId: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ productModelId: [{required: true, message: "璇烽�夋嫨瑙勬牸鍨嬪彿", trigger: "change"}],
model: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
testStandardId: [{required: true, message: "璇烽�夋嫨鎸囨爣", trigger: "change"}],
unit: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
@@ -211,6 +226,7 @@
const tableLoading = ref(false);
const currentProductId = ref(0);
const processOptions = ref([]); // 宸ュ簭涓嬫媺妗嗘暟鎹�
+const modelOptions = ref([]); // 瑙勬牸鍨嬪彿涓嬫媺妗嗘暟鎹�
const testStandardOptions = ref([]); // 鎸囨爣閫夋嫨涓嬫媺妗嗘暟鎹�
// 鑾峰彇宸ュ簭鍒楄〃
@@ -241,6 +257,7 @@
form.value = {}
testStandardOptions.value = [];
tableData.value = [];
+ modelOptions.value = [];
getProductOptions();
// 鍏堝姞杞藉伐搴忓垪琛�
await getProcessList();
@@ -260,6 +277,10 @@
currentProductId.value = row.productId || 0
// 缂栬緫妯″紡涓嬶紝鍏堝姞杞芥寚鏍囬�夐」锛岀劧鍚庡姞杞藉弬鏁板垪琛�
if (currentProductId.value) {
+ // 鍔犺浇瑙勬牸鍨嬪彿閫夐」
+ modelList({ id: currentProductId.value }).then((res) => {
+ modelOptions.value = res;
+ });
// 鍏堝姞杞芥寚鏍囬�夐」
let params = {
productId: currentProductId.value,
@@ -307,10 +328,26 @@
const getModels = (value) => {
currentProductId.value = value
form.value.productName = findNodeById(productOptions.value, value);
+ modelOptions.value = [];
+ form.value.productModelId = "";
+ form.value.model = "";
if (currentProductId.value) {
+ modelList({ id: value }).then((res) => {
+ modelOptions.value = res;
+ });
getList();
}
};
+const getProductModel = (value) => {
+ const index = modelOptions.value.findIndex((item) => item.id === value);
+ if (index !== -1) {
+ form.value.model = modelOptions.value[index].model;
+ form.value.unit = modelOptions.value[index].unit;
+ } else {
+ form.value.model = "";
+ form.value.unit = "";
+ }
+};
const findNodeById = (nodes, productId) => {
for (let i = 0; i < nodes.length; i++) {
if (nodes[i].value === productId) {
--
Gitblit v1.9.3