From ca0c2cd9dcece8b67ee6d74161d183be10048d1d Mon Sep 17 00:00:00 2001
From: yaowanxin <3588231647@qq.com>
Date: 星期四, 18 九月 2025 13:52:36 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_script' into ywx
---
src/views/qualityManagement/rawMaterialInspection/components/formDia.vue | 113 +++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 94 insertions(+), 19 deletions(-)
diff --git a/src/views/qualityManagement/rawMaterialInspection/components/formDia.vue b/src/views/qualityManagement/rawMaterialInspection/components/formDia.vue
index 32192c0..977b420 100644
--- a/src/views/qualityManagement/rawMaterialInspection/components/formDia.vue
+++ b/src/views/qualityManagement/rawMaterialInspection/components/formDia.vue
@@ -54,7 +54,8 @@
</el-col>
<el-col :span="12">
<el-form-item label="鏁伴噺锛�" prop="quantity">
- <el-input v-model="form.quantity" placeholder="璇疯緭鍏�" clearable/>
+ <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.quantity" placeholder="璇疯緭鍏�"
+ clearable :precision="2"/>
</el-form-item>
</el-col>
</el-row>
@@ -67,8 +68,8 @@
<el-col :span="12">
<el-form-item label="妫�娴嬬粨鏋滐細" prop="checkResult">
<el-select v-model="form.checkResult">
- <el-option label="鍚堟牸" value="鍚堟牸" />
- <el-option label="涓嶅悎鏍�" value="涓嶅悎鏍�" />
+ <el-option label="鍚堟牸" value="鍚堟牸"/>
+ <el-option label="涓嶅悎鏍�" value="涓嶅悎鏍�"/>
</el-select>
</el-form-item>
</el-col>
@@ -77,7 +78,7 @@
<el-col :span="12">
<el-form-item label="妫�楠屽憳锛�" prop="checkName">
<el-input v-model="form.checkName" placeholder="璇疯緭鍏�" clearable/>
-
+
</el-form-item>
</el-col>
<el-col :span="12">
@@ -95,6 +96,20 @@
</el-col>
</el-row>
</el-form>
+<!-- <div style="margin-bottom: 10px;text-align: right">-->
+<!-- <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>-->
+<!-- </div>-->
+ <PIMTable
+ rowKey="id"
+ :column="tableColumn"
+ :tableData="tableData"
+ :tableLoading="tableLoading"
+ height="400"
+ >
+ <template #slot="{ row }">
+ <el-input v-model="row.testValue" clearable/>
+ </template>
+ </PIMTable>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm">纭</el-button>
@@ -110,7 +125,11 @@
import {getOptions} from "@/api/procurementManagement/procurementLedger.js";
import {productTreeList} from "@/api/basicData/product.js";
import {qualityInspectAdd, qualityInspectUpdate} from "@/api/qualityManagement/rawMaterialInspection.js";
-const { proxy } = getCurrentInstance()
+import {ElMessageBox} from "element-plus";
+import {qualityInspectParamDel, qualityInspectParamInfo} from "@/api/qualityManagement/qualityInspectParam.js";
+import {qualityInspectDetailByProductId} from "@/api/qualityManagement/metricMaintenance.js";
+
+const {proxy} = getCurrentInstance()
const emit = defineEmits(['close'])
const dialogFormVisible = ref(false);
@@ -129,20 +148,48 @@
checkResult: "",
},
rules: {
- checkTime: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" },],
- supplier: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- checkName: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
- productId: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- model: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
- unit: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
- quantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- checkCompany: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
- checkResult: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ checkTime: [{required: false, message: "璇疯緭鍏�", trigger: "blur"},],
+ supplier: [{required: true, message: "璇疯緭鍏�", trigger: "blur"}],
+ checkName: [{required: false, message: "璇疯緭鍏�", trigger: "blur"}],
+ productId: [{required: true, message: "璇疯緭鍏�", trigger: "blur"}],
+ model: [{required: false, message: "璇疯緭鍏�", trigger: "blur"}],
+ unit: [{required: false, message: "璇疯緭鍏�", trigger: "blur"}],
+ quantity: [{required: true, message: "璇疯緭鍏�", trigger: "blur"}],
+ checkCompany: [{required: false, message: "璇疯緭鍏�", trigger: "blur"}],
+ checkResult: [{required: true, message: "璇烽�夋嫨妫�娴嬬粨鏋�", trigger: "change"}],
},
});
-const { form, rules } = toRefs(data);
+const tableColumn = ref([
+ {
+ label: "鎸囨爣",
+ prop: "parameterItem",
+ },
+ {
+ label: "鍗曚綅",
+ prop: "unit",
+ },
+ {
+ label: "鏍囧噯鍊�",
+ prop: "standardValue",
+ },
+ {
+ label: "鍐呮帶鍊�",
+ prop: "controlValue",
+ },
+ {
+ label: "妫�楠屽��",
+ prop: "testValue",
+ dataType: 'slot',
+ slot: 'slot',
+ },
+]);
+const tableData = ref([]);
+const tableLoading = ref(false);
+
+const {form, rules} = toRefs(data);
const supplierList = ref([]);
const productOptions = ref([]);
+const currentProductId = ref(0);
// 鎵撳紑寮规
const openDialog = (type, row) => {
@@ -151,9 +198,12 @@
getOptions().then((res) => {
supplierList.value = res.data;
});
+ form.value = {}
getProductOptions();
if (operationType.value === 'edit') {
form.value = {...row}
+ currentProductId.value = row.productId || 0
+ getQualityInspectParamList(row.id)
}
}
const getProductOptions = () => {
@@ -162,7 +212,11 @@
});
};
const getModels = (value) => {
+ currentProductId.value = value
form.value.productName = findNodeById(productOptions.value, value);
+ if (currentProductId) {
+ getList();
+ }
};
const findNodeById = (nodes, productId) => {
for (let i = 0; i < nodes.length; i++) {
@@ -178,9 +232,10 @@
}
return null; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull
};
+
function convertIdToValue(data) {
return data.map((item) => {
- const { id, children, ...rest } = item;
+ const {id, children, ...rest} = item;
const newItem = {
...rest,
value: id, // 灏� id 鏀逛负 value
@@ -188,22 +243,29 @@
if (children && children.length > 0) {
newItem.children = convertIdToValue(children);
}
-
+
return newItem;
});
}
+
// 鎻愪氦浜у搧琛ㄥ崟
const submitForm = () => {
proxy.$refs.formRef.validate(valid => {
if (valid) {
form.value.inspectType = 0
+ if (operationType.value === "add") {
+ tableData.value.forEach((item) => {
+ delete item.id
+ })
+ }
+ const data = {...form.value, qualityInspectParams: tableData.value}
if (operationType.value === "add") {
- qualityInspectAdd(form.value).then(res => {
+ qualityInspectAdd(data).then(res => {
proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
closeDia();
})
} else {
- qualityInspectUpdate(form.value).then(res => {
+ qualityInspectUpdate(data).then(res => {
proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
closeDia();
})
@@ -211,9 +273,22 @@
}
})
}
+
+const getList = () => {
+ qualityInspectDetailByProductId(currentProductId.value).then(res => {
+ tableData.value = res.data;
+ })
+}
+
+const getQualityInspectParamList = (id) => {
+ qualityInspectParamInfo(id).then(res => {
+ tableData.value = res.data;
+ })
+}
// 鍏抽棴寮规
const closeDia = () => {
proxy.resetForm("formRef");
+ tableData.value = []
dialogFormVisible.value = false;
emit('close')
};
--
Gitblit v1.9.3