From 4a811fb2cd4ee4e1cbfe284bfd1fe3a7d16204ce Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期四, 02 四月 2026 17:35:48 +0800
Subject: [PATCH] fix: 终检表单优化检验用粉剂/液情况字段
---
src/views/qualityManagement/processInspection/components/formDia.vue | 122 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 121 insertions(+), 1 deletions(-)
diff --git a/src/views/qualityManagement/processInspection/components/formDia.vue b/src/views/qualityManagement/processInspection/components/formDia.vue
index 784b88c..216ff14 100644
--- a/src/views/qualityManagement/processInspection/components/formDia.vue
+++ b/src/views/qualityManagement/processInspection/components/formDia.vue
@@ -66,8 +66,52 @@
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="鏁伴噺锛�" prop="quantity">
+ <el-form-item label="鎬绘暟閲忥細" prop="quantity">
<el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.quantity" placeholder="璇疯緭鍏�" clearable :precision="2" :disabled="processQuantityDisabled"/>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="妫�鍝佹暟閲忥細" prop="inspectedQuantity">
+ <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.inspectedQuantity" placeholder="璇疯緭鍏ワ紝涓嶅ぇ浜庢�绘暟閲�" clearable :precision="2" :disabled="processQuantityDisabled"/>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="妫�楠岀敤绮夊墏/娑叉儏鍐碉細" prop="inspectMaterialCondition">
+ <el-radio-group v-model="form.inspectMaterialCondition">
+ <el-radio label="绮夊墏">绮夊墏</el-radio>
+ <el-radio label="娑蹭綋">娑蹭綋</el-radio>
+ </el-radio-group>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="鐢熶骇鏃ユ湡锛�" prop="productionDate">
+ <el-date-picker
+ v-model="form.productionDate"
+ type="date"
+ placeholder="璇烽�夋嫨鏃ユ湡"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ clearable
+ style="width: 100%"
+ @change="calculateValidityDate"
+ />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鏈夋晥鏈燂細" prop="validityDate">
+ <el-date-picker
+ v-model="form.validityDate"
+ type="date"
+ placeholder="鑷姩璁$畻鎴栨墜鍔ㄩ�夋嫨"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ clearable
+ style="width: 100%"
+ />
</el-form-item>
</el-col>
</el-row>
@@ -77,6 +121,18 @@
<el-input v-model="form.uidNo" placeholder="璇疯緭鍏�" disabled/>
</el-form-item>
</el-col>
+ <el-col :span="12">
+ <el-form-item label="鎵瑰彿锛�" prop="batchNo">
+ <el-input
+ v-model="form.batchNo"
+ placeholder="璇疯緭鍏�"
+ clearable
+ :disabled="operationType === 'edit'"
+ />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
<el-col :span="12">
<el-form-item label="妫�娴嬪崟浣嶏細" prop="checkCompany">
<el-input v-model="form.checkCompany" placeholder="璇疯緭鍏�" clearable/>
@@ -90,6 +146,8 @@
</el-select>
</el-form-item>
</el-col>
+ </el-row>
+ <el-row :gutter="30">
<el-col :span="12">
<el-form-item label="妫�楠屽憳锛�" prop="checkName">
<el-select v-model="form.checkName" placeholder="璇烽�夋嫨" clearable>
@@ -193,6 +251,15 @@
const dialogFormVisible = ref(false);
const operationType = ref('')
+
+const validateBatchNo = (rule, value, callback) => {
+ if (value === undefined || value === null || String(value).trim() === '') {
+ callback(new Error('璇疯緭鍏ユ壒鍙�'));
+ return;
+ }
+ callback();
+};
+
const data = reactive({
form: {
checkTime: "",
@@ -203,9 +270,14 @@
productModelId: "",
model: "",
uidNo: "",
+ batchNo: "",
testStandardId: "",
unit: "",
quantity: "",
+ inspectedQuantity: "",
+ inspectMaterialCondition: "",
+ productionDate: "",
+ validityDate: "",
checkCompany: "",
checkResult: "",
},
@@ -218,7 +290,27 @@
testStandardId: [{required: false, message: "璇烽�夋嫨鎸囨爣", trigger: "change"}],
unit: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
quantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ inspectedQuantity: [
+ { required: true, message: "璇疯緭鍏ユ鍝佹暟閲�", trigger: "blur" },
+ {
+ validator: (rule, value, callback) => {
+ if (value !== '' && value !== null && value !== undefined) {
+ const qty = Number(form.value.quantity);
+ const inspectedQty = Number(value);
+ if (!isNaN(qty) && !isNaN(inspectedQty) && inspectedQty > qty) {
+ callback(new Error("妫�鍝佹暟閲忎笉鑳藉ぇ浜庢�绘暟閲�"));
+ } else {
+ callback();
+ }
+ } else {
+ callback();
+ }
+ },
+ trigger: "blur"
+ }
+ ],
checkCompany: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ batchNo: [{ required: true, validator: validateBatchNo, trigger: "blur" }],
checkResult: [{ required: true, message: "璇疯緭鍏�", trigger: "change" }],
},
});
@@ -314,7 +406,12 @@
testStandardId: "",
unit: "",
uidNo: "",
+ batchNo: "",
quantity: "",
+ inspectedQuantity: "",
+ inspectMaterialCondition: "",
+ productionDate: "",
+ validityDate: "",
checkCompany: "",
checkResult: "",
}
@@ -399,6 +496,7 @@
form.value.productModelId = undefined;
form.value.unit = undefined;
form.value.uidNo = undefined;
+ form.value.batchNo = "";
modelOptions.value = [];
currentProductId.value = value
form.value.productName = findNodeById(productOptions.value, value);
@@ -414,6 +512,10 @@
form.value.model = modelOptions.value.find(item => item.id == value)?.model || '';
form.value.unit = modelOptions.value.find(item => item.id == value)?.unit || '';
form.value.uidNo = modelOptions.value.find(item => item.id == value)?.uidNo || '';
+ // 閫夋嫨瑙勬牸鍨嬪彿鍚庯紝濡傛灉宸叉湁鐢熶骇鏃ユ湡鍒欓噸鏂拌绠楁湁鏁堟湡
+ if (form.value.productionDate) {
+ calculateValidityDate();
+ }
}
const findNodeById = (nodes, productId) => {
@@ -557,6 +659,24 @@
}
};
+// 璁$畻鏈夋晥鏈燂紙鐢熶骇鏃ユ湡 + 瑙勬牸鍨嬪彿涓殑鏈夋晥鏈燂級
+const calculateValidityDate = async () => {
+ if (!form.value.productionDate) {
+ form.value.validityDate = '';
+ return;
+ }
+ // 鑾峰彇瑙勬牸鍨嬪彿鐨勬湁鏁堟湡
+ const selectedModel = modelOptions.value.find(item => item.id == form.value.productModelId);
+ if (selectedModel && selectedModel.validityPeriod) {
+ const productionDate = new Date(form.value.productionDate);
+ const validityPeriod = parseFloat(selectedModel.validityPeriod);
+ const validityDate = new Date(productionDate);
+ validityDate.setFullYear(validityDate.getFullYear() + Math.floor(validityPeriod));
+ validityDate.setMonth(validityDate.getMonth() + Math.round((validityPeriod % 1) * 12));
+ form.value.validityDate = validityDate.toISOString().split('T')[0];
+ }
+};
+
// 鍏抽棴寮规
const closeDia = () => {
proxy.resetForm("formRef");
--
Gitblit v1.9.3