From 3b03e4594df3dd2c45382f1bb0794d091194c7a8 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期二, 31 三月 2026 21:55:21 +0800
Subject: [PATCH] feat: 新增检品数量、生产日期及有效期字段
---
src/views/qualityManagement/finalInspection/components/formDia.vue | 160 +++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 129 insertions(+), 31 deletions(-)
diff --git a/src/views/qualityManagement/finalInspection/components/formDia.vue b/src/views/qualityManagement/finalInspection/components/formDia.vue
index 332b3fd..567b126 100644
--- a/src/views/qualityManagement/finalInspection/components/formDia.vue
+++ b/src/views/qualityManagement/finalInspection/components/formDia.vue
@@ -62,8 +62,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="quantityDisabled"/>
+ </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="quantityDisabled"/>
+ </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>
@@ -134,10 +178,19 @@
</el-select>
</template>
<template #deviceStatus="{ row }">
- <el-tag v-if="row.deviceStatus" :type="getDeviceStatusType(row.deviceStatus)">
- {{ row.deviceStatus }}
- </el-tag>
- <span v-else style="color: #999">-</span>
+ <el-select
+ v-model="row.deviceStatus"
+ placeholder="璇烽�夋嫨"
+ default-first-option
+ clearable
+ style="width: 100%"
+ >
+ <el-option label="姝e父" value="姝e父" />
+ <el-option label="鍋滄満" value="鍋滄満" />
+ <el-option label="杩愯" value="杩愯" />
+ <el-option label="缁翠慨" value="缁翠慨" />
+ <el-option label="/" value="/" />
+ </el-select>
</template>
<template #result="{ row }">
<el-input v-model="row.result" placeholder="璇疯緭鍏�" clearable />
@@ -187,6 +240,10 @@
unit: "",
uidNo: "",
quantity: "",
+ inspectedQuantity: "",
+ inspectMaterialCondition: "",
+ productionDate: "",
+ validityDate: "",
checkCompany: "",
checkResult: "",
},
@@ -199,6 +256,25 @@
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" }],
checkResult: [{ required: true, message: "璇疯緭鍏�", trigger: "change" }],
},
@@ -222,32 +298,32 @@
prop: "standardValue",
width: 180
},
- {
- label: "鍗曚綅",
- prop: "unit",
- width: 80
- },
- {
- label: "妫�娴嬪櫒鍏�",
- prop: "instrument",
- dataType: 'slot',
- slot: 'instrument',
- width: 220
- },
- {
- label: "璁惧鐘舵��",
- prop: "deviceStatus",
- dataType: 'slot',
- slot: 'deviceStatus',
- width: 120
- },
- {
- label: "妫�娴嬬粨鏋�",
- prop: "result",
- dataType: 'slot',
- slot: 'result',
- minWidth: 150
- },
+ {
+ label: "鍗曚綅",
+ prop: "unit",
+ width: 70
+ },
+ {
+ label: "妫�娴嬪櫒鍏�",
+ prop: "instrument",
+ dataType: 'slot',
+ slot: 'instrument',
+ width: 220
+ },
+ {
+ label: "璁惧鐘舵��",
+ prop: "deviceStatus",
+ dataType: 'slot',
+ slot: 'deviceStatus',
+ width: 120
+ },
+ {
+ label: "妫�娴嬬粨鏋�",
+ prop: "result",
+ dataType: 'slot',
+ slot: 'result',
+ width: 150
+ },
{
label: "缁撴灉鍒ゆ柇",
prop: "resultJudgment",
@@ -378,6 +454,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) => {
@@ -475,6 +555,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 loadDeviceList = () => {
qualityInspectParamDeviceList().then(res => {
--
Gitblit v1.9.3