From b0a7f824ec000a13d49e9e0e7e8e15e8e0401d25 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期四, 19 三月 2026 15:41:06 +0800
Subject: [PATCH] feat:1.工序检验时,需要加入【不良数量】(不良数量+合格数量=报工总数)、【原因】字段(不良原因做成字典)
---
src/views/qualityManagement/processInspection/components/formDia.vue | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 55 insertions(+), 3 deletions(-)
diff --git a/src/views/qualityManagement/processInspection/components/formDia.vue b/src/views/qualityManagement/processInspection/components/formDia.vue
index c1185d2..bc4bb93 100644
--- a/src/views/qualityManagement/processInspection/components/formDia.vue
+++ b/src/views/qualityManagement/processInspection/components/formDia.vue
@@ -66,8 +66,35 @@
</el-form-item>
</el-col>
<el-col :span="12">
+ <el-form-item label="涓嶈壇鏁伴噺锛�" prop="defectiveQuantity">
+ <el-input-number
+ :step="0.01"
+ :min="0"
+ :max="getMaxDefectiveQuantity()"
+ style="width: 100%"
+ v-model="form.defectiveQuantity"
+ placeholder="璇疯緭鍏�"
+ clearable
+ :precision="2"
+
+ />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="涓嶈壇鍘熷洜锛�" prop="defectiveReason">
+ <el-select v-model="form.defectiveReason" placeholder="璇烽�夋嫨" clearable style="width: 100%">
+ <el-option
+ v-for="dict in defective_reason"
+ :key="dict.value"
+ :label="dict.label"
+ :value="dict.value"
+ />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
<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-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.quantity" placeholder="璇疯緭鍏�" clearable :precision="2" :disabled="operationType !== 'add'"/>
</el-form-item>
</el-col>
</el-row>
@@ -132,7 +159,7 @@
</template>
<script setup>
-import {ref, reactive, toRefs, computed, getCurrentInstance, nextTick} from "vue";
+import {ref, reactive, toRefs, computed, getCurrentInstance, nextTick, watch} from "vue";
import {getOptions} from "@/api/procurementManagement/procurementLedger.js";
import {modelList, productTreeList} from "@/api/basicData/product.js";
import {qualityInspectAdd, qualityInspectUpdate} from "@/api/qualityManagement/rawMaterialInspection.js";
@@ -140,10 +167,12 @@
import {userListNoPage} from "@/api/system/user.js";
import {qualityInspectParamInfo} from "@/api/qualityManagement/qualityInspectParam.js";
import { list } from "@/api/productionManagement/productionProcess";
+import { useDict } from "@/utils/dict.js";
const { proxy } = getCurrentInstance()
const emit = defineEmits(['close'])
-
+// 鑾峰彇瀛楀吀鏁版嵁
+const { defective_reason } = useDict('defective_reason');
const dialogFormVisible = ref(false);
const operationType = ref('')
@@ -159,6 +188,8 @@
testStandardId: "",
unit: "",
quantity: "",
+ defectiveQuantity: "",
+ defectiveReason: "",
checkCompany: "",
checkResult: "",
},
@@ -214,6 +245,27 @@
const currentProductId = ref(0);
const testStandardOptions = ref([]); // 鎸囨爣閫夋嫨涓嬫媺妗嗘暟鎹�
const modelOptions = ref([]);
+// 淇濆瓨鍒濆鐨� defectiveQuantity 鍊硷紙鐢ㄤ簬璁$畻鍙樺寲閲忥級
+const initialDefectiveQuantity = ref(0);
+
+// 鑾峰彇涓嶈壇鏁伴噺鏈�澶у��
+const getMaxDefectiveQuantity = () => {
+ return form.value.quantity || 0;
+};
+
+// 鐩戝惉涓嶈壇鏁伴噺鍙樺寲锛岃嚜鍔ㄦ洿鏂版暟閲�
+// 褰� defectiveQuantity 澧炲姞鏃讹紝quantity 鍑忓皯锛涘綋 defectiveQuantity 鍑忓皯鏃讹紝quantity 澧炲姞
+watch(() => form.value.defectiveQuantity, (newVal, oldVal) => {
+ const newDefectiveQty = Number(newVal) || 0;
+ const oldDefectiveQty = Number(oldVal) || 0;
+ const currentQuantity = Number(form.value.quantity) || 0;
+
+ // 璁$畻鍙樺寲閲忥細鏂板�� - 鏃у��
+ const changeAmount = newDefectiveQty - oldDefectiveQty;
+
+ // quantity 鍙嶅悜鍙樺寲
+ form.value.quantity = Number((currentQuantity - changeAmount).toFixed(2));
+});
// 鎵撳紑寮规
const openDialog = async (type, row) => {
--
Gitblit v1.9.3