From 7465eb431e134576b4c9c43103c9fc6f918d1696 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 20 五月 2026 17:37:21 +0800
Subject: [PATCH] fix: 每个工序添加投入重量字段
---
src/views/productionManagement/workOrder/components/CopperPrintingForm.vue | 66 ++++++++++++++++++++++++++++++++-
1 files changed, 64 insertions(+), 2 deletions(-)
diff --git a/src/views/productionManagement/workOrder/components/CopperPrintingForm.vue b/src/views/productionManagement/workOrder/components/CopperPrintingForm.vue
index 0a27bd0..7f8581a 100644
--- a/src/views/productionManagement/workOrder/components/CopperPrintingForm.vue
+++ b/src/views/productionManagement/workOrder/components/CopperPrintingForm.vue
@@ -1,5 +1,5 @@
<script setup lang="ts">
-import {computed, onMounted, reactive, ref} from "vue";
+import {computed, onMounted, reactive, ref, watch} from "vue";
import dayjs from "dayjs";
import {userListNoPageByTenantId} from "@/api/system/user.js";
import {getDeviceLedger} from "@/api/equipmentManagement/ledger.js";
@@ -22,7 +22,12 @@
row: {
type: Object,
default: () => ({}),
- }
+ },
+ /** 宸ュ崟 BOM 鎶曞叆閲嶉噺锛屽洖鏄惧埌銆屾姇鍏ラ噸閲忋�� */
+ bomInputQty: {
+ type: Number,
+ default: null,
+ },
});
const emits = defineEmits(["update:isShow", "refreshData"]);
@@ -83,6 +88,7 @@
copperFiringTime: undefined, // 鐑ч摐杩涚倝鏃堕棿
steelFiringTime: undefined, // 鐑ч挗鍑虹倝鏃堕棿
weight: undefined, // 閲嶉噺锛坘g/pos锛�
+ inputWeight: undefined, // 鎶曞叆閲嶉噺(KG)
copperSmeltingTemperatureProfile: undefined, // 鐑ч摐娓╁害鏇茬嚎
remark: undefined, // 澶囨敞
}
@@ -183,11 +189,30 @@
});
};
+const resolveBomInputQty = () => {
+ const bom = props.bomInputQty ?? props.row?.bomInputQty;
+ if (bom === null || bom === undefined || bom === "") {
+ return null;
+ }
+ const n = Number(bom);
+ return Number.isFinite(n) ? n : null;
+};
+
+const applyBomInputWeight = () => {
+ const n = resolveBomInputQty();
+ if (n !== null) {
+ formData.otherData.inputWeight = n;
+ }
+};
+
const initData = () => {
if (!props.isEdit) {
formData.otherData = JSON.parse(props.row.otherData || '{}');
formData.quantity = props.row.quantity;
formData.scrapQty = props.row.scrapQty;
+ if (formData.otherData.inputWeight === undefined || formData.otherData.inputWeight === null || formData.otherData.inputWeight === "") {
+ applyBomInputWeight();
+ }
} else {
const row = props.row;
formData.planQuantity = row.planQuantity
@@ -195,8 +220,32 @@
formData.workOrderId = row.id
formData.reportWork = row.reportWork
formData.productMainId = row.productMainId
+ applyBomInputWeight();
}
}
+
+watch(
+ () => props.isShow,
+ (show) => {
+ if (show) {
+ initData();
+ }
+ }
+);
+
+watch(
+ () => [props.bomInputQty, props.row?.bomInputQty],
+ () => {
+ if (!props.isShow) return;
+ if (props.isEdit) {
+ applyBomInputWeight();
+ return;
+ }
+ if (formData.otherData.inputWeight === undefined || formData.otherData.inputWeight === null || formData.otherData.inputWeight === "") {
+ applyBomInputWeight();
+ }
+ }
+);
const displayValue = (value: any) => {
return value === undefined || value === null || value === "" ? "-" : value;
@@ -446,6 +495,19 @@
<span v-else class="view-value">{{ displayValue(formData.otherData.steelFiringTime) }}</span>
</td>
</tr>
+ <tr class="report-row report-row--double">
+ <td class="label" colspan="2">鎶曞叆閲嶉噺(KG)</td>
+ <td colspan="19" class="cell-field">
+ <el-input-number
+ v-if="props.isEdit"
+ v-model="formData.otherData.inputWeight"
+ :controls="false"
+ style="width: 100%"
+ placeholder="璇疯緭鍏�"
+ />
+ <span v-else class="view-value">{{ displayValue(formData.otherData.inputWeight) }}</span>
+ </td>
+ </tr>
<tr class="report-row report-row--triple">
<td class="label" colspan="2">鐑ч摐浜у嚭</td>
<td colspan="5" class="cell-field">
--
Gitblit v1.9.3